diff --git a/3rdparty/sdl2-2.0.4/Makefile.pandora b/3rdparty/sdl2-2.0.4/Makefile.pandora deleted file mode 100644 index bb89d52a69..0000000000 --- a/3rdparty/sdl2-2.0.4/Makefile.pandora +++ /dev/null @@ -1,37 +0,0 @@ -# Makefile to build the pandora SDL library - -AR = arm-none-linux-gnueabi-ar -RANLIB = arm-none-linux-gnueabi-ranlib -CC = arm-none-linux-gnueabi-gcc -CXX = arm-none-linux-gnueabi-g++ -STRIP = arm-none-linux-gnueabi-strip - -CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ - -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ - -I./include -I$(PNDSDK)/usr/include -DSDL_REVISION=0 - -TARGET = libSDL.a - -SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ - ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \ - ./src/joystick/*.c ./src/haptic/*.c ./src/power/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \ - ./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \ - ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \ - ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \ - ./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \ - ./src/atomic/linux/*.c ./src/filesystem/unix/*.c \ - ./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c - - -OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') - -CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h && touch include/SDL_revision.h) - -all: $(TARGET) - -$(TARGET): $(CONFIG_H) $(OBJECTS) - $(AR) crv $@ $^ - $(RANLIB) $@ - -clean: - rm -f $(TARGET) $(OBJECTS) diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj b/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj deleted file mode 100644 index 3776d2433b..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj +++ /dev/null @@ -1,452 +0,0 @@ - - - - - Debug - Win32 - - - Debug - ARM - - - Release - Win32 - - - Release - ARM - - - - {33048af1-031a-4ce6-b61e-fad2db832e9e} - SDL - en-US - 11.0 - SDL2-WinPhone80 - - - - DynamicLibrary - true - v110_wp80 - false - - - DynamicLibrary - true - v110_wp80 - false - - - DynamicLibrary - false - true - v110_wp80 - false - - - DynamicLibrary - false - true - v110_wp80 - false - - - - - - - - false - - - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - - _USRDLL;UNICODE;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - NotUsing - pch.h - false - $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) - ..\..\include - false - - - Console - false - false - true - DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies) - - - - - _USRDLL;UNICODE;SDL_BUILDING_WINRT=1;NDEBUG;%(PreprocessorDefinitions) - NotUsing - pch.h - false - $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) - ..\..\include - - - Console - false - false - true - DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies) - - - - - _USRDLL;UNICODE;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - NotUsing - pch.h - false - $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) - ..\..\include - false - - - Console - false - false - true - DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies) - - - - - _USRDLL;UNICODE;SDL_BUILDING_WINRT=1;NDEBUG;%(PreprocessorDefinitions) - NotUsing - pch.h - false - $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) - ..\..\include - - - Console - false - false - true - DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies) - - - - - true - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - - - - - - - - - - - - true - true - true - true - - - - - - - - - - - - - - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - true - true - true - true - - - - - - - \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters b/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters deleted file mode 100644 index 1f4df44e41..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters +++ /dev/null @@ -1,678 +0,0 @@ - - - - - {02b21b9a-45a7-41ee-a8a6-e45d14aa28da} - - - {abc3a7e6-f955-4cb5-8340-fae0f653e9c1} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.sln b/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.sln deleted file mode 100644 index f2ef55f68f..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL-WinRT", "SDL-WinRT80.vcxproj", "{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|ARM = Release|ARM - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.ActiveCfg = Debug|ARM - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.Build.0 = Debug|ARM - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.ActiveCfg = Debug|Win32 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.Build.0 = Debug|Win32 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.ActiveCfg = Debug|x64 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.Build.0 = Debug|x64 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.ActiveCfg = Release|ARM - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.Build.0 = Release|ARM - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.ActiveCfg = Release|Win32 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.Build.0 = Release|Win32 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.ActiveCfg = Release|x64 - {AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj b/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj deleted file mode 100644 index fbcd94b6b6..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj +++ /dev/null @@ -1,548 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {aeaea3a2-d4e6-45b1-8ec6-53d84287fc14} - Win32Proj - SDL2-WinRT80 - SDL_VS2012_WinRT - en-US - 11.0 - true - - - - DynamicLibrary - true - v110 - - - DynamicLibrary - true - v110 - - - DynamicLibrary - true - v110 - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - true - v110 - - - - - - - - - - - - - - - - - - - - - - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - false - false - SDL2 - Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - NotUsing - false - ..\..\include;%(AdditionalIncludeDirectories) - _WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - - - Console - false - false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) - - - - - - \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters b/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters deleted file mode 100644 index aa539d37e1..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters +++ /dev/null @@ -1,726 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Header Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - {20773b57-7034-4c24-af5a-334844585f1b} - - - {ddf04d85-6a87-4c5a-bc52-869b38f45a61} - - - \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL_VS2008.vcproj deleted file mode 100644 index 3d3d39969a..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL_VS2008.vcproj +++ /dev/null @@ -1,1509 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDL_VS2008.sln b/3rdparty/sdl2-2.0.4/VisualC/SDL_VS2008.sln deleted file mode 100644 index 047508a80b..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/SDL_VS2008.sln +++ /dev/null @@ -1,269 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL_VS2008.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain_VS2008.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys_VS2008.vcproj", "{26828762-C95D-4637-9CB1-7F0979523813}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loopwave", "tests\loopwave\loopwave_VS2008.vcproj", "{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testatomic", "tests\testatomic\testatomic_VS2008.vcproj", "{66B32F7E-5716-48D0-B5B9-D832FD052DD5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testautomation", "tests\testautomation\testautomation_VS2008.vcproj", "{9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw2", "tests\testdraw2\testdraw2_VS2008.vcproj", "{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfile", "tests\testfile\testfile_VS2008.vcproj", "{CAE4F1D0-314F-4B10-805B-0EFD670133A0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgesture", "tests\testgesture\testgesture_VS2008.vcproj", "{79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl2", "tests\testgl2\testgl2_VS2008.vcproj", "{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjoystick", "tests\testjoystick\testjoystick_VS2008.vcproj", "{55812185-D13C-4022-9C81-32E0F4A08304}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay2", "tests\testoverlay2\testoverlay2_VS2008.vcproj", "{B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplatform", "tests\testplatform\testplatform_VS2008.vcproj", "{26932B24-EFC6-4E3A-B277-ED653DA37968}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpower", "tests\testpower\testpower_VS2008.vcproj", "{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testrendertarget", "tests\testrendertarget\testrendertarget_VS2008.vcproj", "{2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testrumble", "tests\testrumble\testrumble_VS2008.vcproj", "{BFF40245-E9A6-4297-A425-A554E5D767E8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testscale", "tests\testscale\testscale_VS2008.vcproj", "{5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testshape", "tests\testshape\testshape_VS2008.vcproj", "{31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2_VS2008.vcproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest_VS2008.vcproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller_VS2008.vcproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgles2", "tests\testgles2\testgles2_VS2008.vcproj", "{E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controllermap", "tests\controllermap\controllermap_VS2008.vcproj", "{55812185-D13C-4022-9C81-32E0F4A08306}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.ActiveCfg = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.Build.0 = Debug|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.ActiveCfg = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.Build.0 = Release|Win32 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 - {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Win32.ActiveCfg = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Win32.Build.0 = Debug|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.ActiveCfg = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|x64.Build.0 = Debug|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.ActiveCfg = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.Build.0 = Release|Win32 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg = Release|x64 - {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.Build.0 = Release|x64 - {26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.ActiveCfg = Debug|Win32 - {26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.Build.0 = Debug|Win32 - {26828762-C95D-4637-9CB1-7F0979523813}.Debug|x64.ActiveCfg = Debug|x64 - {26828762-C95D-4637-9CB1-7F0979523813}.Debug|x64.Build.0 = Debug|x64 - {26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.ActiveCfg = Release|Win32 - {26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.Build.0 = Release|Win32 - {26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.ActiveCfg = Release|x64 - {26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.Build.0 = Release|x64 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|Win32.ActiveCfg = Debug|Win32 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|Win32.Build.0 = Debug|Win32 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|x64.ActiveCfg = Debug|x64 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|x64.Build.0 = Debug|x64 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.ActiveCfg = Release|Win32 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.Build.0 = Release|Win32 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.ActiveCfg = Release|x64 - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.Build.0 = Release|x64 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Debug|Win32.ActiveCfg = Debug|Win32 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Debug|Win32.Build.0 = Debug|Win32 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Debug|x64.ActiveCfg = Debug|x64 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Debug|x64.Build.0 = Debug|x64 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Release|Win32.ActiveCfg = Release|Win32 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Release|Win32.Build.0 = Release|Win32 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Release|x64.ActiveCfg = Release|x64 - {66B32F7E-5716-48D0-B5B9-D832FD052DD5}.Release|x64.Build.0 = Release|x64 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Debug|Win32.ActiveCfg = Debug|Win32 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Debug|Win32.Build.0 = Debug|Win32 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Debug|x64.ActiveCfg = Debug|x64 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Debug|x64.Build.0 = Debug|x64 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|Win32.ActiveCfg = Release|Win32 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|Win32.Build.0 = Release|Win32 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|x64.ActiveCfg = Release|x64 - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA}.Release|x64.Build.0 = Release|x64 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.Build.0 = Debug|Win32 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.ActiveCfg = Debug|x64 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.Build.0 = Debug|x64 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.ActiveCfg = Release|Win32 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.Build.0 = Release|Win32 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.ActiveCfg = Release|x64 - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.Build.0 = Release|x64 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.ActiveCfg = Debug|Win32 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.Build.0 = Debug|Win32 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|x64.ActiveCfg = Debug|x64 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|x64.Build.0 = Debug|x64 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.ActiveCfg = Release|Win32 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.Build.0 = Release|Win32 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.ActiveCfg = Release|x64 - {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.Build.0 = Release|x64 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Debug|Win32.ActiveCfg = Debug|Win32 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Debug|Win32.Build.0 = Debug|Win32 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Debug|x64.ActiveCfg = Debug|x64 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Debug|x64.Build.0 = Debug|x64 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Release|Win32.ActiveCfg = Release|Win32 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Release|Win32.Build.0 = Release|Win32 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Release|x64.ActiveCfg = Release|x64 - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF}.Release|x64.Build.0 = Release|x64 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.ActiveCfg = Debug|Win32 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.Build.0 = Debug|Win32 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|x64.ActiveCfg = Debug|x64 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|x64.Build.0 = Debug|x64 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.ActiveCfg = Release|Win32 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.Build.0 = Release|Win32 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.ActiveCfg = Release|x64 - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.Build.0 = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|Win32.ActiveCfg = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|Win32.Build.0 = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|x64.ActiveCfg = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|x64.Build.0 = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08304}.Release|Win32.ActiveCfg = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08304}.Release|Win32.Build.0 = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08304}.Release|x64.ActiveCfg = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08304}.Release|x64.Build.0 = Release|x64 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|Win32.Build.0 = Debug|Win32 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|x64.ActiveCfg = Debug|x64 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|x64.Build.0 = Debug|x64 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|Win32.ActiveCfg = Release|Win32 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|Win32.Build.0 = Release|Win32 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|x64.ActiveCfg = Release|x64 - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|x64.Build.0 = Release|x64 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.ActiveCfg = Debug|Win32 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.Build.0 = Debug|Win32 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|x64.ActiveCfg = Debug|x64 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|x64.Build.0 = Debug|x64 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.ActiveCfg = Release|Win32 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.Build.0 = Release|Win32 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.ActiveCfg = Release|x64 - {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.Build.0 = Release|x64 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.ActiveCfg = Debug|Win32 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.Build.0 = Debug|Win32 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|x64.ActiveCfg = Debug|x64 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|x64.Build.0 = Debug|x64 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.ActiveCfg = Release|Win32 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.Build.0 = Release|Win32 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.ActiveCfg = Release|x64 - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.Build.0 = Release|x64 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Debug|Win32.Build.0 = Debug|Win32 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Debug|x64.ActiveCfg = Debug|x64 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Debug|x64.Build.0 = Debug|x64 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Release|Win32.ActiveCfg = Release|Win32 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Release|Win32.Build.0 = Release|Win32 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Release|x64.ActiveCfg = Release|x64 - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E}.Release|x64.Build.0 = Release|x64 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Debug|Win32.ActiveCfg = Debug|Win32 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Debug|Win32.Build.0 = Debug|Win32 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Debug|x64.ActiveCfg = Debug|x64 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Debug|x64.Build.0 = Debug|x64 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Release|Win32.ActiveCfg = Release|Win32 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Release|Win32.Build.0 = Release|Win32 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Release|x64.ActiveCfg = Release|x64 - {BFF40245-E9A6-4297-A425-A554E5D767E8}.Release|x64.Build.0 = Release|x64 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Debug|Win32.ActiveCfg = Debug|Win32 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Debug|Win32.Build.0 = Debug|Win32 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Debug|x64.ActiveCfg = Debug|x64 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Debug|x64.Build.0 = Debug|x64 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Release|Win32.ActiveCfg = Release|Win32 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Release|Win32.Build.0 = Release|Win32 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Release|x64.ActiveCfg = Release|x64 - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6}.Release|x64.Build.0 = Release|x64 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Debug|Win32.Build.0 = Debug|Win32 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Debug|x64.ActiveCfg = Debug|x64 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Debug|x64.Build.0 = Debug|x64 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Release|Win32.ActiveCfg = Release|Win32 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Release|Win32.Build.0 = Release|Win32 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Release|x64.ActiveCfg = Release|x64 - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2}.Release|x64.Build.0 = Release|x64 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.ActiveCfg = Debug|Win32 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.Build.0 = Debug|Win32 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|x64.ActiveCfg = Debug|x64 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|x64.Build.0 = Debug|x64 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.ActiveCfg = Release|Win32 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.Build.0 = Release|Win32 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.ActiveCfg = Release|x64 - {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.Build.0 = Release|x64 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Win32.ActiveCfg = Debug|Win32 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Win32.Build.0 = Debug|Win32 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|x64.ActiveCfg = Debug|x64 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|x64.Build.0 = Debug|x64 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Win32.ActiveCfg = Release|Win32 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Win32.Build.0 = Release|Win32 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|x64.ActiveCfg = Release|x64 - {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|x64.Build.0 = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Win32.ActiveCfg = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Win32.Build.0 = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|x64.ActiveCfg = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|x64.Build.0 = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Win32.ActiveCfg = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Win32.Build.0 = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08305}.Release|x64.ActiveCfg = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08305}.Release|x64.Build.0 = Release|x64 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Debug|Win32.Build.0 = Debug|Win32 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Debug|x64.ActiveCfg = Debug|x64 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Debug|x64.Build.0 = Debug|x64 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Release|Win32.ActiveCfg = Release|Win32 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Release|Win32.Build.0 = Release|Win32 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Release|x64.ActiveCfg = Release|x64 - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315}.Release|x64.Build.0 = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08306}.Debug|Win32.ActiveCfg = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08306}.Debug|Win32.Build.0 = Debug|Win32 - {55812185-D13C-4022-9C81-32E0F4A08306}.Debug|x64.ActiveCfg = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08306}.Debug|x64.Build.0 = Debug|x64 - {55812185-D13C-4022-9C81-32E0F4A08306}.Release|Win32.ActiveCfg = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08306}.Release|Win32.Build.0 = Release|Win32 - {55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.ActiveCfg = Release|x64 - {55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {66B32F7E-5716-48D0-B5B9-D832FD052DD5} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {9C7E8C03-3130-436D-A97E-E8F8ED1AC4EA} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {CAE4F1D0-314F-4B10-805B-0EFD670133A0} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {79CEE57E-1BC3-4FF6-90B3-9E39763CDAFF} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {8B5CFB38-CCBA-40A8-AD7A-89C57B070884} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {55812185-D13C-4022-9C81-32E0F4A08304} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {26932B24-EFC6-4E3A-B277-ED653DA37968} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {2D17C1EB-1157-460E-9A99-A82BFC1F9D1E} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {BFF40245-E9A6-4297-A425-A554E5D767E8} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {5D0930C0-7C91-4ECE-9014-7B7DDE9502E6} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {31A3E4E1-AAE9-4EF3-9B23-18D0924BE4D2} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {40FB7794-D3C3-4CFE-BCF4-A80C96635682} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {55812185-D13C-4022-9C81-32E0F4A08305} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {55812185-D13C-4022-9C81-32E0F4A08306} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - {26828762-C95D-4637-9CB1-7F0979523813} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} - EndGlobalSection -EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain_VS2008.vcproj deleted file mode 100644 index 65dd31d39c..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain_VS2008.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest_VS2008.vcproj deleted file mode 100644 index 8a22d0fc45..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest_VS2008.vcproj +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj deleted file mode 100644 index b02c4cfa7d..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/controllermap/controllermap_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/controllermap/controllermap_VS2008.vcproj deleted file mode 100644 index 1ecce67373..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/controllermap/controllermap_VS2008.vcproj +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/loopwave/loopwave_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/loopwave/loopwave_VS2008.vcproj deleted file mode 100644 index 1cbf89a8cd..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/loopwave/loopwave_VS2008.vcproj +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testatomic/testatomic_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testatomic/testatomic_VS2008.vcproj deleted file mode 100644 index 5f4452b580..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testatomic/testatomic_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testautomation/testautomation_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testautomation/testautomation_VS2008.vcproj deleted file mode 100755 index dc1bec0f44..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testautomation/testautomation_VS2008.vcproj +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj deleted file mode 100644 index 16612aeaac..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testfile/testfile_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testfile/testfile_VS2008.vcproj deleted file mode 100644 index 46f796a4a1..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testfile/testfile_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgamecontroller/testgamecontroller_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testgamecontroller/testgamecontroller_VS2008.vcproj deleted file mode 100644 index 1b31f57b0a..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testgamecontroller/testgamecontroller_VS2008.vcproj +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgesture/testgesture_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testgesture/testgesture_VS2008.vcproj deleted file mode 100644 index 4fff2273ea..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testgesture/testgesture_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgl2/testgl2_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testgl2/testgl2_VS2008.vcproj deleted file mode 100644 index 0c42dc72a1..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testgl2/testgl2_VS2008.vcproj +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2_VS2008.vcproj deleted file mode 100644 index b70a137152..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj deleted file mode 100644 index eb1a19fa6b..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj deleted file mode 100644 index 578a7c34a2..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testplatform/testplatform_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testplatform/testplatform_VS2008.vcproj deleted file mode 100644 index 014faeeaa0..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testplatform/testplatform_VS2008.vcproj +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testpower/testpower_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testpower/testpower_VS2008.vcproj deleted file mode 100644 index e140e6b947..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testpower/testpower_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testrendertarget/testrendertarget_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testrendertarget/testrendertarget_VS2008.vcproj deleted file mode 100644 index d13432ac22..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testrendertarget/testrendertarget_VS2008.vcproj +++ /dev/null @@ -1,443 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testrumble/testrumble_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testrumble/testrumble_VS2008.vcproj deleted file mode 100644 index ea4a858365..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testrumble/testrumble_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testscale/testscale_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testscale/testscale_VS2008.vcproj deleted file mode 100644 index 5a15fccf8d..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testscale/testscale_VS2008.vcproj +++ /dev/null @@ -1,443 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testshape/testshape_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testshape/testshape_VS2008.vcproj deleted file mode 100644 index 73db789315..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testshape/testshape_VS2008.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj b/3rdparty/sdl2-2.0.4/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj deleted file mode 100644 index 7236ecc4f8..0000000000 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/WhatsNew.txt b/3rdparty/sdl2-2.0.4/WhatsNew.txt deleted file mode 100644 index 698ebf7dfa..0000000000 --- a/3rdparty/sdl2-2.0.4/WhatsNew.txt +++ /dev/null @@ -1,199 +0,0 @@ - -This is a list of major changes in SDL's version history. - ---------------------------------------------------------------------------- -2.0.4: ---------------------------------------------------------------------------- - -General: -* Added support for web applications using Emscripten, see docs/README-emscripten.md for more information -* Added support for web applications using Native Client (NaCl), see docs/README-nacl.md for more information -* Added an API to queue audio instead of using the audio callback: - SDL_QueueAudio(), SDL_GetQueuedAudioSize(), SDL_ClearQueuedAudio() -* Added events for audio device hot plug support: - SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED -* Added SDL_PointInRect() -* Added SDL_HasAVX2() to detect CPUs with AVX2 support -* Added SDL_SetWindowHitTest() to let apps treat parts of their SDL window like traditional window decorations (drag areas, resize areas) -* Added SDL_GetGrabbedWindow() to get the window that currently has input grab, if any -* Added SDL_RenderIsClipEnabled() to tell whether clipping is currently enabled in a renderer -* Added SDL_CaptureMouse() to capture the mouse to get events while the mouse is not in your window -* Added SDL_WarpMouseGlobal() to warp the mouse cursor in global screen space -* Added SDL_GetGlobalMouseState() to get the current mouse state outside of an SDL window -* Added a direction field to mouse wheel events to tell whether they are flipped (natural) or not -* Added GL_CONTEXT_RELEASE_BEHAVIOR GL attribute (maps to [WGL|GLX]_ARB_context_flush_control extension) -* Added EGL_KHR_create_context support to allow OpenGL ES version selection on some platforms -* Added NV12 and NV21 YUV texture support for OpenGL and OpenGL ES 2.0 renderers -* Added a Vivante video driver that is used on various SoC platforms -* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers when the D3D device is lost, and from Android's event loop when the GLES context had to be recreated -* Added a hint SDL_HINT_NO_SIGNAL_HANDLERS to disable SDL's built in signal handling -* Added a hint SDL_HINT_THREAD_STACK_SIZE to set the stack size of SDL's threads -* Added SDL_sqrtf(), SDL_tan(), and SDL_tanf() to the stdlib routines -* Improved support for WAV and BMP files with unusual chunks in them -* Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertState -* Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden -* Added SDL_GetDisplayDPI() to get the DPI information for a display -* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick -* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to. -* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to. - -Windows: -* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform) -* Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint -* SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds -* Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage() -* Added a hint SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP to control whether SDL_PumpEvents() processes the Windows message loop -* You can distinguish between real mouse and touch events by looking for SDL_TOUCH_MOUSEID in the mouse event "which" field -* SDL_SysWMinfo now contains the window HDC -* Added support for Unicode command line options -* Prevent beeping when Alt-key combos are pressed -* SDL_SetTextInputRect() re-positions the OS-rendered IME -* Added a hint SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to prevent generating SDL_WINDOWEVENT_CLOSE events when Alt-F4 is pressed -* Added a hint SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING to use the old axis and button mapping for XInput devices (deprecated) - -Mac OS X: -* Implemented drag-and-drop support -* Improved joystick hot-plug detection -* The SDL_WINDOWEVENT_EXPOSED window event is triggered in the appropriate situations -* Fixed relative mouse mode when the application loses/regains focus -* Fixed bugs related to transitioning to and from Spaces-aware fullscreen-desktop mode -* Fixed the refresh rate of display modes -* SDL_SysWMInfo is now ARC-compatible -* Added a hint SDL_HINT_MAC_BACKGROUND_APP to prevent forcing the application to become a foreground process - -Linux: -* Enabled building with Mir and Wayland support by default. -* Added IBus IME support -* Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events -* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow() -* Added support for multiple audio devices when using Pulseaudio -* Fixed duplicate mouse events when using relative mouse motion - -iOS: -* Added support for iOS 8 -* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels -* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior) -* Added native resolution support for the iPhone 6 Plus -* Added support for MFi game controllers -* Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK -* Added sRGB OpenGL ES context support on iOS 7+ -* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER -* SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view -* Fixed various rotation and orientation issues -* Fixed memory leaks - -Android: -* Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events -* Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION -* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER -* Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox() - -Raspberry Pi: -* Added support for the Raspberry Pi 2 - - ---------------------------------------------------------------------------- -2.0.3: ---------------------------------------------------------------------------- - -Mac OS X: -* Fixed creating an OpenGL context by default on Mac OS X 10.6 - - ---------------------------------------------------------------------------- -2.0.2: ---------------------------------------------------------------------------- -General: -* Added SDL_GL_ResetAttributes() to reset OpenGL attributes to default values -* Added an API to load a database of game controller mappings from a file: - SDL_GameControllerAddMappingsFromFile(), SDL_GameControllerAddMappingsFromRW() -* Added game controller mappings for the PS4 and OUYA controllers -* Added SDL_GetDefaultAssertionHandler() and SDL_GetAssertionHandler() -* Added SDL_DetachThread() -* Added SDL_HasAVX() to determine if the CPU has AVX features -* Added SDL_vsscanf(), SDL_acos(), and SDL_asin() to the stdlib routines -* EGL can now create/manage OpenGL and OpenGL ES 1.x/2.x contexts, and share - them using SDL_GL_SHARE_WITH_CURRENT_CONTEXT -* Added a field "clicks" to the mouse button event which records whether the event is a single click, double click, etc. -* The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior. -* Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping. -* testgl2 does not need to link with libGL anymore -* Added testgles2 test program to demonstrate working with OpenGL ES 2.0 -* Added controllermap test program to visually map a game controller - -Windows: -* Support for OpenGL ES 2.x contexts using either WGL or EGL (natively via - the driver or emulated through ANGLE) -* Added a hint SDL_HINT_VIDEO_WIN_D3DCOMPILER to specify which D3D shader compiler to use for OpenGL ES 2 support through ANGLE -* Added a hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that is useful when creating multiple windows that should share the same OpenGL context. -* Added an event SDL_RENDER_TARGETS_RESET that is sent when D3D9 render targets are reset after the device has been restored. - -Mac OS X: -* Added a hint SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK to control whether Ctrl+click should be treated as a right click on Mac OS X. This is off by default. - -Linux: -* Fixed fullscreen and focused behavior when receiving NotifyGrab events -* Added experimental Wayland and Mir support, disabled by default - -Android: -* Joystick support (minimum SDK version required to build SDL is now 12, - the required runtime version remains at 10, but on such devices joystick - support won't be available). -* Hotplugging support for joysticks -* Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default. - - ---------------------------------------------------------------------------- -2.0.1: ---------------------------------------------------------------------------- - -General: -* Added an API to get common filesystem paths in SDL_filesystem.h: - SDL_GetBasePath(), SDL_GetPrefPath() -* Added an API to do optimized YV12 and IYUV texture updates: - SDL_UpdateYUVTexture() -* Added an API to get the amount of RAM on the system: - SDL_GetSystemRAM() -* Added a macro to perform timestamp comparisons with SDL_GetTicks(): - SDL_TICKS_PASSED() -* Dramatically improved OpenGL ES 2.0 rendering performance -* Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE - -Windows: -* Created a static library configuration for the Visual Studio 2010 project -* Added a hint to create the Direct3D device with support for multi-threading: - SDL_HINT_RENDER_DIRECT3D_THREADSAFE -* Added a function to get the D3D9 adapter index for a display: - SDL_Direct3D9GetAdapterIndex() -* Added a function to get the D3D9 device for a D3D9 renderer: - SDL_RenderGetD3D9Device() -* Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred) -* Fixed crash when using two XInput controllers at the same time -* Fixed detecting a mixture of XInput and DirectInput controllers -* Fixed clearing a D3D render target larger than the window -* Improved support for format specifiers in SDL_snprintf() - -Mac OS X: -* Added support for retina displays: - Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately. -* Fixed mouse warping in fullscreen mode -* Right mouse click is emulated by holding the Ctrl key while left clicking - -Linux: -* Fixed float audio support with the PulseAudio driver -* Fixed missing line endpoints in the OpenGL renderer on some drivers -* X11 symbols are no longer defined to avoid collisions when linking statically - -iOS: -* Fixed status bar visibility on iOS 7 -* Flipped the accelerometer Y axis to match expected values - -Android: -IMPORTANT: You MUST get the updated SDLActivity.java to match C code -* Moved EGL initialization to native code -* Fixed the accelerometer axis rotation relative to the device rotation -* Fixed race conditions when handling the EGL context on pause/resume -* Touch devices are available for enumeration immediately after init - -Raspberry Pi: -* Added support for the Raspberry Pi, see README-raspberrypi.txt for details diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/rectangles.c b/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/rectangles.c deleted file mode 100644 index 86fce49fe6..0000000000 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/rectangles.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * rectangles.c - * written by Holmes Futrell - * use however you want -*/ - -#include "SDL.h" -#include -#include "common.h" - -void -render(SDL_Renderer *renderer) -{ - - Uint8 r, g, b; - /* Come up with a random rectangle */ - SDL_Rect rect; - rect.w = randomInt(64, 128); - rect.h = randomInt(64, 128); - rect.x = randomInt(0, SCREEN_WIDTH); - rect.y = randomInt(0, SCREEN_HEIGHT); - - /* Come up with a random color */ - r = randomInt(50, 255); - g = randomInt(50, 255); - b = randomInt(50, 255); - - /* Fill the rectangle in the color */ - SDL_SetRenderDrawColor(renderer, r, g, b, 255); - SDL_RenderFillRect(renderer, &rect); - - /* update screen */ - SDL_RenderPresent(renderer); - -} - -int -main(int argc, char *argv[]) -{ - if (SDL_Init(SDL_INIT_VIDEO/* | SDL_INIT_AUDIO */) < 0) - { - printf("Unable to initialize SDL"); - } - - SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - int landscape = 1; - int modes = SDL_GetNumDisplayModes(0); - int sx = 0, sy = 0; - for (int i = 0; i < modes; i++) - { - SDL_DisplayMode mode; - SDL_GetDisplayMode(0, i, &mode); - if (landscape ? mode.w > sx : mode.h > sy) - { - sx = mode.w; - sy = mode.h; - } - } - - printf("picked: %d %d\n", sx, sy); - - SDL_Window *_sdl_window = NULL; - SDL_GLContext _sdl_context = NULL; - - _sdl_window = SDL_CreateWindow("fred", - 0, 0, - sx, sy, - SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS); - - SDL_SetHint("SDL_HINT_ORIENTATIONS", "LandscapeLeft LandscapeRight"); - - int ax = 0, ay = 0; - SDL_GetWindowSize(_sdl_window, &ax, &ay); - - printf("given: %d %d\n", ax, ay); - - return 0; -} diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/SDL.xcscmblueprint b/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/SDL.xcscmblueprint deleted file mode 100644 index 7666622cf3..0000000000 --- a/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/SDL.xcscmblueprint +++ /dev/null @@ -1,30 +0,0 @@ -{ - "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "63C4897045D0EF88507AD257AEF500CB53038CE0", - "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { - - }, - "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { - "63C4897045D0EF88507AD257AEF500CB53038CE0" : 0, - "EF0074ACEA8EBDF04F37E9286B575E78349A7203" : 0 - }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "09B03A57-FF11-46EE-859C-BF71AAED9443", - "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { - "63C4897045D0EF88507AD257AEF500CB53038CE0" : "moai-dev\/", - "EF0074ACEA8EBDF04F37E9286B575E78349A7203" : "" - }, - "DVTSourceControlWorkspaceBlueprintNameKey" : "SDL", - "DVTSourceControlWorkspaceBlueprintVersion" : 204, - "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "3rdparty\/sdl2-2.0.4\/Xcode\/SDL\/SDL.xcodeproj", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/fallguyconsulting\/moai-dev.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "63C4897045D0EF88507AD257AEF500CB53038CE0" - }, - { - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/moai\/future-proof.git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", - "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "EF0074ACEA8EBDF04F37E9286B575E78349A7203" - } - ] -} \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/android-project/AndroidManifest.xml b/3rdparty/sdl2-2.0.4/android-project/AndroidManifest.xml deleted file mode 100644 index 5dbb5486a7..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/AndroidManifest.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/android-project/ant.properties b/3rdparty/sdl2-2.0.4/android-project/ant.properties deleted file mode 100644 index b0971e891e..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/ant.properties +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked into Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/3rdparty/sdl2-2.0.4/android-project/build.properties b/3rdparty/sdl2-2.0.4/android-project/build.properties deleted file mode 100644 index edc7f23050..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/3rdparty/sdl2-2.0.4/android-project/build.xml b/3rdparty/sdl2-2.0.4/android-project/build.xml deleted file mode 100644 index 9f19a077b1..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/build.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/3rdparty/sdl2-2.0.4/android-project/default.properties b/3rdparty/sdl2-2.0.4/android-project/default.properties deleted file mode 100644 index 0cdab9561b..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/default.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-12 diff --git a/3rdparty/sdl2-2.0.4/android-project/jni/Application.mk b/3rdparty/sdl2-2.0.4/android-project/jni/Application.mk deleted file mode 100644 index e5b50793b9..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/jni/Application.mk +++ /dev/null @@ -1,6 +0,0 @@ - -# Uncomment this if you're using STL in your project -# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information -# APP_STL := stlport_static - -APP_ABI := armeabi armeabi-v7a x86 diff --git a/3rdparty/sdl2-2.0.4/android-project/jni/src/Android_static.mk b/3rdparty/sdl2-2.0.4/android-project/jni/src/Android_static.mk deleted file mode 100644 index faed669c0e..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/jni/src/Android_static.mk +++ /dev/null @@ -1,12 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := main - -LOCAL_SRC_FILES := YourSourceHere.c - -LOCAL_STATIC_LIBRARIES := SDL2_static - -include $(BUILD_SHARED_LIBRARY) -$(call import-module,SDL)LOCAL_PATH := $(call my-dir) diff --git a/3rdparty/sdl2-2.0.4/android-project/res/layout/main.xml b/3rdparty/sdl2-2.0.4/android-project/res/layout/main.xml deleted file mode 100644 index 123c4b6eac..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/res/layout/main.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/3rdparty/sdl2-2.0.4/android-project/res/values/strings.xml b/3rdparty/sdl2-2.0.4/android-project/res/values/strings.xml deleted file mode 100644 index 9bce51cb36..0000000000 --- a/3rdparty/sdl2-2.0.4/android-project/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - SDL App - diff --git a/3rdparty/sdl2-2.0.4/build-scripts/androidbuild.sh b/3rdparty/sdl2-2.0.4/build-scripts/androidbuild.sh deleted file mode 100755 index 8ca3c916da..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/androidbuild.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/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 ... " - echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..." - exit 1 -fi - - - -SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )" - -NDKBUILD=`which ndk-build` -if [ -z "$NDKBUILD" ];then - echo "Could not find the ndk-build utility, install Android's NDK and add it to the path" - exit 1 -fi - -ANDROID=`which android` -if [ -z "$ANDROID" ];then - echo "Could not find the android utility, install Android's SDK and add it to the path" - exit 1 -fi - -ANT=`which ant` - -if [ -z "$ANT" ];then - echo "Could not find the ant utility, install Android's SDK and add it to the path" - exit 1 -fi - -NCPUS="1" -case "$OSTYPE" in - darwin*) - NCPU=`sysctl -n hw.ncpu` - ;; - linux*) - if [ -n `which nproc` ]; then - NCPUS=`nproc` - fi - ;; - *);; -esac - -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/jni/SDL -if [ -z "$COPYSOURCE" ]; then - ln -s $SDLPATH/src $BUILDPATH/jni/SDL - ln -s $SDLPATH/include $BUILDPATH/jni/SDL -else - cp -r $SDLPATH/src $BUILDPATH/jni/SDL - cp -r $SDLPATH/include $BUILDPATH/jni/SDL -fi - -cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL -sed -i "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk -sed -i "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml - -# Copy user sources -for src in "${SOURCES[@]}" -do - cp $src $BUILDPATH/jni/src -done - -# Create an inherited Activity -cd $BUILDPATH/src -for folder in "${APPARR[@]}" -do - mkdir -p $folder - cd $folder -done - -ACTIVITY="${folder}Activity" -sed -i "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml -sed -i "s|SDLActivity|$APP|g" $BUILDPATH/build.xml - -# Fill in a default Activity -echo "package $APP;" > "$ACTIVITY.java" -echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java" -echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java" - -# Update project and build -cd $BUILDPATH -$ANDROID update project --path $BUILDPATH -$NDKBUILD -j $NCPUS $NDKARGS -$ANT debug - -cd $CURDIR - -APK="$BUILDPATH/bin/$APP-debug.apk" - -if [ -f "$APK" ]; then - echo "Your APK is ready at $APK" - echo "To install to your device: " - echo "cd $BUILDPATH" - echo "ant debug install" - exit 0 -fi - -echo "There was an error building the APK" -exit 1 \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/build-scripts/install-sh b/3rdparty/sdl2-2.0.4/build-scripts/install-sh deleted file mode 100755 index 1a8353401c..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-02-02.21 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/3rdparty/sdl2-2.0.4/build-scripts/iosbuild.sh b/3rdparty/sdl2-2.0.4/build-scripts/iosbuild.sh deleted file mode 100755 index eeb5716244..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/iosbuild.sh +++ /dev/null @@ -1,277 +0,0 @@ -#!/bin/sh -# -# Build a fat binary for iOS -# Based on fatbuild.sh and code from the Ignifuga Game Engine - -# Number of CPUs (for make -j) -NCPU=`sysctl -n hw.ncpu` -if test x$NJOB = x; then - NJOB=$NCPU -fi - -# SDK path -XCODE_PATH=`xcode-select --print-path` -if [ -z "$XCODE_PATH" ]; then - echo "Could not find XCode location (use xcode-select -switch to set the correct path)" - exit 1 -fi - -prepare_environment() { - ARCH=$1 - - if test x$SDK_VERSION = x; then - export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"` - if [ -z "$XCODE_PATH" ]; then - echo "Could not find a valid iOS SDK" - exit 1 - fi - fi - - case $ARCH in - armv6) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - armv7) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - i386) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac - - if [ ! -d "$SDK_PATH" ]; then - echo "Could not find iOS SDK at $SDK_PATH" - exit 1 - fi - - if test x$MIN_OS_VERSION = x; then - export MIN_OS_VERSION="3.0" - fi - - # Environment flags - CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/" - LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -static-libgcc" - export CXXFLAGS="$CFLAGS" - export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2" - export CPP="$CXXCPP" - export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2" - export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2" - export LD="$DEV_PATH/usr/bin/ld" - export AR="$DEV_PATH/usr/bin/ar" - export AS="$DEV_PATH/usr/bin/ls" - export NM="$DEV_PATH/usr/bin/nm" - export RANLIB="$DEV_PATH/usr/bin/ranlib" - export STRIP="$DEV_PATH/usr/bin/strip" - - # We dynamically load X11, so using the system X11 headers is fine. - CONFIG_FLAGS="--disable-shared --enable-static" - - case $ARCH in - armv6) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin" - export CFLAGS="$CFLAGS -arch armv6" - export LDFLAGS="$LDFLAGS -arch armv6" - ;; - armv7) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin" - export CFLAGS="$CFLAGS -arch armv7" - export LDFLAGS="$LDFLAGS -arch armv7" - ;; - i386) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin" - export CFLAGS="$CFLAGS -arch i386" - export LDFLAGS="$LDFLAGS -arch i386" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac -} - -prepare_environment "armv6" -echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION" - -# -# Find the configure script -# -srcdir=`dirname $0`/.. -srcdir=`cd $srcdir && pwd` -auxdir=$srcdir/build-scripts -cd $srcdir - -# -# Figure out which phase to build: -# all, -# configure, configure-armv6, configure-armv7, configure-i386 -# make, make-armv6, make-armv7, make-i386, merge -# clean -if test x"$1" = x; then - phase=all -else - phase="$1" -fi -case $phase in - all) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - configure) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - ;; - configure-armv6) - configure_armv6="yes" - ;; - configure-armv7) - configure_armv7="yes" - ;; - configure-i386) - configure_i386="yes" - ;; - make) - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - make-armv6) - make_armv6="yes" - ;; - make-armv7) - make_armv7="yes" - ;; - make-i386) - make_i386="yes" - ;; - merge) - merge="yes" - ;; - clean) - clean_armv6="yes" - clean_armv7="yes" - clean_i386="yes" - ;; - clean-armv6) - clean_armv6="yes" - ;; - clean-armv7) - clean_armv7="yes" - ;; - clean-i386) - clean_i386="yes" - ;; - *) - echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]" - exit 1 - ;; -esac - -# -# Create the build directories -# -for dir in build build/armv6 build/armv7 build/i386; do - if test -d $dir; then - : - else - mkdir $dir || exit 1 - fi -done - -# -# Build the armv6 binary -# -prepare_environment "armv6" -if test x$configure_armv6 = xyes; then - (cd build/armv6 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv6/include - cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2 -fi -if test x$make_armv6 = xyes; then - (cd build/armv6 && make -j$NJOB) || exit 3 -fi -# -# Build the armv7 binary -# -prepare_environment "armv7" -if test x$configure_armv7 = xyes; then - (cd build/armv7 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv7/include - cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2 -fi -if test x$make_armv7 = xyes; then - (cd build/armv7 && make -j$NJOB) || exit 3 -fi -# -# Build the i386 binary -# -prepare_environment "i386" -if test x$configure_i386 = xyes; then - (cd build/i386 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/i386/include - cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2 -fi -if test x$make_i386 = xyes; then - (cd build/i386 && make -j$NJOB) || exit 3 -fi - -# -# Combine into fat binary -# -if test x$merge = xyes; then - output=ios/lib - sh $auxdir/mkinstalldirs build/$output - cd build - target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` - (lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a && - lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a && - cp -r armv6/include ios - echo "Build complete!" && - echo "Files can be found under the build/ios directory.") || exit 4 - cd .. -fi - -# -# Clean up -# -do_clean() -{ - echo $* - $* || exit 6 -} -if test x$clean_armv6 = xyes; then - do_clean rm -r build/armv6 -fi -if test x$clean_armv7 = xyes; then - do_clean rm -r build/armv7 -fi -if test x$clean_i386 = xyes; then - do_clean rm -r build/i386 -fi diff --git a/3rdparty/sdl2-2.0.4/build-scripts/mkinstalldirs b/3rdparty/sdl2-2.0.4/build-scripts/mkinstalldirs deleted file mode 100755 index 8ab885ec92..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/mkinstalldirs +++ /dev/null @@ -1,99 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - 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 - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here diff --git a/3rdparty/sdl2-2.0.4/build-scripts/showrev.sh b/3rdparty/sdl2-2.0.4/build-scripts/showrev.sh deleted file mode 100755 index 2a68fe694e..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/showrev.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -# Print the current source revision, if available - -# FIXME: this prints the tip, which isn't useful if you're on a different -# branch, or just not sync'd to the tip. -hg tip --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1) diff --git a/3rdparty/sdl2-2.0.4/build-scripts/update-copyright.sh b/3rdparty/sdl2-2.0.4/build-scripts/update-copyright.sh deleted file mode 100755 index 34864bc91c..0000000000 --- a/3rdparty/sdl2-2.0.4/build-scripts/update-copyright.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -find . -type f -exec grep -Il "Copyright" {} \; \ -| grep -v \.hg \ -| while read i; \ -do \ - LC_ALL=C sed -ie "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$i"; \ - rm "${i}e"; \ -done diff --git a/3rdparty/sdl2-2.0.4/include-moai/SDL_config_windows.h b/3rdparty/sdl2-2.0.4/include-moai/SDL_config_windows.h deleted file mode 100644 index 58921c5fdc..0000000000 --- a/3rdparty/sdl2-2.0.4/include-moai/SDL_config_windows.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h - -#include "SDL_platform.h" - -/* This is a set of defines to configure the SDL features */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -#endif -#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) -#define LONG_PTR LONG -#endif -#else /* !__GNUC__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __GNUC__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -#ifdef _WIN64 -# define SIZEOF_VOIDP 8 -#else -# define SIZEOF_VOIDP 4 -#endif - -#define HAVE_DDRAW_H 1 -#define HAVE_DINPUT_H 1 -#define HAVE_DSOUND_H 1 -#define HAVE_DXGI_H 1 -#define HAVE_XINPUT_H 1 - -/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ -#ifdef HAVE_LIBC -/* Useful headers */ -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#if _MSC_VER >= 1800 -#define HAVE_STRTOLL 1 -#define HAVE_VSSCANF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_SCALBN 1 -#endif -#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#endif - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_DSOUND 0 -#define SDL_AUDIO_DRIVER_XAUDIO2 0 -#define SDL_AUDIO_DRIVER_WINMM 0 -#define SDL_AUDIO_DRIVER_DISK 0 -#define SDL_AUDIO_DRIVER_DUMMY 0 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_DINPUT 1 -#define SDL_JOYSTICK_XINPUT 0 -#define SDL_HAPTIC_DINPUT 1 -#define SDL_HAPTIC_XINPUT 0 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 0 - -/* Enable various threading systems */ -#define SDL_THREAD_WINDOWS 1 - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 0 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif -#ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 -#endif - -/* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif - - -/* Enable system power support */ -#define SDL_POWER_WINDOWS 1 - -/* Enable filesystem support */ -#define SDL_FILESYSTEM_WINDOWS 1 - -/* Enable assembly routines (Win64 doesn't have inline asm) */ -#ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 -#endif - -#endif /* _SDL_config_windows_h */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_blendmode.h b/3rdparty/sdl2-2.0.4/include/SDL_blendmode.h deleted file mode 100644 index 56d8ad66ef..0000000000 --- a/3rdparty/sdl2-2.0.4/include/SDL_blendmode.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/** - * \file SDL_blendmode.h - * - * Header file declaring the SDL_BlendMode enumeration - */ - -#ifndef _SDL_blendmode_h -#define _SDL_blendmode_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief The blend mode used in SDL_RenderCopy() and drawing operations. - */ -typedef enum -{ - SDL_BLENDMODE_NONE = 0x00000000, /**< no blending - dstRGBA = srcRGBA */ - SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending - dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) - dstA = srcA + (dstA * (1-srcA)) */ - SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending - dstRGB = (srcRGB * srcA) + dstRGB - dstA = dstA */ - SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate - dstRGB = srcRGB * dstRGB - dstA = dstA */ -} SDL_BlendMode; - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif -#include "close_code.h" - -#endif /* _SDL_blendmode_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_revision.h b/3rdparty/sdl2-2.0.4/include/SDL_revision.h deleted file mode 100644 index 6d7163d4d4..0000000000 --- a/3rdparty/sdl2-2.0.4/include/SDL_revision.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SDL_REVISION "hg-10001:e12c38730512" -#define SDL_REVISION_NUMBER 10001 diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audio_c.h b/3rdparty/sdl2-2.0.4/src/audio/SDL_audio_c.h deleted file mode 100644 index b03a9156f6..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audio_c.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ - -/* Functions to get a list of "close" audio formats */ -extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format); -extern SDL_AudioFormat SDL_NextAudioFormat(void); - -/* Function to calculate the size and silence for a SDL_AudioSpec */ -extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec); - -/* The actual mixing thread function */ -extern int SDLCALL SDL_RunAudio(void *audiop); - -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat src_fmt; - SDL_AudioFormat dst_fmt; - SDL_AudioFilter filter; -} SDL_AudioTypeFilters; -extern const SDL_AudioTypeFilters sdl_audio_type_filters[]; - -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat fmt; - int channels; - int upsample; - int multiple; - SDL_AudioFilter filter; -} SDL_AudioRateFilters; -extern const SDL_AudioRateFilters sdl_audio_rate_filters[]; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiocvt.c b/3rdparty/sdl2-2.0.4/src/audio/SDL_audiocvt.c deleted file mode 100644 index 3b47c4cbcc..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiocvt.c +++ /dev/null @@ -1,1121 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Functions for audio drivers to perform runtime conversion of audio format */ - -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#include "SDL_assert.h" - -/* #define DEBUG_CONVERT */ - -/* Effectively mix right and left channels into a single channel */ -static void SDLCALL -SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - Sint32 sample; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to mono\n"); -#endif - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Uint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst; - - src = (Sint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Sint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[0] << 8) | src[1]) + - (Uint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[1] << 8) | src[0]) + - (Uint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[0] << 8) | src[1]) + - (Sint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[1] << 8) | src[0]) + - (Sint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) cvt->buf; - Uint32 *dst = (Uint32 *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapBE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapBE32(src[1]))); - *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2))); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapLE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapLE32(src[1]))); - *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2))); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) cvt->buf; - float *dst = (float *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatBE(src[0]); - const float src2 = SDL_SwapFloatBE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatBE(halved); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatLE(src[0]); - const float src2 = SDL_SwapFloatLE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatLE(halved); - } - } - } - break; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Discard top 4 channels */ -static void SDLCALL -SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting down from 6 channels to stereo\n"); -#endif - -#define strip_chans_6_to_2(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - src += 6; \ - dst += 2; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_2(Uint8); - break; - case 16: - strip_chans_6_to_2(Uint16); - break; - case 32: - strip_chans_6_to_2(Uint32); - break; - } - -#undef strip_chans_6_to_2 - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Discard top 2 channels of 6 */ -static void SDLCALL -SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting 6 down to quad\n"); -#endif - -#define strip_chans_6_to_4(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - dst[2] = src[2]; \ - dst[3] = src[3]; \ - src += 6; \ - dst += 4; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_4(Uint8); - break; - case 16: - strip_chans_6_to_4(Uint16); - break; - case 32: - strip_chans_6_to_4(Uint32); - break; - } - -#undef strip_chans_6_to_4 - - cvt->len_cvt /= 6; - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Duplicate a mono channel to both stereo channels */ -static void SDLCALL -SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to stereo\n"); -#endif - -#define dup_chans_1_to_2(type) \ - { \ - const type *src = (const type *) (cvt->buf + cvt->len_cvt); \ - type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \ - for (i = cvt->len_cvt / sizeof(type); i; --i) { \ - src -= 1; \ - dst -= 2; \ - dst[0] = dst[1] = *src; \ - } \ - } - - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - dup_chans_1_to_2(Uint8); - break; - case 16: - dup_chans_1_to_2(Uint16); - break; - case 32: - dup_chans_1_to_2(Uint32); - break; - } - -#undef dup_chans_1_to_2 - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Duplicate a stereo channel to a pseudo-5.1 stream */ -static void SDLCALL -SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to surround\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3); - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3; - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - Sint32 lf, rf, ce; - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = SDL_SwapBE32((Uint32) lf); - dst[1] = SDL_SwapBE32((Uint32) rf); - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapBE32((Uint32) ce); - dst[5] = SDL_SwapBE32((Uint32) ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapLE32((Uint32) ce); - dst[5] = SDL_SwapLE32((Uint32) ce); - } - } - } - break; - - case AUDIO_F32: - { - float lf, rf, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatBE(ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatLE(ce); - } - } - } - break; - - } - cvt->len_cvt *= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Duplicate a stereo channel to a pseudo-4.0 stream */ -static void SDLCALL -SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to quad\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2); - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2; - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2); - Sint32 lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - float lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - } - } - } - break; - } - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -int -SDL_ConvertAudio(SDL_AudioCVT * cvt) -{ - /* !!! FIXME: (cvt) should be const; stack-copy it here. */ - /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */ - - /* Make sure there's data to convert */ - if (cvt->buf == NULL) { - SDL_SetError("No buffer allocated for conversion"); - return (-1); - } - /* Return okay if no conversion is necessary */ - cvt->len_cvt = cvt->len; - if (cvt->filters[0] == NULL) { - return (0); - } - - /* Set up the conversion and go! */ - cvt->filter_index = 0; - cvt->filters[0] (cvt, cvt->src_format); - return (0); -} - - -static SDL_AudioFilter -SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - - -/* - * Find a converter between two data types. We try to select a hand-tuned - * asm/vectorized/optimized function first, and then fallback to an - * autogenerated function that is customized to convert between two - * specific data types. - */ -static int -SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) -{ - if (src_fmt != dst_fmt) { - const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); - const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); - SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt); - - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) { - const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i]; - if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these formats"); - return -1; - } - } - - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_bitsize < dst_bitsize) { - const int mult = (dst_bitsize / src_bitsize); - cvt->len_mult *= mult; - cvt->len_ratio *= mult; - } else if (src_bitsize > dst_bitsize) { - cvt->len_ratio /= (src_bitsize / dst_bitsize); - } - - return 1; /* added a converter. */ - } - - return 0; /* no conversion necessary. */ -} - - -static SDL_AudioFilter -SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - -static int -SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate) -{ - int retval = 0; - - /* If we only built with the arbitrary resamplers, ignore multiples. */ -#if !LESS_RESAMPLERS - int lo, hi; - int div; - - SDL_assert(src_rate != 0); - SDL_assert(dst_rate != 0); - SDL_assert(src_rate != dst_rate); - - if (src_rate < dst_rate) { - lo = src_rate; - hi = dst_rate; - } else { - lo = dst_rate; - hi = src_rate; - } - - /* zero means "not a supported multiple" ... we only do 2x and 4x. */ - if ((hi % lo) != 0) - return 0; /* not a multiple. */ - - div = hi / lo; - retval = ((div == 2) || (div == 4)) ? div : 0; -#endif - - return retval; -} - -static int -SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - if (src_rate != dst_rate) { - SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels, - src_rate, dst_rate); - - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - const int upsample = (src_rate < dst_rate) ? 1 : 0; - const int multiple = - SDL_FindFrequencyMultiple(src_rate, dst_rate); - - for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) { - const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i]; - if ((filt->fmt == cvt->dst_format) && - (filt->channels == dst_channels) && - (filt->upsample == upsample) && - (filt->multiple == multiple)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these rates"); - return -1; - } - } - - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_rate < dst_rate) { - const double mult = ((double) dst_rate) / ((double) src_rate); - cvt->len_mult *= (int) SDL_ceil(mult); - cvt->len_ratio *= mult; - } else { - cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); - } - - return 1; /* added a converter. */ - } - - return 0; /* no conversion necessary. */ -} - - -/* Creates a set of audio filters to convert from one format to another. - Returns -1 if the format conversion is not supported, 0 if there's - no conversion needed, or 1 if the audio filter is set up. -*/ - -int -SDL_BuildAudioCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, - SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) -{ - /* - * !!! FIXME: reorder filters based on which grow/shrink the buffer. - * !!! FIXME: ideally, we should do everything that shrinks the buffer - * !!! FIXME: first, so we don't have to process as many bytes in a given - * !!! FIXME: filter and abuse the CPU cache less. This might not be as - * !!! FIXME: good in practice as it sounds in theory, though. - */ - - /* Sanity check target pointer */ - if (cvt == NULL) { - return SDL_InvalidParamError("cvt"); - } - - /* there are no unsigned types over 16 bits, so catch this up front. */ - if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) { - return SDL_SetError("Invalid source format"); - } - if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) { - return SDL_SetError("Invalid destination format"); - } - - /* prevent possible divisions by zero, etc. */ - if ((src_channels == 0) || (dst_channels == 0)) { - return SDL_SetError("Source or destination channels is zero"); - } - if ((src_rate == 0) || (dst_rate == 0)) { - return SDL_SetError("Source or destination rate is zero"); - } -#ifdef DEBUG_CONVERT - printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", - src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); -#endif - - /* Start off with no conversion necessary */ - SDL_zerop(cvt); - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->needed = 0; - cvt->filter_index = 0; - cvt->filters[0] = NULL; - cvt->len_mult = 1; - cvt->len_ratio = 1.0; - cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); - - /* Convert data types, if necessary. Updates (cvt). */ - if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) { - return -1; /* shouldn't happen, but just in case... */ - } - - /* Channel conversion */ - if (src_channels != dst_channels) { - if ((src_channels == 1) && (dst_channels > 1)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels = 2; - cvt->len_ratio *= 2; - } - if ((src_channels == 2) && (dst_channels == 6)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround; - src_channels = 6; - cvt->len_mult *= 3; - cvt->len_ratio *= 3; - } - if ((src_channels == 2) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround_4; - src_channels = 4; - cvt->len_mult *= 2; - cvt->len_ratio *= 2; - } - while ((src_channels * 2) <= dst_channels) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels *= 2; - cvt->len_ratio *= 2; - } - if ((src_channels == 6) && (dst_channels <= 2)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip; - src_channels = 2; - cvt->len_ratio /= 3; - } - if ((src_channels == 6) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip_2; - src_channels = 4; - cvt->len_ratio /= 2; - } - /* This assumes that 4 channel audio is in the format: - Left {front/back} + Right {front/back} - so converting to L/R stereo works properly. - */ - while (((src_channels % 2) == 0) && - ((src_channels / 2) >= dst_channels)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertMono; - src_channels /= 2; - cvt->len_ratio /= 2; - } - if (src_channels != dst_channels) { - /* Uh oh.. */ ; - } - } - - /* Do rate conversion, if necessary. Updates (cvt). */ - if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) == - -1) { - return -1; /* shouldn't happen, but just in case... */ - } - - /* Set up the filter information */ - if (cvt->filter_index != 0) { - cvt->needed = 1; - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->len = 0; - cvt->buf = NULL; - cvt->filters[cvt->filter_index] = NULL; - } - return (cvt->needed); -} - - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiotypecvt.c b/3rdparty/sdl2-2.0.4/src/audio/SDL_audiotypecvt.c deleted file mode 100644 index be3b7430aa..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiotypecvt.c +++ /dev/null @@ -1,16015 +0,0 @@ -/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../SDL_internal.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 -#endif - - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 -#endif - -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 -#endif - -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif - - -/* *INDENT-OFF* */ - -#define DIVBY127 0.0078740157480315f -#define DIVBY32767 3.05185094759972e-05f -#define DIVBY2147483647 4.6566128752458e-10f - -#if !NO_CONVERTERS - -static void SDLCALL -SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n"); -#endif - - src = (const Uint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Sint8 val = ((*src) ^ 0x80); - *dst = ((Sint8) val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n"); -#endif - - src = (const Uint8 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Uint8 val = ((((Sint8) *src)) ^ 0x80); - *dst = val; - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapLE16(*src); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapBE16(*src); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatLE(*src); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatBE(*src); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -#endif /* !NO_CONVERTERS */ - - -const SDL_AudioTypeFilters sdl_audio_type_filters[] = -{ -#if !NO_CONVERTERS - { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 }, - { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB }, - { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB }, - { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB }, - { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB }, - { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB }, - { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB }, - { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB }, - { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB }, - { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 }, - { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB }, - { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB }, - { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB }, - { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB }, - { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB }, - { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB }, - { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB }, - { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB }, - { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 }, - { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 }, - { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB }, - { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB }, - { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB }, - { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB }, - { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB }, - { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB }, - { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB }, - { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 }, - { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 }, - { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB }, - { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB }, - { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB }, - { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB }, - { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB }, - { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB }, - { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB }, - { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 }, - { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 }, - { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB }, - { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB }, - { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB }, - { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB }, - { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB }, - { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB }, - { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB }, - { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 }, - { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 }, - { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB }, - { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB }, - { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB }, - { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB }, - { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB }, - { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB }, - { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB }, - { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 }, - { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 }, - { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB }, - { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB }, - { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB }, - { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB }, - { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB }, - { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB }, - { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB }, - { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 }, - { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 }, - { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB }, - { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB }, - { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB }, - { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB }, - { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB }, - { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB }, - { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB }, - { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 }, - { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 }, - { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB }, - { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB }, - { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB }, - { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB }, - { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB }, - { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB }, - { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB }, - { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 }, - { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 }, - { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB }, - { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB }, - { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB }, - { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB }, - { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB }, - { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB }, - { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB }, -#endif /* !NO_CONVERTERS */ - { 0, 0, NULL } -}; - - -#if !NO_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = sample0; - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst++; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = sample1; - dst[0] = sample0; - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst += 2; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst += 4; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst += 6; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample7 = src[7]; - Uint8 sample6 = src[6]; - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample7 = sample7; - Uint8 last_sample6 = sample6; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = sample7; - dst[6] = sample6; - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 sample6 = src[6]; - Uint8 sample7 = src[7]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - Uint8 last_sample6 = sample6; - Uint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst[6] = sample6; - dst[7] = sample7; - dst += 8; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint8) sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst++; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst += 2; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst += 4; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst += 6; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample7 = sample7; - Sint8 last_sample6 = sample6; - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint8) sample7); - dst[6] = ((Sint8) sample6); - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - Sint8 last_sample6 = sample6; - Sint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst[6] = ((Sint8) sample6); - dst[7] = ((Sint8) sample7); - dst += 8; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapLE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapLE16(sample7); - dst[6] = SDL_SwapLE16(sample6); - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst[6] = SDL_SwapLE16(sample6); - dst[7] = SDL_SwapLE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapBE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapBE16(sample7); - dst[6] = SDL_SwapBE16(sample6); - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst[6] = SDL_SwapBE16(sample6); - dst[7] = SDL_SwapBE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatLE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatLE(src[7]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatLE(sample7); - dst[6] = SDL_SwapFloatLE(sample6); - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample7 = SDL_SwapFloatLE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst[6] = SDL_SwapFloatLE(sample6); - dst[7] = SDL_SwapFloatLE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatBE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatBE(src[7]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatBE(sample7); - dst[6] = SDL_SwapFloatBE(sample6); - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample7 = SDL_SwapFloatBE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst[6] = SDL_SwapFloatBE(sample6); - dst[7] = SDL_SwapFloatBE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -#if !LESS_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 2; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[3] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[7] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[11] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 12; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 24; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[15] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 32; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 2; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[3] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[7] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[11] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 12; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 24; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[15] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 32; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - - -const SDL_AudioRateFilters sdl_audio_rate_filters[] = -{ -#if !NO_RESAMPLERS - { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c }, - { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c }, - { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c }, - { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c }, - { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c }, - { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c }, - { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c }, - { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c }, - { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c }, - { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c }, - { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c }, - { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c }, - { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c }, - { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c }, - { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c }, - { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c }, - { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c }, - { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c }, - { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c }, - { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c }, - { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c }, - { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c }, - { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c }, - { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c }, - { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c }, - { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c }, - { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c }, - { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c }, - { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c }, - { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c }, - { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c }, - { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c }, - { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c }, - { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c }, - { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c }, - { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c }, - { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c }, - { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c }, - { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c }, - { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c }, - { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c }, - { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c }, - { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c }, - { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c }, - { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c }, - { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c }, - { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c }, - { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c }, - { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c }, - { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c }, - { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c }, - { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c }, - { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c }, - { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c }, - { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c }, - { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c }, - { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c }, - { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c }, - { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c }, - { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c }, - { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c }, - { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c }, - { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c }, - { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c }, - { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c }, - { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c }, - { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c }, - { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c }, - { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c }, - { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c }, - { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c }, - { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c }, - { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c }, - { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c }, - { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c }, - { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c }, - { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c }, - { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c }, - { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c }, - { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c }, - { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c }, - { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c }, - { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c }, - { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c }, - { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c }, - { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c }, - { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c }, - { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c }, - { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c }, - { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c }, - { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c }, - { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c }, - { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c }, - { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c }, - { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c }, - { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c }, - { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c }, - { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c }, - { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c }, - { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c }, -#if !LESS_RESAMPLERS - { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 }, - { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 }, - { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 }, - { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 }, - { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 }, - { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 }, - { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 }, - { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 }, - { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 }, - { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 }, - { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 }, - { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 }, - { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 }, - { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 }, - { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 }, - { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 }, - { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 }, - { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 }, - { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 }, - { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 }, - { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 }, - { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 }, - { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 }, - { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 }, - { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 }, - { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 }, - { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 }, - { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 }, - { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 }, - { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 }, - { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 }, - { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 }, - { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 }, - { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 }, - { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 }, - { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 }, - { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 }, - { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 }, - { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 }, - { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 }, - { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 }, - { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 }, - { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 }, - { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 }, - { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 }, - { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 }, - { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 }, - { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 }, - { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 }, - { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 }, - { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 }, - { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 }, - { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 }, - { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 }, - { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 }, - { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 }, -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - { 0, 0, 0, 0, NULL } -}; - -/* 390 converters generated. */ - -/* *INDENT-ON* */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.c b/3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.c deleted file mode 100644 index af952371b4..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.c +++ /dev/null @@ -1,685 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ALSA - -/* Allow access to a raw mixing buffer */ - -#include -#include /* For kill() */ -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_alsa_audio.h" - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC -#include "SDL_loadso.h" -#endif - -static int (*ALSA_snd_pcm_open) - (snd_pcm_t **, const char *, snd_pcm_stream_t, int); -static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm); -static snd_pcm_sframes_t(*ALSA_snd_pcm_writei) - (snd_pcm_t *, const void *, snd_pcm_uframes_t); -static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int); -static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *); -static int (*ALSA_snd_pcm_drain) (snd_pcm_t *); -static const char *(*ALSA_snd_strerror) (int); -static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void); -static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void); -static void (*ALSA_snd_pcm_hw_params_copy) - (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_hw_params_set_access) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t); -static int (*ALSA_snd_pcm_hw_params_set_format) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t); -static int (*ALSA_snd_pcm_hw_params_set_channels) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int); -static int (*ALSA_snd_pcm_hw_params_get_channels) - (const snd_pcm_hw_params_t *, unsigned int *); -static int (*ALSA_snd_pcm_hw_params_set_rate_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_set_period_size_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); -static int (*ALSA_snd_pcm_hw_params_get_period_size) - (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); -static int (*ALSA_snd_pcm_hw_params_set_periods_near) - (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_get_periods) - (const snd_pcm_hw_params_t *, unsigned int *, int *); -static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near) - (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *); -static int (*ALSA_snd_pcm_hw_params_get_buffer_size) - (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *); -static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *); -static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *, - snd_pcm_sw_params_t *); -static int (*ALSA_snd_pcm_sw_params_set_start_threshold) - (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); -static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *); -static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int); -static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int); -static int (*ALSA_snd_pcm_sw_params_set_avail_min) - (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC -#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof -#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof - -static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC; -static void *alsa_handle = NULL; - -static int -load_alsa_sym(const char *fn, void **addr) -{ - *addr = SDL_LoadFunction(alsa_handle, fn); - if (*addr == NULL) { - /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ - return 0; - } - - return 1; -} - -/* cast funcs to char* first, to please GCC's strict aliasing rules. */ -#define SDL_ALSA_SYM(x) \ - if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1 -#else -#define SDL_ALSA_SYM(x) ALSA_##x = x -#endif - -static int -load_alsa_syms(void) -{ - SDL_ALSA_SYM(snd_pcm_open); - SDL_ALSA_SYM(snd_pcm_close); - SDL_ALSA_SYM(snd_pcm_writei); - SDL_ALSA_SYM(snd_pcm_recover); - SDL_ALSA_SYM(snd_pcm_prepare); - SDL_ALSA_SYM(snd_pcm_drain); - SDL_ALSA_SYM(snd_strerror); - SDL_ALSA_SYM(snd_pcm_hw_params_sizeof); - SDL_ALSA_SYM(snd_pcm_sw_params_sizeof); - SDL_ALSA_SYM(snd_pcm_hw_params_copy); - SDL_ALSA_SYM(snd_pcm_hw_params_any); - SDL_ALSA_SYM(snd_pcm_hw_params_set_access); - SDL_ALSA_SYM(snd_pcm_hw_params_set_format); - SDL_ALSA_SYM(snd_pcm_hw_params_set_channels); - SDL_ALSA_SYM(snd_pcm_hw_params_get_channels); - SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near); - SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size); - SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_periods); - SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near); - SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size); - SDL_ALSA_SYM(snd_pcm_hw_params); - SDL_ALSA_SYM(snd_pcm_sw_params_current); - SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold); - SDL_ALSA_SYM(snd_pcm_sw_params); - SDL_ALSA_SYM(snd_pcm_nonblock); - SDL_ALSA_SYM(snd_pcm_wait); - SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min); - return 0; -} - -#undef SDL_ALSA_SYM - -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC - -static void -UnloadALSALibrary(void) -{ - if (alsa_handle != NULL) { - SDL_UnloadObject(alsa_handle); - alsa_handle = NULL; - } -} - -static int -LoadALSALibrary(void) -{ - int retval = 0; - if (alsa_handle == NULL) { - alsa_handle = SDL_LoadObject(alsa_library); - if (alsa_handle == NULL) { - retval = -1; - /* Don't call SDL_SetError(): SDL_LoadObject already did. */ - } else { - retval = load_alsa_syms(); - if (retval < 0) { - UnloadALSALibrary(); - } - } - } - return retval; -} - -#else - -static void -UnloadALSALibrary(void) -{ -} - -static int -LoadALSALibrary(void) -{ - load_alsa_syms(); - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ - -static const char * -get_audio_device(int channels) -{ - const char *device; - - device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ - if (device == NULL) { - switch (channels) { - case 6: - device = "plug:surround51"; - break; - case 4: - device = "plug:surround40"; - break; - default: - device = "default"; - break; - } - } - return device; -} - - -/* This function waits until it is possible to write a full sound buffer */ -static void -ALSA_WaitDevice(_THIS) -{ - /* We're in blocking mode, so there's nothing to do here */ -} - - -/* !!! FIXME: is there a channel swizzler in alsalib instead? */ -/* - * http://bugzilla.libsdl.org/show_bug.cgi?id=110 - * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE - * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR" - */ -#define SWIZ6(T) \ - T *ptr = (T *) this->hidden->mixbuf; \ - Uint32 i; \ - for (i = 0; i < this->spec.samples; i++, ptr += 6) { \ - T tmp; \ - tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \ - tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ - } - -static SDL_INLINE void -swizzle_alsa_channels_6_64bit(_THIS) -{ - SWIZ6(Uint64); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_32bit(_THIS) -{ - SWIZ6(Uint32); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_16bit(_THIS) -{ - SWIZ6(Uint16); -} - -static SDL_INLINE void -swizzle_alsa_channels_6_8bit(_THIS) -{ - SWIZ6(Uint8); -} - -#undef SWIZ6 - - -/* - * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle - * channels from Windows/Mac order to the format alsalib will want. - */ -static SDL_INLINE void -swizzle_alsa_channels(_THIS) -{ - if (this->spec.channels == 6) { - const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */ - if (fmtsize == 16) - swizzle_alsa_channels_6_16bit(this); - else if (fmtsize == 8) - swizzle_alsa_channels_6_8bit(this); - else if (fmtsize == 32) - swizzle_alsa_channels_6_32bit(this); - else if (fmtsize == 64) - swizzle_alsa_channels_6_64bit(this); - } - - /* !!! FIXME: update this for 7.1 if needed, later. */ -} - - -static void -ALSA_PlayDevice(_THIS) -{ - int status; - const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf; - const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) * - this->spec.channels; - snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples); - - swizzle_alsa_channels(this); - - while ( frames_left > 0 && this->enabled ) { - /* !!! FIXME: This works, but needs more testing before going live */ - /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ - status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, - sample_buf, frames_left); - - if (status < 0) { - if (status == -EAGAIN) { - /* Apparently snd_pcm_recover() doesn't handle this case - - does it assume snd_pcm_wait() above? */ - SDL_Delay(1); - continue; - } - status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); - if (status < 0) { - /* Hmm, not much we can do - abort */ - fprintf(stderr, "ALSA write failed (unrecoverable): %s\n", - ALSA_snd_strerror(status)); - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - continue; - } - sample_buf += status * frame_size; - frames_left -= status; - } -} - -static Uint8 * -ALSA_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -ALSA_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->pcm_handle) { - ALSA_snd_pcm_drain(this->hidden->pcm_handle); - ALSA_snd_pcm_close(this->hidden->pcm_handle); - this->hidden->pcm_handle = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -ALSA_finalize_hardware(_THIS, snd_pcm_hw_params_t *hwparams, int override) -{ - int status; - snd_pcm_uframes_t bufsize; - - /* "set" the hardware with the desired parameters */ - status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams); - if ( status < 0 ) { - return(-1); - } - - /* Get samples for the actual buffer size */ - status = ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize); - if ( status < 0 ) { - return(-1); - } - if ( !override && bufsize != this->spec.samples * 2 ) { - return(-1); - } - - /* !!! FIXME: Is this safe to do? */ - this->spec.samples = bufsize / 2; - - /* This is useful for debugging */ - if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) { - snd_pcm_uframes_t persize = 0; - unsigned int periods = 0; - - ALSA_snd_pcm_hw_params_get_period_size(hwparams, &persize, NULL); - ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL); - - fprintf(stderr, - "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", - persize, periods, bufsize); - } - - return(0); -} - -static int -ALSA_set_period_size(_THIS, snd_pcm_hw_params_t *params, int override) -{ - const char *env; - int status; - snd_pcm_hw_params_t *hwparams; - snd_pcm_uframes_t frames; - unsigned int periods; - - /* Copy the hardware parameters for this setup */ - snd_pcm_hw_params_alloca(&hwparams); - ALSA_snd_pcm_hw_params_copy(hwparams, params); - - if ( !override ) { - env = SDL_getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE"); - if ( env ) { - override = SDL_atoi(env); - if ( override == 0 ) { - return(-1); - } - } - } - - frames = this->spec.samples; - status = ALSA_snd_pcm_hw_params_set_period_size_near( - this->hidden->pcm_handle, hwparams, &frames, NULL); - if ( status < 0 ) { - return(-1); - } - - periods = 2; - status = ALSA_snd_pcm_hw_params_set_periods_near( - this->hidden->pcm_handle, hwparams, &periods, NULL); - if ( status < 0 ) { - return(-1); - } - - return ALSA_finalize_hardware(this, hwparams, override); -} - -static int -ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params, int override) -{ - const char *env; - int status; - snd_pcm_hw_params_t *hwparams; - snd_pcm_uframes_t frames; - - /* Copy the hardware parameters for this setup */ - snd_pcm_hw_params_alloca(&hwparams); - ALSA_snd_pcm_hw_params_copy(hwparams, params); - - if ( !override ) { - env = SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE"); - if ( env ) { - override = SDL_atoi(env); - if ( override == 0 ) { - return(-1); - } - } - } - - frames = this->spec.samples * 2; - status = ALSA_snd_pcm_hw_params_set_buffer_size_near( - this->hidden->pcm_handle, hwparams, &frames); - if ( status < 0 ) { - return(-1); - } - - return ALSA_finalize_hardware(this, hwparams, override); -} - -static int -ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - int status = 0; - snd_pcm_t *pcm_handle = NULL; - snd_pcm_hw_params_t *hwparams = NULL; - snd_pcm_sw_params_t *swparams = NULL; - snd_pcm_format_t format = 0; - SDL_AudioFormat test_format = 0; - unsigned int rate = 0; - unsigned int channels = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Open the audio device */ - /* Name of device should depend on # channels in spec */ - status = ALSA_snd_pcm_open(&pcm_handle, - get_audio_device(this->spec.channels), - SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); - - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't open audio device: %s", - ALSA_snd_strerror(status)); - } - - this->hidden->pcm_handle = pcm_handle; - - /* Figure out what the hardware is capable of */ - snd_pcm_hw_params_alloca(&hwparams); - status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't get hardware config: %s", - ALSA_snd_strerror(status)); - } - - /* SDL only uses interleaved sample output */ - status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams, - SND_PCM_ACCESS_RW_INTERLEAVED); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set interleaved access: %s", - ALSA_snd_strerror(status)); - } - - /* Try for a closest match on audio format */ - status = -1; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - test_format && (status < 0);) { - status = 0; /* if we can't support a format, it'll become -1. */ - switch (test_format) { - case AUDIO_U8: - format = SND_PCM_FORMAT_U8; - break; - case AUDIO_S8: - format = SND_PCM_FORMAT_S8; - break; - case AUDIO_S16LSB: - format = SND_PCM_FORMAT_S16_LE; - break; - case AUDIO_S16MSB: - format = SND_PCM_FORMAT_S16_BE; - break; - case AUDIO_U16LSB: - format = SND_PCM_FORMAT_U16_LE; - break; - case AUDIO_U16MSB: - format = SND_PCM_FORMAT_U16_BE; - break; - case AUDIO_S32LSB: - format = SND_PCM_FORMAT_S32_LE; - break; - case AUDIO_S32MSB: - format = SND_PCM_FORMAT_S32_BE; - break; - case AUDIO_F32LSB: - format = SND_PCM_FORMAT_FLOAT_LE; - break; - case AUDIO_F32MSB: - format = SND_PCM_FORMAT_FLOAT_BE; - break; - default: - status = -1; - break; - } - if (status >= 0) { - status = ALSA_snd_pcm_hw_params_set_format(pcm_handle, - hwparams, format); - } - if (status < 0) { - test_format = SDL_NextAudioFormat(); - } - } - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); - } - this->spec.format = test_format; - - /* Set the number of channels */ - status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams, - this->spec.channels); - channels = this->spec.channels; - if (status < 0) { - status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set audio channels"); - } - this->spec.channels = channels; - } - - /* Set the audio rate */ - rate = this->spec.freq; - status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, - &rate, NULL); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set audio frequency: %s", - ALSA_snd_strerror(status)); - } - this->spec.freq = rate; - - /* Set the buffer size, in samples */ - if ( ALSA_set_period_size(this, hwparams, 0) < 0 && - ALSA_set_buffer_size(this, hwparams, 0) < 0 ) { - /* Failed to set desired buffer size, do the best you can... */ - if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status)); - } - } - /* Set the software parameters */ - snd_pcm_sw_params_alloca(&swparams); - status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't get software config: %s", - ALSA_snd_strerror(status)); - } - status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set minimum available samples: %s", - ALSA_snd_strerror(status)); - } - status = - ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("ALSA: Couldn't set start threshold: %s", - ALSA_snd_strerror(status)); - } - status = ALSA_snd_pcm_sw_params(pcm_handle, swparams); - if (status < 0) { - ALSA_CloseDevice(this); - return SDL_SetError("Couldn't set software audio parameters: %s", - ALSA_snd_strerror(status)); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - ALSA_CloseDevice(this); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); - - /* Switch to blocking mode for playback */ - ALSA_snd_pcm_nonblock(pcm_handle, 0); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -ALSA_Deinitialize(void) -{ - UnloadALSALibrary(); -} - -static int -ALSA_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadALSALibrary() < 0) { - return 0; - } - - /* Set the function pointers */ - impl->OpenDevice = ALSA_OpenDevice; - impl->WaitDevice = ALSA_WaitDevice; - impl->GetDeviceBuf = ALSA_GetDeviceBuf; - impl->PlayDevice = ALSA_PlayDevice; - impl->CloseDevice = ALSA_CloseDevice; - impl->Deinitialize = ALSA_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */ - - return 1; /* this audio target is available. */ -} - - -AudioBootStrap ALSA_bootstrap = { - "alsa", "ALSA PCM audio", ALSA_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_ALSA */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.c b/3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.c deleted file mode 100644 index 46b617dc06..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.c +++ /dev/null @@ -1,698 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_COREAUDIO - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_coreaudio.h" -#include "SDL_assert.h" - -#define DEBUG_COREAUDIO 0 - -static void COREAUDIO_CloseDevice(_THIS); - -#define CHECK_RESULT(msg) \ - if (result != noErr) { \ - COREAUDIO_CloseDevice(this); \ - SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \ - return 0; \ - } - -#if MACOSX_COREAUDIO -static const AudioObjectPropertyAddress devlist_address = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster -}; - -typedef void (*addDevFn)(const char *name, const int iscapture, AudioDeviceID devId, void *data); - -typedef struct AudioDeviceList -{ - AudioDeviceID devid; - SDL_bool alive; - struct AudioDeviceList *next; -} AudioDeviceList; - -static AudioDeviceList *output_devs = NULL; -static AudioDeviceList *capture_devs = NULL; - -static SDL_bool -add_to_internal_dev_list(const int iscapture, AudioDeviceID devId) -{ - AudioDeviceList *item = (AudioDeviceList *) SDL_malloc(sizeof (AudioDeviceList)); - if (item == NULL) { - return SDL_FALSE; - } - item->devid = devId; - item->alive = SDL_TRUE; - item->next = iscapture ? capture_devs : output_devs; - if (iscapture) { - capture_devs = item; - } else { - output_devs = item; - } - - return SDL_TRUE; -} - -static void -addToDevList(const char *name, const int iscapture, AudioDeviceID devId, void *data) -{ - if (add_to_internal_dev_list(iscapture, devId)) { - SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); - } -} - -static void -build_device_list(int iscapture, addDevFn addfn, void *addfndata) -{ - OSStatus result = noErr; - UInt32 size = 0; - AudioDeviceID *devs = NULL; - UInt32 i = 0; - UInt32 max = 0; - - result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, - &devlist_address, 0, NULL, &size); - if (result != kAudioHardwareNoError) - return; - - devs = (AudioDeviceID *) alloca(size); - if (devs == NULL) - return; - - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, - &devlist_address, 0, NULL, &size, devs); - if (result != kAudioHardwareNoError) - return; - - max = size / sizeof (AudioDeviceID); - for (i = 0; i < max; i++) { - CFStringRef cfstr = NULL; - char *ptr = NULL; - AudioDeviceID dev = devs[i]; - AudioBufferList *buflist = NULL; - int usable = 0; - CFIndex len = 0; - const AudioObjectPropertyAddress addr = { - kAudioDevicePropertyStreamConfiguration, - iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; - - const AudioObjectPropertyAddress nameaddr = { - kAudioObjectPropertyName, - iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; - - result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); - if (result != noErr) - continue; - - buflist = (AudioBufferList *) SDL_malloc(size); - if (buflist == NULL) - continue; - - result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, - &size, buflist); - - if (result == noErr) { - UInt32 j; - for (j = 0; j < buflist->mNumberBuffers; j++) { - if (buflist->mBuffers[j].mNumberChannels > 0) { - usable = 1; - break; - } - } - } - - SDL_free(buflist); - - if (!usable) - continue; - - - size = sizeof (CFStringRef); - result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); - if (result != kAudioHardwareNoError) - continue; - - len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), - kCFStringEncodingUTF8); - - ptr = (char *) SDL_malloc(len + 1); - usable = ((ptr != NULL) && - (CFStringGetCString - (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); - - CFRelease(cfstr); - - if (usable) { - len = strlen(ptr); - /* Some devices have whitespace at the end...trim it. */ - while ((len > 0) && (ptr[len - 1] == ' ')) { - len--; - } - usable = (len > 0); - } - - if (usable) { - ptr[len] = '\0'; - -#if DEBUG_COREAUDIO - printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", - ((iscapture) ? "capture" : "output"), - (int) *devCount, ptr, (int) dev); -#endif - addfn(ptr, iscapture, dev, addfndata); - } - SDL_free(ptr); /* addfn() would have copied the string. */ - } -} - -static void -free_audio_device_list(AudioDeviceList **list) -{ - AudioDeviceList *item = *list; - while (item) { - AudioDeviceList *next = item->next; - SDL_free(item); - item = next; - } - *list = NULL; -} - -static void -COREAUDIO_DetectDevices(void) -{ - build_device_list(SDL_TRUE, addToDevList, NULL); - build_device_list(SDL_FALSE, addToDevList, NULL); -} - -static void -build_device_change_list(const char *name, const int iscapture, AudioDeviceID devId, void *data) -{ - AudioDeviceList **list = (AudioDeviceList **) data; - AudioDeviceList *item; - for (item = *list; item != NULL; item = item->next) { - if (item->devid == devId) { - item->alive = SDL_TRUE; - return; - } - } - - add_to_internal_dev_list(iscapture, devId); /* new device, add it. */ - SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); -} - -static void -reprocess_device_list(const int iscapture, AudioDeviceList **list) -{ - AudioDeviceList *item; - AudioDeviceList *prev = NULL; - for (item = *list; item != NULL; item = item->next) { - item->alive = SDL_FALSE; - } - - build_device_list(iscapture, build_device_change_list, list); - - /* free items in the list that aren't still alive. */ - item = *list; - while (item != NULL) { - AudioDeviceList *next = item->next; - if (item->alive) { - prev = item; - } else { - SDL_RemoveAudioDevice(iscapture, (void *) ((size_t) item->devid)); - if (prev) { - prev->next = item->next; - } else { - *list = item->next; - } - SDL_free(item); - } - item = next; - } -} - -/* this is called when the system's list of available audio devices changes. */ -static OSStatus -device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) -{ - reprocess_device_list(SDL_TRUE, &capture_devs); - reprocess_device_list(SDL_FALSE, &output_devs); - return 0; -} -#endif - -/* The CoreAudio callback */ -static OSStatus -outputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon; - AudioBuffer *abuf; - UInt32 remaining, len; - void *ptr; - UInt32 i; - - /* Only do anything if audio is enabled and not paused */ - if (!this->enabled || this->paused) { - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize); - } - return 0; - } - - /* No SDL conversion should be needed here, ever, since we accept - any input format in OpenAudio, and leave the conversion to CoreAudio. - */ - /* - SDL_assert(!this->convert.needed); - SDL_assert(this->spec.channels == ioData->mNumberChannels); - */ - - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - remaining = abuf->mDataByteSize; - ptr = abuf->mData; - while (remaining > 0) { - if (this->hidden->bufferOffset >= this->hidden->bufferSize) { - /* Generate the data */ - SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, - this->hidden->buffer, this->hidden->bufferSize); - SDL_UnlockMutex(this->mixer_lock); - this->hidden->bufferOffset = 0; - } - - len = this->hidden->bufferSize - this->hidden->bufferOffset; - if (len > remaining) - len = remaining; - SDL_memcpy(ptr, (char *)this->hidden->buffer + - this->hidden->bufferOffset, len); - ptr = (char *)ptr + len; - remaining -= len; - this->hidden->bufferOffset += len; - } - } - - return 0; -} - -static OSStatus -inputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - /* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */ - /* !!! FIXME: write me! */ - return noErr; -} - - -#if MACOSX_COREAUDIO -static const AudioObjectPropertyAddress alive_address = -{ - kAudioDevicePropertyDeviceIsAlive, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster -}; - -static OSStatus -device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_bool dead = SDL_FALSE; - UInt32 isAlive = 1; - UInt32 size = sizeof (isAlive); - OSStatus error; - - if (!this->enabled) { - return 0; /* already known to be dead. */ - } - - error = AudioObjectGetPropertyData(this->hidden->deviceID, &alive_address, - 0, NULL, &size, &isAlive); - - if (error == kAudioHardwareBadDeviceError) { - dead = SDL_TRUE; /* device was unplugged. */ - } else if ((error == kAudioHardwareNoError) && (!isAlive)) { - dead = SDL_TRUE; /* device died in some other way. */ - } - - if (dead) { - SDL_OpenedAudioDeviceDisconnected(this); - } - - return 0; -} -#endif - -static void -COREAUDIO_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - if (this->hidden->audioUnitOpened) { - #if MACOSX_COREAUDIO - /* Unregister our disconnect callback. */ - AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); - #endif - - AURenderCallbackStruct callback; - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const int iscapture = this->iscapture; - const AudioUnitElement bus = - ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = - ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - - /* stop processing the audio unit */ - AudioOutputUnitStop(this->hidden->audioUnit); - - /* Remove the input callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - - #if MACOSX_COREAUDIO - CloseComponent(this->hidden->audioUnit); - #else - AudioComponentInstanceDispose(this->hidden->audioUnit); - #endif - - this->hidden->audioUnitOpened = 0; - } - SDL_free(this->hidden->buffer); - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -#if MACOSX_COREAUDIO -static int -prepare_device(_THIS, void *handle, int iscapture) -{ - AudioDeviceID devid = (AudioDeviceID) ((size_t) handle); - OSStatus result = noErr; - UInt32 size = 0; - UInt32 alive = 0; - pid_t pid = 0; - - AudioObjectPropertyAddress addr = { - 0, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; - - if (handle == NULL) { - size = sizeof (AudioDeviceID); - addr.mSelector = - ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : - kAudioHardwarePropertyDefaultOutputDevice); - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, &devid); - CHECK_RESULT("AudioHardwareGetProperty (default device)"); - } - - addr.mSelector = kAudioDevicePropertyDeviceIsAlive; - addr.mScope = iscapture ? kAudioDevicePropertyScopeInput : - kAudioDevicePropertyScopeOutput; - - size = sizeof (alive); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); - CHECK_RESULT - ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); - - if (!alive) { - SDL_SetError("CoreAudio: requested device exists, but isn't alive."); - return 0; - } - - addr.mSelector = kAudioDevicePropertyHogMode; - size = sizeof (pid); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); - - /* some devices don't support this property, so errors are fine here. */ - if ((result == noErr) && (pid != -1)) { - SDL_SetError("CoreAudio: requested device is being hogged."); - return 0; - } - - this->hidden->deviceID = devid; - return 1; -} -#endif - -static int -prepare_audiounit(_THIS, void *handle, int iscapture, - const AudioStreamBasicDescription * strdesc) -{ - OSStatus result = noErr; - AURenderCallbackStruct callback; -#if MACOSX_COREAUDIO - ComponentDescription desc; - Component comp = NULL; -#else - AudioComponentDescription desc; - AudioComponent comp = NULL; -#endif - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - -#if MACOSX_COREAUDIO - if (!prepare_device(this, handle, iscapture)) { - return 0; - } -#endif - - SDL_zero(desc); - desc.componentType = kAudioUnitType_Output; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - -#if MACOSX_COREAUDIO - desc.componentSubType = kAudioUnitSubType_DefaultOutput; - comp = FindNextComponent(NULL, &desc); -#else - desc.componentSubType = kAudioUnitSubType_RemoteIO; - comp = AudioComponentFindNext(NULL, &desc); -#endif - - if (comp == NULL) { - SDL_SetError("Couldn't find requested CoreAudio component"); - return 0; - } - - /* Open & initialize the audio unit */ -#if MACOSX_COREAUDIO - result = OpenAComponent(comp, &this->hidden->audioUnit); - CHECK_RESULT("OpenAComponent"); -#else - /* - AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6 - We can't use OpenAComponent on iPhone because it is not present - */ - result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit); - CHECK_RESULT("AudioComponentInstanceNew"); -#endif - - this->hidden->audioUnitOpened = 1; - -#if MACOSX_COREAUDIO - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioOutputUnitProperty_CurrentDevice, - kAudioUnitScope_Global, 0, - &this->hidden->deviceID, - sizeof(AudioDeviceID)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)"); -#endif - - /* Set the data format of the audio unit. */ - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_StreamFormat, - scope, bus, strdesc, sizeof(*strdesc)); - CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)"); - - /* Set the audio callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - callback.inputProc = ((iscapture) ? inputCallback : outputCallback); - callback.inputProcRefCon = this; - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)"); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate a sample buffer */ - this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size; - this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); - - result = AudioUnitInitialize(this->hidden->audioUnit); - CHECK_RESULT("AudioUnitInitialize"); - - /* Finally, start processing of the audio unit */ - result = AudioOutputUnitStart(this->hidden->audioUnit); - CHECK_RESULT("AudioOutputUnitStart"); - -#if MACOSX_COREAUDIO - /* Fire a callback if the device stops being "alive" (disconnected, etc). */ - AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); -#endif - - /* We're running! */ - return 1; -} - - -static int -COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - AudioStreamBasicDescription strdesc; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Setup a AudioStreamBasicDescription with the requested format */ - SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription)); - strdesc.mFormatID = kAudioFormatLinearPCM; - strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; - strdesc.mChannelsPerFrame = this->spec.channels; - strdesc.mSampleRate = this->spec.freq; - strdesc.mFramesPerPacket = 1; - - while ((!valid_datatype) && (test_format)) { - this->spec.format = test_format; - /* Just a list of valid SDL formats, so people don't pass junk here. */ - switch (test_format) { - case AUDIO_U8: - case AUDIO_S8: - case AUDIO_U16LSB: - case AUDIO_S16LSB: - case AUDIO_U16MSB: - case AUDIO_S16MSB: - case AUDIO_S32LSB: - case AUDIO_S32MSB: - case AUDIO_F32LSB: - case AUDIO_F32MSB: - valid_datatype = 1; - strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); - if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (SDL_AUDIO_ISSIGNED(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; - break; - } - } - - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - COREAUDIO_CloseDevice(this); - return SDL_SetError("Unsupported audio format"); - } - - strdesc.mBytesPerFrame = - strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; - strdesc.mBytesPerPacket = - strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; - - if (!prepare_audiounit(this, handle, iscapture, &strdesc)) { - COREAUDIO_CloseDevice(this); - return -1; /* prepare_audiounit() will call SDL_SetError()... */ - } - - return 0; /* good to go. */ -} - -static void -COREAUDIO_Deinitialize(void) -{ -#if MACOSX_COREAUDIO - AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); - free_audio_device_list(&capture_devs); - free_audio_device_list(&output_devs); -#endif -} - -static int -COREAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = COREAUDIO_OpenDevice; - impl->CloseDevice = COREAUDIO_CloseDevice; - impl->Deinitialize = COREAUDIO_Deinitialize; - -#if MACOSX_COREAUDIO - impl->DetectDevices = COREAUDIO_DetectDevices; - AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); -#else - impl->OnlyHasDefaultOutputDevice = 1; - - /* Set category to ambient sound so that other music continues playing. - You can change this at runtime in your own code if you need different - behavior. If this is common, we can add an SDL hint for this. - */ - AudioSessionInitialize(NULL, NULL, NULL, nil); - UInt32 category = kAudioSessionCategory_AmbientSound; - AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &category); -#endif - - impl->ProvidesOwnCallbackThread = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "CoreAudio", COREAUDIO_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_COREAUDIO */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.c b/3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.c deleted file mode 100644 index 28745f9d04..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_DISK - -/* Output raw audio data to a file. */ - -#if HAVE_STDIO_H -#include -#endif - -#include "SDL_rwops.h" -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audiomem.h" -#include "../SDL_audio_c.h" -#include "SDL_diskaudio.h" - -/* environment variables and defaults. */ -#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" -#define DISKDEFAULT_OUTFILE "sdlaudio.raw" -#define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY" -#define DISKDEFAULT_WRITEDELAY 150 - -static const char * -DISKAUD_GetOutputFilename(const char *devname) -{ - if (devname == NULL) { - devname = SDL_getenv(DISKENVR_OUTFILE); - if (devname == NULL) { - devname = DISKDEFAULT_OUTFILE; - } - } - return devname; -} - -/* This function waits until it is possible to write a full sound buffer */ -static void -DISKAUD_WaitDevice(_THIS) -{ - SDL_Delay(this->hidden->write_delay); -} - -static void -DISKAUD_PlayDevice(_THIS) -{ - size_t written; - - /* Write the audio data */ - written = SDL_RWwrite(this->hidden->output, - this->hidden->mixbuf, 1, this->hidden->mixlen); - - /* If we couldn't write, assume fatal error for now */ - if (written != this->hidden->mixlen) { - SDL_OpenedAudioDeviceDisconnected(this); - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static Uint8 * -DISKAUD_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -DISKAUD_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->output != NULL) { - SDL_RWclose(this->hidden->output); - this->hidden->output = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -DISKAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - /* handle != NULL means "user specified the placeholder name on the fake detected device list" */ - const char *fname = DISKAUD_GetOutputFilename(handle ? NULL : devname); - const char *envr = SDL_getenv(DISKENVR_WRITEDELAY); - - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, sizeof(*this->hidden)); - - this->hidden->mixlen = this->spec.size; - this->hidden->write_delay = - (envr) ? SDL_atoi(envr) : DISKDEFAULT_WRITEDELAY; - - /* Open the audio device */ - this->hidden->output = SDL_RWFromFile(fname, "wb"); - if (this->hidden->output == NULL) { - DISKAUD_CloseDevice(this); - return -1; - } - - /* Allocate mixing buffer */ - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - DISKAUD_CloseDevice(this); - return -1; - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - -#if HAVE_STDIO_H - fprintf(stderr, - "WARNING: You are using the SDL disk writer audio driver!\n" - " Writing to file [%s].\n", fname); -#endif - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -DISKAUD_DetectDevices(void) -{ - /* !!! FIXME: stole this literal string from DEFAULT_OUTPUT_DEVNAME in SDL_audio.c */ - SDL_AddAudioDevice(SDL_FALSE, "System audio output device", (void *) 0x1); -} - -static int -DISKAUD_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = DISKAUD_OpenDevice; - impl->WaitDevice = DISKAUD_WaitDevice; - impl->PlayDevice = DISKAUD_PlayDevice; - impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; - impl->CloseDevice = DISKAUD_CloseDevice; - impl->DetectDevices = DISKAUD_DetectDevices; - - impl->AllowsArbitraryDeviceNames = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap DISKAUD_bootstrap = { - "disk", "direct-to-disk audio", DISKAUD_Init, 1 -}; - -#endif /* SDL_AUDIO_DRIVER_DISK */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.c b/3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.c deleted file mode 100644 index 8378233ca2..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_EMSCRIPTEN - -#include "SDL_audio.h" -#include "SDL_log.h" -#include "../SDL_audio_c.h" -#include "SDL_emscriptenaudio.h" - -#include - -static int -copyData(_THIS) -{ - int byte_len; - - if (this->hidden->write_off + this->convert.len_cvt > this->hidden->mixlen) { - if (this->hidden->write_off > this->hidden->read_off) { - SDL_memmove(this->hidden->mixbuf, - this->hidden->mixbuf + this->hidden->read_off, - this->hidden->mixlen - this->hidden->read_off); - this->hidden->write_off = this->hidden->write_off - this->hidden->read_off; - } else { - this->hidden->write_off = 0; - } - this->hidden->read_off = 0; - } - - SDL_memcpy(this->hidden->mixbuf + this->hidden->write_off, - this->convert.buf, - this->convert.len_cvt); - this->hidden->write_off += this->convert.len_cvt; - byte_len = this->hidden->write_off - this->hidden->read_off; - - return byte_len; -} - -static void -HandleAudioProcess(_THIS) -{ - Uint8 *buf = NULL; - int byte_len = 0; - int bytes = SDL_AUDIO_BITSIZE(this->spec.format) / 8; - int bytes_in = SDL_AUDIO_BITSIZE(this->convert.src_format) / 8; - - /* Only do soemthing if audio is enabled */ - if (!this->enabled) - return; - - if (this->paused) - return; - - if (this->convert.needed) { - if (this->hidden->conv_in_len != 0) { - this->convert.len = this->hidden->conv_in_len * bytes_in * this->spec.channels; - } - - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - buf = this->convert.buf; - byte_len = this->convert.len_cvt; - - /* size mismatch*/ - if (byte_len != this->spec.size) { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size > byte_len ? this->spec.size * 2 : byte_len * 2; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); - } - - /* copy existing data */ - byte_len = copyData(this); - - /* read more data*/ - while (byte_len < this->spec.size) { - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - byte_len = copyData(this); - } - - byte_len = this->spec.size; - buf = this->hidden->mixbuf + this->hidden->read_off; - this->hidden->read_off += byte_len; - } - - } else { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); - } - (*this->spec.callback) (this->spec.userdata, - this->hidden->mixbuf, - this->hidden->mixlen); - buf = this->hidden->mixbuf; - byte_len = this->hidden->mixlen; - } - - if (buf) { - EM_ASM_ARGS({ - var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; - for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); - if (channelData.length != $1) { - throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; - } - - for (var j = 0; j < $1; ++j) { - channelData[j] = getValue($0 + (j*numChannels + c)*4, 'float'); - } - } - }, buf, byte_len / bytes / this->spec.channels); - } -} - -static void -Emscripten_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - if (this->hidden->mixbuf != NULL) { - /* Clean up the audio buffer */ - SDL_free(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - } - - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -Emscripten_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - SDL_bool valid_format = SDL_FALSE; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int i; - float f; - int result; - - while ((!valid_format) && (test_format)) { - switch (test_format) { - case AUDIO_F32: /* web audio only supports floats */ - this->spec.format = test_format; - - valid_format = SDL_TRUE; - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (!valid_format) { - /* Didn't find a compatible format :( */ - return SDL_SetError("No compatible audio format!"); - } - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* based on parts of library_sdl.js */ - - /* create context (TODO: this puts stuff in the global namespace...)*/ - result = EM_ASM_INT_V({ - if(typeof(SDL2) === 'undefined') - SDL2 = {}; - - if(typeof(SDL2.audio) === 'undefined') - SDL2.audio = {}; - - if (!SDL2.audioContext) { - if (typeof(AudioContext) !== 'undefined') { - SDL2.audioContext = new AudioContext(); - } else if (typeof(webkitAudioContext) !== 'undefined') { - SDL2.audioContext = new webkitAudioContext(); - } else { - return -1; - } - } - return 0; - }); - if (result < 0) { - return SDL_SetError("Web Audio API is not available!"); - } - - /* limit to native freq */ - int sampleRate = EM_ASM_INT_V({ - return SDL2.audioContext['sampleRate']; - }); - - if(this->spec.freq != sampleRate) { - for (i = this->spec.samples; i > 0; i--) { - f = (float)i / (float)sampleRate * (float)this->spec.freq; - if (SDL_floor(f) == f) { - this->hidden->conv_in_len = SDL_floor(f); - break; - } - } - - this->spec.freq = sampleRate; - } - - SDL_CalculateAudioSpec(&this->spec); - - /* setup a ScriptProcessorNode */ - EM_ASM_ARGS({ - SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); - SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { - SDL2.audio.currentOutputBuffer = e['outputBuffer']; - Runtime.dynCall('vi', $2, [$3]); - }; - SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); - }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); - return 0; -} - -static int -Emscripten_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = Emscripten_OpenDevice; - impl->CloseDevice = Emscripten_CloseDevice; - - /* only one output */ - impl->OnlyHasDefaultOutputDevice = 1; - - /* no threads here */ - impl->SkipMixerLock = 1; - impl->ProvidesOwnCallbackThread = 1; - - /* check availability */ - int available = EM_ASM_INT_V({ - if (typeof(AudioContext) !== 'undefined') { - return 1; - } else if (typeof(webkitAudioContext) !== 'undefined') { - return 1; - } - return 0; - }); - - if (!available) { - SDL_SetError("No audio context available"); - } - - return available; -} - -AudioBootStrap EmscriptenAudio_bootstrap = { - "emscripten", "SDL emscripten audio driver", Emscripten_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/sdlgenaudiocvt.pl b/3rdparty/sdl2-2.0.4/src/audio/sdlgenaudiocvt.pl deleted file mode 100755 index c53f1c3559..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/sdlgenaudiocvt.pl +++ /dev/null @@ -1,761 +0,0 @@ -#!/usr/bin/perl -w - -use warnings; -use strict; - -my @audiotypes = qw( - U8 - S8 - U16LSB - S16LSB - U16MSB - S16MSB - S32LSB - S32MSB - F32LSB - F32MSB -); - -my @channels = ( 1, 2, 4, 6, 8 ); -my %funcs; -my $custom_converters = 0; - - -sub getTypeConvertHashId { - my ($from, $to) = @_; - return "TYPECONVERTER $from/$to"; -} - - -sub getResamplerHashId { - my ($from, $channels, $upsample, $multiple) = @_; - return "RESAMPLER $from/$channels/$upsample/$multiple"; -} - - -sub outputHeader { - print < - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../SDL_internal.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 -#endif - - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 -#endif - -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 -#endif - -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif - - -/* *INDENT-OFF* */ - -EOF - - my @vals = ( 127, 32767, 2147483647 ); - foreach (@vals) { - my $val = $_; - my $fval = 1.0 / $val; - print("#define DIVBY${val} ${fval}f\n"); - } - - print("\n"); -} - -sub outputFooter { - print < 8) { - $code = "SDL_Swap${BEorLE}${size}($val)"; - } else { - $code = $val; - } - - if (($signed) and (!$float)) { - $code = "((Sint${size}) $code)"; - } - } - - return "${code}"; -} - - -sub maxIntVal { - my $size = shift; - if ($size == 8) { - return 0x7F; - } elsif ($size == 16) { - return 0x7FFF; - } elsif ($size == 32) { - return 0x7FFFFFFF; - } - - die("bug in script.\n"); -} - -sub getFloatToIntMult { - my $size = shift; - my $val = maxIntVal($size) . '.0'; - $val .= 'f' if ($size < 32); - return $val; -} - -sub getIntToFloatDivBy { - my $size = shift; - return 'DIVBY' . maxIntVal($size); -} - -sub getSignFlipVal { - my $size = shift; - if ($size == 8) { - return '0x80'; - } elsif ($size == 16) { - return '0x8000'; - } elsif ($size == 32) { - return '0x80000000'; - } - - die("bug in script.\n"); -} - -sub buildCvtFunc { - my ($from, $to) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - my ($tsigned, $tfloat, $tsize, $tendian, $tctype) = splittype($to); - my $diffs = 0; - $diffs++ if ($fsize != $tsize); - $diffs++ if ($fsigned != $tsigned); - $diffs++ if ($ffloat != $tfloat); - $diffs++ if ($fendian ne $tendian); - - return if ($diffs == 0); - - my $hashid = getTypeConvertHashId($from, $to); - if (1) { # !!! FIXME: if ($diffs > 1) { - my $sym = "SDL_Convert_${from}_to_${to}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # Always unsigned for ints, for possible byteswaps. - my $srctype = (($ffloat) ? 'float' : "Uint${fsize}"); - - print <buf + cvt->len_cvt)) - 1; - dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) { -EOF - } else { - print <buf; - dst = ($tctype *) cvt->buf; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, ++src, ++dst) { -EOF - } - - # Have to convert to/from float/int. - # !!! FIXME: cast through double for int32<->float? - my $code = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, '*src'); - if ($ffloat != $tfloat) { - if ($ffloat) { - my $mult = getFloatToIntMult($tsize); - if (!$tsigned) { # bump from -1.0f/1.0f to 0.0f/2.0f - $code = "($code + 1.0f)"; - } - $code = "(($tctype) ($code * $mult))"; - } else { - # $divby will be the reciprocal, to avoid pipeline stalls - # from floating point division...so multiply it. - my $divby = getIntToFloatDivBy($fsize); - $code = "(((float) $code) * $divby)"; - if (!$fsigned) { # bump from 0.0f/2.0f to -1.0f/1.0f. - $code = "($code - 1.0f)"; - } - } - } else { - # All integer conversions here. - if ($fsigned != $tsigned) { - my $signflipval = getSignFlipVal($fsize); - $code = "(($code) ^ $signflipval)"; - } - - my $shiftval = abs($fsize - $tsize); - if ($fsize < $tsize) { - $code = "((($tctype) $code) << $shiftval)"; - } elsif ($fsize > $tsize) { - $code = "(($tctype) ($code >> $shiftval))"; - } - } - - my $swap = getSwapFunc($tsize, $tsigned, $tfloat, $tendian, 'val'); - - print < $tsize) { - my $divby = $fsize / $tsize; - print(" cvt->len_cvt /= $divby;\n"); - } elsif ($fsize < $tsize) { - my $mult = $tsize / $fsize; - print(" cvt->len_cvt *= $mult;\n"); - } - - print <filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_$to); - } -} - -EOF - - } else { - if ($fsigned != $tsigned) { - $funcs{$hashid} = 'SDL_ConvertSigned'; - } elsif ($ffloat != $tfloat) { - $funcs{$hashid} = 'SDL_ConvertFloat'; - } elsif ($fsize != $tsize) { - $funcs{$hashid} = 'SDL_ConvertSize'; - } elsif ($fendian ne $tendian) { - $funcs{$hashid} = 'SDL_ConvertEndian'; - } else { - die("error in script.\n"); - } - } -} - - -sub buildTypeConverters { - print "#if !NO_CONVERTERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - buildCvtFunc($from, $to); - } - } - print "#endif /* !NO_CONVERTERS */\n\n\n"; - - print "const SDL_AudioTypeFilters sdl_audio_type_filters[] =\n{\n"; - print "#if !NO_CONVERTERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - if ($from ne $to) { - my $hashid = getTypeConvertHashId($from, $to); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, AUDIO_$to, $sym },\n"); - } - } - } - print "#endif /* !NO_CONVERTERS */\n"; - - print(" { 0, 0, NULL }\n"); - print "};\n\n\n"; -} - -sub getBiggerCtype { - my ($isfloat, $size) = @_; - - if ($isfloat) { - if ($size == 32) { - return 'double'; - } - die("bug in script.\n"); - } - - if ($size == 8) { - return 'Sint16'; - } elsif ($size == 16) { - return 'Sint32' - } elsif ($size == 32) { - return 'Sint64' - } - - die("bug in script.\n"); -} - - -# These handle arbitrary resamples...44100Hz to 48000Hz, for example. -# Man, this code is skanky. -sub buildArbitraryResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, 0); - my $sym = "SDL_${resample}_${from}_${channels}c"; - $funcs{$hashid} = $sym; - $custom_converters++; - - my $fudge = $fsize * $channels * 2; # !!! FIXME - my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize'; - my $incr = ''; - my $incr2 = ''; - my $block_align = $channels * $fsize/8; - - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <rate_incr); -#endif - - const int srcsize = cvt->len_cvt - $fudge; - const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align}; - register int eps = 0; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= dstsize) { - $incr2; -EOF - } else { # downsample. - $incr = ($channels == 1) ? 'src++' : "src += $channels"; - print <= srcsize) { -EOF - for (my $i = 0; $i < $channels; $i++) { - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${i}"); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -# These handle clean resamples...doubling and quadrupling the sample rate, etc. -sub buildMultipleResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample, $multiple) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - my $interp2 = ($ffloat) ? '* 0.25' : '>> 2'; - my $mult3 = ($ffloat) ? '3.0' : '3'; - my $lencvtop = ($upsample) ? '*' : '/'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, $multiple); - my $sym = "SDL_${resample}_${from}_${channels}c_x${multiple}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <len_cvt $lencvtop $multiple; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels * $multiple; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= 0; $i--) { - my $dsti = $i + $channels; - print <= 0; $i--) { - my $dsti = $i; - print <= 0; $i--) { - my $dsti = $i + ($channels * 3); - print <= 0; $i--) { - my $dsti = $i + ($channels * 2); - print <= 0; $i--) { - my $dsti = $i + ($channels * 1); - print <= 0; $i--) { - my $dsti = $i + ($channels * 0); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -sub buildResamplers { - print "#if !NO_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - buildArbitraryResampleFunc($from, $channel, 1); - buildArbitraryResampleFunc($from, $channel, 0); - } - } - - print "\n#if !LESS_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - buildMultipleResampleFunc($from, $channel, 1, $multiple); - buildMultipleResampleFunc($from, $channel, 0, $multiple); - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n\n\n"; - - print "const SDL_AudioRateFilters sdl_audio_rate_filters[] =\n{\n"; - print "#if !NO_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, 0); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, 0, $sym },\n"); - } - } - } - - print "#if !LESS_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, $multiple); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, $multiple, $sym },\n"); - } - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n"; - print(" { 0, 0, 0, 0, NULL }\n"); - print "};\n\n"; -} - - -# mainline ... - -outputHeader(); -buildTypeConverters(); -buildResamplers(); -outputFooter(); - -exit 0; - -# end of sdlgenaudiocvt.pl ... - diff --git a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.c b/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.c deleted file mode 100644 index dff234b401..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* WinRT NOTICE: - - A few changes to SDL's XAudio2 backend were warranted by API - changes to Windows. Many, but not all of these are documented by Microsoft - at: - http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - - 1. Windows' thread synchronization function, CreateSemaphore, was removed - from WinRT. SDL's semaphore API was substituted instead. - 2. The method calls, IXAudio2::GetDeviceCount and IXAudio2::GetDeviceDetails - were removed from the XAudio2 API. Microsoft is telling developers to - use APIs in Windows::Foundation instead. - For SDL, the missing methods were reimplemented using the APIs Microsoft - said to use. - 3. CoInitialize and CoUninitialize are not available in WinRT. - These calls were removed, as COM will have been initialized earlier, - at least by the call to the WinRT app's main function - (aka 'int main(Platform::Array^)). (DLudwig: - This was my understanding of how WinRT: the 'main' function uses - a tag of [MTAThread], which should initialize COM. My understanding - of COM is somewhat limited, and I may be incorrect here.) - 4. IXAudio2::CreateMasteringVoice changed its integer-based 'DeviceIndex' - argument to a string-based one, 'szDeviceId'. In WinRT, the - string-based argument will be used. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_XAUDIO2 - -#include "../../core/windows/SDL_windows.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_assert.h" - -#ifdef __GNUC__ -/* The configure script already did any necessary checking */ -# define SDL_XAUDIO2_HAS_SDK 1 -#elif defined(__WINRT__) -/* WinRT always has access to the XAudio 2 SDK (albeit with a header file - that doesn't compile as C code). -*/ -# define SDL_XAUDIO2_HAS_SDK -#include "SDL_xaudio2.h" /* ... compiles as C code, in contrast to XAudio2 headers - in the Windows SDK, v.10.0.10240.0 (Win 10's initial SDK) - */ -#else -/* XAudio2 exists in the last DirectX SDK as well as the latest Windows SDK. - To enable XAudio2 support, you will need to add the location of your DirectX SDK headers to - the SDL projects additional include directories and then set SDL_XAUDIO2_HAS_SDK=1 as a - preprocessor define - */ -#if 0 /* See comment above */ -#include -#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) -# pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") -#else -# define SDL_XAUDIO2_HAS_SDK 1 -#endif -#endif -#endif /* 0 */ - -#ifdef SDL_XAUDIO2_HAS_SDK - -/* Check to see if we're compiling for XAudio 2.8, or higher. */ -#ifdef WINVER -#if WINVER >= 0x0602 /* Windows 8 SDK or higher? */ -#define SDL_XAUDIO2_WIN8 1 -#endif -#endif - -#if !defined(_SDL_XAUDIO2_H) -#define INITGUID 1 -#include -#endif - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -#ifdef __WINRT__ -#include "SDL_xaudio2_winrthelpers.h" -#endif - -/* Fixes bug 1210 where some versions of gcc need named parameters */ -#ifdef __GNUC__ -#ifdef THIS -#undef THIS -#endif -#define THIS INTERFACE *p -#ifdef THIS_ -#undef THIS_ -#endif -#define THIS_ INTERFACE *p, -#endif - -struct SDL_PrivateAudioData -{ - IXAudio2 *ixa2; - IXAudio2SourceVoice *source; - IXAudio2MasteringVoice *mastering; - SDL_sem * semaphore; - Uint8 *mixbuf; - int mixlen; - Uint8 *nextbuf; -}; - - -static void -XAUDIO2_DetectDevices(void) -{ - IXAudio2 *ixa2 = NULL; - UINT32 devcount = 0; - UINT32 i = 0; - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - SDL_SetError("XAudio2: XAudio2Create() failed at detection."); - return; - } else if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) { - SDL_SetError("XAudio2: IXAudio2::GetDeviceCount() failed."); - IXAudio2_Release(ixa2); - return; - } - - for (i = 0; i < devcount; i++) { - XAUDIO2_DEVICE_DETAILS details; - if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) { - char *str = WIN_StringToUTF8(details.DisplayName); - if (str != NULL) { - SDL_AddAudioDevice(SDL_FALSE, str, (void *) ((size_t) i+1)); - SDL_free(str); /* SDL_AddAudioDevice made a copy of the string. */ - } - } - } - - IXAudio2_Release(ixa2); -} - -static void STDMETHODCALLTYPE -VoiceCBOnBufferEnd(THIS_ void *data) -{ - /* Just signal the SDL audio thread and get out of XAudio2's way. */ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_SemPost(this->hidden->semaphore); -} - -static void STDMETHODCALLTYPE -VoiceCBOnVoiceError(THIS_ void *data, HRESULT Error) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_OpenedAudioDeviceDisconnected(this); -} - -/* no-op callbacks... */ -static void STDMETHODCALLTYPE VoiceCBOnStreamEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassStart(THIS_ UINT32 b) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnBufferStart(THIS_ void *data) {} -static void STDMETHODCALLTYPE VoiceCBOnLoopEnd(THIS_ void *data) {} - - -static Uint8 * -XAUDIO2_GetDeviceBuf(_THIS) -{ - return this->hidden->nextbuf; -} - -static void -XAUDIO2_PlayDevice(_THIS) -{ - XAUDIO2_BUFFER buffer; - Uint8 *mixbuf = this->hidden->mixbuf; - Uint8 *nextbuf = this->hidden->nextbuf; - const int mixlen = this->hidden->mixlen; - IXAudio2SourceVoice *source = this->hidden->source; - HRESULT result = S_OK; - - if (!this->enabled) { /* shutting down? */ - return; - } - - /* Submit the next filled buffer */ - SDL_zero(buffer); - buffer.AudioBytes = mixlen; - buffer.pAudioData = nextbuf; - buffer.pContext = this; - - if (nextbuf == mixbuf) { - nextbuf += mixlen; - } else { - nextbuf = mixbuf; - } - this->hidden->nextbuf = nextbuf; - - result = IXAudio2SourceVoice_SubmitSourceBuffer(source, &buffer, NULL); - if (result == XAUDIO2_E_DEVICE_INVALIDATED) { - /* !!! FIXME: possibly disconnected or temporary lost. Recover? */ - } - - if (result != S_OK) { /* uhoh, panic! */ - IXAudio2SourceVoice_FlushSourceBuffers(source); - SDL_OpenedAudioDeviceDisconnected(this); - } -} - -static void -XAUDIO2_WaitDevice(_THIS) -{ - if (this->enabled) { - SDL_SemWait(this->hidden->semaphore); - } -} - -static void -XAUDIO2_WaitDone(_THIS) -{ - IXAudio2SourceVoice *source = this->hidden->source; - XAUDIO2_VOICE_STATE state; - SDL_assert(!this->enabled); /* flag that stops playing. */ - IXAudio2SourceVoice_Discontinuity(source); -#if SDL_XAUDIO2_WIN8 - IXAudio2SourceVoice_GetState(source, &state, XAUDIO2_VOICE_NOSAMPLESPLAYED); -#else - IXAudio2SourceVoice_GetState(source, &state); -#endif - while (state.BuffersQueued > 0) { - SDL_SemWait(this->hidden->semaphore); -#if SDL_XAUDIO2_WIN8 - IXAudio2SourceVoice_GetState(source, &state, XAUDIO2_VOICE_NOSAMPLESPLAYED); -#else - IXAudio2SourceVoice_GetState(source, &state); -#endif - } -} - - -static void -XAUDIO2_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - IXAudio2 *ixa2 = this->hidden->ixa2; - IXAudio2SourceVoice *source = this->hidden->source; - IXAudio2MasteringVoice *mastering = this->hidden->mastering; - - if (source != NULL) { - IXAudio2SourceVoice_Stop(source, 0, XAUDIO2_COMMIT_NOW); - IXAudio2SourceVoice_FlushSourceBuffers(source); - IXAudio2SourceVoice_DestroyVoice(source); - } - if (ixa2 != NULL) { - IXAudio2_StopEngine(ixa2); - } - if (mastering != NULL) { - IXAudio2MasteringVoice_DestroyVoice(mastering); - } - if (ixa2 != NULL) { - IXAudio2_Release(ixa2); - } - SDL_free(this->hidden->mixbuf); - if (this->hidden->semaphore != NULL) { - SDL_DestroySemaphore(this->hidden->semaphore); - } - - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -static int -XAUDIO2_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - HRESULT result = S_OK; - WAVEFORMATEX waveformat; - int valid_format = 0; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - IXAudio2 *ixa2 = NULL; - IXAudio2SourceVoice *source = NULL; -#if defined(SDL_XAUDIO2_WIN8) - LPCWSTR devId = NULL; -#else - UINT32 devId = 0; /* 0 == system default device. */ -#endif - - static IXAudio2VoiceCallbackVtbl callbacks_vtable = { - VoiceCBOnVoiceProcessPassStart, - VoiceCBOnVoiceProcessPassEnd, - VoiceCBOnStreamEnd, - VoiceCBOnBufferStart, - VoiceCBOnBufferEnd, - VoiceCBOnLoopEnd, - VoiceCBOnVoiceError - }; - - static IXAudio2VoiceCallback callbacks = { &callbacks_vtable }; - -#if defined(SDL_XAUDIO2_WIN8) - /* !!! FIXME: hook up hotplugging. */ -#else - if (handle != NULL) { /* specific device requested? */ - /* -1 because we increment the original value to avoid NULL. */ - const size_t val = ((size_t) handle) - 1; - devId = (UINT32) val; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - return SDL_SetError("XAudio2: XAudio2Create() failed at open."); - } - - /* - XAUDIO2_DEBUG_CONFIGURATION debugConfig; - debugConfig.TraceMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS | XAUDIO2_LOG_DETAIL | XAUDIO2_LOG_FUNC_CALLS | XAUDIO2_LOG_TIMING | XAUDIO2_LOG_LOCKS | XAUDIO2_LOG_MEMORY | XAUDIO2_LOG_STREAMING; - debugConfig.BreakMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS; - debugConfig.LogThreadID = TRUE; - debugConfig.LogFileline = TRUE; - debugConfig.LogFunctionName = TRUE; - debugConfig.LogTiming = TRUE; - ixa2->SetDebugConfiguration(&debugConfig); - */ - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - IXAudio2_Release(ixa2); - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - this->hidden->ixa2 = ixa2; - this->hidden->semaphore = SDL_CreateSemaphore(1); - if (this->hidden->semaphore == NULL) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: CreateSemaphore() failed!"); - } - - while ((!valid_format) && (test_format)) { - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16: - case AUDIO_S32: - case AUDIO_F32: - this->spec.format = test_format; - valid_format = 1; - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (!valid_format) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: Unsupported audio format"); - } - - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - - /* We feed a Source, it feeds the Mastering, which feeds the device. */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - XAUDIO2_CloseDevice(this); - return SDL_OutOfMemory(); - } - this->hidden->nextbuf = this->hidden->mixbuf; - SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen); - - /* We use XAUDIO2_DEFAULT_CHANNELS instead of this->spec.channels. On - Xbox360, this means 5.1 output, but on Windows, it means "figure out - what the system has." It might be preferable to let XAudio2 blast - stereo output to appropriate surround sound configurations - instead of clamping to 2 channels, even though we'll configure the - Source Voice for whatever number of channels you supply. */ -#if SDL_XAUDIO2_WIN8 - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL, AudioCategory_GameEffects); -#else - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL); -#endif - if (result != S_OK) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: Couldn't create mastering voice"); - } - - SDL_zero(waveformat); - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - waveformat.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } else { - waveformat.wFormatTag = WAVE_FORMAT_PCM; - } - waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - waveformat.nChannels = this->spec.channels; - waveformat.nSamplesPerSec = this->spec.freq; - waveformat.nBlockAlign = - waveformat.nChannels * (waveformat.wBitsPerSample / 8); - waveformat.nAvgBytesPerSec = - waveformat.nSamplesPerSec * waveformat.nBlockAlign; - waveformat.cbSize = sizeof(waveformat); - -#ifdef __WINRT__ - // DLudwig: for now, make XAudio2 do sample rate conversion, just to - // get the loopwave test to work. - // - // TODO, WinRT: consider removing WinRT-specific source-voice creation code from SDL_xaudio2.c - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - 0, - 1.0f, &callbacks, NULL, NULL); -#else - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - XAUDIO2_VOICE_NOSRC | - XAUDIO2_VOICE_NOPITCH, - 1.0f, &callbacks, NULL, NULL); - -#endif - if (result != S_OK) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: Couldn't create source voice"); - } - this->hidden->source = source; - - /* Start everything playing! */ - result = IXAudio2_StartEngine(ixa2); - if (result != S_OK) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: Couldn't start engine"); - } - - result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW); - if (result != S_OK) { - XAUDIO2_CloseDevice(this); - return SDL_SetError("XAudio2: Couldn't start source voice"); - } - - return 0; /* good to go. */ -} - -static void -XAUDIO2_Deinitialize(void) -{ -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif -} - -#endif /* SDL_XAUDIO2_HAS_SDK */ - - -static int -XAUDIO2_Init(SDL_AudioDriverImpl * impl) -{ -#ifndef SDL_XAUDIO2_HAS_SDK - SDL_SetError("XAudio2: SDL was built without XAudio2 support (old DirectX SDK)."); - return 0; /* no XAudio2 support, ever. Update your SDK! */ -#else - /* XAudio2Create() is a macro that uses COM; we don't load the .dll */ - IXAudio2 *ixa2 = NULL; -#if defined(__WIN32__) - // TODO, WinRT: Investigate using CoInitializeEx here - if (FAILED(WIN_CoInitialize())) { - SDL_SetError("XAudio2: CoInitialize() failed"); - return 0; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif - SDL_SetError("XAudio2: XAudio2Create() failed at initialization"); - return 0; /* not available. */ - } - IXAudio2_Release(ixa2); - - /* Set the function pointers */ - impl->DetectDevices = XAUDIO2_DetectDevices; - impl->OpenDevice = XAUDIO2_OpenDevice; - impl->PlayDevice = XAUDIO2_PlayDevice; - impl->WaitDevice = XAUDIO2_WaitDevice; - impl->WaitDone = XAUDIO2_WaitDone; - impl->GetDeviceBuf = XAUDIO2_GetDeviceBuf; - impl->CloseDevice = XAUDIO2_CloseDevice; - impl->Deinitialize = XAUDIO2_Deinitialize; - - /* !!! FIXME: We can apparently use a C++ interface on Windows 8 - * !!! FIXME: (Windows::Devices::Enumeration::DeviceInformation) for device - * !!! FIXME: detection, but it's not implemented here yet. - * !!! FIXME: see http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - * !!! FIXME: for now, force the default device. - */ -#if defined(SDL_XAUDIO2_WIN8) || defined(__WINRT__) - impl->OnlyHasDefaultOutputDevice = 1; -#endif - - return 1; /* this audio target is available. */ -#endif -} - -AudioBootStrap XAUDIO2_bootstrap = { - "xaudio2", "XAudio2", XAUDIO2_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_XAUDIO2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.h b/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.h deleted file mode 100644 index 864eba451d..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_XAUDIO2_H -#define _SDL_XAUDIO2_H - -#include -#include -#include - -/* XAudio2 packs its structure members together as tightly as possible. - This pragma is needed to ensure compatibility with XAudio2 on 64-bit - platforms. -*/ -#pragma pack(push, 1) - -typedef interface IXAudio2 IXAudio2; -typedef interface IXAudio2SourceVoice IXAudio2SourceVoice; -typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice; -typedef interface IXAudio2EngineCallback IXAudio2EngineCallback; -typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback; -typedef interface IXAudio2Voice IXAudio2Voice; -typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice; - -typedef enum _AUDIO_STREAM_CATEGORY { - AudioCategory_Other = 0, - AudioCategory_ForegroundOnlyMedia, - AudioCategory_BackgroundCapableMedia, - AudioCategory_Communications, - AudioCategory_Alerts, - AudioCategory_SoundEffects, - AudioCategory_GameEffects, - AudioCategory_GameMedia, - AudioCategory_GameChat, - AudioCategory_Movie, - AudioCategory_Media -} AUDIO_STREAM_CATEGORY; - -typedef struct XAUDIO2_BUFFER { - UINT32 Flags; - UINT32 AudioBytes; - const BYTE *pAudioData; - UINT32 PlayBegin; - UINT32 PlayLength; - UINT32 LoopBegin; - UINT32 LoopLength; - UINT32 LoopCount; - void *pContext; -} XAUDIO2_BUFFER; - -typedef struct XAUDIO2_BUFFER_WMA { - const UINT32 *pDecodedPacketCumulativeBytes; - UINT32 PacketCount; -} XAUDIO2_BUFFER_WMA; - -typedef struct XAUDIO2_SEND_DESCRIPTOR { - UINT32 Flags; - IXAudio2Voice *pOutputVoice; -} XAUDIO2_SEND_DESCRIPTOR; - -typedef struct XAUDIO2_VOICE_SENDS { - UINT32 SendCount; - XAUDIO2_SEND_DESCRIPTOR *pSends; -} XAUDIO2_VOICE_SENDS; - -typedef struct XAUDIO2_EFFECT_DESCRIPTOR { - IUnknown *pEffect; - BOOL InitialState; - UINT32 OutputChannels; -} XAUDIO2_EFFECT_DESCRIPTOR; - -typedef struct XAUDIO2_EFFECT_CHAIN { - UINT32 EffectCount; - XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors; -} XAUDIO2_EFFECT_CHAIN; - -typedef struct XAUDIO2_PERFORMANCE_DATA { - UINT64 AudioCyclesSinceLastQuery; - UINT64 TotalCyclesSinceLastQuery; - UINT32 MinimumCyclesPerQuantum; - UINT32 MaximumCyclesPerQuantum; - UINT32 MemoryUsageInBytes; - UINT32 CurrentLatencyInSamples; - UINT32 GlitchesSinceEngineStarted; - UINT32 ActiveSourceVoiceCount; - UINT32 TotalSourceVoiceCount; - UINT32 ActiveSubmixVoiceCount; - UINT32 ActiveResamplerCount; - UINT32 ActiveMatrixMixCount; - UINT32 ActiveXmaSourceVoices; - UINT32 ActiveXmaStreams; -} XAUDIO2_PERFORMANCE_DATA; - -typedef struct XAUDIO2_DEBUG_CONFIGURATION { - UINT32 TraceMask; - UINT32 BreakMask; - BOOL LogThreadID; - BOOL LogFileline; - BOOL LogFunctionName; - BOOL LogTiming; -} XAUDIO2_DEBUG_CONFIGURATION; - -typedef struct XAUDIO2_VOICE_DETAILS { - UINT32 CreationFlags; - UINT32 ActiveFlags; - UINT32 InputChannels; - UINT32 InputSampleRate; -} XAUDIO2_VOICE_DETAILS; - -typedef enum XAUDIO2_FILTER_TYPE { - LowPassFilter = 0, - BandPassFilter = 1, - HighPassFilter = 2, - NotchFilter = 3, - LowPassOnePoleFilter = 4, - HighPassOnePoleFilter = 5 -} XAUDIO2_FILTER_TYPE; - -typedef struct XAUDIO2_FILTER_PARAMETERS { - XAUDIO2_FILTER_TYPE Type; - float Frequency; - float OneOverQ; -} XAUDIO2_FILTER_PARAMETERS; - -typedef struct XAUDIO2_VOICE_STATE { - void *pCurrentBufferContext; - UINT32 BuffersQueued; - UINT64 SamplesPlayed; -} XAUDIO2_VOICE_STATE; - - -typedef UINT32 XAUDIO2_PROCESSOR; -#define Processor1 0x00000001 -#define XAUDIO2_DEFAULT_PROCESSOR Processor1 - -#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 -#define XAUDIO2_COMMIT_NOW 0 -#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 -#define XAUDIO2_DEFAULT_CHANNELS 0 - -extern HRESULT __stdcall XAudio2Create( - _Out_ IXAudio2 **ppXAudio2, - _In_ UINT32 Flags, - _In_ XAUDIO2_PROCESSOR XAudio2Processor - ); - -#undef INTERFACE -#define INTERFACE IXAudio2 -typedef interface IXAudio2 { - const struct IXAudio2Vtbl FAR* lpVtbl; -} IXAudio2; -typedef const struct IXAudio2Vtbl IXAudio2Vtbl; -const struct IXAudio2Vtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* IXAudio2 */ - STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice, - const WAVEFORMATEX *pSourceFormat, - UINT32 Flags, - float MaxFrequencyRatio, - IXAudio2VoiceCallback *pCallback, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - UINT32 ProcessingStage, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - LPCWSTR szDeviceId, - const XAUDIO2_EFFECT_CHAIN *pEffectChain, - AUDIO_STREAM_CATEGORY StreamCategory) PURE; - STDMETHOD_(HRESULT, StartEngine)(THIS) PURE; - STDMETHOD_(VOID, StopEngine)(THIS) PURE; - STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE; - STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration, - VOID *pReserved) PURE; -}; - -#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A)) -#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A)) -#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2SourceVoice -typedef interface IXAudio2SourceVoice { - const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl; -} IXAudio2SourceVoice; -typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl; -const struct IXAudio2SourceVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer, - const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE; - STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE; - STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE; - STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState, - UINT32 Flags) PURE; - STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE; - STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE; -}; - -#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) -#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C)) -#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C)) -#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A)) -#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A)) -#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C)) - - -#undef INTERFACE -#define INTERFACE IXAudio2MasteringVoice -typedef interface IXAudio2MasteringVoice { - const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl; -} IXAudio2MasteringVoice; -typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl; -const struct IXAudio2MasteringVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE; -}; - -#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2VoiceCallback -typedef interface IXAudio2VoiceCallback { - const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl; -} IXAudio2VoiceCallback; -typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl; -const struct IXAudio2VoiceCallbackVtbl -{ - /* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's - * own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit - * from any other interface! - */ - - /* IXAudio2VoiceCallback */ - STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE; - STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE; - STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE; - STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE; -}; - -#pragma pack(pop) /* Undo pragma push */ - -#endif /* _SDL_XAUDIO2_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp b/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp deleted file mode 100644 index b2d67c7fb0..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#include -#include "SDL_xaudio2_winrthelpers.h" - -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP -using Windows::Devices::Enumeration::DeviceClass; -using Windows::Devices::Enumeration::DeviceInformation; -using Windows::Devices::Enumeration::DeviceInformationCollection; -#endif - -extern "C" HRESULT __cdecl IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // There doesn't seem to be any audio device enumeration on Windows Phone. - // In lieu of this, just treat things as if there is one and only one - // audio device. - *devcount = 1; - return S_OK; -#else - // TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - *devcount = devices->Size; - return S_OK; -#endif -} - -extern "C" HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // Windows Phone doesn't seem to have the same device enumeration APIs that - // Windows 8/RT has, or it doesn't have them at all. In lieu of this, - // just treat things as if there is one, and only one, default device. - if (index != 0) - { - return XAUDIO2_E_INVALID_CALL; - } - - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE); - } - return S_OK; -#else - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - if (index >= devices->Size) - { - return XAUDIO2_E_INVALID_CALL; - } - - DeviceInformation^ d = devices->GetAt(index); - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE); - } - return S_OK; -#endif -} diff --git a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h b/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h deleted file mode 100644 index aa6486f91c..0000000000 --- a/3rdparty/sdl2-2.0.4/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -// -// Re-implementation of methods removed from XAudio2 (in WinRT): -// - -typedef struct XAUDIO2_DEVICE_DETAILS -{ - WCHAR DeviceID[256]; - WCHAR DisplayName[256]; - /* Other fields exist in the pre-Windows 8 version of this struct, however - they weren't used by SDL, so they weren't added. - */ -} XAUDIO2_DEVICE_DETAILS; - - -#ifdef __cplusplus -extern "C" { -#endif - -HRESULT IXAudio2_GetDeviceCount(IXAudio2 * unused, UINT32 * devcount); -HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details); - -#ifdef __cplusplus -} -#endif - - -// -// C-style macros to call XAudio2's methods in C++: -// -#ifdef __cplusplus -/* -#define IXAudio2_CreateMasteringVoice(A, B, C, D, E, F, G) (A)->CreateMasteringVoice((B), (C), (D), (E), (F), (G)) -#define IXAudio2_CreateSourceVoice(A, B, C, D, E, F, G, H) (A)->CreateSourceVoice((B), (C), (D), (E), (F), (G), (H)) -#define IXAudio2_QueryInterface(A, B, C) (A)->QueryInterface((B), (C)) -#define IXAudio2_Release(A) (A)->Release() -#define IXAudio2_StartEngine(A) (A)->StartEngine() -#define IXAudio2_StopEngine(A) (A)->StopEngine() - -#define IXAudio2MasteringVoice_DestroyVoice(A) (A)->DestroyVoice() - -#define IXAudio2SourceVoice_DestroyVoice(A) (A)->DestroyVoice() -#define IXAudio2SourceVoice_Discontinuity(A) (A)->Discontinuity() -#define IXAudio2SourceVoice_FlushSourceBuffers(A) (A)->FlushSourceBuffers() -#define IXAudio2SourceVoice_GetState(A, B) (A)->GetState((B)) -#define IXAudio2SourceVoice_Start(A, B, C) (A)->Start((B), (C)) -#define IXAudio2SourceVoice_Stop(A, B, C) (A)->Stop((B), (C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A, B, C) (A)->SubmitSourceBuffer((B), (C)) -*/ -#endif // ifdef __cplusplus diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.c b/3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.c deleted file mode 100644 index 5d0df050c8..0000000000 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" -#include "SDL_dbus.h" - -#if SDL_USE_LIBDBUS -/* we never link directly to libdbus. */ -#include "SDL_loadso.h" -static const char *dbus_library = "libdbus-1.so.3"; -static void *dbus_handle = NULL; -static unsigned int screensaver_cookie = 0; -static SDL_DBusContext dbus = {0}; - -static int -LoadDBUSSyms(void) -{ - #define SDL_DBUS_SYM2(x, y) \ - if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1 - - #define SDL_DBUS_SYM(x) \ - SDL_DBUS_SYM2(x, dbus_##x) - - SDL_DBUS_SYM(bus_get_private); - SDL_DBUS_SYM(bus_register); - SDL_DBUS_SYM(bus_add_match); - SDL_DBUS_SYM(connection_open_private); - SDL_DBUS_SYM(connection_set_exit_on_disconnect); - SDL_DBUS_SYM(connection_get_is_connected); - SDL_DBUS_SYM(connection_add_filter); - SDL_DBUS_SYM(connection_try_register_object_path); - SDL_DBUS_SYM(connection_send); - SDL_DBUS_SYM(connection_send_with_reply_and_block); - SDL_DBUS_SYM(connection_close); - SDL_DBUS_SYM(connection_unref); - SDL_DBUS_SYM(connection_flush); - SDL_DBUS_SYM(connection_read_write); - SDL_DBUS_SYM(connection_dispatch); - SDL_DBUS_SYM(message_is_signal); - SDL_DBUS_SYM(message_new_method_call); - SDL_DBUS_SYM(message_append_args); - SDL_DBUS_SYM(message_get_args); - SDL_DBUS_SYM(message_iter_init); - SDL_DBUS_SYM(message_iter_next); - SDL_DBUS_SYM(message_iter_get_basic); - SDL_DBUS_SYM(message_iter_get_arg_type); - SDL_DBUS_SYM(message_iter_recurse); - SDL_DBUS_SYM(message_unref); - SDL_DBUS_SYM(error_init); - SDL_DBUS_SYM(error_is_set); - SDL_DBUS_SYM(error_free); - SDL_DBUS_SYM(get_local_machine_id); - SDL_DBUS_SYM(free); - SDL_DBUS_SYM(shutdown); - - #undef SDL_DBUS_SYM - #undef SDL_DBUS_SYM2 - - return 0; -} - -static void -UnloadDBUSLibrary(void) -{ - if (dbus_handle != NULL) { - SDL_UnloadObject(dbus_handle); - dbus_handle = NULL; - } -} - -static int -LoadDBUSLibrary(void) -{ - int retval = 0; - if (dbus_handle == NULL) { - dbus_handle = SDL_LoadObject(dbus_library); - if (dbus_handle == NULL) { - retval = -1; - /* Don't call SDL_SetError(): SDL_LoadObject already did. */ - } else { - retval = LoadDBUSSyms(); - if (retval < 0) { - UnloadDBUSLibrary(); - } - } - } - - return retval; -} - -void -SDL_DBus_Init(void) -{ - if (!dbus.session_conn && LoadDBUSLibrary() != -1) { - DBusError err; - dbus.error_init(&err); - dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); - if (dbus.error_is_set(&err)) { - dbus.error_free(&err); - if (dbus.session_conn) { - dbus.connection_unref(dbus.session_conn); - dbus.session_conn = NULL; - } - return; /* oh well */ - } - dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); - } -} - -void -SDL_DBus_Quit(void) -{ - if (dbus.session_conn) { - dbus.connection_close(dbus.session_conn); - dbus.connection_unref(dbus.session_conn); - dbus.shutdown(); - SDL_memset(&dbus, 0, sizeof(dbus)); - } - UnloadDBUSLibrary(); -} - -SDL_DBusContext * -SDL_DBus_GetContext(void) -{ - if(!dbus_handle || !dbus.session_conn){ - SDL_DBus_Init(); - } - - if(dbus_handle && dbus.session_conn){ - return &dbus; - } else { - return NULL; - } -} - -void -SDL_DBus_ScreensaverTickle(void) -{ - DBusConnection *conn = dbus.session_conn; - if (conn != NULL) { - DBusMessage *msg = dbus.message_new_method_call("org.gnome.ScreenSaver", - "/org/gnome/ScreenSaver", - "org.gnome.ScreenSaver", - "SimulateUserActivity"); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); - } - dbus.message_unref(msg); - } - } -} - -SDL_bool -SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) -{ - DBusConnection *conn = dbus.session_conn; - - if (conn == NULL) - return SDL_FALSE; - - if (inhibit && - screensaver_cookie != 0) - return SDL_TRUE; - if (!inhibit && - screensaver_cookie == 0) - return SDL_TRUE; - - if (inhibit) { - const char *app = "My SDL application"; - const char *reason = "Playing a game"; - - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "Inhibit"); - if (msg != NULL) { - dbus.message_append_args (msg, - DBUS_TYPE_STRING, &app, - DBUS_TYPE_STRING, &reason, - DBUS_TYPE_INVALID); - } - - if (msg != NULL) { - DBusMessage *reply; - - reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); - if (reply) { - if (!dbus.message_get_args(reply, NULL, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID)) - screensaver_cookie = 0; - dbus.message_unref(reply); - } - - dbus.message_unref(msg); - } - - if (screensaver_cookie == 0) { - return SDL_FALSE; - } - return SDL_TRUE; - } else { - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "UnInhibit"); - dbus.message_append_args (msg, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); - } - dbus.message_unref(msg); - } - - screensaver_cookie = 0; - return SDL_TRUE; - } -} -#endif diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.c b/3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.c deleted file mode 100644 index a8f2b138e5..0000000000 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.c +++ /dev/null @@ -1,808 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_INPUT_LINUXEV - -/* This is based on the linux joystick driver */ -/* References: https://www.kernel.org/doc/Documentation/input/input.txt - * https://www.kernel.org/doc/Documentation/input/event-codes.txt - * /usr/include/linux/input.h - * The evtest application is also useful to debug the protocol - */ - - -#include "SDL_evdev.h" -#define _THIS SDL_EVDEV_PrivateData *_this -static _THIS = NULL; - -#include -#include -#include -#include -#include /* For the definition of PATH_MAX */ -#include -#ifdef SDL_INPUT_LINUXKD -#include -#include -#endif - - -/* We need this to prevent keystrokes from appear in the console */ -#ifndef KDSKBMUTE -#define KDSKBMUTE 0x4B51 -#endif -#ifndef KDSKBMODE -#define KDSKBMODE 0x4B45 -#endif -#ifndef K_OFF -#define K_OFF 0x04 -#endif - -#include "SDL.h" -#include "SDL_assert.h" -#include "SDL_endian.h" -#include "../../core/linux/SDL_udev.h" -#include "SDL_scancode.h" -#include "../../events/SDL_events_c.h" - -/* This isn't defined in older Linux kernel headers */ -#ifndef SYN_DROPPED -#define SYN_DROPPED 3 -#endif - -static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode); -static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); -static int SDL_EVDEV_device_removed(const char *devpath); - -#if SDL_USE_LIBUDEV -static int SDL_EVDEV_device_added(const char *devpath); -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); -#endif /* SDL_USE_LIBUDEV */ - -static SDL_Scancode EVDEV_Keycodes[] = { - SDL_SCANCODE_UNKNOWN, /* KEY_RESERVED 0 */ - SDL_SCANCODE_ESCAPE, /* KEY_ESC 1 */ - SDL_SCANCODE_1, /* KEY_1 2 */ - SDL_SCANCODE_2, /* KEY_2 3 */ - SDL_SCANCODE_3, /* KEY_3 4 */ - SDL_SCANCODE_4, /* KEY_4 5 */ - SDL_SCANCODE_5, /* KEY_5 6 */ - SDL_SCANCODE_6, /* KEY_6 7 */ - SDL_SCANCODE_7, /* KEY_7 8 */ - SDL_SCANCODE_8, /* KEY_8 9 */ - SDL_SCANCODE_9, /* KEY_9 10 */ - SDL_SCANCODE_0, /* KEY_0 11 */ - SDL_SCANCODE_MINUS, /* KEY_MINUS 12 */ - SDL_SCANCODE_EQUALS, /* KEY_EQUAL 13 */ - SDL_SCANCODE_BACKSPACE, /* KEY_BACKSPACE 14 */ - SDL_SCANCODE_TAB, /* KEY_TAB 15 */ - SDL_SCANCODE_Q, /* KEY_Q 16 */ - SDL_SCANCODE_W, /* KEY_W 17 */ - SDL_SCANCODE_E, /* KEY_E 18 */ - SDL_SCANCODE_R, /* KEY_R 19 */ - SDL_SCANCODE_T, /* KEY_T 20 */ - SDL_SCANCODE_Y, /* KEY_Y 21 */ - SDL_SCANCODE_U, /* KEY_U 22 */ - SDL_SCANCODE_I, /* KEY_I 23 */ - SDL_SCANCODE_O, /* KEY_O 24 */ - SDL_SCANCODE_P, /* KEY_P 25 */ - SDL_SCANCODE_LEFTBRACKET, /* KEY_LEFTBRACE 26 */ - SDL_SCANCODE_RIGHTBRACKET, /* KEY_RIGHTBRACE 27 */ - SDL_SCANCODE_RETURN, /* KEY_ENTER 28 */ - SDL_SCANCODE_LCTRL, /* KEY_LEFTCTRL 29 */ - SDL_SCANCODE_A, /* KEY_A 30 */ - SDL_SCANCODE_S, /* KEY_S 31 */ - SDL_SCANCODE_D, /* KEY_D 32 */ - SDL_SCANCODE_F, /* KEY_F 33 */ - SDL_SCANCODE_G, /* KEY_G 34 */ - SDL_SCANCODE_H, /* KEY_H 35 */ - SDL_SCANCODE_J, /* KEY_J 36 */ - SDL_SCANCODE_K, /* KEY_K 37 */ - SDL_SCANCODE_L, /* KEY_L 38 */ - SDL_SCANCODE_SEMICOLON, /* KEY_SEMICOLON 39 */ - SDL_SCANCODE_APOSTROPHE, /* KEY_APOSTROPHE 40 */ - SDL_SCANCODE_GRAVE, /* KEY_GRAVE 41 */ - SDL_SCANCODE_LSHIFT, /* KEY_LEFTSHIFT 42 */ - SDL_SCANCODE_BACKSLASH, /* KEY_BACKSLASH 43 */ - SDL_SCANCODE_Z, /* KEY_Z 44 */ - SDL_SCANCODE_X, /* KEY_X 45 */ - SDL_SCANCODE_C, /* KEY_C 46 */ - SDL_SCANCODE_V, /* KEY_V 47 */ - SDL_SCANCODE_B, /* KEY_B 48 */ - SDL_SCANCODE_N, /* KEY_N 49 */ - SDL_SCANCODE_M, /* KEY_M 50 */ - SDL_SCANCODE_COMMA, /* KEY_COMMA 51 */ - SDL_SCANCODE_PERIOD, /* KEY_DOT 52 */ - SDL_SCANCODE_SLASH, /* KEY_SLASH 53 */ - SDL_SCANCODE_RSHIFT, /* KEY_RIGHTSHIFT 54 */ - SDL_SCANCODE_KP_MULTIPLY, /* KEY_KPASTERISK 55 */ - SDL_SCANCODE_LALT, /* KEY_LEFTALT 56 */ - SDL_SCANCODE_SPACE, /* KEY_SPACE 57 */ - SDL_SCANCODE_CAPSLOCK, /* KEY_CAPSLOCK 58 */ - SDL_SCANCODE_F1, /* KEY_F1 59 */ - SDL_SCANCODE_F2, /* KEY_F2 60 */ - SDL_SCANCODE_F3, /* KEY_F3 61 */ - SDL_SCANCODE_F4, /* KEY_F4 62 */ - SDL_SCANCODE_F5, /* KEY_F5 63 */ - SDL_SCANCODE_F6, /* KEY_F6 64 */ - SDL_SCANCODE_F7, /* KEY_F7 65 */ - SDL_SCANCODE_F8, /* KEY_F8 66 */ - SDL_SCANCODE_F9, /* KEY_F9 67 */ - SDL_SCANCODE_F10, /* KEY_F10 68 */ - SDL_SCANCODE_NUMLOCKCLEAR, /* KEY_NUMLOCK 69 */ - SDL_SCANCODE_SCROLLLOCK, /* KEY_SCROLLLOCK 70 */ - SDL_SCANCODE_KP_7, /* KEY_KP7 71 */ - SDL_SCANCODE_KP_8, /* KEY_KP8 72 */ - SDL_SCANCODE_KP_9, /* KEY_KP9 73 */ - SDL_SCANCODE_KP_MINUS, /* KEY_KPMINUS 74 */ - SDL_SCANCODE_KP_4, /* KEY_KP4 75 */ - SDL_SCANCODE_KP_5, /* KEY_KP5 76 */ - SDL_SCANCODE_KP_6, /* KEY_KP6 77 */ - SDL_SCANCODE_KP_PLUS, /* KEY_KPPLUS 78 */ - SDL_SCANCODE_KP_1, /* KEY_KP1 79 */ - SDL_SCANCODE_KP_2, /* KEY_KP2 80 */ - SDL_SCANCODE_KP_3, /* KEY_KP3 81 */ - SDL_SCANCODE_KP_0, /* KEY_KP0 82 */ - SDL_SCANCODE_KP_PERIOD, /* KEY_KPDOT 83 */ - SDL_SCANCODE_UNKNOWN, /* 84 */ - SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU 85 */ - SDL_SCANCODE_UNKNOWN, /* KEY_102ND 86 */ - SDL_SCANCODE_F11, /* KEY_F11 87 */ - SDL_SCANCODE_F12, /* KEY_F12 88 */ - SDL_SCANCODE_UNKNOWN, /* KEY_RO 89 */ - SDL_SCANCODE_LANG3, /* KEY_KATAKANA 90 */ - SDL_SCANCODE_LANG4, /* KEY_HIRAGANA 91 */ - SDL_SCANCODE_UNKNOWN, /* KEY_HENKAN 92 */ - SDL_SCANCODE_LANG3, /* KEY_KATAKANAHIRAGANA 93 */ - SDL_SCANCODE_UNKNOWN, /* KEY_MUHENKAN 94 */ - SDL_SCANCODE_KP_COMMA, /* KEY_KPJPCOMMA 95 */ - SDL_SCANCODE_KP_ENTER, /* KEY_KPENTER 96 */ - SDL_SCANCODE_RCTRL, /* KEY_RIGHTCTRL 97 */ - SDL_SCANCODE_KP_DIVIDE, /* KEY_KPSLASH 98 */ - SDL_SCANCODE_SYSREQ, /* KEY_SYSRQ 99 */ - SDL_SCANCODE_RALT, /* KEY_RIGHTALT 100 */ - SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED 101 */ - SDL_SCANCODE_HOME, /* KEY_HOME 102 */ - SDL_SCANCODE_UP, /* KEY_UP 103 */ - SDL_SCANCODE_PAGEUP, /* KEY_PAGEUP 104 */ - SDL_SCANCODE_LEFT, /* KEY_LEFT 105 */ - SDL_SCANCODE_RIGHT, /* KEY_RIGHT 106 */ - SDL_SCANCODE_END, /* KEY_END 107 */ - SDL_SCANCODE_DOWN, /* KEY_DOWN 108 */ - SDL_SCANCODE_PAGEDOWN, /* KEY_PAGEDOWN 109 */ - SDL_SCANCODE_INSERT, /* KEY_INSERT 110 */ - SDL_SCANCODE_DELETE, /* KEY_DELETE 111 */ - SDL_SCANCODE_UNKNOWN, /* KEY_MACRO 112 */ - SDL_SCANCODE_MUTE, /* KEY_MUTE 113 */ - SDL_SCANCODE_VOLUMEDOWN, /* KEY_VOLUMEDOWN 114 */ - SDL_SCANCODE_VOLUMEUP, /* KEY_VOLUMEUP 115 */ - SDL_SCANCODE_POWER, /* KEY_POWER 116 SC System Power Down */ - SDL_SCANCODE_KP_EQUALS, /* KEY_KPEQUAL 117 */ - SDL_SCANCODE_KP_MINUS, /* KEY_KPPLUSMINUS 118 */ - SDL_SCANCODE_PAUSE, /* KEY_PAUSE 119 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SCALE 120 AL Compiz Scale (Expose) */ - SDL_SCANCODE_KP_COMMA, /* KEY_KPCOMMA 121 */ - SDL_SCANCODE_LANG1, /* KEY_HANGEUL,KEY_HANGUEL 122 */ - SDL_SCANCODE_LANG2, /* KEY_HANJA 123 */ - SDL_SCANCODE_INTERNATIONAL3,/* KEY_YEN 124 */ - SDL_SCANCODE_LGUI, /* KEY_LEFTMETA 125 */ - SDL_SCANCODE_RGUI, /* KEY_RIGHTMETA 126 */ - SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE 127 */ - SDL_SCANCODE_STOP, /* KEY_STOP 128 AC Stop */ - SDL_SCANCODE_AGAIN, /* KEY_AGAIN 129 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PROPS 130 AC Properties */ - SDL_SCANCODE_UNDO, /* KEY_UNDO 131 AC Undo */ - SDL_SCANCODE_UNKNOWN, /* KEY_FRONT 132 */ - SDL_SCANCODE_COPY, /* KEY_COPY 133 AC Copy */ - SDL_SCANCODE_UNKNOWN, /* KEY_OPEN 134 AC Open */ - SDL_SCANCODE_PASTE, /* KEY_PASTE 135 AC Paste */ - SDL_SCANCODE_FIND, /* KEY_FIND 136 AC Search */ - SDL_SCANCODE_CUT, /* KEY_CUT 137 AC Cut */ - SDL_SCANCODE_HELP, /* KEY_HELP 138 AL Integrated Help Center */ - SDL_SCANCODE_MENU, /* KEY_MENU 139 Menu (show menu) */ - SDL_SCANCODE_CALCULATOR, /* KEY_CALC 140 AL Calculator */ - SDL_SCANCODE_UNKNOWN, /* KEY_SETUP 141 */ - SDL_SCANCODE_SLEEP, /* KEY_SLEEP 142 SC System Sleep */ - SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP 143 System Wake Up */ - SDL_SCANCODE_UNKNOWN, /* KEY_FILE 144 AL Local Machine Browser */ - SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE 145 */ - SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE 146 */ - SDL_SCANCODE_UNKNOWN, /* KEY_XFER 147 */ - SDL_SCANCODE_APP1, /* KEY_PROG1 148 */ - SDL_SCANCODE_APP1, /* KEY_PROG2 149 */ - SDL_SCANCODE_WWW, /* KEY_WWW 150 AL Internet Browser */ - SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS 151 */ - SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE,KEY_SCREENLOCK 152 AL Terminal Lock/Screensaver */ - SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION 153 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS 154 */ - SDL_SCANCODE_MAIL, /* KEY_MAIL 155 */ - SDL_SCANCODE_AC_BOOKMARKS, /* KEY_BOOKMARKS 156 AC Bookmarks */ - SDL_SCANCODE_COMPUTER, /* KEY_COMPUTER 157 */ - SDL_SCANCODE_AC_BACK, /* KEY_BACK 158 AC Back */ - SDL_SCANCODE_AC_FORWARD, /* KEY_FORWARD 159 AC Forward */ - SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD 160 */ - SDL_SCANCODE_EJECT, /* KEY_EJECTCD 161 */ - SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD 162 */ - SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG 163 */ - SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE 164 */ - SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG 165 */ - SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD 166 */ - SDL_SCANCODE_UNKNOWN, /* KEY_RECORD 167 */ - SDL_SCANCODE_UNKNOWN, /* KEY_REWIND 168 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PHONE 169 Media Select Telephone */ - SDL_SCANCODE_UNKNOWN, /* KEY_ISO 170 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG 171 AL Consumer Control Configuration */ - SDL_SCANCODE_AC_HOME, /* KEY_HOMEPAGE 172 AC Home */ - SDL_SCANCODE_AC_REFRESH, /* KEY_REFRESH 173 AC Refresh */ - SDL_SCANCODE_UNKNOWN, /* KEY_EXIT 174 AC Exit */ - SDL_SCANCODE_UNKNOWN, /* KEY_MOVE 175 */ - SDL_SCANCODE_UNKNOWN, /* KEY_EDIT 176 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP 177 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN 178 */ - SDL_SCANCODE_KP_LEFTPAREN, /* KEY_KPLEFTPAREN 179 */ - SDL_SCANCODE_KP_RIGHTPAREN, /* KEY_KPRIGHTPAREN 180 */ - SDL_SCANCODE_UNKNOWN, /* KEY_NEW 181 AC New */ - SDL_SCANCODE_AGAIN, /* KEY_REDO 182 AC Redo/Repeat */ - SDL_SCANCODE_F13, /* KEY_F13 183 */ - SDL_SCANCODE_F14, /* KEY_F14 184 */ - SDL_SCANCODE_F15, /* KEY_F15 185 */ - SDL_SCANCODE_F16, /* KEY_F16 186 */ - SDL_SCANCODE_F17, /* KEY_F17 187 */ - SDL_SCANCODE_F18, /* KEY_F18 188 */ - SDL_SCANCODE_F19, /* KEY_F19 189 */ - SDL_SCANCODE_F20, /* KEY_F20 190 */ - SDL_SCANCODE_F21, /* KEY_F21 191 */ - SDL_SCANCODE_F22, /* KEY_F22 192 */ - SDL_SCANCODE_F23, /* KEY_F23 193 */ - SDL_SCANCODE_F24, /* KEY_F24 194 */ - SDL_SCANCODE_UNKNOWN, /* 195 */ - SDL_SCANCODE_UNKNOWN, /* 196 */ - SDL_SCANCODE_UNKNOWN, /* 197 */ - SDL_SCANCODE_UNKNOWN, /* 198 */ - SDL_SCANCODE_UNKNOWN, /* 199 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD 200 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD 201 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 202 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 203 */ - SDL_SCANCODE_UNKNOWN, /* KEY_DASHBOARD 204 AL Dashboard */ - SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND 205 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE 206 AC Close */ - SDL_SCANCODE_UNKNOWN, /* KEY_PLAY 207 */ - SDL_SCANCODE_UNKNOWN, /* KEY_FASTFORWARD 208 */ - SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST 209 */ - SDL_SCANCODE_UNKNOWN, /* KEY_PRINT 210 AC Print */ - SDL_SCANCODE_UNKNOWN, /* KEY_HP 211 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA 212 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SOUND 213 */ - SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION 214 */ - SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL 215 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CHAT 216 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SEARCH 217 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT 218 */ - SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE 219 AL Checkbook/Finance */ - SDL_SCANCODE_UNKNOWN, /* KEY_SPORT 220 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SHOP 221 */ - SDL_SCANCODE_UNKNOWN, /* KEY_ALTERASE 222 */ - SDL_SCANCODE_UNKNOWN, /* KEY_CANCEL 223 AC Cancel */ - SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESSDOWN 224 */ - SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESSUP 225 */ - SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA 226 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SWITCHVIDEOMODE 227 Cycle between available video outputs (Monitor/LCD/TV-out/etc) */ - SDL_SCANCODE_UNKNOWN, /* KEY_KBDILLUMTOGGLE 228 */ - SDL_SCANCODE_UNKNOWN, /* KEY_KBDILLUMDOWN 229 */ - SDL_SCANCODE_UNKNOWN, /* KEY_KBDILLUMUP 230 */ - SDL_SCANCODE_UNKNOWN, /* KEY_SEND 231 AC Send */ - SDL_SCANCODE_UNKNOWN, /* KEY_REPLY 232 AC Reply */ - SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL 233 AC Forward Msg */ - SDL_SCANCODE_UNKNOWN, /* KEY_SAVE 234 AC Save */ - SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS 235 */ - SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY 236 */ - SDL_SCANCODE_UNKNOWN, /* KEY_BLUETOOTH 237 */ - SDL_SCANCODE_UNKNOWN, /* KEY_WLAN 238 */ - SDL_SCANCODE_UNKNOWN, /* KEY_UWB 239 */ - SDL_SCANCODE_UNKNOWN, /* KEY_UNKNOWN 240 */ - SDL_SCANCODE_UNKNOWN, /* KEY_VIDEO_NEXT 241 drive next video source */ - SDL_SCANCODE_UNKNOWN, /* KEY_VIDEO_PREV 242 drive previous video source */ - SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_CYCLE 243 brightness up, after max is min */ - SDL_SCANCODE_UNKNOWN, /* KEY_BRIGHTNESS_ZERO 244 brightness off, use ambient */ - SDL_SCANCODE_UNKNOWN, /* KEY_DISPLAY_OFF 245 display device to off state */ - SDL_SCANCODE_UNKNOWN, /* KEY_WIMAX 246 */ - SDL_SCANCODE_UNKNOWN, /* KEY_RFKILL 247 Key that controls all radios */ - SDL_SCANCODE_UNKNOWN, /* KEY_MICMUTE 248 Mute / unmute the microphone */ -}; - -static Uint8 EVDEV_MouseButtons[] = { - SDL_BUTTON_LEFT, /* BTN_LEFT 0x110 */ - SDL_BUTTON_RIGHT, /* BTN_RIGHT 0x111 */ - SDL_BUTTON_MIDDLE, /* BTN_MIDDLE 0x112 */ - SDL_BUTTON_X1, /* BTN_SIDE 0x113 */ - SDL_BUTTON_X2, /* BTN_EXTRA 0x114 */ - SDL_BUTTON_X2 + 1, /* BTN_FORWARD 0x115 */ - SDL_BUTTON_X2 + 2, /* BTN_BACK 0x116 */ - SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ -}; - -static const char* EVDEV_consoles[] = { - "/proc/self/fd/0", - "/dev/tty", - "/dev/tty0", - "/dev/tty1", - "/dev/tty2", - "/dev/tty3", - "/dev/tty4", - "/dev/tty5", - "/dev/tty6", - "/dev/vc/0", - "/dev/console" -}; - -#define IS_CONSOLE(fd) isatty (fd) && ioctl(fd, KDGKBTYPE, &arg) == 0 && ((arg == KB_101) || (arg == KB_84)) - -static int SDL_EVDEV_get_console_fd(void) -{ - int fd, i; - char arg = 0; - - /* Try a few consoles to see which one we have read access to */ - - for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) { - fd = open(EVDEV_consoles[i], O_RDONLY); - if (fd >= 0) { - if (IS_CONSOLE(fd)) return fd; - close(fd); - } - } - - /* Try stdin, stdout, stderr */ - - for(fd = 0; fd < 3; fd++) { - if (IS_CONSOLE(fd)) return fd; - } - - /* We won't be able to send SDL_TEXTINPUT events */ - return -1; -} - -/* Prevent keystrokes from reaching the tty */ -static int SDL_EVDEV_mute_keyboard(int tty, int *kb_mode) -{ - char arg; - - *kb_mode = 0; /* FIXME: Is this a sane default in case KDGKBMODE fails? */ - if (!IS_CONSOLE(tty)) { - return SDL_SetError("Tried to mute an invalid tty"); - } - ioctl(tty, KDGKBMODE, kb_mode); /* It's not fatal if this fails */ - if (ioctl(tty, KDSKBMUTE, 1) && ioctl(tty, KDSKBMODE, K_OFF)) { - return SDL_SetError("EVDEV: Failed muting keyboard"); - } - - return 0; -} - -/* Restore the keyboard mode for given tty */ -static void SDL_EVDEV_unmute_keyboard(int tty, int kb_mode) -{ - if (ioctl(tty, KDSKBMUTE, 0) && ioctl(tty, KDSKBMODE, kb_mode)) { - SDL_Log("EVDEV: Failed restoring keyboard mode"); - } -} - -/* Read /sys/class/tty/tty0/active and open the tty */ -static int SDL_EVDEV_get_active_tty() -{ - int fd, len; - char ttyname[NAME_MAX + 1]; - char ttypath[PATH_MAX+1] = "/dev/"; - char arg; - - fd = open("/sys/class/tty/tty0/active", O_RDONLY); - if (fd < 0) { - return SDL_SetError("Could not determine which tty is active"); - } - - len = read(fd, ttyname, NAME_MAX); - close(fd); - - if (len <= 0) { - return SDL_SetError("Could not read which tty is active"); - } - - if (ttyname[len-1] == '\n') { - ttyname[len-1] = '\0'; - } - else { - ttyname[len] = '\0'; - } - - SDL_strlcat(ttypath, ttyname, PATH_MAX); - fd = open(ttypath, O_RDWR | O_NOCTTY); - if (fd < 0) { - return SDL_SetError("Could not open tty: %s", ttypath); - } - - if (!IS_CONSOLE(fd)) { - close(fd); - return SDL_SetError("Invalid tty obtained: %s", ttypath); - } - - return fd; -} - -int -SDL_EVDEV_Init(void) -{ - int retval = 0; - - if (_this == NULL) { - - _this = (SDL_EVDEV_PrivateData *) SDL_calloc(1, sizeof(*_this)); - if(_this == NULL) { - return SDL_OutOfMemory(); - } - -#if SDL_USE_LIBUDEV - if (SDL_UDEV_Init() < 0) { - SDL_free(_this); - _this = NULL; - return -1; - } - - /* Set up the udev callback */ - if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) { - SDL_EVDEV_Quit(); - return -1; - } - - /* Force a scan to build the initial device list */ - SDL_UDEV_Scan(); -#else - /* TODO: Scan the devices manually, like a caveman */ -#endif /* SDL_USE_LIBUDEV */ - - /* We need a physical terminal (not PTS) to be able to translate key code to symbols via the kernel tables */ - _this->console_fd = SDL_EVDEV_get_console_fd(); - - /* Mute the keyboard so keystrokes only generate evdev events and do not leak through to the console */ - _this->tty = STDIN_FILENO; - if (SDL_EVDEV_mute_keyboard(_this->tty, &_this->kb_mode) < 0) { - /* stdin is not a tty, probably we were launched remotely, so we try to disable the active tty */ - _this->tty = SDL_EVDEV_get_active_tty(); - if (_this->tty >= 0) { - if (SDL_EVDEV_mute_keyboard(_this->tty, &_this->kb_mode) < 0) { - close(_this->tty); - _this->tty = -1; - } - } - } - } - - _this->ref_count += 1; - - return retval; -} - -void -SDL_EVDEV_Quit(void) -{ - if (_this == NULL) { - return; - } - - _this->ref_count -= 1; - - if (_this->ref_count < 1) { - -#if SDL_USE_LIBUDEV - SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); - SDL_UDEV_Quit(); -#endif /* SDL_USE_LIBUDEV */ - - if (_this->console_fd >= 0) { - close(_this->console_fd); - } - - if (_this->tty >= 0) { - SDL_EVDEV_unmute_keyboard(_this->tty, _this->kb_mode); - close(_this->tty); - } - - /* Remove existing devices */ - while(_this->first != NULL) { - SDL_EVDEV_device_removed(_this->first->path); - } - - SDL_assert(_this->first == NULL); - SDL_assert(_this->last == NULL); - SDL_assert(_this->numdevices == 0); - - SDL_free(_this); - _this = NULL; - } -} - -#if SDL_USE_LIBUDEV -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) -{ - if (devpath == NULL) { - return; - } - - switch(udev_type) { - case SDL_UDEV_DEVICEADDED: - if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE|SDL_UDEV_DEVICE_KEYBOARD))) { - return; - } - SDL_EVDEV_device_added(devpath); - break; - - case SDL_UDEV_DEVICEREMOVED: - SDL_EVDEV_device_removed(devpath); - break; - - default: - break; - } -} - -#endif /* SDL_USE_LIBUDEV */ - -void -SDL_EVDEV_Poll(void) -{ - struct input_event events[32]; - int i, len; - SDL_evdevlist_item *item; - SDL_Scancode scan_code; - int mouse_button; - SDL_Mouse *mouse; -#ifdef SDL_INPUT_LINUXKD - Uint16 modstate; - struct kbentry kbe; - static char keysym[8]; - char *end; - Uint32 kval; -#endif - - if (!_this) { - return; - } - -#if SDL_USE_LIBUDEV - SDL_UDEV_Poll(); -#endif - - mouse = SDL_GetMouse(); - - for (item = _this->first; item != NULL; item = item->next) { - while ((len = read(item->fd, events, (sizeof events))) > 0) { - len /= sizeof(events[0]); - for (i = 0; i < len; ++i) { - switch (events[i].type) { - case EV_KEY: - if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { - mouse_button = events[i].code - BTN_MOUSE; - if (events[i].value == 0) { - SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); - } else if (events[i].value == 1) { - SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); - } - break; - } - - /* Probably keyboard */ - scan_code = SDL_EVDEV_translate_keycode(events[i].code); - if (scan_code != SDL_SCANCODE_UNKNOWN) { - if (events[i].value == 0) { - SDL_SendKeyboardKey(SDL_RELEASED, scan_code); - } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */) { - SDL_SendKeyboardKey(SDL_PRESSED, scan_code); -#ifdef SDL_INPUT_LINUXKD - if (_this->console_fd >= 0) { - kbe.kb_index = events[i].code; - /* Convert the key to an UTF-8 char */ - /* Ref: http://www.linuxjournal.com/article/2783 */ - modstate = SDL_GetModState(); - kbe.kb_table = 0; - - /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */ - kbe.kb_table |= -((modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL); - kbe.kb_table |= -((modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL); - kbe.kb_table |= -((modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT); - kbe.kb_table |= -((modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT); - kbe.kb_table |= -((modstate & KMOD_LALT) != 0) & (1 << KG_ALT); - kbe.kb_table |= -((modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR); - - if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && - ((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER))) - { - kval = KVAL(kbe.kb_value); - - /* While there's a KG_CAPSSHIFT symbol, it's not useful to build the table index with it - * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table - * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale! - */ - if (modstate & KMOD_CAPS && isalpha(kval)) { - if (isupper(kval)) { - kval = tolower(kval); - } else { - kval = toupper(kval); - } - } - - /* Convert to UTF-8 and send */ - end = SDL_UCS4ToUTF8(kval, keysym); - *end = '\0'; - SDL_SendKeyboardText(keysym); - } - } -#endif /* SDL_INPUT_LINUXKD */ - } - } - break; - case EV_ABS: - switch(events[i].code) { - case ABS_X: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); - break; - case ABS_Y: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); - break; - default: - break; - } - break; - case EV_REL: - switch(events[i].code) { - case REL_X: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0); - break; - case REL_Y: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value); - break; - case REL_WHEEL: - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value, SDL_MOUSEWHEEL_NORMAL); - break; - case REL_HWHEEL: - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL); - break; - default: - break; - } - break; - case EV_SYN: - switch (events[i].code) { - case SYN_DROPPED: - SDL_EVDEV_sync_device(item); - break; - default: - break; - } - break; - } - } - } - } -} - -static SDL_Scancode -SDL_EVDEV_translate_keycode(int keycode) -{ - SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; - - if (keycode < SDL_arraysize(EVDEV_Keycodes)) { - scancode = EVDEV_Keycodes[keycode]; - } - if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list EVDEV KeyCode %d \n", keycode); - } - return scancode; -} - -static void -SDL_EVDEV_sync_device(SDL_evdevlist_item *item) -{ - /* TODO: get full state of device and report whatever is required */ -} - -#if SDL_USE_LIBUDEV -static int -SDL_EVDEV_device_added(const char *devpath) -{ - SDL_evdevlist_item *item; - - /* Check to make sure it's not already in list. */ - for (item = _this->first; item != NULL; item = item->next) { - if (SDL_strcmp(devpath, item->path) == 0) { - return -1; /* already have this one */ - } - } - - item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); - if (item == NULL) { - return SDL_OutOfMemory(); - } - - item->fd = open(devpath, O_RDONLY, 0); - if (item->fd < 0) { - SDL_free(item); - return SDL_SetError("Unable to open %s", devpath); - } - - item->path = SDL_strdup(devpath); - if (item->path == NULL) { - close(item->fd); - SDL_free(item); - return SDL_OutOfMemory(); - } - - /* Non blocking read mode */ - fcntl(item->fd, F_SETFL, O_NONBLOCK); - - if (_this->last == NULL) { - _this->first = _this->last = item; - } else { - _this->last->next = item; - _this->last = item; - } - - SDL_EVDEV_sync_device(item); - - return _this->numdevices++; -} -#endif /* SDL_USE_LIBUDEV */ - -static int -SDL_EVDEV_device_removed(const char *devpath) -{ - SDL_evdevlist_item *item; - SDL_evdevlist_item *prev = NULL; - - for (item = _this->first; item != NULL; item = item->next) { - /* found it, remove it. */ - if (SDL_strcmp(devpath, item->path) == 0) { - if (prev != NULL) { - prev->next = item->next; - } else { - SDL_assert(_this->first == item); - _this->first = item->next; - } - if (item == _this->last) { - _this->last = prev; - } - close(item->fd); - SDL_free(item->path); - SDL_free(item); - _this->numdevices--; - return 0; - } - prev = item; - } - - return -1; -} - - -#endif /* SDL_INPUT_LINUXEV */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.h b/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.h deleted file mode 100644 index 5faac2194e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_dynapi_h -#define _SDL_dynapi_h - -/* IMPORTANT: - This is the master switch to disabling the dynamic API. We made it so you - have to hand-edit an internal source file in SDL to turn it off; you - can do it if you want it badly enough, but hopefully you won't want to. - You should understand the ramifications of turning this off: it makes it - hard to update your SDL in the field, and impossible if you've statically - linked SDL into your app. Understand that platforms change, and if we can't - drop in an updated SDL, your application can definitely break some time - in the future, even if it's fine today. - To be sure, as new system-level video and audio APIs are introduced, an - updated SDL can transparently take advantage of them, but your program will - not without this feature. Think hard before turning it off. -*/ -#ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */ -#error Nope, you have to edit this file to force this off. -#endif - -#ifdef __APPLE__ -#include "TargetConditionals.h" -#endif - -#if TARGET_OS_IPHONE || __native_client__ || __EMSCRIPTEN__ /* probably not useful on iOS, NACL or Emscripten. */ -#define SDL_DYNAMIC_API 0 -#elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */ -#define SDL_DYNAMIC_API 0 -#elif defined(__clang_analyzer__) -#define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ -#endif - -/* everyone else. This is where we turn on the API if nothing forced it off. */ -#ifndef SDL_DYNAMIC_API -#define SDL_DYNAMIC_API 1 -#endif - -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_events.c b/3rdparty/sdl2-2.0.4/src/events/SDL_events.c deleted file mode 100644 index ffd1038249..0000000000 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_events.c +++ /dev/null @@ -1,658 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* General event handling code for SDL */ - -#include "SDL.h" -#include "SDL_events.h" -#include "SDL_syswm.h" -#include "SDL_thread.h" -#include "SDL_events_c.h" -#include "../timer/SDL_timer_c.h" -#if !SDL_JOYSTICK_DISABLED -#include "../joystick/SDL_joystick_c.h" -#endif -#include "../video/SDL_sysvideo.h" - -/* An arbitrary limit so we don't have unbounded growth */ -#define SDL_MAX_QUEUED_EVENTS 65535 - -/* Public data -- the event filter */ -SDL_EventFilter SDL_EventOK = NULL; -void *SDL_EventOKParam; - -typedef struct SDL_EventWatcher { - SDL_EventFilter callback; - void *userdata; - struct SDL_EventWatcher *next; -} SDL_EventWatcher; - -static SDL_EventWatcher *SDL_event_watchers = NULL; - -typedef struct { - Uint32 bits[8]; -} SDL_DisabledEventBlock; - -static SDL_DisabledEventBlock *SDL_disabled_events[256]; -static Uint32 SDL_userevents = SDL_USEREVENT; - -/* Private data -- event queue */ -typedef struct _SDL_EventEntry -{ - SDL_Event event; - SDL_SysWMmsg msg; - struct _SDL_EventEntry *prev; - struct _SDL_EventEntry *next; -} SDL_EventEntry; - -typedef struct _SDL_SysWMEntry -{ - SDL_SysWMmsg msg; - struct _SDL_SysWMEntry *next; -} SDL_SysWMEntry; - -static struct -{ - SDL_mutex *lock; - volatile SDL_bool active; - volatile int count; - volatile int max_events_seen; - SDL_EventEntry *head; - SDL_EventEntry *tail; - SDL_EventEntry *free; - SDL_SysWMEntry *wmmsg_used; - SDL_SysWMEntry *wmmsg_free; -} SDL_EventQ = { NULL, SDL_TRUE, 0, 0, NULL, NULL, NULL, NULL, NULL }; - - -/* Public functions */ - -void -SDL_StopEventLoop(void) -{ - const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS"); - int i; - SDL_EventEntry *entry; - SDL_SysWMEntry *wmmsg; - - if (SDL_EventQ.lock) { - SDL_LockMutex(SDL_EventQ.lock); - } - - SDL_EventQ.active = SDL_FALSE; - - if (report && SDL_atoi(report)) { - SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", - SDL_EventQ.max_events_seen); - } - - /* Clean out EventQ */ - for (entry = SDL_EventQ.head; entry; ) { - SDL_EventEntry *next = entry->next; - SDL_free(entry); - entry = next; - } - for (entry = SDL_EventQ.free; entry; ) { - SDL_EventEntry *next = entry->next; - SDL_free(entry); - entry = next; - } - for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; ) { - SDL_SysWMEntry *next = wmmsg->next; - SDL_free(wmmsg); - wmmsg = next; - } - for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) { - SDL_SysWMEntry *next = wmmsg->next; - SDL_free(wmmsg); - wmmsg = next; - } - - SDL_EventQ.count = 0; - SDL_EventQ.max_events_seen = 0; - SDL_EventQ.head = NULL; - SDL_EventQ.tail = NULL; - SDL_EventQ.free = NULL; - SDL_EventQ.wmmsg_used = NULL; - SDL_EventQ.wmmsg_free = NULL; - - /* Clear disabled event state */ - for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) { - SDL_free(SDL_disabled_events[i]); - SDL_disabled_events[i] = NULL; - } - - while (SDL_event_watchers) { - SDL_EventWatcher *tmp = SDL_event_watchers; - SDL_event_watchers = tmp->next; - SDL_free(tmp); - } - SDL_EventOK = NULL; - - if (SDL_EventQ.lock) { - SDL_UnlockMutex(SDL_EventQ.lock); - SDL_DestroyMutex(SDL_EventQ.lock); - SDL_EventQ.lock = NULL; - } -} - -/* This function (and associated calls) may be called more than once */ -int -SDL_StartEventLoop(void) -{ - /* We'll leave the event queue alone, since we might have gotten - some important events at launch (like SDL_DROPFILE) - - FIXME: Does this introduce any other bugs with events at startup? - */ - - /* Create the lock and set ourselves active */ -#if !SDL_THREADS_DISABLED - if (!SDL_EventQ.lock) { - SDL_EventQ.lock = SDL_CreateMutex(); - } - if (SDL_EventQ.lock == NULL) { - return (-1); - } -#endif /* !SDL_THREADS_DISABLED */ - - /* Process most event types */ - SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); - SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); - SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); - - SDL_EventQ.active = SDL_TRUE; - - return (0); -} - - -/* Add an event to the event queue -- called with the queue locked */ -static int -SDL_AddEvent(SDL_Event * event) -{ - SDL_EventEntry *entry; - - if (SDL_EventQ.count >= SDL_MAX_QUEUED_EVENTS) { - SDL_SetError("Event queue is full (%d events)", SDL_EventQ.count); - return 0; - } - - if (SDL_EventQ.free == NULL) { - entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry)); - if (!entry) { - return 0; - } - } else { - entry = SDL_EventQ.free; - SDL_EventQ.free = entry->next; - } - - entry->event = *event; - if (event->type == SDL_SYSWMEVENT) { - entry->msg = *event->syswm.msg; - entry->event.syswm.msg = &entry->msg; - } - - if (SDL_EventQ.tail) { - SDL_EventQ.tail->next = entry; - entry->prev = SDL_EventQ.tail; - SDL_EventQ.tail = entry; - entry->next = NULL; - } else { - SDL_assert(!SDL_EventQ.head); - SDL_EventQ.head = entry; - SDL_EventQ.tail = entry; - entry->prev = NULL; - entry->next = NULL; - } - ++SDL_EventQ.count; - - if (SDL_EventQ.count > SDL_EventQ.max_events_seen) { - SDL_EventQ.max_events_seen = SDL_EventQ.count; - } - - return 1; -} - -/* Remove an event from the queue -- called with the queue locked */ -static void -SDL_CutEvent(SDL_EventEntry *entry) -{ - if (entry->prev) { - entry->prev->next = entry->next; - } - if (entry->next) { - entry->next->prev = entry->prev; - } - - if (entry == SDL_EventQ.head) { - SDL_assert(entry->prev == NULL); - SDL_EventQ.head = entry->next; - } - if (entry == SDL_EventQ.tail) { - SDL_assert(entry->next == NULL); - SDL_EventQ.tail = entry->prev; - } - - entry->next = SDL_EventQ.free; - SDL_EventQ.free = entry; - SDL_assert(SDL_EventQ.count > 0); - --SDL_EventQ.count; -} - -/* Lock the event queue, take a peep at it, and unlock it */ -int -SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, - Uint32 minType, Uint32 maxType) -{ - int i, used; - - /* Don't look after we've quit */ - if (!SDL_EventQ.active) { - /* We get a few spurious events at shutdown, so don't warn then */ - if (action != SDL_ADDEVENT) { - SDL_SetError("The event system has been shut down"); - } - return (-1); - } - /* Lock the event queue */ - used = 0; - if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { - if (action == SDL_ADDEVENT) { - for (i = 0; i < numevents; ++i) { - used += SDL_AddEvent(&events[i]); - } - } else { - SDL_EventEntry *entry, *next; - SDL_SysWMEntry *wmmsg, *wmmsg_next; - SDL_Event tmpevent; - Uint32 type; - - /* If 'events' is NULL, just see if they exist */ - if (events == NULL) { - action = SDL_PEEKEVENT; - numevents = 1; - events = &tmpevent; - } - - /* Clean out any used wmmsg data - FIXME: Do we want to retain the data for some period of time? - */ - for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { - wmmsg_next = wmmsg->next; - wmmsg->next = SDL_EventQ.wmmsg_free; - SDL_EventQ.wmmsg_free = wmmsg; - } - SDL_EventQ.wmmsg_used = NULL; - - for (entry = SDL_EventQ.head; entry && used < numevents; entry = next) { - next = entry->next; - type = entry->event.type; - if (minType <= type && type <= maxType) { - events[used] = entry->event; - if (entry->event.type == SDL_SYSWMEVENT) { - /* We need to copy the wmmsg somewhere safe. - For now we'll guarantee it's valid at least until - the next call to SDL_PeepEvents() - */ - if (SDL_EventQ.wmmsg_free) { - wmmsg = SDL_EventQ.wmmsg_free; - SDL_EventQ.wmmsg_free = wmmsg->next; - } else { - wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); - } - wmmsg->msg = *entry->event.syswm.msg; - wmmsg->next = SDL_EventQ.wmmsg_used; - SDL_EventQ.wmmsg_used = wmmsg; - events[used].syswm.msg = &wmmsg->msg; - } - ++used; - - if (action == SDL_GETEVENT) { - SDL_CutEvent(entry); - } - } - } - } - SDL_UnlockMutex(SDL_EventQ.lock); - } else { - return SDL_SetError("Couldn't lock event queue"); - } - return (used); -} - -SDL_bool -SDL_HasEvent(Uint32 type) -{ - return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0); -} - -SDL_bool -SDL_HasEvents(Uint32 minType, Uint32 maxType) -{ - return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0); -} - -void -SDL_FlushEvent(Uint32 type) -{ - SDL_FlushEvents(type, type); -} - -void -SDL_FlushEvents(Uint32 minType, Uint32 maxType) -{ - /* Don't look after we've quit */ - if (!SDL_EventQ.active) { - return; - } - - /* Make sure the events are current */ -#if 0 - /* Actually, we can't do this since we might be flushing while processing - a resize event, and calling this might trigger further resize events. - */ - SDL_PumpEvents(); -#endif - - /* Lock the event queue */ - if (SDL_LockMutex(SDL_EventQ.lock) == 0) { - SDL_EventEntry *entry, *next; - Uint32 type; - for (entry = SDL_EventQ.head; entry; entry = next) { - next = entry->next; - type = entry->event.type; - if (minType <= type && type <= maxType) { - SDL_CutEvent(entry); - } - } - SDL_UnlockMutex(SDL_EventQ.lock); - } -} - -/* Run the system dependent event loops */ -void -SDL_PumpEvents(void) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - - /* Get events from the video subsystem */ - if (_this) { - _this->PumpEvents(_this); - } -#if !SDL_JOYSTICK_DISABLED - /* Check for joystick state change */ - if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) { - SDL_JoystickUpdate(); - } -#endif - - SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */ -} - -/* Public functions */ - -int -SDL_PollEvent(SDL_Event * event) -{ - return SDL_WaitEventTimeout(event, 0); -} - -int -SDL_WaitEvent(SDL_Event * event) -{ - return SDL_WaitEventTimeout(event, -1); -} - -int -SDL_WaitEventTimeout(SDL_Event * event, int timeout) -{ - Uint32 expiration = 0; - - if (timeout > 0) - expiration = SDL_GetTicks() + timeout; - - for (;;) { - SDL_PumpEvents(); - switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) { - case -1: - return 0; - case 1: - return 1; - case 0: - if (timeout == 0) { - /* Polling and no events, just return */ - return 0; - } - if (timeout > 0 && SDL_TICKS_PASSED(SDL_GetTicks(), expiration)) { - /* Timeout expired and no events */ - return 0; - } - SDL_Delay(10); - break; - } - } -} - -int -SDL_PushEvent(SDL_Event * event) -{ - SDL_EventWatcher *curr; - - event->common.timestamp = SDL_GetTicks(); - - if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) { - return 0; - } - - for (curr = SDL_event_watchers; curr; curr = curr->next) { - curr->callback(curr->userdata, event); - } - - if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) { - return -1; - } - - SDL_GestureProcessEvent(event); - - return 1; -} - -void -SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) -{ - /* Set filter and discard pending events */ - SDL_EventOK = NULL; - SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); - SDL_EventOKParam = userdata; - SDL_EventOK = filter; -} - -SDL_bool -SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata) -{ - if (filter) { - *filter = SDL_EventOK; - } - if (userdata) { - *userdata = SDL_EventOKParam; - } - return SDL_EventOK ? SDL_TRUE : SDL_FALSE; -} - -/* FIXME: This is not thread-safe yet */ -void -SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) -{ - SDL_EventWatcher *watcher, *tail; - - watcher = (SDL_EventWatcher *)SDL_malloc(sizeof(*watcher)); - if (!watcher) { - /* Uh oh... */ - return; - } - - /* create the watcher */ - watcher->callback = filter; - watcher->userdata = userdata; - watcher->next = NULL; - - /* add the watcher to the end of the list */ - if (SDL_event_watchers) { - for (tail = SDL_event_watchers; tail->next; tail = tail->next) { - continue; - } - tail->next = watcher; - } else { - SDL_event_watchers = watcher; - } -} - -/* FIXME: This is not thread-safe yet */ -void -SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) -{ - SDL_EventWatcher *prev = NULL; - SDL_EventWatcher *curr; - - for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->next) { - if (curr->callback == filter && curr->userdata == userdata) { - if (prev) { - prev->next = curr->next; - } else { - SDL_event_watchers = curr->next; - } - SDL_free(curr); - break; - } - } -} - -void -SDL_FilterEvents(SDL_EventFilter filter, void *userdata) -{ - if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) { - SDL_EventEntry *entry, *next; - for (entry = SDL_EventQ.head; entry; entry = next) { - next = entry->next; - if (!filter(userdata, &entry->event)) { - SDL_CutEvent(entry); - } - } - SDL_UnlockMutex(SDL_EventQ.lock); - } -} - -Uint8 -SDL_EventState(Uint32 type, int state) -{ - Uint8 current_state; - Uint8 hi = ((type >> 8) & 0xff); - Uint8 lo = (type & 0xff); - - if (SDL_disabled_events[hi] && - (SDL_disabled_events[hi]->bits[lo/32] & (1 << (lo&31)))) { - current_state = SDL_DISABLE; - } else { - current_state = SDL_ENABLE; - } - - if (state != current_state) - { - switch (state) { - case SDL_DISABLE: - /* Disable this event type and discard pending events */ - if (!SDL_disabled_events[hi]) { - SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock)); - if (!SDL_disabled_events[hi]) { - /* Out of memory, nothing we can do... */ - break; - } - } - SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); - SDL_FlushEvent(type); - break; - case SDL_ENABLE: - SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31)); - break; - default: - /* Querying state... */ - break; - } - } - - return current_state; -} - -Uint32 -SDL_RegisterEvents(int numevents) -{ - Uint32 event_base; - - if ((numevents > 0) && (SDL_userevents+numevents <= SDL_LASTEVENT)) { - event_base = SDL_userevents; - SDL_userevents += numevents; - } else { - event_base = (Uint32)-1; - } - return event_base; -} - -int -SDL_SendAppEvent(SDL_EventType eventType) -{ - int posted; - - posted = 0; - if (SDL_GetEventState(eventType) == SDL_ENABLE) { - SDL_Event event; - event.type = eventType; - posted = (SDL_PushEvent(&event) > 0); - } - return (posted); -} - -int -SDL_SendSysWMEvent(SDL_SysWMmsg * message) -{ - int posted; - - posted = 0; - if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { - SDL_Event event; - SDL_memset(&event, 0, sizeof(event)); - event.type = SDL_SYSWMEVENT; - event.syswm.msg = message; - posted = (SDL_PushEvent(&event) > 0); - } - /* Update internal event state */ - return (posted); -} - -int -SDL_SendKeymapChangedEvent(void) -{ - return SDL_SendAppEvent(SDL_KEYMAPCHANGED); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontroller.c b/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontroller.c deleted file mode 100644 index 0fd1ef4a7a..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontroller.c +++ /dev/null @@ -1,1318 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* This is the game controller API for Simple DirectMedia Layer */ - -#include "SDL_events.h" -#include "SDL_assert.h" -#include "SDL_sysjoystick.h" -#include "SDL_hints.h" -#include "SDL_gamecontrollerdb.h" - -#if !SDL_EVENTS_DISABLED -#include "../events/SDL_events_c.h" -#endif -#define ABS(_x) ((_x) < 0 ? -(_x) : (_x)) - -#define SDL_CONTROLLER_PLATFORM_FIELD "platform:" - -/* a list of currently opened game controllers */ -static SDL_GameController *SDL_gamecontrollers = NULL; - -/* keep track of the hat and mask value that transforms this hat movement into a button/axis press */ -struct _SDL_HatMapping -{ - int hat; - Uint8 mask; -}; - -#define k_nMaxReverseEntries 20 - -/** - * We are encoding the "HAT" as 0xhm. where h == hat ID and m == mask - * MAX 4 hats supported - */ -#define k_nMaxHatEntries 0x3f + 1 - -/* our in memory mapping db between joystick objects and controller mappings */ -struct _SDL_ControllerMapping -{ - SDL_JoystickGUID guid; - const char *name; - - /* mapping of axis/button id to controller version */ - int axes[SDL_CONTROLLER_AXIS_MAX]; - int buttonasaxis[SDL_CONTROLLER_AXIS_MAX]; - - int buttons[SDL_CONTROLLER_BUTTON_MAX]; - int axesasbutton[SDL_CONTROLLER_BUTTON_MAX]; - struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX]; - - /* reverse mapping, joystick indices to buttons */ - SDL_GameControllerAxis raxes[k_nMaxReverseEntries]; - SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries]; - - SDL_GameControllerButton rbuttons[k_nMaxReverseEntries]; - SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries]; - SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries]; - -}; - - -/* our hard coded list of mapping support */ -typedef struct _ControllerMapping_t -{ - SDL_JoystickGUID guid; - char *name; - char *mapping; - struct _ControllerMapping_t *next; -} ControllerMapping_t; - -static ControllerMapping_t *s_pSupportedControllers = NULL; -static ControllerMapping_t *s_pXInputMapping = NULL; -static ControllerMapping_t *s_pEmscriptenMapping = NULL; - -/* The SDL game controller structure */ -struct _SDL_GameController -{ - SDL_Joystick *joystick; /* underlying joystick device */ - int ref_count; - Uint8 hatState[4]; /* the current hat state for this controller */ - struct _SDL_ControllerMapping mapping; /* the mapping object for this controller */ - struct _SDL_GameController *next; /* pointer to next game controller we have allocated */ -}; - - -int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); -int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); - -/* - * Event filter to fire controller events from joystick ones - */ -int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) -{ - switch(event->type) { - case SDL_JOYAXISMOTION: - { - SDL_GameController *controllerlist; - - if (event->jaxis.axis >= k_nMaxReverseEntries) break; - - controllerlist = SDL_gamecontrollers; - while (controllerlist) { - if (controllerlist->joystick->instance_id == event->jaxis.which) { - if (controllerlist->mapping.raxes[event->jaxis.axis] >= 0) /* simple axis to axis, send it through */ { - SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis]; - Sint16 value = event->jaxis.value; - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - /* Shift it to be 0 - 32767. */ - value = value / 2 + 16384; - default: - break; - } - SDL_PrivateGameControllerAxis(controllerlist, axis, value); - } else if (controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0) { /* simulate an axis as a button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? SDL_PRESSED : SDL_RELEASED); - } - break; - } - controllerlist = controllerlist->next; - } - } - break; - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - { - SDL_GameController *controllerlist; - - if (event->jbutton.button >= k_nMaxReverseEntries) break; - - controllerlist = SDL_gamecontrollers; - while (controllerlist) { - if (controllerlist->joystick->instance_id == event->jbutton.which) { - if (controllerlist->mapping.rbuttons[event->jbutton.button] >= 0) { /* simple button as button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rbuttons[event->jbutton.button], event->jbutton.state); - } else if (controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0) { /* an button pretending to be an axis */ - SDL_PrivateGameControllerAxis(controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0); - } - break; - } - controllerlist = controllerlist->next; - } - } - break; - case SDL_JOYHATMOTION: - { - SDL_GameController *controllerlist; - - if (event->jhat.hat >= 4) break; - - controllerlist = SDL_gamecontrollers; - while (controllerlist) { - if (controllerlist->joystick->instance_id == event->jhat.which) { - Uint8 bSame = controllerlist->hatState[event->jhat.hat] & event->jhat.value; - /* Get list of removed bits (button release) */ - Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame; - /* the hat idx in the high nibble */ - int bHighHat = event->jhat.hat << 4; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_RELEASED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_RELEASED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_RELEASED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED); - - /* Get list of added bits (button press) */ - bChanged = event->jhat.value ^ bSame; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_PRESSED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_PRESSED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_PRESSED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED); - - /* update our state cache */ - controllerlist->hatState[event->jhat.hat] = event->jhat.value; - - break; - } - controllerlist = controllerlist->next; - } - } - break; - case SDL_JOYDEVICEADDED: - { - if (SDL_IsGameController(event->jdevice.which)) { - SDL_Event deviceevent; - deviceevent.type = SDL_CONTROLLERDEVICEADDED; - deviceevent.cdevice.which = event->jdevice.which; - SDL_PushEvent(&deviceevent); - } - } - break; - case SDL_JOYDEVICEREMOVED: - { - SDL_GameController *controllerlist = SDL_gamecontrollers; - while (controllerlist) { - if (controllerlist->joystick->instance_id == event->jdevice.which) { - SDL_Event deviceevent; - deviceevent.type = SDL_CONTROLLERDEVICEREMOVED; - deviceevent.cdevice.which = event->jdevice.which; - SDL_PushEvent(&deviceevent); - break; - } - controllerlist = controllerlist->next; - } - } - break; - default: - break; - } - - return 1; -} - -/* - * Helper function to scan the mappings database for a controller with the specified GUID - */ -ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) -{ - ControllerMapping_t *pSupportedController = s_pSupportedControllers; - while (pSupportedController) { - if (SDL_memcmp(guid, &pSupportedController->guid, sizeof(*guid)) == 0) { - return pSupportedController; - } - pSupportedController = pSupportedController->next; - } - return NULL; -} - -static const char* map_StringForControllerAxis[] = { - "leftx", - "lefty", - "rightx", - "righty", - "lefttrigger", - "righttrigger", - NULL -}; - -/* - * convert a string to its enum equivalent - */ -SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString) -{ - int entry; - if (!pchString || !pchString[0]) - return SDL_CONTROLLER_AXIS_INVALID; - - for (entry = 0; map_StringForControllerAxis[entry]; ++entry) { - if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry])) - return entry; - } - return SDL_CONTROLLER_AXIS_INVALID; -} - -/* - * convert an enum to its string equivalent - */ -const char* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis) -{ - if (axis > SDL_CONTROLLER_AXIS_INVALID && axis < SDL_CONTROLLER_AXIS_MAX) { - return map_StringForControllerAxis[axis]; - } - return NULL; -} - -static const char* map_StringForControllerButton[] = { - "a", - "b", - "x", - "y", - "back", - "guide", - "start", - "leftstick", - "rightstick", - "leftshoulder", - "rightshoulder", - "dpup", - "dpdown", - "dpleft", - "dpright", - NULL -}; - -/* - * convert a string to its enum equivalent - */ -SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString) -{ - int entry; - if (!pchString || !pchString[0]) - return SDL_CONTROLLER_BUTTON_INVALID; - - for (entry = 0; map_StringForControllerButton[entry]; ++entry) { - if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0) - return entry; - } - return SDL_CONTROLLER_BUTTON_INVALID; -} - -/* - * convert an enum to its string equivalent - */ -const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis) -{ - if (axis > SDL_CONTROLLER_BUTTON_INVALID && axis < SDL_CONTROLLER_BUTTON_MAX) { - return map_StringForControllerButton[axis]; - } - return NULL; -} - -/* - * given a controller button name and a joystick name update our mapping structure with it - */ -void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping) -{ - int iSDLButton = 0; - SDL_GameControllerButton button; - SDL_GameControllerAxis axis; - button = SDL_GameControllerGetButtonFromString(szGameButton); - axis = SDL_GameControllerGetAxisFromString(szGameButton); - iSDLButton = SDL_atoi(&szJoystickButton[1]); - - if (szJoystickButton[0] == 'a') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Axis index too large: %d", iSDLButton); - return; - } - if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->axes[ axis ] = iSDLButton; - pMapping->raxes[ iSDLButton ] = axis; - } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->axesasbutton[ button ] = iSDLButton; - pMapping->raxesasbutton[ iSDLButton ] = button; - } else { - SDL_assert(!"How did we get here?"); - } - - } else if (szJoystickButton[0] == 'b') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Button index too large: %d", iSDLButton); - return; - } - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->buttons[ button ] = iSDLButton; - pMapping->rbuttons[ iSDLButton ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->buttonasaxis[ axis ] = iSDLButton; - pMapping->rbuttonasaxis[ iSDLButton ] = axis; - } else { - SDL_assert(!"How did we get here?"); - } - } else if (szJoystickButton[0] == 'h') { - int hat = SDL_atoi(&szJoystickButton[1]); - int mask = SDL_atoi(&szJoystickButton[3]); - if (hat >= 4) { - SDL_SetError("Hat index too large: %d", iSDLButton); - } - - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - int ridx; - pMapping->hatasbutton[ button ].hat = hat; - pMapping->hatasbutton[ button ].mask = mask; - ridx = (hat << 4) | mask; - pMapping->rhatasbutton[ ridx ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - SDL_assert(!"Support hat as axis"); - } else { - SDL_assert(!"How did we get here?"); - } - } -} - - -/* - * given a controller mapping string update our mapping object - */ -static void -SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMapping *pMapping, const char *pchString) -{ - char szGameButton[20]; - char szJoystickButton[20]; - SDL_bool bGameButton = SDL_TRUE; - int i = 0; - const char *pchPos = pchString; - - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); - - while (pchPos && *pchPos) { - if (*pchPos == ':') { - i = 0; - bGameButton = SDL_FALSE; - } else if (*pchPos == ' ') { - - } else if (*pchPos == ',') { - i = 0; - bGameButton = SDL_TRUE; - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); - - } else if (bGameButton) { - if (i >= sizeof(szGameButton)) { - SDL_SetError("Button name too large: %s", szGameButton); - return; - } - szGameButton[i] = *pchPos; - i++; - } else { - if (i >= sizeof(szJoystickButton)) { - SDL_SetError("Joystick button name too large: %s", szJoystickButton); - return; - } - szJoystickButton[i] = *pchPos; - i++; - } - pchPos++; - } - - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); - -} - -/* - * Make a new button mapping struct - */ -void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) -{ - int j; - - pMapping->guid = guid; - pMapping->name = pchName; - - /* set all the button mappings to non defaults */ - for (j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++) { - pMapping->axes[j] = -1; - pMapping->buttonasaxis[j] = -1; - } - for (j = 0; j < SDL_CONTROLLER_BUTTON_MAX; j++) { - pMapping->buttons[j] = -1; - pMapping->axesasbutton[j] = -1; - pMapping->hatasbutton[j].hat = -1; - } - - for (j = 0; j < k_nMaxReverseEntries; j++) { - pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID; - pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - for (j = 0; j < k_nMaxHatEntries; j++) { - pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - SDL_PrivateGameControllerParseControllerConfigString(pMapping, pchMapping); -} - - -/* - * grab the guid string from a mapping string - */ -char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) -{ - const char *pFirstComma = SDL_strchr(pMapping, ','); - if (pFirstComma) { - char *pchGUID = SDL_malloc(pFirstComma - pMapping + 1); - if (!pchGUID) { - SDL_OutOfMemory(); - return NULL; - } - SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping); - pchGUID[ pFirstComma - pMapping ] = 0; - return pchGUID; - } - return NULL; -} - - -/* - * grab the name string from a mapping string - */ -char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) -{ - const char *pFirstComma, *pSecondComma; - char *pchName; - - pFirstComma = SDL_strchr(pMapping, ','); - if (!pFirstComma) - return NULL; - - pSecondComma = SDL_strchr(pFirstComma + 1, ','); - if (!pSecondComma) - return NULL; - - pchName = SDL_malloc(pSecondComma - pFirstComma); - if (!pchName) { - SDL_OutOfMemory(); - return NULL; - } - SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma); - pchName[ pSecondComma - pFirstComma - 1 ] = 0; - return pchName; -} - - -/* - * grab the button mapping string from a mapping string - */ -char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) -{ - const char *pFirstComma, *pSecondComma; - - pFirstComma = SDL_strchr(pMapping, ','); - if (!pFirstComma) - return NULL; - - pSecondComma = SDL_strchr(pFirstComma + 1, ','); - if (!pSecondComma) - return NULL; - - return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */ -} - -/* - * Helper function to refresh a mapping - */ -void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) -{ - SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; - while (gamecontrollerlist) { - if (!SDL_memcmp(&gamecontrollerlist->mapping.guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { - SDL_Event event; - event.type = SDL_CONTROLLERDEVICEREMAPPED; - event.cdevice.which = gamecontrollerlist->joystick->instance_id; - SDL_PushEvent(&event); - - /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ - SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); - } - - gamecontrollerlist = gamecontrollerlist->next; - } -} - -/* - * Helper function to add a mapping for a guid - */ -static ControllerMapping_t * -SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing) -{ - char *pchName; - char *pchMapping; - ControllerMapping_t *pControllerMapping; - - pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString); - if (!pchName) { - SDL_SetError("Couldn't parse name from %s", mappingString); - return NULL; - } - - pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString); - if (!pchMapping) { - SDL_free(pchName); - SDL_SetError("Couldn't parse %s", mappingString); - return NULL; - } - - pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); - if (pControllerMapping) { - /* Update existing mapping */ - SDL_free(pControllerMapping->name); - pControllerMapping->name = pchName; - SDL_free(pControllerMapping->mapping); - pControllerMapping->mapping = pchMapping; - /* refresh open controllers */ - SDL_PrivateGameControllerRefreshMapping(pControllerMapping); - *existing = SDL_TRUE; - } else { - pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); - if (!pControllerMapping) { - SDL_free(pchName); - SDL_free(pchMapping); - SDL_OutOfMemory(); - return NULL; - } - pControllerMapping->guid = jGUID; - pControllerMapping->name = pchName; - pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; - *existing = SDL_FALSE; - } - return pControllerMapping; -} - -/* - * Helper function to determine pre-calculated offset to certain joystick mappings - */ -ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) -{ - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); - ControllerMapping_t *mapping; - - mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); -#if SDL_JOYSTICK_XINPUT - if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) { - mapping = s_pXInputMapping; - } -#endif -#if defined(SDL_JOYSTICK_EMSCRIPTEN) - if (!mapping && s_pEmscriptenMapping) { - mapping = s_pEmscriptenMapping; - } -#endif -#ifdef __LINUX__ - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { - /* The Linux driver xpad.c maps the wireless dpad to buttons */ - SDL_bool existing; - mapping = SDL_PrivateAddMappingForGUID(jGUID, -"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - &existing); - } - } - } -#endif /* __LINUX__ */ - - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box")) { - mapping = s_pXInputMapping; - } - } - } - return mapping; -} - -/* - * Add or update an entry into the Mappings Database - */ -int -SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw) -{ - const char *platform = SDL_GetPlatform(); - int controllers = 0; - char *buf, *line, *line_end, *tmp, *comma, line_platform[64]; - size_t db_size, platform_len; - - if (rw == NULL) { - return SDL_SetError("Invalid RWops"); - } - db_size = (size_t)SDL_RWsize(rw); - - buf = (char *)SDL_malloc(db_size + 1); - if (buf == NULL) { - if (freerw) { - SDL_RWclose(rw); - } - return SDL_SetError("Could not allocate space to read DB into memory"); - } - - if (SDL_RWread(rw, buf, db_size, 1) != 1) { - if (freerw) { - SDL_RWclose(rw); - } - SDL_free(buf); - return SDL_SetError("Could not read DB"); - } - - if (freerw) { - SDL_RWclose(rw); - } - - buf[db_size] = '\0'; - line = buf; - - while (line < buf + db_size) { - line_end = SDL_strchr(line, '\n'); - if (line_end != NULL) { - *line_end = '\0'; - } else { - line_end = buf + db_size; - } - - /* Extract and verify the platform */ - tmp = SDL_strstr(line, SDL_CONTROLLER_PLATFORM_FIELD); - if (tmp != NULL) { - tmp += SDL_strlen(SDL_CONTROLLER_PLATFORM_FIELD); - comma = SDL_strchr(tmp, ','); - if (comma != NULL) { - platform_len = comma - tmp + 1; - if (platform_len + 1 < SDL_arraysize(line_platform)) { - SDL_strlcpy(line_platform, tmp, platform_len); - if (SDL_strncasecmp(line_platform, platform, platform_len) == 0 && - SDL_GameControllerAddMapping(line) > 0) { - controllers++; - } - } - } - } - - line = line_end + 1; - } - - SDL_free(buf); - return controllers; -} - -/* - * Add or update an entry into the Mappings Database - */ -int -SDL_GameControllerAddMapping(const char *mappingString) -{ - char *pchGUID; - SDL_JoystickGUID jGUID; - SDL_bool is_xinput_mapping = SDL_FALSE; - SDL_bool is_emscripten_mapping = SDL_FALSE; - SDL_bool existing = SDL_FALSE; - ControllerMapping_t *pControllerMapping; - - if (!mappingString) { - return SDL_InvalidParamError("mappingString"); - } - - pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString); - if (!pchGUID) { - return SDL_SetError("Couldn't parse GUID from %s", mappingString); - } - if (!SDL_strcasecmp(pchGUID, "xinput")) { - is_xinput_mapping = SDL_TRUE; - } - if (!SDL_strcasecmp(pchGUID, "emscripten")) { - is_emscripten_mapping = SDL_TRUE; - } - jGUID = SDL_JoystickGetGUIDFromString(pchGUID); - SDL_free(pchGUID); - - pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing); - if (!pControllerMapping) { - return -1; - } - - if (existing) { - return 0; - } else { - if (is_xinput_mapping) { - s_pXInputMapping = pControllerMapping; - } - if (is_emscripten_mapping) { - s_pEmscriptenMapping = pControllerMapping; - } - return 1; - } -} - -/* - * Get the mapping string for this GUID - */ -char * -SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid) -{ - char *pMappingString = NULL; - ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(&guid); - if (mapping) { - char pchGUID[33]; - size_t needed; - SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID)); - /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ - needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; - pMappingString = SDL_malloc(needed); - if (!pMappingString) { - SDL_OutOfMemory(); - return NULL; - } - SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); - } - return pMappingString; -} - -/* - * Get the mapping string for this device - */ -char * -SDL_GameControllerMapping(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) { - return NULL; - } - - return SDL_GameControllerMappingForGUID(gamecontroller->mapping.guid); -} - -static void -SDL_GameControllerLoadHints() -{ - const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG); - if (hint && hint[0]) { - size_t nchHints = SDL_strlen(hint); - char *pUserMappings = SDL_malloc(nchHints + 1); - char *pTempMappings = pUserMappings; - SDL_memcpy(pUserMappings, hint, nchHints); - pUserMappings[nchHints] = '\0'; - while (pUserMappings) { - char *pchNewLine = NULL; - - pchNewLine = SDL_strchr(pUserMappings, '\n'); - if (pchNewLine) - *pchNewLine = '\0'; - - SDL_GameControllerAddMapping(pUserMappings); - - if (pchNewLine) { - pUserMappings = pchNewLine + 1; - } else { - pUserMappings = NULL; - } - } - SDL_free(pTempMappings); - } -} - -/* - * Initialize the game controller system, mostly load our DB of controller config mappings - */ -int -SDL_GameControllerInit(void) -{ - int i = 0; - const char *pMappingString = NULL; - s_pSupportedControllers = NULL; - pMappingString = s_ControllerMappings[i]; - while (pMappingString) { - SDL_GameControllerAddMapping(pMappingString); - - i++; - pMappingString = s_ControllerMappings[i]; - } - - /* load in any user supplied config */ - SDL_GameControllerLoadHints(); - - /* watch for joy events and fire controller ones if needed */ - SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL); - - /* Send added events for controllers currently attached */ - for (i = 0; i < SDL_NumJoysticks(); ++i) { - if (SDL_IsGameController(i)) { - SDL_Event deviceevent; - deviceevent.type = SDL_CONTROLLERDEVICEADDED; - deviceevent.cdevice.which = i; - SDL_PushEvent(&deviceevent); - } - } - - return (0); -} - - -/* - * Get the implementation dependent name of a controller - */ -const char * -SDL_GameControllerNameForIndex(int device_index) -{ - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if (pSupportedController) { - return pSupportedController->name; - } - return NULL; -} - - -/* - * Return 1 if the joystick at this device index is a supported controller - */ -SDL_bool -SDL_IsGameController(int device_index) -{ - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if (pSupportedController) { - return SDL_TRUE; - } - - return SDL_FALSE; -} - -/* - * Open a controller for use - the index passed as an argument refers to - * the N'th controller on the system. This index is the value which will - * identify this controller in future controller events. - * - * This function returns a controller identifier, or NULL if an error occurred. - */ -SDL_GameController * -SDL_GameControllerOpen(int device_index) -{ - SDL_GameController *gamecontroller; - SDL_GameController *gamecontrollerlist; - ControllerMapping_t *pSupportedController = NULL; - - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { - SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); - return (NULL); - } - - gamecontrollerlist = SDL_gamecontrollers; - /* If the controller is already open, return it */ - while (gamecontrollerlist) { - if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id) { - gamecontroller = gamecontrollerlist; - ++gamecontroller->ref_count; - return (gamecontroller); - } - gamecontrollerlist = gamecontrollerlist->next; - } - - /* Find a controller mapping */ - pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if (!pSupportedController) { - SDL_SetError("Couldn't find mapping for device (%d)", device_index); - return (NULL); - } - - /* Create and initialize the joystick */ - gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller)); - if (gamecontroller == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - SDL_memset(gamecontroller, 0, (sizeof *gamecontroller)); - gamecontroller->joystick = SDL_JoystickOpen(device_index); - if (!gamecontroller->joystick) { - SDL_free(gamecontroller); - return NULL; - } - - SDL_PrivateLoadButtonMapping(&gamecontroller->mapping, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping); - - /* Add joystick to list */ - ++gamecontroller->ref_count; - /* Link the joystick in the list */ - gamecontroller->next = SDL_gamecontrollers; - SDL_gamecontrollers = gamecontroller; - - SDL_SYS_JoystickUpdate(gamecontroller->joystick); - - return (gamecontroller); -} - -/* - * Manually pump for controller updates. - */ -void -SDL_GameControllerUpdate(void) -{ - /* Just for API completeness; the joystick API does all the work. */ - SDL_JoystickUpdate(); -} - - -/* - * Get the current state of an axis control on a controller - */ -Sint16 -SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) -{ - if (!gamecontroller) - return 0; - - if (gamecontroller->mapping.axes[axis] >= 0) { - Sint16 value = (SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axes[axis])); - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - /* Shift it to be 0 - 32767. */ - value = value / 2 + 16384; - default: - break; - } - return value; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - Uint8 value; - value = SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttonasaxis[axis]); - if (value > 0) - return 32767; - return 0; - } - return 0; -} - - -/* - * Get the current state of a button on a controller - */ -Uint8 -SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) -{ - if (!gamecontroller) - return 0; - - if (gamecontroller->mapping.buttons[button] >= 0) { - return (SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttons[button])); - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - Sint16 value; - value = SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axesasbutton[button]); - if (ABS(value) > 32768/2) - return 1; - return 0; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - Uint8 value; - value = SDL_JoystickGetHat(gamecontroller->joystick, gamecontroller->mapping.hatasbutton[button].hat); - - if (value & gamecontroller->mapping.hatasbutton[button].mask) - return 1; - return 0; - } - - return 0; -} - -/* - * Return if the joystick in question is currently attached to the system, - * \return 0 if not plugged in, 1 if still present. - */ -SDL_bool -SDL_GameControllerGetAttached(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) - return SDL_FALSE; - - return SDL_JoystickGetAttached(gamecontroller->joystick); -} - - -const char * -SDL_GameControllerName(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) - return NULL; - - return (gamecontroller->mapping.name); -} - - -/* - * Get the joystick for this controller - */ -SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) - return NULL; - - return gamecontroller->joystick; -} - - -/* - * Find the SDL_GameController that owns this instance id - */ -SDL_GameController * -SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) -{ - SDL_GameController *gamecontroller = SDL_gamecontrollers; - while (gamecontroller) { - if (gamecontroller->joystick->instance_id == joyid) { - return gamecontroller; - } - gamecontroller = gamecontroller->next; - } - - return NULL; -} - - -/** - * Get the SDL joystick layer binding for this controller axis mapping - */ -SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) -{ - SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); - - if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID) - return bind; - - if (gamecontroller->mapping.axes[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.button = gamecontroller->mapping.axes[axis]; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttonasaxis[axis]; - } - - return bind; -} - - -/** - * Get the SDL joystick layer binding for this controller button mapping - */ -SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) -{ - SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); - - if (!gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID) - return bind; - - if (gamecontroller->mapping.buttons[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttons[button]; - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.axis = gamecontroller->mapping.axesasbutton[button]; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT; - bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; - bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; - } - - return bind; -} - - -void -SDL_GameControllerClose(SDL_GameController * gamecontroller) -{ - SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev; - - if (!gamecontroller) - return; - - /* First decrement ref count */ - if (--gamecontroller->ref_count > 0) { - return; - } - - SDL_JoystickClose(gamecontroller->joystick); - - gamecontrollerlist = SDL_gamecontrollers; - gamecontrollerlistprev = NULL; - while (gamecontrollerlist) { - if (gamecontroller == gamecontrollerlist) { - if (gamecontrollerlistprev) { - /* unlink this entry */ - gamecontrollerlistprev->next = gamecontrollerlist->next; - } else { - SDL_gamecontrollers = gamecontroller->next; - } - - break; - } - gamecontrollerlistprev = gamecontrollerlist; - gamecontrollerlist = gamecontrollerlist->next; - } - - SDL_free(gamecontroller); -} - - -/* - * Quit the controller subsystem - */ -void -SDL_GameControllerQuit(void) -{ - ControllerMapping_t *pControllerMap; - while (SDL_gamecontrollers) { - SDL_gamecontrollers->ref_count = 1; - SDL_GameControllerClose(SDL_gamecontrollers); - } - - while (s_pSupportedControllers) { - pControllerMap = s_pSupportedControllers; - s_pSupportedControllers = s_pSupportedControllers->next; - SDL_free(pControllerMap->name); - SDL_free(pControllerMap->mapping); - SDL_free(pControllerMap); - } - - SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); - -} - -/* - * Event filter to transform joystick events into appropriate game controller ones - */ -int -SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value) -{ - int posted; - - /* translate the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_CONTROLLERAXISMOTION; - event.caxis.which = gamecontroller->joystick->instance_id; - event.caxis.axis = axis; - event.caxis.value = value; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - - -/* - * Event filter to transform joystick events into appropriate game controller ones - */ -int -SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state) -{ - int posted; -#if !SDL_EVENTS_DISABLED - SDL_Event event; - - if (button == SDL_CONTROLLER_BUTTON_INVALID) - return (0); - - switch (state) { - case SDL_PRESSED: - event.type = SDL_CONTROLLERBUTTONDOWN; - break; - case SDL_RELEASED: - event.type = SDL_CONTROLLERBUTTONUP; - break; - default: - /* Invalid state -- bail */ - return (0); - } -#endif /* !SDL_EVENTS_DISABLED */ - - /* translate the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.cbutton.which = gamecontroller->joystick->instance_id; - event.cbutton.button = button; - event.cbutton.state = state; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - -/* - * Turn off controller events - */ -int -SDL_GameControllerEventState(int state) -{ -#if SDL_EVENTS_DISABLED - return SDL_IGNORE; -#else - const Uint32 event_list[] = { - SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, - SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, - }; - unsigned int i; - - switch (state) { - case SDL_QUERY: - state = SDL_IGNORE; - for (i = 0; i < SDL_arraysize(event_list); ++i) { - state = SDL_EventState(event_list[i], SDL_QUERY); - if (state == SDL_ENABLE) { - break; - } - } - break; - default: - for (i = 0; i < SDL_arraysize(event_list); ++i) { - SDL_EventState(event_list[i], state); - } - break; - } - return (state); -#endif /* SDL_EVENTS_DISABLED */ -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontrollerdb.h b/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontrollerdb.h deleted file mode 100644 index 211d00d01e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontrollerdb.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - - -/* Default mappings we support - - The easiest way to generate a new mapping is to start Steam in Big Picture - mode, configure your joystick and then look in config/config.vdf in your - Steam installation directory for the "SDL_GamepadBind" entry. - - Alternatively, you can use the app located in test/controllermap - */ -static const char *s_ControllerMappings [] = -{ -#if SDL_JOYSTICK_XINPUT - "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", -#endif -#if SDL_JOYSTICK_DINPUT - "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", - "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", - "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", - "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", - "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", -#endif -#if defined(__MACOSX__) - "830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", - "6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ - "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", -#endif -#if defined(__LINUX__) - "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", - "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", - "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", - "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", - "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", - "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", - "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000005e040000d102000001010000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", -#endif -#if defined(__ANDROID__) - "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", -#endif -#if defined(SDL_JOYSTICK_MFI) - "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", - "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,", -#endif -#if defined(SDL_JOYSTICK_EMSCRIPTEN) - "emscripten,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", -#endif - NULL -}; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick.c b/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick.c deleted file mode 100644 index dc910a82b1..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick.c +++ /dev/null @@ -1,863 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* This is the joystick API for Simple DirectMedia Layer */ - -#include "SDL.h" -#include "SDL_events.h" -#include "SDL_sysjoystick.h" -#include "SDL_assert.h" -#include "SDL_hints.h" - -#if !SDL_EVENTS_DISABLED -#include "../events/SDL_events_c.h" -#endif - -static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE; -static SDL_Joystick *SDL_joysticks = NULL; -static SDL_Joystick *SDL_updating_joystick = NULL; - -static void -SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - if (hint && *hint == '1') { - SDL_joystick_allows_background_events = SDL_TRUE; - } else { - SDL_joystick_allows_background_events = SDL_FALSE; - } -} - -int -SDL_JoystickInit(void) -{ - int status; - - /* See if we should allow joystick events while in the background */ - SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, - SDL_JoystickAllowBackgroundEventsChanged, NULL); - -#if !SDL_EVENTS_DISABLED - if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { - return -1; - } -#endif /* !SDL_EVENTS_DISABLED */ - - status = SDL_SYS_JoystickInit(); - if (status >= 0) { - status = 0; - } - return (status); -} - -/* - * Count the number of joysticks attached to the system - */ -int -SDL_NumJoysticks(void) -{ - return SDL_SYS_NumJoysticks(); -} - -/* - * Get the implementation dependent name of a joystick - */ -const char * -SDL_JoystickNameForIndex(int device_index) -{ - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { - SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); - return (NULL); - } - return (SDL_SYS_JoystickNameForDeviceIndex(device_index)); -} - -/* - * Open a joystick for use - the index passed as an argument refers to - * the N'th joystick on the system. This index is the value which will - * identify this joystick in future joystick events. - * - * This function returns a joystick identifier, or NULL if an error occurred. - */ -SDL_Joystick * -SDL_JoystickOpen(int device_index) -{ - SDL_Joystick *joystick; - SDL_Joystick *joysticklist; - const char *joystickname = NULL; - - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { - SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); - return (NULL); - } - - joysticklist = SDL_joysticks; - /* If the joystick is already open, return it - * it is important that we have a single joystick * for each instance id - */ - while (joysticklist) { - if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == joysticklist->instance_id) { - joystick = joysticklist; - ++joystick->ref_count; - return (joystick); - } - joysticklist = joysticklist->next; - } - - /* Create and initialize the joystick */ - joystick = (SDL_Joystick *) SDL_malloc((sizeof *joystick)); - if (joystick == NULL) { - SDL_OutOfMemory(); - return NULL; - } - - SDL_memset(joystick, 0, (sizeof *joystick)); - if (SDL_SYS_JoystickOpen(joystick, device_index) < 0) { - SDL_free(joystick); - return NULL; - } - - joystickname = SDL_SYS_JoystickNameForDeviceIndex(device_index); - if (joystickname) - joystick->name = SDL_strdup(joystickname); - else - joystick->name = NULL; - - if (joystick->naxes > 0) { - joystick->axes = (Sint16 *) SDL_malloc - (joystick->naxes * sizeof(Sint16)); - } - if (joystick->nhats > 0) { - joystick->hats = (Uint8 *) SDL_malloc - (joystick->nhats * sizeof(Uint8)); - } - if (joystick->nballs > 0) { - joystick->balls = (struct balldelta *) SDL_malloc - (joystick->nballs * sizeof(*joystick->balls)); - } - if (joystick->nbuttons > 0) { - joystick->buttons = (Uint8 *) SDL_malloc - (joystick->nbuttons * sizeof(Uint8)); - } - if (((joystick->naxes > 0) && !joystick->axes) - || ((joystick->nhats > 0) && !joystick->hats) - || ((joystick->nballs > 0) && !joystick->balls) - || ((joystick->nbuttons > 0) && !joystick->buttons)) { - SDL_OutOfMemory(); - SDL_JoystickClose(joystick); - return NULL; - } - if (joystick->axes) { - SDL_memset(joystick->axes, 0, joystick->naxes * sizeof(Sint16)); - } - if (joystick->hats) { - SDL_memset(joystick->hats, 0, joystick->nhats * sizeof(Uint8)); - } - if (joystick->balls) { - SDL_memset(joystick->balls, 0, - joystick->nballs * sizeof(*joystick->balls)); - } - if (joystick->buttons) { - SDL_memset(joystick->buttons, 0, joystick->nbuttons * sizeof(Uint8)); - } - joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; - - /* Add joystick to list */ - ++joystick->ref_count; - /* Link the joystick in the list */ - joystick->next = SDL_joysticks; - SDL_joysticks = joystick; - - SDL_SYS_JoystickUpdate(joystick); - - return (joystick); -} - - -/* - * Checks to make sure the joystick is valid. - */ -int -SDL_PrivateJoystickValid(SDL_Joystick * joystick) -{ - int valid; - - if (joystick == NULL) { - SDL_SetError("Joystick hasn't been opened yet"); - valid = 0; - } else { - valid = 1; - } - - return valid; -} - -/* - * Get the number of multi-dimensional axis controls on a joystick - */ -int -SDL_JoystickNumAxes(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - return (joystick->naxes); -} - -/* - * Get the number of hats on a joystick - */ -int -SDL_JoystickNumHats(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - return (joystick->nhats); -} - -/* - * Get the number of trackballs on a joystick - */ -int -SDL_JoystickNumBalls(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - return (joystick->nballs); -} - -/* - * Get the number of buttons on a joystick - */ -int -SDL_JoystickNumButtons(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - return (joystick->nbuttons); -} - -/* - * Get the current state of an axis control on a joystick - */ -Sint16 -SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) -{ - Sint16 state; - - if (!SDL_PrivateJoystickValid(joystick)) { - return (0); - } - if (axis < joystick->naxes) { - state = joystick->axes[axis]; - } else { - SDL_SetError("Joystick only has %d axes", joystick->naxes); - state = 0; - } - return (state); -} - -/* - * Get the current state of a hat on a joystick - */ -Uint8 -SDL_JoystickGetHat(SDL_Joystick * joystick, int hat) -{ - Uint8 state; - - if (!SDL_PrivateJoystickValid(joystick)) { - return (0); - } - if (hat < joystick->nhats) { - state = joystick->hats[hat]; - } else { - SDL_SetError("Joystick only has %d hats", joystick->nhats); - state = 0; - } - return (state); -} - -/* - * Get the ball axis change since the last poll - */ -int -SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy) -{ - int retval; - - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - - retval = 0; - if (ball < joystick->nballs) { - if (dx) { - *dx = joystick->balls[ball].dx; - } - if (dy) { - *dy = joystick->balls[ball].dy; - } - joystick->balls[ball].dx = 0; - joystick->balls[ball].dy = 0; - } else { - return SDL_SetError("Joystick only has %d balls", joystick->nballs); - } - return (retval); -} - -/* - * Get the current state of a button on a joystick - */ -Uint8 -SDL_JoystickGetButton(SDL_Joystick * joystick, int button) -{ - Uint8 state; - - if (!SDL_PrivateJoystickValid(joystick)) { - return (0); - } - if (button < joystick->nbuttons) { - state = joystick->buttons[button]; - } else { - SDL_SetError("Joystick only has %d buttons", joystick->nbuttons); - state = 0; - } - return (state); -} - -/* - * Return if the joystick in question is currently attached to the system, - * \return SDL_FALSE if not plugged in, SDL_TRUE if still present. - */ -SDL_bool -SDL_JoystickGetAttached(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return SDL_FALSE; - } - - return SDL_SYS_JoystickAttached(joystick); -} - -/* - * Get the instance id for this opened joystick - */ -SDL_JoystickID -SDL_JoystickInstanceID(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (-1); - } - - return (joystick->instance_id); -} - -/* - * Find the SDL_Joystick that owns this instance id - */ -SDL_Joystick * -SDL_JoystickFromInstanceID(SDL_JoystickID joyid) -{ - SDL_Joystick *joystick = SDL_joysticks; - while (joystick) { - if (joystick->instance_id == joyid) { - return joystick; - } - joystick = joystick->next; - } - - return NULL; -} - -/* - * Get the friendly name of this joystick - */ -const char * -SDL_JoystickName(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (NULL); - } - - return (joystick->name); -} - -/* - * Close a joystick previously opened with SDL_JoystickOpen() - */ -void -SDL_JoystickClose(SDL_Joystick * joystick) -{ - SDL_Joystick *joysticklist; - SDL_Joystick *joysticklistprev; - - if (!joystick) { - return; - } - - /* First decrement ref count */ - if (--joystick->ref_count > 0) { - return; - } - - if (joystick == SDL_updating_joystick) { - return; - } - - SDL_SYS_JoystickClose(joystick); - joystick->hwdata = NULL; - - joysticklist = SDL_joysticks; - joysticklistprev = NULL; - while (joysticklist) { - if (joystick == joysticklist) { - if (joysticklistprev) { - /* unlink this entry */ - joysticklistprev->next = joysticklist->next; - } else { - SDL_joysticks = joystick->next; - } - break; - } - joysticklistprev = joysticklist; - joysticklist = joysticklist->next; - } - - SDL_free(joystick->name); - - /* Free the data associated with this joystick */ - SDL_free(joystick->axes); - SDL_free(joystick->hats); - SDL_free(joystick->balls); - SDL_free(joystick->buttons); - SDL_free(joystick); -} - -void -SDL_JoystickQuit(void) -{ - /* Make sure we're not getting called in the middle of updating joysticks */ - SDL_assert(!SDL_updating_joystick); - - /* Stop the event polling */ - while (SDL_joysticks) { - SDL_joysticks->ref_count = 1; - SDL_JoystickClose(SDL_joysticks); - } - - /* Quit the joystick setup */ - SDL_SYS_JoystickQuit(); - -#if !SDL_EVENTS_DISABLED - SDL_QuitSubSystem(SDL_INIT_EVENTS); -#endif -} - - -static SDL_bool -SDL_PrivateJoystickShouldIgnoreEvent() -{ - if (SDL_joystick_allows_background_events) { - return SDL_FALSE; - } - - if (SDL_WasInit(SDL_INIT_VIDEO)) { - if (SDL_GetKeyboardFocus() == NULL) { - /* Video is initialized and we don't have focus, ignore the event. */ - return SDL_TRUE; - } else { - return SDL_FALSE; - } - } - - /* Video subsystem wasn't initialized, always allow the event */ - return SDL_FALSE; -} - -/* These are global for SDL_sysjoystick.c and SDL_events.c */ - -int -SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) -{ - int posted; - - /* Make sure we're not getting garbage or duplicate events */ - if (axis >= joystick->naxes) { - return 0; - } - if (value == joystick->axes[axis]) { - return 0; - } - - /* We ignore events if we don't have keyboard focus, except for centering - * events. - */ - if (SDL_PrivateJoystickShouldIgnoreEvent()) { - if ((value > 0 && value >= joystick->axes[axis]) || - (value < 0 && value <= joystick->axes[axis])) { - return 0; - } - } - - /* Update internal joystick state */ - joystick->axes[axis] = value; - - /* Post the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_JOYAXISMOTION; - event.jaxis.which = joystick->instance_id; - event.jaxis.axis = axis; - event.jaxis.value = value; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - -int -SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value) -{ - int posted; - - /* Make sure we're not getting garbage or duplicate events */ - if (hat >= joystick->nhats) { - return 0; - } - if (value == joystick->hats[hat]) { - return 0; - } - - /* We ignore events if we don't have keyboard focus, except for centering - * events. - */ - if (SDL_PrivateJoystickShouldIgnoreEvent()) { - if (value != SDL_HAT_CENTERED) { - return 0; - } - } - - /* Update internal joystick state */ - joystick->hats[hat] = value; - - /* Post the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { - SDL_Event event; - event.jhat.type = SDL_JOYHATMOTION; - event.jhat.which = joystick->instance_id; - event.jhat.hat = hat; - event.jhat.value = value; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - -int -SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball, - Sint16 xrel, Sint16 yrel) -{ - int posted; - - /* Make sure we're not getting garbage events */ - if (ball >= joystick->nballs) { - return 0; - } - - /* We ignore events if we don't have keyboard focus. */ - if (SDL_PrivateJoystickShouldIgnoreEvent()) { - return 0; - } - - /* Update internal mouse state */ - joystick->balls[ball].dx += xrel; - joystick->balls[ball].dy += yrel; - - /* Post the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { - SDL_Event event; - event.jball.type = SDL_JOYBALLMOTION; - event.jball.which = joystick->instance_id; - event.jball.ball = ball; - event.jball.xrel = xrel; - event.jball.yrel = yrel; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - -int -SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state) -{ - int posted; -#if !SDL_EVENTS_DISABLED - SDL_Event event; - - switch (state) { - case SDL_PRESSED: - event.type = SDL_JOYBUTTONDOWN; - break; - case SDL_RELEASED: - event.type = SDL_JOYBUTTONUP; - break; - default: - /* Invalid state -- bail */ - return (0); - } -#endif /* !SDL_EVENTS_DISABLED */ - - /* Make sure we're not getting garbage or duplicate events */ - if (button >= joystick->nbuttons) { - return 0; - } - if (state == joystick->buttons[button]) { - return 0; - } - - /* We ignore events if we don't have keyboard focus, except for button - * release. */ - if (SDL_PrivateJoystickShouldIgnoreEvent()) { - if (state == SDL_PRESSED) { - return 0; - } - } - - /* Update internal joystick state */ - joystick->buttons[button] = state; - - /* Post the event, if desired */ - posted = 0; -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jbutton.which = joystick->instance_id; - event.jbutton.button = button; - event.jbutton.state = state; - posted = SDL_PushEvent(&event) == 1; - } -#endif /* !SDL_EVENTS_DISABLED */ - return (posted); -} - -void -SDL_JoystickUpdate(void) -{ - SDL_Joystick *joystick; - - joystick = SDL_joysticks; - while (joystick) { - SDL_Joystick *joysticknext; - /* save off the next pointer, the Update call may cause a joystick removed event - * and cause our joystick pointer to be freed - */ - joysticknext = joystick->next; - - SDL_updating_joystick = joystick; - - SDL_SYS_JoystickUpdate(joystick); - - if (joystick->force_recentering) { - int i; - - /* Tell the app that everything is centered/unpressed... */ - for (i = 0; i < joystick->naxes; i++) { - SDL_PrivateJoystickAxis(joystick, i, 0); - } - - for (i = 0; i < joystick->nbuttons; i++) { - SDL_PrivateJoystickButton(joystick, i, 0); - } - - for (i = 0; i < joystick->nhats; i++) { - SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED); - } - - joystick->force_recentering = SDL_FALSE; - } - - SDL_updating_joystick = NULL; - - /* If the joystick was closed while updating, free it here */ - if (joystick->ref_count <= 0) { - SDL_JoystickClose(joystick); - } - - joystick = joysticknext; - } - - /* this needs to happen AFTER walking the joystick list above, so that any - dangling hardware data from removed devices can be free'd - */ - SDL_SYS_JoystickDetect(); -} - -int -SDL_JoystickEventState(int state) -{ -#if SDL_EVENTS_DISABLED - return SDL_DISABLE; -#else - const Uint32 event_list[] = { - SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, - SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED - }; - unsigned int i; - - switch (state) { - case SDL_QUERY: - state = SDL_DISABLE; - for (i = 0; i < SDL_arraysize(event_list); ++i) { - state = SDL_EventState(event_list[i], SDL_QUERY); - if (state == SDL_ENABLE) { - break; - } - } - break; - default: - for (i = 0; i < SDL_arraysize(event_list); ++i) { - SDL_EventState(event_list[i], state); - } - break; - } - return (state); -#endif /* SDL_EVENTS_DISABLED */ -} - -/* return the guid for this index */ -SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) -{ - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { - SDL_JoystickGUID emptyGUID; - SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); - SDL_zero(emptyGUID); - return emptyGUID; - } - return SDL_SYS_JoystickGetDeviceGUID(device_index); -} - -/* return the guid for this opened device */ -SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - SDL_JoystickGUID emptyGUID; - SDL_zero(emptyGUID); - return emptyGUID; - } - return SDL_SYS_JoystickGetGUID(joystick); -} - -/* convert the guid to a printable string */ -void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) -{ - static const char k_rgchHexToASCII[] = "0123456789abcdef"; - int i; - - if ((pszGUID == NULL) || (cbGUID <= 0)) { - return; - } - - for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) { - /* each input byte writes 2 ascii chars, and might write a null byte. */ - /* If we don't have room for next input byte, stop */ - unsigned char c = guid.data[i]; - - *pszGUID++ = k_rgchHexToASCII[c >> 4]; - *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; - } - *pszGUID = '\0'; -} - - -/*----------------------------------------------------------------------------- - * Purpose: Returns the 4 bit nibble for a hex character - * Input : c - - * Output : unsigned char - *-----------------------------------------------------------------------------*/ -static unsigned char nibble(char c) -{ - if ((c >= '0') && (c <= '9')) { - return (unsigned char)(c - '0'); - } - - if ((c >= 'A') && (c <= 'F')) { - return (unsigned char)(c - 'A' + 0x0a); - } - - if ((c >= 'a') && (c <= 'f')) { - return (unsigned char)(c - 'a' + 0x0a); - } - - /* received an invalid character, and no real way to return an error */ - /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */ - return 0; -} - - -/* convert the string version of a joystick guid to the struct */ -SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID) -{ - SDL_JoystickGUID guid; - int maxoutputbytes= sizeof(guid); - size_t len = SDL_strlen(pchGUID); - Uint8 *p; - size_t i; - - /* Make sure it's even */ - len = (len) & ~0x1; - - SDL_memset(&guid, 0x00, sizeof(guid)); - - p = (Uint8 *)&guid; - for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) { - *p = (nibble(pchGUID[i]) << 4) | nibble(pchGUID[i+1]); - } - - return guid; -} - - -/* update the power level for this joystick */ -void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick, SDL_JoystickPowerLevel ePowerLevel) -{ - joystick->epowerlevel = ePowerLevel; -} - - -/* return its power level */ -SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return (SDL_JOYSTICK_POWER_UNKNOWN); - } - return joystick->epowerlevel; -} - - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick_c.h b/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick_c.h deleted file mode 100644 index 4a076f6d66..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick_c.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* Useful functions and variables from SDL_joystick.c */ -#include "SDL_joystick.h" - -/* Initialization and shutdown functions */ -extern int SDL_JoystickInit(void); -extern void SDL_JoystickQuit(void); - -/* Initialization and shutdown functions */ -extern int SDL_GameControllerInit(void); -extern void SDL_GameControllerQuit(void); - - -/* Internal event queueing functions */ -extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick, - Uint8 axis, Sint16 value); -extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick, - Uint8 ball, Sint16 xrel, Sint16 yrel); -extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick, - Uint8 hat, Uint8 value); -extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick, - Uint8 button, Uint8 state); -extern void SDL_PrivateJoystickBatteryLevel( SDL_Joystick * joystick, - SDL_JoystickPowerLevel ePowerLevel ); - -/* Internal sanity checking functions */ -extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick); - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/SDL_sysjoystick.h b/3rdparty/sdl2-2.0.4/src/joystick/SDL_sysjoystick.h deleted file mode 100644 index 1015840aff..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/SDL_sysjoystick.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#ifndef _SDL_sysjoystick_h -#define _SDL_sysjoystick_h - -/* This is the system specific header for the SDL joystick API */ - -#include "SDL_joystick.h" -#include "SDL_joystick_c.h" - -/* The SDL joystick structure */ -struct _SDL_Joystick -{ - SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ - char *name; /* Joystick name - system dependent */ - - int naxes; /* Number of axis controls on the joystick */ - Sint16 *axes; /* Current axis states */ - - int nhats; /* Number of hats on the joystick */ - Uint8 *hats; /* Current hat states */ - - int nballs; /* Number of trackballs on the joystick */ - struct balldelta { - int dx; - int dy; - } *balls; /* Current ball motion deltas */ - - int nbuttons; /* Number of buttons on the joystick */ - Uint8 *buttons; /* Current button states */ - - struct joystick_hwdata *hwdata; /* Driver dependent information */ - - int ref_count; /* Reference count for multiple opens */ - - SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */ - SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */ - struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ -}; - -/* Function to scan the system for joysticks. - * Joystick 0 should be the system default joystick. - * This function should return the number of available joysticks, or -1 - * on an unrecoverable fatal error. - */ -extern int SDL_SYS_JoystickInit(void); - -/* Function to return the number of joystick devices plugged in right now */ -extern int SDL_SYS_NumJoysticks(); - -/* Function to cause any queued joystick insertions to be processed */ -extern void SDL_SYS_JoystickDetect(); - -/* Function to get the device-dependent name of a joystick */ -extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index); - -/* Function to get the current instance id of the joystick located at device_index */ -extern SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index); - -/* Function to open a joystick for use. - The joystick to open is specified by the device index. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -extern int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index); - -/* Function to query if the joystick is currently attached - * It returns SDL_TRUE if attached, SDL_FALSE otherwise. - */ -extern SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick * joystick); - -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -extern void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick); - -/* Function to close a joystick after use */ -extern void SDL_SYS_JoystickClose(SDL_Joystick * joystick); - -/* Function to perform any system-specific joystick related cleanup */ -extern void SDL_SYS_JoystickQuit(void); - -/* Function to return the stable GUID for a plugged in device */ -extern SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index); - -/* Function to return the stable GUID for a opened joystick */ -extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick); - -#if SDL_JOYSTICK_XINPUT -/* Function returns SDL_TRUE if this device is an XInput gamepad */ -extern SDL_bool SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index); -#endif - -#endif /* _SDL_sysjoystick_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick_c.h deleted file mode 100644 index 49b494c547..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick_c.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ - -#include "../../SDL_internal.h" - -#ifdef SDL_JOYSTICK_ANDROID -#include "../SDL_sysjoystick.h" - -extern int Android_OnPadDown(int device_id, int keycode); -extern int Android_OnPadUp(int device_id, int keycode); -extern int Android_OnJoy(int device_id, int axisnum, float value); -extern int Android_OnHat(int device_id, int hat_id, int x, int y); -extern int Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs); -extern int Android_RemoveJoystick(int device_id); - -/* A linked list of available joysticks */ -typedef struct SDL_joylist_item -{ - int device_instance; - int device_id; /* Android's device id */ - char *name; /* "SideWinder 3D Pro" or whatever */ - SDL_JoystickGUID guid; - SDL_bool is_accelerometer; - SDL_Joystick *joystick; - int nbuttons, naxes, nhats, nballs; - - struct SDL_joylist_item *next; -} SDL_joylist_item; - -typedef SDL_joylist_item joystick_hwdata; - -#endif /* SDL_JOYSTICK_ANDROID */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/dummy/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.4/src/joystick/dummy/SDL_sysjoystick.c deleted file mode 100644 index 10fda10da2..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/dummy/SDL_sysjoystick.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) - -/* This is the dummy implementation of the SDL joystick API */ - -#include "SDL_joystick.h" -#include "../SDL_sysjoystick.h" -#include "../SDL_joystick_c.h" - -/* Function to scan the system for joysticks. - * It should return 0, or -1 on an unrecoverable fatal error. - */ -int -SDL_SYS_JoystickInit(void) -{ - return 0; -} - -int SDL_SYS_NumJoysticks() -{ - return 0; -} - -void SDL_SYS_JoystickDetect() -{ -} - -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) -{ - SDL_SetError("Logic error: No joysticks available"); - return (NULL); -} - -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) -{ - return device_index; -} - -/* Function to open a joystick for use. - The joystick to open is specified by the device index. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) -{ - return SDL_SetError("Logic error: No joysticks available"); -} - -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) -{ -} - -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) -{ -} - -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) -{ -} - -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) -{ - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index ); - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; -} - - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) -{ - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = joystick->name; - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; -} - -#endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick_c.h deleted file mode 100644 index c7103c56af..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick_c.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ - -#include "../../SDL_internal.h" - -#ifdef SDL_JOYSTICK_EMSCRIPTEN -#include "../SDL_sysjoystick.h" - - -#include - -/* A linked list of available joysticks */ -typedef struct SDL_joylist_item -{ - int index; - char *name; - char *mapping; - SDL_JoystickID device_instance; - SDL_Joystick *joystick; - int nbuttons; - int naxes; - double timestamp; - double axis[64]; - double analogButton[64]; - EM_BOOL digitalButton[64]; - - struct SDL_joylist_item *next; -} SDL_joylist_item; - -typedef SDL_joylist_item joystick_hwdata; - -#endif /* SDL_JOYSTICK_EMSCRIPTEN */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick.c b/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick.c deleted file mode 100644 index f6b0cc88d4..0000000000 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick.c +++ /dev/null @@ -1,906 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#include "../SDL_sysjoystick.h" - -#if SDL_JOYSTICK_DINPUT - -#include "SDL_windowsjoystick_c.h" -#include "SDL_dinputjoystick_c.h" -#include "SDL_xinputjoystick_c.h" - -#ifndef DIDFT_OPTIONAL -#define DIDFT_OPTIONAL 0x80000000 -#endif - -#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ - -/* external variables referenced. */ -extern HWND SDL_HelperWindow; - -/* local variables */ -static SDL_bool coinitialized = SDL_FALSE; -static LPDIRECTINPUT8 dinput = NULL; -static PRAWINPUTDEVICELIST SDL_RawDevList = NULL; -static UINT SDL_RawDevListCount = 0; - -/* Taken from Wine - Thanks! */ -static DIOBJECTDATAFORMAT dfDIJoystick2[] = { - { &GUID_XAxis, DIJOFS_X, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_YAxis, DIJOFS_Y, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_ZAxis, DIJOFS_Z, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RxAxis, DIJOFS_RX, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RyAxis, DIJOFS_RY, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RzAxis, DIJOFS_RZ, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, DIJOFS_SLIDER(0), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, DIJOFS_SLIDER(1), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_POV, DIJOFS_POV(0), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, - { &GUID_POV, DIJOFS_POV(1), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, - { &GUID_POV, DIJOFS_POV(2), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, - { &GUID_POV, DIJOFS_POV(3), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(0), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(1), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(2), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(3), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(4), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(5), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(6), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(7), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(8), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(9), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(10), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(11), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(12), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(13), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(14), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(15), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(16), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(17), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(18), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(19), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(20), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(21), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(22), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(23), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(24), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(25), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(26), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(27), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(28), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(29), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(30), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(31), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(32), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(33), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(34), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(35), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(36), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(37), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(38), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(39), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(40), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(41), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(42), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(43), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(44), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(45), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(46), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(47), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(48), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(49), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(50), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(51), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(52), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(53), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(54), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(55), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(56), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(57), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(58), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(59), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(60), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(61), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(62), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(63), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(64), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(65), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(66), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(67), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(68), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(69), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(70), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(71), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(72), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(73), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(74), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(75), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(76), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(77), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(78), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(79), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(80), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(81), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(82), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(83), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(84), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(85), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(86), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(87), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(88), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(89), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(90), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(91), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(92), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(93), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(94), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(95), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(96), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(97), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(98), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(99), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(100), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(101), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(102), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(103), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(104), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(105), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(106), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(107), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(108), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(109), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(110), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(111), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(112), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(113), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(114), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(115), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(116), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(117), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(118), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(119), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(120), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(121), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(122), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(123), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(124), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(125), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(126), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { NULL, DIJOFS_BUTTON(127), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, - { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lVX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lVY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lVZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lVRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lVRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lVRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lAX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lAY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lAZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lARx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lARy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lARz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lFX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lFY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lFZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lFRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lFRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lFRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, - { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, -}; - -const DIDATAFORMAT c_dfDIJoystick2 = { - sizeof(DIDATAFORMAT), - sizeof(DIOBJECTDATAFORMAT), - DIDF_ABSAXIS, - sizeof(DIJOYSTATE2), - SDL_arraysize(dfDIJoystick2), - dfDIJoystick2 -}; - -/* Convert a DirectInput return code to a text message */ -static int -SetDIerror(const char *function, HRESULT code) -{ - /* - return SDL_SetError("%s() [%s]: %s", function, - DXGetErrorString9A(code), DXGetErrorDescription9A(code)); - */ - return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code); -} - -static SDL_bool -SDL_IsXInputDevice(const GUID* pGuidProductFromDirectInput) -{ - static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; - static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; - static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; - - static const GUID *s_XInputProductGUID[] = { - &IID_ValveStreamingGamepad, - &IID_X360WiredGamepad, /* Microsoft's wired X360 controller for Windows. */ - &IID_X360WirelessGamepad /* Microsoft's wireless X360 controller for Windows. */ - }; - - size_t iDevice; - UINT i; - - if (!SDL_XINPUT_Enabled()) { - return SDL_FALSE; - } - - /* Check for well known XInput device GUIDs */ - /* This lets us skip RAWINPUT for popular devices. Also, we need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. */ - for (iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice) { - if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) { - return SDL_TRUE; - } - } - - /* Go through RAWINPUT (WinXP and later) to find HID devices. */ - /* Cache this if we end up using it. */ - if (SDL_RawDevList == NULL) { - if ((GetRawInputDeviceList(NULL, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) || (!SDL_RawDevListCount)) { - return SDL_FALSE; /* oh well. */ - } - - SDL_RawDevList = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * SDL_RawDevListCount); - if (SDL_RawDevList == NULL) { - SDL_OutOfMemory(); - return SDL_FALSE; - } - - if (GetRawInputDeviceList(SDL_RawDevList, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) { - SDL_free(SDL_RawDevList); - SDL_RawDevList = NULL; - return SDL_FALSE; /* oh well. */ - } - } - - for (i = 0; i < SDL_RawDevListCount; i++) { - RID_DEVICE_INFO rdi; - char devName[128]; - UINT rdiSize = sizeof(rdi); - UINT nameSize = SDL_arraysize(devName); - - rdi.cbSize = sizeof(rdi); - if ((SDL_RawDevList[i].dwType == RIM_TYPEHID) && - (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) && - (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)pGuidProductFromDirectInput->Data1)) && - (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) && - (SDL_strstr(devName, "IG_") != NULL)) { - return SDL_TRUE; - } - } - - return SDL_FALSE; -} - -int -SDL_DINPUT_JoystickInit(void) -{ - HRESULT result; - HINSTANCE instance; - - result = WIN_CoInitialize(); - if (FAILED(result)) { - return SetDIerror("CoInitialize", result); - } - - coinitialized = SDL_TRUE; - - result = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, - &IID_IDirectInput8, (LPVOID)&dinput); - - if (FAILED(result)) { - return SetDIerror("CoCreateInstance", result); - } - - /* Because we used CoCreateInstance, we need to Initialize it, first. */ - instance = GetModuleHandle(NULL); - if (instance == NULL) { - return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError()); - } - result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION); - - if (FAILED(result)) { - return SetDIerror("IDirectInput::Initialize", result); - } - return 0; -} - -/* helper function for direct input, gets called for each connected joystick */ -static BOOL CALLBACK -EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) -{ - JoyStick_DeviceData *pNewJoystick; - JoyStick_DeviceData *pPrevJoystick = NULL; - const DWORD devtype = (pdidInstance->dwDevType & 0xFF); - - if (devtype == DI8DEVTYPE_SUPPLEMENTAL) { - return DIENUM_CONTINUE; /* Ignore touchpads, etc. */ - } - - if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) { - return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */ - } - - pNewJoystick = *(JoyStick_DeviceData **)pContext; - while (pNewJoystick) { - if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) { - /* if we are replacing the front of the list then update it */ - if (pNewJoystick == *(JoyStick_DeviceData **)pContext) { - *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext; - } else if (pPrevJoystick) { - pPrevJoystick->pNext = pNewJoystick->pNext; - } - - pNewJoystick->pNext = SYS_Joystick; - SYS_Joystick = pNewJoystick; - - return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */ - } - - pPrevJoystick = pNewJoystick; - pNewJoystick = pNewJoystick->pNext; - } - - pNewJoystick = (JoyStick_DeviceData *)SDL_malloc(sizeof(JoyStick_DeviceData)); - if (!pNewJoystick) { - return DIENUM_CONTINUE; /* better luck next time? */ - } - - SDL_zerop(pNewJoystick); - pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName); - if (!pNewJoystick->joystickname) { - SDL_free(pNewJoystick); - return DIENUM_CONTINUE; /* better luck next time? */ - } - - SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, - sizeof(DIDEVICEINSTANCE)); - - SDL_memcpy(&pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid)); - SDL_SYS_AddJoystickDevice(pNewJoystick); - - return DIENUM_CONTINUE; /* get next device, please */ -} - -void -SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) -{ - IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, pContext, DIEDFL_ATTACHEDONLY); - - if (SDL_RawDevList) { - SDL_free(SDL_RawDevList); /* in case we used this in DirectInput detection */ - SDL_RawDevList = NULL; - } - SDL_RawDevListCount = 0; -} - -static BOOL CALLBACK -EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) -{ - SDL_Joystick *joystick = (SDL_Joystick *)pvRef; - HRESULT result; - input_t *in = &joystick->hwdata->Inputs[joystick->hwdata->NumInputs]; - - if (dev->dwType & DIDFT_BUTTON) { - in->type = BUTTON; - in->num = joystick->nbuttons; - in->ofs = DIJOFS_BUTTON(in->num); - joystick->nbuttons++; - } else if (dev->dwType & DIDFT_POV) { - in->type = HAT; - in->num = joystick->nhats; - in->ofs = DIJOFS_POV(in->num); - joystick->nhats++; - } else if (dev->dwType & DIDFT_AXIS) { - DIPROPRANGE diprg; - DIPROPDWORD dilong; - - in->type = AXIS; - in->num = joystick->naxes; - if (!SDL_memcmp(&dev->guidType, &GUID_XAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_X; - else if (!SDL_memcmp(&dev->guidType, &GUID_YAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_Y; - else if (!SDL_memcmp(&dev->guidType, &GUID_ZAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_Z; - else if (!SDL_memcmp(&dev->guidType, &GUID_RxAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_RX; - else if (!SDL_memcmp(&dev->guidType, &GUID_RyAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_RY; - else if (!SDL_memcmp(&dev->guidType, &GUID_RzAxis, sizeof(dev->guidType))) - in->ofs = DIJOFS_RZ; - else if (!SDL_memcmp(&dev->guidType, &GUID_Slider, sizeof(dev->guidType))) { - in->ofs = DIJOFS_SLIDER(joystick->hwdata->NumSliders); - ++joystick->hwdata->NumSliders; - } else { - return DIENUM_CONTINUE; /* not an axis we can grok */ - } - - diprg.diph.dwSize = sizeof(diprg); - diprg.diph.dwHeaderSize = sizeof(diprg.diph); - diprg.diph.dwObj = dev->dwType; - diprg.diph.dwHow = DIPH_BYID; - diprg.lMin = AXIS_MIN; - diprg.lMax = AXIS_MAX; - - result = - IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, - DIPROP_RANGE, &diprg.diph); - if (FAILED(result)) { - return DIENUM_CONTINUE; /* don't use this axis */ - } - - /* Set dead zone to 0. */ - dilong.diph.dwSize = sizeof(dilong); - dilong.diph.dwHeaderSize = sizeof(dilong.diph); - dilong.diph.dwObj = dev->dwType; - dilong.diph.dwHow = DIPH_BYID; - dilong.dwData = 0; - result = - IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, - DIPROP_DEADZONE, &dilong.diph); - if (FAILED(result)) { - return DIENUM_CONTINUE; /* don't use this axis */ - } - - joystick->naxes++; - } else { - /* not supported at this time */ - return DIENUM_CONTINUE; - } - - joystick->hwdata->NumInputs++; - - if (joystick->hwdata->NumInputs == MAX_INPUTS) { - return DIENUM_STOP; /* too many */ - } - - return DIENUM_CONTINUE; -} - -/* Sort using the data offset into the DInput struct. - * This gives a reasonable ordering for the inputs. - */ -static int -SortDevFunc(const void *a, const void *b) -{ - const input_t *inputA = (const input_t*)a; - const input_t *inputB = (const input_t*)b; - - if (inputA->ofs < inputB->ofs) - return -1; - if (inputA->ofs > inputB->ofs) - return 1; - return 0; -} - -/* Sort the input objects and recalculate the indices for each input. */ -static void -SortDevObjects(SDL_Joystick *joystick) -{ - input_t *inputs = joystick->hwdata->Inputs; - int nButtons = 0; - int nHats = 0; - int nAxis = 0; - int n; - - SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc); - - for (n = 0; n < joystick->hwdata->NumInputs; n++) { - switch (inputs[n].type) { - case BUTTON: - inputs[n].num = nButtons; - nButtons++; - break; - - case HAT: - inputs[n].num = nHats; - nHats++; - break; - - case AXIS: - inputs[n].num = nAxis; - nAxis++; - break; - } - } -} - -int -SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice) -{ - HRESULT result; - LPDIRECTINPUTDEVICE8 device; - DIPROPDWORD dipdw; - - joystick->hwdata->buffered = SDL_TRUE; - joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS); - - SDL_zero(dipdw); - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - - result = - IDirectInput8_CreateDevice(dinput, - &(joystickdevice->dxdevice.guidInstance), &device, NULL); - if (FAILED(result)) { - return SetDIerror("IDirectInput::CreateDevice", result); - } - - /* Now get the IDirectInputDevice8 interface, instead. */ - result = IDirectInputDevice8_QueryInterface(device, - &IID_IDirectInputDevice8, - (LPVOID *)& joystick-> - hwdata->InputDevice); - /* We are done with this object. Use the stored one from now on. */ - IDirectInputDevice8_Release(device); - - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::QueryInterface", result); - } - - /* Acquire shared access. Exclusive access is required for forces, - * though. */ - result = - IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata-> - InputDevice, SDL_HelperWindow, - DISCL_EXCLUSIVE | - DISCL_BACKGROUND); - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result); - } - - /* Use the extended data structure: DIJOYSTATE2. */ - result = - IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice, - &c_dfDIJoystick2); - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::SetDataFormat", result); - } - - /* Get device capabilities */ - result = - IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice, - &joystick->hwdata->Capabilities); - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::GetCapabilities", result); - } - - /* Force capable? */ - if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { - - result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::Acquire", result); - } - - /* reset all actuators. */ - result = - IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata-> - InputDevice, - DISFFC_RESET); - - /* Not necessarily supported, ignore if not supported. - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result); - } - */ - - result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); - - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::Unacquire", result); - } - - /* Turn on auto-centering for a ForceFeedback device (until told - * otherwise). */ - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = DIPROPAUTOCENTER_ON; - - result = - IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, - DIPROP_AUTOCENTER, &dipdw.diph); - - /* Not necessarily supported, ignore if not supported. - if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::SetProperty", result); - } - */ - } - - /* What buttons and axes does it have? */ - IDirectInputDevice8_EnumObjects(joystick->hwdata->InputDevice, - EnumDevObjectsCallback, joystick, - DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV); - - /* Reorder the input objects. Some devices do not report the X axis as - * the first axis, for example. */ - SortDevObjects(joystick); - - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = INPUT_QSIZE; - - /* Set the buffer size */ - result = - IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, - DIPROP_BUFFERSIZE, &dipdw.diph); - - if (result == DI_POLLEDDEVICE) { - /* This device doesn't support buffering, so we're forced - * to use less reliable polling. */ - joystick->hwdata->buffered = SDL_FALSE; - } else if (FAILED(result)) { - return SetDIerror("IDirectInputDevice8::SetProperty", result); - } - return 0; -} - -static Uint8 -TranslatePOV(DWORD value) -{ - const int HAT_VALS[] = { - SDL_HAT_UP, - SDL_HAT_UP | SDL_HAT_RIGHT, - SDL_HAT_RIGHT, - SDL_HAT_DOWN | SDL_HAT_RIGHT, - SDL_HAT_DOWN, - SDL_HAT_DOWN | SDL_HAT_LEFT, - SDL_HAT_LEFT, - SDL_HAT_UP | SDL_HAT_LEFT - }; - - if (LOWORD(value) == 0xFFFF) - return SDL_HAT_CENTERED; - - /* Round the value up: */ - value += 4500 / 2; - value %= 36000; - value /= 4500; - - if (value >= 8) - return SDL_HAT_CENTERED; /* shouldn't happen */ - - return HAT_VALS[value]; -} - -static void -UpdateDINPUTJoystickState_Buffered(SDL_Joystick * joystick) -{ - int i; - HRESULT result; - DWORD numevents; - DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; - - numevents = INPUT_QSIZE; - result = - IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice, - sizeof(DIDEVICEOBJECTDATA), evtbuf, - &numevents, 0); - if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { - IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); - result = - IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice, - sizeof(DIDEVICEOBJECTDATA), - evtbuf, &numevents, 0); - } - - /* Handle the events or punt */ - if (FAILED(result)) { - joystick->hwdata->send_remove_event = SDL_TRUE; - joystick->hwdata->removed = SDL_TRUE; - return; - } - - for (i = 0; i < (int)numevents; ++i) { - int j; - - for (j = 0; j < joystick->hwdata->NumInputs; ++j) { - const input_t *in = &joystick->hwdata->Inputs[j]; - - if (evtbuf[i].dwOfs != in->ofs) - continue; - - switch (in->type) { - case AXIS: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)evtbuf[i].dwData); - break; - case BUTTON: - SDL_PrivateJoystickButton(joystick, in->num, - (Uint8)(evtbuf[i].dwData ? SDL_PRESSED : SDL_RELEASED)); - break; - case HAT: - { - Uint8 pos = TranslatePOV(evtbuf[i].dwData); - SDL_PrivateJoystickHat(joystick, in->num, pos); - } - break; - } - } - } -} - -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -static void -UpdateDINPUTJoystickState_Polled(SDL_Joystick * joystick) -{ - DIJOYSTATE2 state; - HRESULT result; - int i; - - result = - IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice, - sizeof(DIJOYSTATE2), &state); - if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { - IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); - result = - IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice, - sizeof(DIJOYSTATE2), &state); - } - - if (result != DI_OK) { - joystick->hwdata->send_remove_event = SDL_TRUE; - joystick->hwdata->removed = SDL_TRUE; - return; - } - - /* Set each known axis, button and POV. */ - for (i = 0; i < joystick->hwdata->NumInputs; ++i) { - const input_t *in = &joystick->hwdata->Inputs[i]; - - switch (in->type) { - case AXIS: - switch (in->ofs) { - case DIJOFS_X: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lX); - break; - case DIJOFS_Y: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lY); - break; - case DIJOFS_Z: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lZ); - break; - case DIJOFS_RX: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRx); - break; - case DIJOFS_RY: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRy); - break; - case DIJOFS_RZ: - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRz); - break; - case DIJOFS_SLIDER(0): - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[0]); - break; - case DIJOFS_SLIDER(1): - SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[1]); - break; - } - break; - - case BUTTON: - SDL_PrivateJoystickButton(joystick, in->num, - (Uint8)(state.rgbButtons[in->ofs - DIJOFS_BUTTON0] ? SDL_PRESSED : SDL_RELEASED)); - break; - case HAT: - { - Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs - DIJOFS_POV(0)]); - SDL_PrivateJoystickHat(joystick, in->num, pos); - break; - } - } - } -} - -void -SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick) -{ - HRESULT result; - - result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); - if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { - IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); - IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); - } - - if (joystick->hwdata->buffered) { - UpdateDINPUTJoystickState_Buffered(joystick); - } else { - UpdateDINPUTJoystickState_Polled(joystick); - } -} - -void -SDL_DINPUT_JoystickClose(SDL_Joystick * joystick) -{ - IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); - IDirectInputDevice8_Release(joystick->hwdata->InputDevice); -} - -void -SDL_DINPUT_JoystickQuit(void) -{ - if (dinput != NULL) { - IDirectInput8_Release(dinput); - dinput = NULL; - } - - if (coinitialized) { - WIN_CoUninitialize(); - coinitialized = SDL_FALSE; - } -} - -#else /* !SDL_JOYSTICK_DINPUT */ - -typedef struct JoyStick_DeviceData JoyStick_DeviceData; - -int -SDL_DINPUT_JoystickInit(void) -{ - return 0; -} - -void -SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) -{ -} - -int -SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice) -{ - return SDL_Unsupported(); -} - -void -SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick) -{ -} - -void -SDL_DINPUT_JoystickClose(SDL_Joystick * joystick) -{ -} - -void -SDL_DINPUT_JoystickQuit(void) -{ -} - -#endif /* SDL_JOYSTICK_DINPUT */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/libm/e_log.c b/3rdparty/sdl2-2.0.4/src/libm/e_log.c deleted file mode 100644 index da64138cd1..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/e_log.c +++ /dev/null @@ -1,167 +0,0 @@ -/* @(#)e_log.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_log.c,v 1.8 1995/05/10 20:45:49 jtc Exp $"; -#endif - -/* __ieee754_log(x) - * Return the logrithm of x - * - * Method : - * 1. Argument Reduction: find k and f such that - * x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * 2. Approximation of log(1+f). - * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) - * = 2s + 2/3 s**3 + 2/5 s**5 + ....., - * = 2s + s*R - * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error - * of this polynomial approximation is bounded by 2**-58.45. In - * other words, - * 2 4 6 8 10 12 14 - * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s - * (the values of Lg1 to Lg7 are listed in the program) - * and - * | 2 14 | -58.45 - * | Lg1*s +...+Lg7*s - R(z) | <= 2 - * | | - * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. - * In order to guarantee error in log below 1ulp, we compute log - * by - * log(1+f) = f - s*(f - R) (if f is not too large) - * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) - * - * 3. Finally, log(x) = k*ln2 + log(1+f). - * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: - * ln2_hi + ln2_lo, - * where n*ln2_hi is always exact for |n| < 2000. - * - * Special cases: - * log(x) is NaN with signal if x < 0 (including -INF) ; - * log(+INF) is +INF; log(0) is -INF with signal; - * log(NaN) is that NaN with no signal. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math_libm.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif - ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ - ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ - two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ - Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ - Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ - Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ - Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ - Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ - Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ - Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ - -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif - -#ifdef __STDC__ -double attribute_hidden -__ieee754_log(double x) -#else -double attribute_hidden -__ieee754_log(x) - double x; -#endif -{ - double hfsq, f, s, z, R, w, t1, t2, dk; - int32_t k, hx, i, j; - u_int32_t lx; - - EXTRACT_WORDS(hx, lx, x); - - k = 0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx & 0x7fffffff) | lx) == 0) - return -two54 / zero; /* log(+-0)=-inf */ - if (hx < 0) - return (x - x) / zero; /* log(-#) = NaN */ - k -= 54; - x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx, x); - } - if (hx >= 0x7ff00000) - return x + x; - k += (hx >> 20) - 1023; - hx &= 0x000fffff; - i = (hx + 0x95f64) & 0x100000; - SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */ - k += (i >> 20); - f = x - 1.0; - if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */ - if (f == zero) { - if (k == 0) - return zero; - else { - dk = (double) k; - return dk * ln2_hi + dk * ln2_lo; - } - } - R = f * f * (0.5 - 0.33333333333333333 * f); - if (k == 0) - return f - R; - else { - dk = (double) k; - return dk * ln2_hi - ((R - dk * ln2_lo) - f); - } - } - s = f / (2.0 + f); - dk = (double) k; - z = s * s; - i = hx - 0x6147a; - w = z * z; - j = 0x6b851 - hx; - t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); - t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); - i |= j; - R = t2 + t1; - if (i > 0) { - hfsq = 0.5 * f * f; - if (k == 0) - return f - (hfsq - s * (hfsq + R)); - else - return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) - - f); - } else { - if (k == 0) - return f - s * (f - R); - else - return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f); - } -} diff --git a/3rdparty/sdl2-2.0.4/src/libm/e_pow.c b/3rdparty/sdl2-2.0.4/src/libm/e_pow.c deleted file mode 100644 index 686da2e556..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/e_pow.c +++ /dev/null @@ -1,342 +0,0 @@ -/* @(#)e_pow.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; -#endif - -/* __ieee754_pow(x,y) return x**y - * - * n - * Method: Let x = 2 * (1+f) - * 1. Compute and return log2(x) in two pieces: - * log2(x) = w1 + w2, - * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision - * arithmetic, where |y'|<=0.5. - * 3. Return x**y = 2**n*exp(y'*log2) - * - * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN - * - * Accuracy: - * pow(x,y) returns x**y nearly rounded. In particular - * pow(integer,integer) - * always returns the correct integer provided it is - * representable. - * - * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math_libm.h" -#include "math_private.h" - -libm_hidden_proto(scalbn) - libm_hidden_proto(fabs) -#ifdef __STDC__ - static const double -#else - static double -#endif - bp[] = { 1.0, 1.5, }, dp_h[] = { - 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ - - dp_l[] = { - 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ - - zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ - huge_val = 1.0e300, tiny = 1.0e-300, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ - L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ - L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ - L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ - L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ - L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ - L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ - P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ - P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ - P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ - P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ - P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ - lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ - lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ - lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ - ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ - cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ - cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ - cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h */ - ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ - ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2 */ - ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail */ - -#ifdef __STDC__ - double attribute_hidden __ieee754_pow(double x, double y) -#else - double attribute_hidden __ieee754_pow(x, y) - double x, y; -#endif - { - double z, ax, z_h, z_l, p_h, p_l; - double y1, t1, t2, r, s, t, u, v, w; - int32_t i, j, k, yisint, n; - int32_t hx, hy, ix, iy; - u_int32_t lx, ly; - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - ix = hx & 0x7fffffff; - iy = hy & 0x7fffffff; - - /* y==zero: x**0 = 1 */ - if ((iy | ly) == 0) - return one; - - /* +-NaN return x+y */ - if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || - iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0))) - return x + y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if (hx < 0) { - if (iy >= 0x43400000) - yisint = 2; /* even integer y */ - else if (iy >= 0x3ff00000) { - k = (iy >> 20) - 0x3ff; /* exponent */ - if (k > 20) { - j = ly >> (52 - k); - if ((j << (52 - k)) == ly) - yisint = 2 - (j & 1); - } else if (ly == 0) { - j = iy >> (20 - k); - if ((j << (20 - k)) == iy) - yisint = 2 - (j & 1); - } - } - } - - /* special value of y */ - if (ly == 0) { - if (iy == 0x7ff00000) { /* y is +-inf */ - if (((ix - 0x3ff00000) | lx) == 0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ - return (hy >= 0) ? y : zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy < 0) ? -y : zero; - } - if (iy == 0x3ff00000) { /* y is +-1 */ - if (hy < 0) - return one / x; - else - return x; - } - if (hy == 0x40000000) - return x * x; /* y is 2 */ - if (hy == 0x3fe00000) { /* y is 0.5 */ - if (hx >= 0) /* x >= +0 */ - return __ieee754_sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if (lx == 0) { - if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) { - z = ax; /* x is +-0,+-inf,+-1 */ - if (hy < 0) - z = one / z; /* z = (1/|x|) */ - if (hx < 0) { - if (((ix - 0x3ff00000) | yisint) == 0) { - z = (z - z) / (z - z); /* (-1)**non-int is NaN */ - } else if (yisint == 1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0) - return (x - x) / (x - x); - - /* |y| is huge */ - if (iy > 0x41e00000) { /* if |y| > 2**31 */ - if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ - if (ix <= 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix >= 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - } - /* over/underflow if x is not close to one */ - if (ix < 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix > 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x - 1; /* t has 20 trailing zeros */ - w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); - u = ivln2_h * t; /* ivln2_h has 21 sig. bits */ - v = t * ivln2_l - w * ivln2; - t1 = u + v; - SET_LOW_WORD(t1, 0); - t2 = v - (t1 - u); - } else { - double s2, s_h, s_l, t_h, t_l; - n = 0; - /* take care subnormal number */ - if (ix < 0x00100000) { - ax *= two53; - n -= 53; - GET_HIGH_WORD(ix, ax); - } - n += ((ix) >> 20) - 0x3ff; - j = ix & 0x000fffff; - /* determine interval */ - ix = j | 0x3ff00000; /* normalize ix */ - if (j <= 0x3988E) - k = 0; /* |x|> 1) | 0x20000000) + 0x00080000 + (k << 18)); - t_l = ax - (t_h - bp[k]); - s_l = v * ((u - s_h * t_h) - s_h * t_l); - /* compute log(ax) */ - s2 = s * s; - r = s2 * s2 * (L1 + - s2 * (L2 + - s2 * (L3 + - s2 * (L4 + s2 * (L5 + s2 * L6))))); - r += s_l * (s_h + s); - s2 = s_h * s_h; - t_h = 3.0 + s2 + r; - SET_LOW_WORD(t_h, 0); - t_l = r - ((t_h - 3.0) - s2); - /* u+v = s*(1+...) */ - u = s_h * t_h; - v = s_l * t_h + t_l * s; - /* 2/(3log2)*(s+...) */ - p_h = u + v; - SET_LOW_WORD(p_h, 0); - p_l = v - (p_h - u); - z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l * p_h + p_l * cp + dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double) n; - t1 = (((z_h + z_l) + dp_h[k]) + t); - SET_LOW_WORD(t1, 0); - t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); - } - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0) - s = -one; /* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1, 0); - p_l = (y - y1) * t1 + y * t2; - p_h = y1 * t1; - z = p_l + p_h; - EXTRACT_WORDS(j, i, z); - if (j >= 0x40900000) { /* z >= 1024 */ - if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ - return s * huge_val * huge_val; /* overflow */ - else { - if (p_l + ovt > z - p_h) - return s * huge_val * huge_val; /* overflow */ - } - } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */ - if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ - return s * tiny * tiny; /* underflow */ - else { - if (p_l <= z - p_h) - return s * tiny * tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j & 0x7fffffff; - k = (i >> 20) - 0x3ff; - n = 0; - if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j + (0x00100000 >> (k + 1)); - k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */ - t = zero; - SET_HIGH_WORD(t, n & ~(0x000fffff >> k)); - n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); - if (j < 0) - n = -n; - p_h -= t; - } - t = p_l + p_h; - SET_LOW_WORD(t, 0); - u = t * lg2_h; - v = (p_l - (t - p_h)) * lg2 + t * lg2_l; - z = u + v; - w = v - (z - u); - t = z * z; - t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); - r = (z * t1) / (t1 - two) - (w + z * w); - z = one - (r - z); - GET_HIGH_WORD(j, z); - j += (n << 20); - if ((j >> 20) <= 0) - z = scalbn(z, n); /* subnormal output */ - else - SET_HIGH_WORD(z, j); - return s * z; - } diff --git a/3rdparty/sdl2-2.0.4/src/libm/e_rem_pio2.c b/3rdparty/sdl2-2.0.4/src/libm/e_rem_pio2.c deleted file mode 100644 index a8ffe31421..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/e_rem_pio2.c +++ /dev/null @@ -1,201 +0,0 @@ -/* @(#)e_rem_pio2.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_rem_pio2.c,v 1.8 1995/05/10 20:46:02 jtc Exp $"; -#endif - -/* __ieee754_rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __kernel_rem_pio2() - */ - -#include "math_libm.h" -#include "math_private.h" - -libm_hidden_proto(fabs) - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - */ -#ifdef __STDC__ - static const int32_t two_over_pi[] = { -#else - static int32_t two_over_pi[] = { -#endif - 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, - 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, - 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, - 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, - 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, - 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, - 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, - 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, - 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, - 0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, - 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, - }; - -#ifdef __STDC__ -static const int32_t npio2_hw[] = { -#else -static int32_t npio2_hw[] = { -#endif - 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, - 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, - 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, - 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, - 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, - 0x404858EB, 0x404921FB, -}; - -/* - * invpio2: 53 bits of 2/pi - * pio2_1: first 33 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 33 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 33 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ - -#ifdef __STDC__ -static const double -#else -static double -#endif - zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ - pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ - pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ - pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ - pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ - pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ - -#ifdef __STDC__ -int32_t attribute_hidden -__ieee754_rem_pio2(double x, double *y) -#else -int32_t attribute_hidden -__ieee754_rem_pio2(x, y) - double x, y[]; -#endif -{ - double z = 0.0, w, t, r, fn; - double tx[3]; - int32_t e0, i, j, nx, n, ix, hx; - u_int32_t low; - - GET_HIGH_WORD(hx, x); /* high word of x */ - ix = hx & 0x7fffffff; - if (ix <= 0x3fe921fb) { /* |x| ~<= pi/4 , no need for reduction */ - y[0] = x; - y[1] = 0; - return 0; - } - if (ix < 0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if (hx > 0) { - z = x - pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z - pio2_1t; - y[1] = (z - y[0]) - pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z - y[0]) - pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z + pio2_1t; - y[1] = (z - y[0]) + pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z - y[0]) + pio2_2t; - } - return -1; - } - } - if (ix <= 0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ - t = fabs(x); - n = (int32_t) (t * invpio2 + half); - fn = (double) n; - r = t - fn * pio2_1; - w = fn * pio2_1t; /* 1st round good to 85 bit */ - if (n < 32 && ix != npio2_hw[n - 1]) { - y[0] = r - w; /* quick check no cancellation */ - } else { - u_int32_t high; - j = ix >> 20; - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 16) { /* 2nd iteration needed, good to 118 */ - t = r; - w = fn * pio2_2; - r = t - w; - w = fn * pio2_2t - ((t - r) - w); - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 49) { /* 3rd iteration need, 151 bits acc */ - t = r; /* will cover all possible cases */ - w = fn * pio2_3; - r = t - w; - w = fn * pio2_3t - ((t - r) - w); - y[0] = r - w; - } - } - } - y[1] = (r - y[0]) - w; - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } else - return n; - } - /* - * all other (large) arguments - */ - if (ix >= 0x7ff00000) { /* x is inf or NaN */ - y[0] = y[1] = x - x; - return 0; - } - /* set z = scalbn(|x|,ilogb(x)-23) */ - GET_LOW_WORD(low, x); - SET_LOW_WORD(z, low); - e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ - SET_HIGH_WORD(z, ix - ((int32_t) (e0 << 20))); - for (i = 0; i < 2; i++) { - tx[i] = (double) ((int32_t) (z)); - z = (z - tx[i]) * two24; - } - tx[2] = z; - nx = 3; - while (tx[nx - 1] == zero) - nx--; /* skip zero term */ - n = __kernel_rem_pio2(tx, y, e0, nx, 2, two_over_pi); - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } - return n; -} diff --git a/3rdparty/sdl2-2.0.4/src/libm/k_rem_pio2.c b/3rdparty/sdl2-2.0.4/src/libm/k_rem_pio2.c deleted file mode 100644 index 23c2b61dd9..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/k_rem_pio2.c +++ /dev/null @@ -1,363 +0,0 @@ -/* @(#)k_rem_pio2.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $"; -#endif - -/* - * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) - * double x[],y[]; int e0,nx,prec; int ipio2[]; - * - * __kernel_rem_pio2 return the last three digits of N with - * y = x - N*pi/2 - * so that |y| < pi/2. - * - * The method is to compute the integer (mod 8) and fraction parts of - * (2/pi)*x without doing the full multiplication. In general we - * skip the part of the product that are known to be a huge integer ( - * more accurately, = 0 mod 8 ). Thus the number of operations are - * independent of the exponent of the input. - * - * (2/pi) is represented by an array of 24-bit integers in ipio2[]. - * - * Input parameters: - * x[] The input value (must be positive) is broken into nx - * pieces of 24-bit integers in double precision format. - * x[i] will be the i-th 24 bit of x. The scaled exponent - * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 - * match x's up to 24 bits. - * - * Example of breaking a double positive z into x[0]+x[1]+x[2]: - * e0 = ilogb(z)-23 - * z = scalbn(z,-e0) - * for i = 0,1,2 - * x[i] = floor(z) - * z = (z-x[i])*2**24 - * - * - * y[] ouput result in an array of double precision numbers. - * The dimension of y[] is: - * 24-bit precision 1 - * 53-bit precision 2 - * 64-bit precision 2 - * 113-bit precision 3 - * The actual value is the sum of them. Thus for 113-bit - * precison, one may have to do something like: - * - * long double t,w,r_head, r_tail; - * t = (long double)y[2] + (long double)y[1]; - * w = (long double)y[0]; - * r_head = t+w; - * r_tail = w - (r_head - t); - * - * e0 The exponent of x[0] - * - * nx dimension of x[] - * - * prec an integer indicating the precision: - * 0 24 bits (single) - * 1 53 bits (double) - * 2 64 bits (extended) - * 3 113 bits (quad) - * - * ipio2[] - * integer array, contains the (24*i)-th to (24*i+23)-th - * bit of 2/pi after binary point. The corresponding - * floating value is - * - * ipio2[i] * 2^(-24(i+1)). - * - * External function: - * double scalbn(), floor(); - * - * - * Here is the description of some local variables: - * - * jk jk+1 is the initial number of terms of ipio2[] needed - * in the computation. The recommended value is 2,3,4, - * 6 for single, double, extended,and quad. - * - * jz local integer variable indicating the number of - * terms of ipio2[] used. - * - * jx nx - 1 - * - * jv index for pointing to the suitable ipio2[] for the - * computation. In general, we want - * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 - * is an integer. Thus - * e0-3-24*jv >= 0 or (e0-3)/24 >= jv - * Hence jv = max(0,(e0-3)/24). - * - * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. - * - * q[] double array with integral value, representing the - * 24-bits chunk of the product of x and 2/pi. - * - * q0 the corresponding exponent of q[0]. Note that the - * exponent for q[i] would be q0-24*i. - * - * PIo2[] double precision array, obtained by cutting pi/2 - * into 24 bits chunks. - * - * f[] ipio2[] in floating point - * - * iq[] integer array by breaking up q[] in 24-bits chunk. - * - * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] - * - * ih integer. If >0 it indicates q[] is >= 0.5, hence - * it also indicates the *sign* of the result. - * - */ - - -/* - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "math_libm.h" -#include "math_private.h" - -#include "SDL_assert.h" - -libm_hidden_proto(scalbn) - libm_hidden_proto(floor) -#ifdef __STDC__ - static const int init_jk[] = { 2, 3, 4, 6 }; /* initial value for jk */ -#else - static int init_jk[] = { 2, 3, 4, 6 }; -#endif - -#ifdef __STDC__ -static const double PIo2[] = { -#else -static double PIo2[] = { -#endif - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ -}; - -#ifdef __STDC__ -static const double -#else -static double -#endif - zero = 0.0, one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ - -#ifdef __STDC__ -int attribute_hidden -__kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, - const int32_t * ipio2) -#else -int attribute_hidden -__kernel_rem_pio2(x, y, e0, nx, prec, ipio2) - double x[], y[]; - int e0, nx, prec; - int32_t ipio2[]; -#endif -{ - int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih; - double z, fw, f[20], fq[20], q[20]; - - /* initialize jk */ - SDL_assert((prec >= 0) && (prec < SDL_arraysize(init_jk))); - jk = init_jk[prec]; - SDL_assert((jk >= 2) && (jk <= 6)); - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - SDL_assert(nx > 0); - jx = nx - 1; - jv = (e0 - 3) / 24; - if (jv < 0) - jv = 0; - q0 = e0 - 24 * (jv + 1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv - jx; - m = jx + jk; - for (i = 0; i <= m; i++, j++) - f[i] = (j < 0) ? zero : (double) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i = 0; i <= jk; i++) { - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } - - jz = jk; - recompute: - /* distill q[] into iq[] reversingly */ - for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--) { - fw = (double) ((int32_t) (twon24 * z)); - iq[i] = (int32_t) (z - two24 * fw); - z = q[j - 1] + fw; - } - - /* compute n */ - z = scalbn(z, q0); /* actual value of z */ - z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */ - n = (int32_t) z; - z -= (double) n; - ih = 0; - if (q0 > 0) { /* need iq[jz-1] to determine n */ - i = (iq[jz - 1] >> (24 - q0)); - n += i; - iq[jz - 1] -= i << (24 - q0); - ih = iq[jz - 1] >> (23 - q0); - } else if (q0 == 0) - ih = iq[jz - 1] >> 23; - else if (z >= 0.5) - ih = 2; - - if (ih > 0) { /* q > 0.5 */ - n += 1; - carry = 0; - for (i = 0; i < jz; i++) { /* compute 1-q */ - j = iq[i]; - if (carry == 0) { - if (j != 0) { - carry = 1; - iq[i] = 0x1000000 - j; - } - } else - iq[i] = 0xffffff - j; - } - if (q0 > 0) { /* rare case: chance is 1 in 12 */ - switch (q0) { - case 1: - iq[jz - 1] &= 0x7fffff; - break; - case 2: - iq[jz - 1] &= 0x3fffff; - break; - } - } - if (ih == 2) { - z = one - z; - if (carry != 0) - z -= scalbn(one, q0); - } - } - - /* check if recomputation is needed */ - if (z == zero) { - j = 0; - for (i = jz - 1; i >= jk; i--) - j |= iq[i]; - if (j == 0) { /* need recomputation */ - for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */ - - for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ - f[jx + i] = (double) ipio2[jv + i]; - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if (z == 0.0) { - jz -= 1; - q0 -= 24; - while (iq[jz] == 0) { - jz--; - q0 -= 24; - } - } else { /* break z into 24-bit if necessary */ - z = scalbn(z, -q0); - if (z >= two24) { - fw = (double) ((int32_t) (twon24 * z)); - iq[jz] = (int32_t) (z - two24 * fw); - jz += 1; - q0 += 24; - iq[jz] = (int32_t) fw; - } else - iq[jz] = (int32_t) z; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = scalbn(one, q0); - for (i = jz; i >= 0; i--) { - q[i] = fw * (double) iq[i]; - fw *= twon24; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for (i = jz; i >= 0; i--) { - for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++) - fw += PIo2[k] * q[i + k]; - fq[jz - i] = fw; - } - - /* compress fq[] into y[] */ - switch (prec) { - case 0: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - fw = fq[0] - fw; - for (i = 1; i <= jz; i++) - fw += fq[i]; - y[1] = (ih == 0) ? fw : -fw; - break; - case 3: /* painful */ - for (i = jz; i > 0; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (i = jz; i > 1; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (fw = 0.0, i = jz; i >= 2; i--) - fw += fq[i]; - if (ih == 0) { - y[0] = fq[0]; - y[1] = fq[1]; - y[2] = fw; - } else { - y[0] = -fq[0]; - y[1] = -fq[1]; - y[2] = -fw; - } - } - return n & 7; -} diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_floor.c b/3rdparty/sdl2-2.0.4/src/libm/s_floor.c deleted file mode 100644 index b553d30382..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/s_floor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; -#endif - -/* - * floor(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to floor(x). - */ - -#include "math_libm.h" -#include "math_private.h" - -#ifdef __STDC__ -static const double huge_val = 1.0e300; -#else -static double huge_val = 1.0e300; -#endif - -libm_hidden_proto(floor) -#ifdef __STDC__ - double floor(double x) -#else - double floor(x) - double x; -#endif -{ - int32_t i0, i1, j0; - u_int32_t i, j; - EXTRACT_WORDS(i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) { - if (j0 < 0) { /* raise inexact if x != 0 */ - if (huge_val + x > 0.0) { /* return 0*sign(x) if |x|<1 */ - if (i0 >= 0) { - i0 = i1 = 0; - } else if (((i0 & 0x7fffffff) | i1) != 0) { - i0 = 0xbff00000; - i1 = 0; - } - } - } else { - i = (0x000fffff) >> j0; - if (((i0 & i) | i1) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) - i0 += (0x00100000) >> j0; - i0 &= (~i); - i1 = 0; - } - } - } else if (j0 > 51) { - if (j0 == 0x400) - return x + x; /* inf or NaN */ - else - return x; /* x is integral */ - } else { - i = ((u_int32_t) (0xffffffff)) >> (j0 - 20); - if ((i1 & i) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) { - if (j0 == 20) - i0 += 1; - else { - j = i1 + (1 << (52 - j0)); - if (j < (u_int32_t) i1) - i0 += 1; /* got a carry */ - i1 = j; - } - } - i1 &= (~i); - } - } - INSERT_WORDS(x, i0, i1); - return x; -} - -libm_hidden_def(floor) diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_scalbn.c b/3rdparty/sdl2-2.0.4/src/libm/s_scalbn.c deleted file mode 100644 index f824e926d7..0000000000 --- a/3rdparty/sdl2-2.0.4/src/libm/s_scalbn.c +++ /dev/null @@ -1,79 +0,0 @@ -/* @(#)s_scalbn.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; -#endif - -/* - * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "math_libm.h" -#include "math_private.h" - -libm_hidden_proto(copysign) -#ifdef __STDC__ - static const double -#else - static double -#endif - two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ - twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ - huge_val = 1.0e+300, tiny = 1.0e-300; - -libm_hidden_proto(scalbn) -#ifdef __STDC__ - double scalbn(double x, int n) -#else - double scalbn(x, n) - double x; - int n; -#endif -{ - int32_t k, hx, lx; - EXTRACT_WORDS(hx, lx, x); - k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (k == 0) { /* 0 or subnormal x */ - if ((lx | (hx & 0x7fffffff)) == 0) - return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx, x); - k = ((hx & 0x7ff00000) >> 20) - 54; - if (n < -50000) - return tiny * x; /* underflow */ - } - if (k == 0x7ff) - return x + x; /* NaN or Inf */ - k = k + n; - if (k > 0x7fe) - return huge_val * copysign(huge_val, x); /* overflow */ - if (k > 0) { /* normal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x; - } - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return huge_val * copysign(huge_val, x); /* overflow */ - else - return tiny * copysign(tiny, x); /* underflow */ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x * twom54; -} - -libm_hidden_def(scalbn) diff --git a/3rdparty/sdl2-2.0.4/src/loadso/haiku/SDL_sysloadso.c b/3rdparty/sdl2-2.0.4/src/loadso/haiku/SDL_sysloadso.c deleted file mode 100644 index 1336d9e18a..0000000000 --- a/3rdparty/sdl2-2.0.4/src/loadso/haiku/SDL_sysloadso.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_LOADSO_HAIKU - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent library loading routines */ - -#include -#include - -#include "SDL_loadso.h" - -void * -SDL_LoadObject(const char *sofile) -{ - void *handle = NULL; - image_id library_id = load_add_on(sofile); - if (library_id < 0) { - SDL_SetError(strerror((int) library_id)); - } else { - handle = (void *) (library_id); - } - return (handle); -} - -void * -SDL_LoadFunction(void *handle, const char *name) -{ - void *sym = NULL; - image_id library_id = (image_id) handle; - status_t rc = - get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym); - if (rc != B_NO_ERROR) { - SDL_SetError(strerror(rc)); - } - return (sym); -} - -void -SDL_UnloadObject(void *handle) -{ - image_id library_id; - if (handle != NULL) { - library_id = (image_id) handle; - unload_add_on(library_id); - } -} - -#endif /* SDL_LOADSO_HAIKU */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/main/android/SDL_android_main.c b/3rdparty/sdl2-2.0.4/src/main/android/SDL_android_main.c deleted file mode 100644 index 4173bcb1d1..0000000000 --- a/3rdparty/sdl2-2.0.4/src/main/android/SDL_android_main.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14 -*/ -#include "../../SDL_internal.h" - -#ifdef __ANDROID__ - -/* Include the SDL main definition header */ -#include "SDL_main.h" - -/******************************************************************************* - Functions called by JNI -*******************************************************************************/ -#include - -/* Called before SDL_main() to initialize JNI bindings in SDL library */ -extern void SDL_Android_Init(JNIEnv* env, jclass cls); - -/* Start up the SDL app */ -JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) -{ - int i; - int argc; - int status; - - /* This interface could expand with ABI negotiation, callbacks, etc. */ - SDL_Android_Init(env, cls); - - SDL_SetMainReady(); - - /* Prepare the arguments. */ - - int len = (*env)->GetArrayLength(env, array); - char* argv[1 + len + 1]; - argc = 0; - /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. - https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start - */ - argv[argc++] = SDL_strdup("app_process"); - for (i = 0; i < len; ++i) { - const char* utf; - char* arg = NULL; - jstring string = (*env)->GetObjectArrayElement(env, array, i); - if (string) { - utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - arg = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); - } - (*env)->DeleteLocalRef(env, string); - } - if (!arg) { - arg = SDL_strdup(""); - } - argv[argc++] = arg; - } - argv[argc] = NULL; - - - /* Run the application. */ - - status = SDL_main(argc, argv); - - /* Release the arguments. */ - - for (i = 0; i < argc; ++i) { - SDL_free(argv[i]); - } - - /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ - /* exit(status); */ - - return status; -} - -#endif /* __ANDROID__ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.c b/3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.c deleted file mode 100644 index 83d67bfa70..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED -#include "SDL_stdinc.h" - -#include "SDL_d3dmath.h" - -/* Direct3D matrix math functions */ - -Float4X4 MatrixIdentity() -{ - Float4X4 m; - SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; - return m; -} - -Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2) -{ - Float4X4 m; - m._11 = M1._11 * M2._11 + M1._12 * M2._21 + M1._13 * M2._31 + M1._14 * M2._41; - m._12 = M1._11 * M2._12 + M1._12 * M2._22 + M1._13 * M2._32 + M1._14 * M2._42; - m._13 = M1._11 * M2._13 + M1._12 * M2._23 + M1._13 * M2._33 + M1._14 * M2._43; - m._14 = M1._11 * M2._14 + M1._12 * M2._24 + M1._13 * M2._34 + M1._14 * M2._44; - m._21 = M1._21 * M2._11 + M1._22 * M2._21 + M1._23 * M2._31 + M1._24 * M2._41; - m._22 = M1._21 * M2._12 + M1._22 * M2._22 + M1._23 * M2._32 + M1._24 * M2._42; - m._23 = M1._21 * M2._13 + M1._22 * M2._23 + M1._23 * M2._33 + M1._24 * M2._43; - m._24 = M1._21 * M2._14 + M1._22 * M2._24 + M1._23 * M2._34 + M1._24 * M2._44; - m._31 = M1._31 * M2._11 + M1._32 * M2._21 + M1._33 * M2._31 + M1._34 * M2._41; - m._32 = M1._31 * M2._12 + M1._32 * M2._22 + M1._33 * M2._32 + M1._34 * M2._42; - m._33 = M1._31 * M2._13 + M1._32 * M2._23 + M1._33 * M2._33 + M1._34 * M2._43; - m._34 = M1._31 * M2._14 + M1._32 * M2._24 + M1._33 * M2._34 + M1._34 * M2._44; - m._41 = M1._41 * M2._11 + M1._42 * M2._21 + M1._43 * M2._31 + M1._44 * M2._41; - m._42 = M1._41 * M2._12 + M1._42 * M2._22 + M1._43 * M2._32 + M1._44 * M2._42; - m._43 = M1._41 * M2._13 + M1._42 * M2._23 + M1._43 * M2._33 + M1._44 * M2._43; - m._44 = M1._41 * M2._14 + M1._42 * M2._24 + M1._43 * M2._34 + M1._44 * M2._44; - return m; -} - -Float4X4 MatrixScaling(float x, float y, float z) -{ - Float4X4 m; - SDL_zero(m); - m._11 = x; - m._22 = y; - m._33 = z; - m._44 = 1.0f; - return m; -} - -Float4X4 MatrixTranslation(float x, float y, float z) -{ - Float4X4 m; - SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; - m._41 = x; - m._42 = y; - m._43 = z; - return m; -} - -Float4X4 MatrixRotationX(float r) -{ - float sinR = SDL_sinf(r); - float cosR = SDL_cosf(r); - Float4X4 m; - SDL_zero(m); - m._11 = 1.0f; - m._22 = cosR; - m._23 = sinR; - m._32 = -sinR; - m._33 = cosR; - m._44 = 1.0f; - return m; -} - -Float4X4 MatrixRotationY(float r) -{ - float sinR = SDL_sinf(r); - float cosR = SDL_cosf(r); - Float4X4 m; - SDL_zero(m); - m._11 = cosR; - m._13 = -sinR; - m._22 = 1.0f; - m._31 = sinR; - m._33 = cosR; - m._44 = 1.0f; - return m; -} - -Float4X4 MatrixRotationZ(float r) -{ - float sinR = SDL_sinf(r); - float cosR = SDL_cosf(r); - Float4X4 m; - SDL_zero(m); - m._11 = cosR; - m._12 = sinR; - m._21 = -sinR; - m._22 = cosR; - m._33 = 1.0f; - m._44 = 1.0f; - return m; - -} - -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_mmx.c b/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_mmx.c deleted file mode 100644 index 0de776a36e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_mmx.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - -#include "SDL_stdinc.h" - -#include "mmx.h" - -/* *INDENT-OFF* */ - -static mmx_t MMX_0080w = { .ud = {0x00800080, 0x00800080} }; -static mmx_t MMX_00FFw = { .ud = {0x00ff00ff, 0x00ff00ff} }; -static mmx_t MMX_FF00w = { .ud = {0xff00ff00, 0xff00ff00} }; - -static mmx_t MMX_Ycoeff = { .uw = {0x004a, 0x004a, 0x004a, 0x004a} }; - -static mmx_t MMX_UbluRGB = { .uw = {0x0072, 0x0072, 0x0072, 0x0072} }; -static mmx_t MMX_VredRGB = { .uw = {0x0059, 0x0059, 0x0059, 0x0059} }; -static mmx_t MMX_UgrnRGB = { .uw = {0xffea, 0xffea, 0xffea, 0xffea} }; -static mmx_t MMX_VgrnRGB = { .uw = {0xffd2, 0xffd2, 0xffd2, 0xffd2} }; - -static mmx_t MMX_Ublu5x5 = { .uw = {0x0081, 0x0081, 0x0081, 0x0081} }; -static mmx_t MMX_Vred5x5 = { .uw = {0x0066, 0x0066, 0x0066, 0x0066} }; -static mmx_t MMX_Ugrn565 = { .uw = {0xffe8, 0xffe8, 0xffe8, 0xffe8} }; -static mmx_t MMX_Vgrn565 = { .uw = {0xffcd, 0xffcd, 0xffcd, 0xffcd} }; - -static mmx_t MMX_red565 = { .uw = {0xf800, 0xf800, 0xf800, 0xf800} }; -static mmx_t MMX_grn565 = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} }; - -/** - This MMX assembler is my first assembler/MMX program ever. - Thus it maybe buggy. - Send patches to: - mvogt@rhrk.uni-kl.de - - After it worked fine I have "obfuscated" the code a bit to have - more parallism in the MMX units. This means I moved - initilisation around and delayed other instruction. - Performance measurement did not show that this brought any advantage - but in theory it _should_ be faster this way. - - The overall performanve gain to the C based dither was 30%-40%. - The MMX routine calculates 256bit=8RGB values in each cycle - (4 for row1 & 4 for row2) - - The red/green/blue.. coefficents are taken from the mpeg_play - player. They look nice, but I dont know if you can have - better values, to avoid integer rounding errors. - - - IMPORTANT: - ========== - - It is a requirement that the cr/cb/lum are 8 byte aligned and - the out are 16byte aligned or you will/may get segfaults - -*/ - -void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint32 *row1; - Uint32 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint32 *)out; /* 32 bit target */ - row2 = (Uint32 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*4; /* increment for row1 in byte */ - - __asm__ __volatile__ ( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx,4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - /* create Cr (result in mm1) */ - "pushl %%ebx\n" - "movl 4(%%esp),%%ebx\n" - "movd (%%ebx),%%mm1\n" /* 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "movd (%2), %%mm2\n" /* 0 0 0 0 l3 l2 l1 l0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 v3 0 v2 00 v1 00 v0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 v1 00 v0 00 v1 00 v0 */ - "psubw %9,%%mm1\n" /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */ - - /* create Cr_g (result in mm0) */ - "movq %%mm1,%%mm0\n" /* r1 r1 r0 r0 r1 r1 r0 r0 */ - "pmullw %10,%%mm0\n" /* red*-46dec=0.7136*64 */ - "pmullw %11,%%mm1\n" /* red*89dec=1.4013*64 */ - "psraw $6, %%mm0\n" /* red=red/64 */ - "psraw $6, %%mm1\n" /* red=red/64 */ - - /* create L1 L2 (result in mm2,mm4) */ - /* L2=lum+cols */ - "movq (%2,%4),%%mm3\n" /* 0 0 0 0 L3 L2 L1 L0 */ - "punpckldq %%mm3,%%mm2\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "movq %%mm2,%%mm4\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "pand %12,%%mm2\n" /* L3 0 L1 0 l3 0 l1 0 */ - "pand %13,%%mm4\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "psrlw $8,%%mm2\n" /* 0 L3 0 L1 0 l3 0 l1 */ - - /* create R (result in mm6) */ - "movq %%mm2,%%mm5\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm6\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "paddsw %%mm1, %%mm5\n" /* lum1+red:x R3 x R1 x r3 x r1 */ - "paddsw %%mm1, %%mm6\n" /* lum1+red:x R2 x R0 x r2 x r0 */ - "packuswb %%mm5,%%mm5\n" /* R3 R1 r3 r1 R3 R1 r3 r1 */ - "packuswb %%mm6,%%mm6\n" /* R2 R0 r2 r0 R2 R0 r2 r0 */ - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "punpcklbw %%mm5,%%mm6\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - - /* create Cb (result in mm1) */ - "movd (%1), %%mm1\n" /* 0 0 0 0 u3 u2 u1 u0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 u3 0 u2 00 u1 00 u0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 u1 00 u0 00 u1 00 u0 */ - "psubw %9,%%mm1\n" /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */ - - /* create Cb_g (result in mm5) */ - "movq %%mm1,%%mm5\n" /* u1 u1 u0 u0 u1 u1 u0 u0 */ - "pmullw %14,%%mm5\n" /* blue*-109dec=1.7129*64 */ - "pmullw %15,%%mm1\n" /* blue*114dec=1.78125*64 */ - "psraw $6, %%mm5\n" /* blue=red/64 */ - "psraw $6, %%mm1\n" /* blue=blue/64 */ - - /* create G (result in mm7) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm7\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm5, %%mm3\n" /* lum1+Cb_g:x G3t x G1t x g3t x g1t */ - "paddsw %%mm5, %%mm7\n" /* lum1+Cb_g:x G2t x G0t x g2t x g0t */ - "paddsw %%mm0, %%mm3\n" /* lum1+Cr_g:x G3 x G1 x g3 x g1 */ - "paddsw %%mm0, %%mm7\n" /* lum1+blue:x G2 x G0 x g2 x g0 */ - "packuswb %%mm3,%%mm3\n" /* G3 G1 g3 g1 G3 G1 g3 g1 */ - "packuswb %%mm7,%%mm7\n" /* G2 G0 g2 g0 G2 G0 g2 g0 */ - "punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - - /* create B (result in mm5) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm5\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm1, %%mm3\n" /* lum1+blue:x B3 x B1 x b3 x b1 */ - "paddsw %%mm1, %%mm5\n" /* lum1+blue:x B2 x B0 x b2 x b0 */ - "packuswb %%mm3,%%mm3\n" /* B3 B1 b3 b1 B3 B1 b3 b1 */ - "packuswb %%mm5,%%mm5\n" /* B2 B0 b2 b0 B2 B0 b2 b0 */ - "punpcklbw %%mm3,%%mm5\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "pxor %%mm4,%%mm4\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm6,%%mm1\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - "movq %%mm5,%%mm3\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* process lower lum */ - "punpcklbw %%mm4,%%mm1\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "punpcklbw %%mm4,%%mm3\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "movq %%mm1,%%mm2\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "movq %%mm3,%%mm0\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "punpcklwd %%mm1,%%mm3\n" /* 0 r1 0 b1 0 r0 0 b0 */ - "punpckhwd %%mm2,%%mm0\n" /* 0 r3 0 b3 0 r2 0 b2 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm7,%%mm1\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - "punpcklbw %%mm1,%%mm2\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpcklwd %%mm4,%%mm2\n" /* 0 0 g1 0 0 0 g0 0 */ - "por %%mm3, %%mm2\n" /* 0 r1 g1 b1 0 r0 g0 b0 */ - "movq %%mm2,(%3)\n" /* wrote out ! row1 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpcklbw %%mm1,%%mm4\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpckhwd %%mm2,%%mm4\n" /* 0 0 g3 0 0 0 g2 0 */ - "por %%mm0, %%mm4\n" /* 0 r3 g3 b3 0 r2 g2 b2 */ - "movq %%mm4,8(%3)\n" /* wrote out ! row1 */ - - /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - /* this can be done "destructive" */ - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpckhbw %%mm2,%%mm6\n" /* 0 R3 0 R2 0 R1 0 R0 */ - "punpckhbw %%mm1,%%mm5\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "movq %%mm5,%%mm1\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "punpcklwd %%mm6,%%mm1\n" /* 0 R1 G1 B1 0 R0 G0 B0 */ - "movq %%mm1,(%5)\n" /* wrote out ! row2 */ - "punpckhwd %%mm6,%%mm5\n" /* 0 R3 G3 B3 0 R2 G2 B2 */ - "movq %%mm5,8(%5)\n" /* wrote out ! row2 */ - - "addl $4,%2\n" /* lum+4 */ - "leal 16(%3),%3\n" /* row1+16 */ - "leal 16(%5),%5\n" /* row2+16 */ - "addl $2,(%%esp)\n" /* cr+2 */ - "addl $2,%1\n" /* cb+2 */ - - "addl $4,%6\n" /* x+4 */ - "cmpl %4,%6\n" - - "jl 1b\n" - "addl %4,%2\n" /* lum += cols */ - "addl %8,%3\n" /* row1+= mod */ - "addl %8,%5\n" /* row2+= mod */ - "movl $0,%6\n" /* x=0 */ - "cmpl %7,%2\n" - "jl 1b\n" - - "addl $4,%%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" /* reset MMX registers. */ - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_VgrnRGB),"m"(MMX_VredRGB), - "m"(MMX_FF00w),"m"(MMX_00FFw),"m"(MMX_UgrnRGB), - "m"(MMX_UbluRGB) - ); -} - -void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint16 *row1; - Uint16 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint16 *)out; /* 16 bit target */ - row2 = (Uint16 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*2; /* increment for row1 in byte */ - - __asm__ __volatile__( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx, 4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - "movd (%1), %%mm0\n" /* 4 Cb 0 0 0 0 u3 u2 u1 u0 */ - "pxor %%mm7, %%mm7\n" - "pushl %%ebx\n" - "movl 4(%%esp), %%ebx\n" - "movd (%%ebx), %%mm1\n" /* 4 Cr 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - - "punpcklbw %%mm7, %%mm0\n" /* 4 W cb 0 u3 0 u2 0 u1 0 u0 */ - "punpcklbw %%mm7, %%mm1\n" /* 4 W cr 0 v3 0 v2 0 v1 0 v0 */ - "psubw %9, %%mm0\n" - "psubw %9, %%mm1\n" - "movq %%mm0, %%mm2\n" /* Cb 0 u3 0 u2 0 u1 0 u0 */ - "movq %%mm1, %%mm3\n" /* Cr */ - "pmullw %10, %%mm2\n" /* Cb2green 0 R3 0 R2 0 R1 0 R0 */ - "movq (%2), %%mm6\n" /* L1 l7 L6 L5 L4 L3 L2 L1 L0 */ - "pmullw %11, %%mm0\n" /* Cb2blue */ - "pand %12, %%mm6\n" /* L1 00 L6 00 L4 00 L2 00 L0 */ - "pmullw %13, %%mm3\n" /* Cr2green */ - "movq (%2), %%mm7\n" /* L2 */ - "pmullw %14, %%mm1\n" /* Cr2red */ - "psrlw $8, %%mm7\n" /* L2 00 L7 00 L5 00 L3 00 L1 */ - "pmullw %15, %%mm6\n" /* lum1 */ - "paddw %%mm3, %%mm2\n" /* Cb2green + Cr2green == green */ - "pmullw %15, %%mm7\n" /* lum2 */ - - "movq %%mm6, %%mm4\n" /* lum1 */ - "paddw %%mm0, %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */ - "movq %%mm4, %%mm5\n" /* lum1 */ - "paddw %%mm1, %%mm4\n" /* lum1 +red 00 R6 00 R4 00 R2 00 R0 */ - "paddw %%mm2, %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */ - "psraw $6, %%mm4\n" /* R1 0 .. 64 */ - "movq %%mm7, %%mm3\n" /* lum2 00 L7 00 L5 00 L3 00 L1 */ - "psraw $6, %%mm5\n" /* G1 - .. + */ - "paddw %%mm0, %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */ - "psraw $6, %%mm6\n" /* B1 0 .. 64 */ - "packuswb %%mm4, %%mm4\n" /* R1 R1 */ - "packuswb %%mm5, %%mm5\n" /* G1 G1 */ - "packuswb %%mm6, %%mm6\n" /* B1 B1 */ - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - - "pand %16, %%mm4\n" - "psllw $3, %%mm5\n" /* GREEN 1 */ - "punpcklbw %%mm6, %%mm6\n" - "pand %17, %%mm5\n" - "pand %16, %%mm6\n" - "por %%mm5, %%mm4\n" /* */ - "psrlw $11, %%mm6\n" /* BLUE 1 */ - "movq %%mm3, %%mm5\n" /* lum2 */ - "paddw %%mm1, %%mm3\n" /* lum2 +red 00 R7 00 R5 00 R3 00 R1 */ - "paddw %%mm2, %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */ - "psraw $6, %%mm3\n" /* R2 */ - "por %%mm6, %%mm4\n" /* MM4 */ - "psraw $6, %%mm5\n" /* G2 */ - "movq (%2, %4), %%mm6\n" /* L3 load lum2 */ - "psraw $6, %%mm7\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm5, %%mm5\n" - "packuswb %%mm7, %%mm7\n" - "pand %12, %%mm6\n" /* L3 */ - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm5, %%mm5\n" - "pmullw %15, %%mm6\n" /* lum3 */ - "punpcklbw %%mm7, %%mm7\n" - "psllw $3, %%mm5\n" /* GREEN 2 */ - "pand %16, %%mm7\n" - "pand %16, %%mm3\n" - "psrlw $11, %%mm7\n" /* BLUE 2 */ - "pand %17, %%mm5\n" - "por %%mm7, %%mm3\n" - "movq (%2,%4), %%mm7\n" /* L4 load lum2 */ - "por %%mm5, %%mm3\n" - "psrlw $8, %%mm7\n" /* L4 */ - "movq %%mm4, %%mm5\n" - "punpcklwd %%mm3, %%mm4\n" - "pmullw %15, %%mm7\n" /* lum4 */ - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%3)\n" /* write row1 */ - "movq %%mm5, 8(%3)\n" /* write row1 */ - - "movq %%mm6, %%mm4\n" /* Lum3 */ - "paddw %%mm0, %%mm6\n" /* Lum3 +blue */ - - "movq %%mm4, %%mm5\n" /* Lum3 */ - "paddw %%mm1, %%mm4\n" /* Lum3 +red */ - "paddw %%mm2, %%mm5\n" /* Lum3 +green */ - "psraw $6, %%mm4\n" - "movq %%mm7, %%mm3\n" /* Lum4 */ - "psraw $6, %%mm5\n" - "paddw %%mm0, %%mm7\n" /* Lum4 +blue */ - "psraw $6, %%mm6\n" /* Lum3 +blue */ - "movq %%mm3, %%mm0\n" /* Lum4 */ - "packuswb %%mm4, %%mm4\n" - "paddw %%mm1, %%mm3\n" /* Lum4 +red */ - "packuswb %%mm5, %%mm5\n" - "paddw %%mm2, %%mm0\n" /* Lum4 +green */ - "packuswb %%mm6, %%mm6\n" - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - "punpcklbw %%mm6, %%mm6\n" - "psllw $3, %%mm5\n" /* GREEN 3 */ - "pand %16, %%mm4\n" - "psraw $6, %%mm3\n" /* psr 6 */ - "psraw $6, %%mm0\n" - "pand %16, %%mm6\n" /* BLUE */ - "pand %17, %%mm5\n" - "psrlw $11, %%mm6\n" /* BLUE 3 */ - "por %%mm5, %%mm4\n" - "psraw $6, %%mm7\n" - "por %%mm6, %%mm4\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm0, %%mm0\n" - "packuswb %%mm7, %%mm7\n" - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm0, %%mm0\n" - "punpcklbw %%mm7, %%mm7\n" - "pand %16, %%mm3\n" - "pand %16, %%mm7\n" /* BLUE */ - "psllw $3, %%mm0\n" /* GREEN 4 */ - "psrlw $11, %%mm7\n" - "pand %17, %%mm0\n" - "por %%mm7, %%mm3\n" - "por %%mm0, %%mm3\n" - - "movq %%mm4, %%mm5\n" - - "punpcklwd %%mm3, %%mm4\n" - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%5)\n" - "movq %%mm5, 8(%5)\n" - - "addl $8, %6\n" - "addl $8, %2\n" - "addl $4, (%%esp)\n" - "addl $4, %1\n" - "cmpl %4, %6\n" - "leal 16(%3), %3\n" - "leal 16(%5),%5\n" /* row2+16 */ - - "jl 1b\n" - "addl %4, %2\n" /* lum += cols */ - "addl %8, %3\n" /* row1+= mod */ - "addl %8, %5\n" /* row2+= mod */ - "movl $0, %6\n" /* x=0 */ - "cmpl %7, %2\n" - "jl 1b\n" - "addl $4, %%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_Ugrn565),"m"(MMX_Ublu5x5), - "m"(MMX_00FFw),"m"(MMX_Vgrn565),"m"(MMX_Vred5x5), - "m"(MMX_Ycoeff),"m"(MMX_red565),"m"(MMX_grn565) - ); -} - -/* *INDENT-ON* */ - -#endif /* GCC3 i386 inline assembly */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw.c b/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw.c deleted file mode 100644 index 7fc6b88654..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw.c +++ /dev/null @@ -1,1405 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -/* This is the software implementation of the YUV texture support */ - -/* This code was derived from code carrying the following copyright notices: - - * Copyright (c) 1995 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Copyright (c) 1995 Erik Corry - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF - * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Portions of this software Copyright (c) 1995 Brown University. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement - * is hereby granted, provided that the above copyright notice and the - * following two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#include "SDL_assert.h" -#include "SDL_video.h" -#include "SDL_cpuinfo.h" -#include "SDL_yuv_sw_c.h" - - -/* The colorspace conversion functions */ - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES -extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -#endif - -static void -Color16DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row1; - unsigned short *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned short *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1; - unsigned char *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = out; - row2 = row1 + cols * 3 + mod * 3; - lum2 = lum + cols; - - mod += cols + mod; - mod *= 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1; - unsigned int *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned int *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols + (mod / 2); - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + (mod / 2); - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1 = out; - const int next_row = (cols * 2 + mod) * 3; - unsigned char *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = next_row * 3 + mod * 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols * 2 + mod; - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color16DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned short *) out; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - } - - row += mod; - } -} - -static void -Color24DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned char *) out; - mod *= 3; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - } - row += mod; - } -} - -static void -Color32DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned int *) out; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - } - row += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols + (mod / 2); - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - } - row += next_row; - } -} - -static void -Color24DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row = out; - const int next_row = (cols * 2 + mod) * 3; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - } - row += next_row; - } -} - -static void -Color32DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols * 2 + mod; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - mod += mod; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - - } - - row += next_row; - } -} - -/* - * How many 1 bits are there in the Uint32. - * Low performance, do not call often. - */ -static int -number_of_bits_set(Uint32 a) -{ - if (!a) - return 0; - if (a & 1) - return 1 + number_of_bits_set(a >> 1); - return (number_of_bits_set(a >> 1)); -} - -/* - * How many 0 bits are there at least significant end of Uint32. - * Low performance, do not call often. - */ -static int -free_bits_at_bottom(Uint32 a) -{ - /* assume char is 8 bits */ - if (!a) - return sizeof(Uint32) * 8; - if (((Sint32) a) & 1l) - return 0; - return 1 + free_bits_at_bottom(a >> 1); -} - -static int -SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format) -{ - Uint32 *r_2_pix_alloc; - Uint32 *g_2_pix_alloc; - Uint32 *b_2_pix_alloc; - int i; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - - if (!SDL_PixelFormatEnumToMasks - (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) { - return SDL_SetError("Unsupported YUV destination format"); - } - - swdata->target_format = target_format; - r_2_pix_alloc = &swdata->rgb_2_pix[0 * 768]; - g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768]; - b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768]; - - /* - * Set up entries 0-255 in rgb-to-pixel value tables. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Rmask)); - r_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Rmask); - r_2_pix_alloc[i + 256] |= Amask; - g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Gmask)); - g_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Gmask); - g_2_pix_alloc[i + 256] |= Amask; - b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Bmask)); - b_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Bmask); - b_2_pix_alloc[i + 256] |= Amask; - } - - /* - * If we have 16-bit output depth, then we double the value - * in the top word. This means that we can write out both - * pixels in the pixel doubling mode with one op. It is - * harmless in the normal case as storing a 32-bit value - * through a short pointer will lose the top bits anyway. - */ - if (SDL_BYTESPERPIXEL(target_format) == 2) { - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16; - g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16; - b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16; - } - } - - /* - * Spread out the values we have to the rest of the array so that - * we do not need to check for overflow. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i] = r_2_pix_alloc[256]; - r_2_pix_alloc[i + 512] = r_2_pix_alloc[511]; - g_2_pix_alloc[i] = g_2_pix_alloc[256]; - g_2_pix_alloc[i + 512] = g_2_pix_alloc[511]; - b_2_pix_alloc[i] = b_2_pix_alloc[256]; - b_2_pix_alloc[i + 512] = b_2_pix_alloc[511]; - } - - /* You have chosen wisely... */ - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - if (SDL_BYTESPERPIXEL(target_format) == 2) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0xF800) && - (Gmask == 0x07E0) && (Bmask == 0x001F) - && (swdata->w & 15) == 0) { -/* printf("Using MMX 16-bit 565 dither\n"); */ - swdata->Display1X = Color565DitherYV12MMX1X; - } else { -/* printf("Using C 16-bit dither\n"); */ - swdata->Display1X = Color16DitherYV12Mod1X; - } -#else - swdata->Display1X = Color16DitherYV12Mod1X; -#endif - swdata->Display2X = Color16DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYV12Mod1X; - swdata->Display2X = Color24DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0x00FF0000) && - (Gmask == 0x0000FF00) && - (Bmask == 0x000000FF) && (swdata->w & 15) == 0) { -/* printf("Using MMX 32-bit dither\n"); */ - swdata->Display1X = ColorRGBDitherYV12MMX1X; - } else { -/* printf("Using C 32-bit dither\n"); */ - swdata->Display1X = Color32DitherYV12Mod1X; - } -#else - swdata->Display1X = Color32DitherYV12Mod1X; -#endif - swdata->Display2X = Color32DitherYV12Mod2X; - } - break; - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - if (SDL_BYTESPERPIXEL(target_format) == 2) { - swdata->Display1X = Color16DitherYUY2Mod1X; - swdata->Display2X = Color16DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYUY2Mod1X; - swdata->Display2X = Color24DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { - swdata->Display1X = Color32DitherYUY2Mod1X; - swdata->Display2X = Color32DitherYUY2Mod2X; - } - break; - default: - /* We should never get here (caught above) */ - break; - } - - SDL_FreeSurface(swdata->display); - swdata->display = NULL; - return 0; -} - -SDL_SW_YUVTexture * -SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) -{ - SDL_SW_YUVTexture *swdata; - int *Cr_r_tab; - int *Cr_g_tab; - int *Cb_g_tab; - int *Cb_b_tab; - int i; - int CR, CB; - - switch (format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - break; - default: - SDL_SetError("Unsupported YUV format"); - return NULL; - } - - swdata = (SDL_SW_YUVTexture *) SDL_calloc(1, sizeof(*swdata)); - if (!swdata) { - SDL_OutOfMemory(); - return NULL; - } - - swdata->format = format; - swdata->target_format = SDL_PIXELFORMAT_UNKNOWN; - swdata->w = w; - swdata->h = h; - swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2); - swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); - swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); - if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) { - SDL_SW_DestroyYUVTexture(swdata); - SDL_OutOfMemory(); - return NULL; - } - - /* Generate the tables for the display surface */ - Cr_r_tab = &swdata->colortab[0 * 256]; - Cr_g_tab = &swdata->colortab[1 * 256]; - Cb_g_tab = &swdata->colortab[2 * 256]; - Cb_b_tab = &swdata->colortab[3 * 256]; - for (i = 0; i < 256; i++) { - /* Gamma correction (luminescence table) and chroma correction - would be done here. See the Berkeley mpeg_play sources. - */ - CB = CR = (i - 128); - Cr_r_tab[i] = (int) ((0.419 / 0.299) * CR); - Cr_g_tab[i] = (int) (-(0.299 / 0.419) * CR); - Cb_g_tab[i] = (int) (-(0.114 / 0.331) * CB); - Cb_b_tab[i] = (int) ((0.587 / 0.331) * CB); - } - - /* Find the pitch and offset values for the overlay */ - switch (format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - swdata->pitches[0] = w; - swdata->pitches[1] = swdata->pitches[0] / 2; - swdata->pitches[2] = swdata->pitches[0] / 2; - swdata->planes[0] = swdata->pixels; - swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; - swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2; - break; - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - swdata->pitches[0] = w * 2; - swdata->planes[0] = swdata->pixels; - break; - default: - SDL_assert(0 && "We should never get here (caught above)"); - break; - } - - /* We're all done.. */ - return (swdata); -} - -int -SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels, - int *pitch) -{ - *pixels = swdata->planes[0]; - *pitch = swdata->pitches[0]; - return 0; -} - -int -SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, - const void *pixels, int pitch) -{ - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - if (rect->x == 0 && rect->y == 0 && - rect->w == swdata->w && rect->h == swdata->h) { - SDL_memcpy(swdata->pixels, pixels, - (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2); - } else { - Uint8 *src, *dst; - int row; - size_t length; - - /* Copy the Y plane */ - src = (Uint8 *) pixels; - dst = swdata->pixels + rect->y * swdata->w + rect->x; - length = rect->w; - for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, src, length); - src += pitch; - dst += swdata->w; - } - - /* Copy the next plane */ - src = (Uint8 *) pixels + rect->h * pitch; - dst = swdata->pixels + swdata->h * swdata->w; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { - SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; - } - - /* Copy the next plane */ - src = (Uint8 *) pixels + rect->h * pitch + (rect->h * pitch) / 4; - dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { - SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; - } - } - break; - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - { - Uint8 *src, *dst; - int row; - size_t length; - - src = (Uint8 *) pixels; - dst = - swdata->planes[0] + rect->y * swdata->pitches[0] + - rect->x * 2; - length = rect->w * 2; - for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, src, length); - src += pitch; - dst += swdata->pitches[0]; - } - } - break; - } - return 0; -} - -int -SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, - const Uint8 *Yplane, int Ypitch, - const Uint8 *Uplane, int Upitch, - const Uint8 *Vplane, int Vpitch) -{ - const Uint8 *src; - Uint8 *dst; - int row; - size_t length; - - /* Copy the Y plane */ - src = Yplane; - dst = swdata->pixels + rect->y * swdata->w + rect->x; - length = rect->w; - for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, src, length); - src += Ypitch; - dst += swdata->w; - } - - /* Copy the U plane */ - src = Uplane; - if (swdata->format == SDL_PIXELFORMAT_IYUV) { - dst = swdata->pixels + swdata->h * swdata->w; - } else { - dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; - } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { - SDL_memcpy(dst, src, length); - src += Upitch; - dst += swdata->w/2; - } - - /* Copy the V plane */ - src = Vplane; - if (swdata->format == SDL_PIXELFORMAT_YV12) { - dst = swdata->pixels + swdata->h * swdata->w; - } else { - dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; - } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { - SDL_memcpy(dst, src, length); - src += Vpitch; - dst += swdata->w/2; - } - return 0; -} - -int -SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, - void **pixels, int *pitch) -{ - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - if (rect - && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w - || rect->h != swdata->h)) { - return SDL_SetError - ("YV12 and IYUV textures only support full surface locks"); - } - break; - } - - if (rect) { - *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2; - } else { - *pixels = swdata->planes[0]; - } - *pitch = swdata->pitches[0]; - return 0; -} - -void -SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata) -{ -} - -int -SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, - Uint32 target_format, int w, int h, void *pixels, - int pitch) -{ - const int targetbpp = SDL_BYTESPERPIXEL(target_format); - int stretch; - int scale_2x; - Uint8 *lum, *Cr, *Cb; - int mod; - - if (targetbpp == 0) { - return SDL_SetError("Invalid target pixel format"); - } - - /* Make sure we're set up to display in the desired format */ - if (target_format != swdata->target_format) { - if (SDL_SW_SetupYUVDisplay(swdata, target_format) < 0) { - return -1; - } - } - - stretch = 0; - scale_2x = 0; - if (srcrect->x || srcrect->y || srcrect->w < swdata->w - || srcrect->h < swdata->h) { - /* The source rectangle has been clipped. - Using a scratch surface is easier than adding clipped - source support to all the blitters, plus that would - slow them down in the general unclipped case. - */ - stretch = 1; - } else if ((srcrect->w != w) || (srcrect->h != h)) { - if ((w == 2 * srcrect->w) && (h == 2 * srcrect->h)) { - scale_2x = 1; - } else { - stretch = 1; - } - } - if (stretch) { - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - - if (swdata->display) { - swdata->display->w = w; - swdata->display->h = h; - swdata->display->pixels = pixels; - swdata->display->pitch = pitch; - } else { - /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */ - SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask, - &Bmask, &Amask); - swdata->display = - SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, - Gmask, Bmask, Amask); - if (!swdata->display) { - return (-1); - } - } - if (!swdata->stretch) { - /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */ - SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask, - &Bmask, &Amask); - swdata->stretch = - SDL_CreateRGBSurface(0, swdata->w, swdata->h, bpp, Rmask, - Gmask, Bmask, Amask); - if (!swdata->stretch) { - return (-1); - } - } - pixels = swdata->stretch->pixels; - pitch = swdata->stretch->pitch; - } - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - lum = swdata->planes[0]; - Cr = swdata->planes[1]; - Cb = swdata->planes[2]; - break; - case SDL_PIXELFORMAT_IYUV: - lum = swdata->planes[0]; - Cr = swdata->planes[2]; - Cb = swdata->planes[1]; - break; - case SDL_PIXELFORMAT_YUY2: - lum = swdata->planes[0]; - Cr = lum + 3; - Cb = lum + 1; - break; - case SDL_PIXELFORMAT_UYVY: - lum = swdata->planes[0] + 1; - Cr = lum + 1; - Cb = lum - 1; - break; - case SDL_PIXELFORMAT_YVYU: - lum = swdata->planes[0]; - Cr = lum + 1; - Cb = lum + 3; - break; - default: - return SDL_SetError("Unsupported YUV format in copy"); - } - mod = (pitch / targetbpp); - - if (scale_2x) { - mod -= (swdata->w * 2); - swdata->Display2X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); - } else { - mod -= swdata->w; - swdata->Display1X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); - } - if (stretch) { - SDL_Rect rect = *srcrect; - SDL_SoftStretch(swdata->stretch, &rect, swdata->display, NULL); - } - return 0; -} - -void -SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata) -{ - if (swdata) { - SDL_free(swdata->pixels); - SDL_free(swdata->colortab); - SDL_free(swdata->rgb_2_pix); - SDL_FreeSurface(swdata->stretch); - SDL_FreeSurface(swdata->display); - SDL_free(swdata); - } -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/mmx.h b/3rdparty/sdl2-2.0.4/src/render/mmx.h deleted file mode 100644 index 3bd00ac239..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/mmx.h +++ /dev/null @@ -1,642 +0,0 @@ -/* mmx.h - - MultiMedia eXtensions GCC interface library for IA32. - - To use this library, simply include this header file - and compile with GCC. You MUST have inlining enabled - in order for mmx_ok() to work; this can be done by - simply using -O on the GCC command line. - - Compiling with -DMMX_TRACE will cause detailed trace - output to be sent to stderr for each mmx operation. - This adds lots of code, and obviously slows execution to - a crawl, but can be very useful for debugging. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT - LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR ANY PARTICULAR PURPOSE. - - 1997-99 by H. Dietz and R. Fisher - - Notes: - It appears that the latest gas has the pand problem fixed, therefore - I'll undefine BROKEN_PAND by default. -*/ - -#ifndef _MMX_H -#define _MMX_H - - -/* Warning: at this writing, the version of GAS packaged - with most Linux distributions does not handle the - parallel AND operation mnemonic correctly. If the - symbol BROKEN_PAND is defined, a slower alternative - coding will be used. If execution of mmxtest results - in an illegal instruction fault, define this symbol. -*/ -#undef BROKEN_PAND - - -/* The type of an value that fits in an MMX register - (note that long long constant values MUST be suffixed - by LL and unsigned long long values by ULL, lest - they be truncated by the compiler) -*/ -typedef union -{ - long long q; /* Quadword (64-bit) value */ - unsigned long long uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} __attribute__ ((aligned(8))) mmx_t; /* On an 8-byte (64-bit) boundary */ - - -#if 0 -/* Function to test if multimedia instructions are supported... -*/ -inline extern int -mm_support(void) -{ - /* Returns 1 if MMX instructions are supported, - 3 if Cyrix MMX and Extended MMX instructions are supported - 5 if AMD MMX and 3DNow! instructions are supported - 0 if hardware does not support any of these - */ - register int rval = 0; - - __asm__ __volatile__( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushf\n\t" - "popl %%eax\n\t" "movl %%eax, %%ecx\n\t" - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xorl $0x200000, %%eax\n\t" - "push %%eax\n\t" "popf\n\t" - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" "popl %%eax\n\t" - /* ... Compare and test result */ - "xorl %%eax, %%ecx\n\t" "testl $0x200000, %%ecx\n\t" "jz NotSupported1\n\t" /* CPUID not supported */ - /* Get standard CPUID information, and - go to a specific vendor section */ - "movl $0, %%eax\n\t" "cpuid\n\t" - /* Check for Intel */ - "cmpl $0x756e6547, %%ebx\n\t" - "jne TryAMD\n\t" - "cmpl $0x49656e69, %%edx\n\t" - "jne TryAMD\n\t" - "cmpl $0x6c65746e, %%ecx\n" - "jne TryAMD\n\t" "jmp Intel\n\t" - /* Check for AMD */ - "\nTryAMD:\n\t" - "cmpl $0x68747541, %%ebx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x69746e65, %%edx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x444d4163, %%ecx\n" - "jne TryCyrix\n\t" "jmp AMD\n\t" - /* Check for Cyrix */ - "\nTryCyrix:\n\t" - "cmpl $0x69727943, %%ebx\n\t" - "jne NotSupported2\n\t" - "cmpl $0x736e4978, %%edx\n\t" - "jne NotSupported3\n\t" - "cmpl $0x64616574, %%ecx\n\t" - "jne NotSupported4\n\t" - /* Drop through to Cyrix... */ - /* Cyrix Section */ - /* See if extended CPUID level 80000001 is supported */ - /* The value of CPUID/80000001 for the 6x86MX is undefined - according to the Cyrix CPU Detection Guide (Preliminary - Rev. 1.01 table 1), so we'll check the value of eax for - CPUID/0 to see if standard CPUID level 2 is supported. - According to the table, the only CPU which supports level - 2 is also the only one which supports extended CPUID levels. - */ - "cmpl $0x2, %%eax\n\t" "jne MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported (in theory), so get extended - features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%eax\n\t" /* Test for MMX */ - "jz NotSupported5\n\t" /* MMX not supported */ - "testl $0x01000000, %%eax\n\t" /* Test for Ext'd MMX */ - "jnz EMMXSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "EMMXSupported:\n\t" "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */ - "jmp Return\n\t" - /* AMD Section */ - "AMD:\n\t" - /* See if extended CPUID is supported */ - "movl $0x80000000, %%eax\n\t" "cpuid\n\t" "cmpl $0x80000000, %%eax\n\t" "jl MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported6\n\t" /* MMX not supported */ - "testl $0x80000000, %%edx\n\t" /* Test for 3DNow! */ - "jnz ThreeDNowSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "ThreeDNowSupported:\n\t" "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */ - "jmp Return\n\t" - /* Intel Section */ - "Intel:\n\t" - /* Check for MMX */ - "MMXtest:\n\t" "movl $1, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported7\n\t" /* MMX Not supported */ - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\t" - /* Nothing supported */ - "\nNotSupported1:\n\t" "#movl $101, %0:\n\n\t" "\nNotSupported2:\n\t" "#movl $102, %0:\n\n\t" "\nNotSupported3:\n\t" "#movl $103, %0:\n\n\t" "\nNotSupported4:\n\t" "#movl $104, %0:\n\n\t" "\nNotSupported5:\n\t" "#movl $105, %0:\n\n\t" "\nNotSupported6:\n\t" "#movl $106, %0:\n\n\t" "\nNotSupported7:\n\t" "#movl $107, %0:\n\n\t" "movl $0, %0:\n\n\t" "Return:\n\t":"=a"(rval): /* no input */ - :"eax", "ebx", "ecx", "edx"); - - /* Return */ - return (rval); -} - -/* Function to test if mmx instructions are supported... -*/ -inline extern int -mmx_ok(void) -{ - /* Returns 1 if MMX instructions are supported, 0 otherwise */ - return (mm_support() & 0x1); -} -#endif - -/* Helper functions for the instruction macros that follow... - (note that memory-to-register, m2r, instructions are nearly - as efficient as register-to-register, r2r, instructions; - however, memory-to-memory instructions are really simulated - as a convenience, and are only 1/3 as efficient) -*/ -#ifdef MMX_TRACE - -/* Include the stuff for printing a trace to stderr... -*/ - -#define mmx_i2r(op, imm, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace.uq = (imm); \ - printf(#op "_i2r(" #imm "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2r(op, mem, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mem); \ - printf(#op "_m2r(" #mem "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2m(op, reg, mem) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2m(" #reg "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2r(op, regs, regd) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #regs ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2r(" #regs "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2m(op, mems, memd) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mems); \ - printf(#op "_m2m(" #mems "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#else - -/* These macros are a lot simpler without the tracing... -*/ - -#define mmx_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm) ) - -#define mmx_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "m" (mem)) - -#define mmx_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=m" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define mmx_m2m(op, mems, memd) \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) - -#endif - - -/* 1x64 MOVe Quadword - (this is both a load and a store... - in fact, it is the only way to store) -*/ -#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) -#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) -#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) -#define movq(vars, vard) \ - __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 1x32 MOVe Doubleword - (like movq, this is both load and store... - but is most useful for moving things between - mmx registers and ordinary registers) -*/ -#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) -#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) -#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) -#define movd(vars, vard) \ - __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ - "movd %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 2x32, 4x16, and 8x8 Parallel ADDs -*/ -#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) -#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) -#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) - -#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) -#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) -#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) - -#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) -#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) -#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic -*/ -#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) -#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) -#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) - -#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) -#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) -#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic -*/ -#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) -#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) -#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) - -#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) -#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) -#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel SUBs -*/ -#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) -#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) -#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) - -#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) -#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) -#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) - -#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) -#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) -#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic -*/ -#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) -#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) -#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) - -#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) -#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) -#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic -*/ -#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) -#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) -#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) - -#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) -#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) -#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) - - -/* 4x16 Parallel MULs giving Low 4x16 portions of results -*/ -#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) -#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) -#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) - - -/* 4x16 Parallel MULs giving High 4x16 portions of results -*/ -#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) -#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) -#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) - - -/* 4x16->2x32 Parallel Mul-ADD - (muls like pmullw, then adds adjacent 16-bit fields - in the multiply result to make the final 2x32 result) -*/ -#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) -#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) -#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) - - -/* 1x64 bitwise AND -*/ -#ifdef BROKEN_PAND -#define pand_m2r(var, reg) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, reg); \ - mmx_m2r(pandn, var, reg); \ - } -#define pand_r2r(regs, regd) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, regd); \ - mmx_r2r(pandn, regs, regd) \ - } -#define pand(vars, vard) \ - { \ - movq_m2r(vard, mm0); \ - mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ - mmx_m2r(pandn, vars, mm0); \ - movq_r2m(mm0, vard); \ - } -#else -#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) -#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) -#define pand(vars, vard) mmx_m2m(pand, vars, vard) -#endif - - -/* 1x64 bitwise AND with Not the destination -*/ -#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) -#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) -#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) - - -/* 1x64 bitwise OR -*/ -#define por_m2r(var, reg) mmx_m2r(por, var, reg) -#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) -#define por(vars, vard) mmx_m2m(por, vars, vard) - - -/* 1x64 bitwise eXclusive OR -*/ -#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) -#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) -#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality - (resulting fields are either 0 or -1) -*/ -#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) -#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) - -#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) -#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) - -#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) -#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than - (resulting fields are either 0 or -1) -*/ -#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) -#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) - -#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) -#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) - -#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) -#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical -*/ -#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) -#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) -#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) -#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) - -#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) -#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) -#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) -#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) - -#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) -#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) -#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) -#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical -*/ -#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) -#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) -#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) -#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) - -#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) -#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) -#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) -#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) - -#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) -#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) -#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) -#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) - - -/* 2x32 and 4x16 Parallel Shift Right Arithmetic -*/ -#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) -#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) -#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) -#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) - -#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) -#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) -#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) -#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) - - -/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate - (packs source and dest fields into dest in that order) -*/ -#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) -#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) -#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) - -#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) -#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) -#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) - - -/* 4x16->8x8 PACK and Unsigned Saturate - (packs source and dest fields into dest in that order) -*/ -#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) -#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) -#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low - (interleaves low half of dest with low half of source - as padding in each result field) -*/ -#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) -#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) -#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) - -#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) -#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) -#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) - -#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) -#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) -#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High - (interleaves high half of dest with high half of source - as padding in each result field) -*/ -#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) -#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) -#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) - -#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) -#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) -#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) - -#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) -#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) -#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) - - -/* Empty MMx State - (used to clean-up when going from mmx to float use - of the registers that are shared by both; note that - there is no float-to-mmx operation needed, because - only the float tag word info is corruptible) -*/ -#ifdef MMX_TRACE - -#define emms() \ - { \ - printf("emms()\n"); \ - __asm__ __volatile__ ("emms"); \ - } - -#else - -#define emms() __asm__ __volatile__ ("emms") - -#endif - -#endif -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.c b/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.c deleted file mode 100644 index bcf7b43150..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.c +++ /dev/null @@ -1,463 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED - -#include "SDL_stdinc.h" -#include "SDL_log.h" -#include "SDL_opengl.h" -#include "SDL_video.h" -#include "SDL_shaders_gl.h" - -/* OpenGL shader implementation */ - -/* #define DEBUG_SHADERS */ - -typedef struct -{ - GLhandleARB program; - GLhandleARB vert_shader; - GLhandleARB frag_shader; -} GL_ShaderData; - -struct GL_ShaderContext -{ - GLenum (*glGetError)(void); - - PFNGLATTACHOBJECTARBPROC glAttachObjectARB; - PFNGLCOMPILESHADERARBPROC glCompileShaderARB; - PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; - PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; - PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; - PFNGLGETINFOLOGARBPROC glGetInfoLogARB; - PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; - PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; - PFNGLLINKPROGRAMARBPROC glLinkProgramARB; - PFNGLSHADERSOURCEARBPROC glShaderSourceARB; - PFNGLUNIFORM1IARBPROC glUniform1iARB; - PFNGLUNIFORM1FARBPROC glUniform1fARB; - PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; - - SDL_bool GL_ARB_texture_rectangle_supported; - - GL_ShaderData shaders[NUM_SHADERS]; -}; - -/* - * NOTE: Always use sampler2D, etc here. We'll #define them to the - * texture_rectangle versions if we choose to use that extension. - */ -static const char *shader_source[NUM_SHADERS][2] = -{ - /* SHADER_NONE */ - { NULL, NULL }, - - /* SHADER_SOLID */ - { - /* vertex shader */ -"varying vec4 v_color;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -"}", - /* fragment shader */ -"varying vec4 v_color;\n" -"\n" -"void main()\n" -"{\n" -" gl_FragColor = v_color;\n" -"}" - }, - - /* SHADER_RGB */ - { - /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", - /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0;\n" -"\n" -"void main()\n" -"{\n" -" gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" -"}" - }, - - /* SHADER_YUV */ - { - /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", - /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U \n" -"uniform sampler2D tex2; // V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.y = texture2D(tex1, tcoord).r;\n" -" yuv.z = texture2D(tex2, tcoord).r;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" - }, - - /* SHADER_NV12 */ - { - /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", - /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ra;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" - }, - - /* SHADER_NV21 */ - { - /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", - /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ar;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" - }, -}; - -static SDL_bool -CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char *defines, const char *source) -{ - GLint status; - const char *sources[2]; - - sources[0] = defines; - sources[1] = source; - - ctx->glShaderSourceARB(shader, SDL_arraysize(sources), sources, NULL); - ctx->glCompileShaderARB(shader); - ctx->glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); - if (status == 0) { - GLint length; - char *info; - - ctx->glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - info = SDL_stack_alloc(char, length+1); - ctx->glGetInfoLogARB(shader, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, - "Failed to compile shader:\n%s%s\n%s", defines, source, info); -#ifdef DEBUG_SHADERS - fprintf(stderr, - "Failed to compile shader:\n%s%s\n%s", defines, source, info); -#endif - SDL_stack_free(info); - - return SDL_FALSE; - } else { - return SDL_TRUE; - } -} - -static SDL_bool -CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data) -{ - const int num_tmus_bound = 4; - const char *vert_defines = ""; - const char *frag_defines = ""; - int i; - GLint location; - - if (index == SHADER_NONE) { - return SDL_TRUE; - } - - ctx->glGetError(); - - /* Make sure we use the correct sampler type for our texture type */ - if (ctx->GL_ARB_texture_rectangle_supported) { - frag_defines = -"#define sampler2D sampler2DRect\n" -"#define texture2D texture2DRect\n" -"#define UVCoordScale 0.5\n"; - } else { - frag_defines = -"#define UVCoordScale 1.0\n"; - } - - /* Create one program object to rule them all */ - data->program = ctx->glCreateProgramObjectARB(); - - /* Create the vertex shader */ - data->vert_shader = ctx->glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - if (!CompileShader(ctx, data->vert_shader, vert_defines, shader_source[index][0])) { - return SDL_FALSE; - } - - /* Create the fragment shader */ - data->frag_shader = ctx->glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - if (!CompileShader(ctx, data->frag_shader, frag_defines, shader_source[index][1])) { - return SDL_FALSE; - } - - /* ... and in the darkness bind them */ - ctx->glAttachObjectARB(data->program, data->vert_shader); - ctx->glAttachObjectARB(data->program, data->frag_shader); - ctx->glLinkProgramARB(data->program); - - /* Set up some uniform variables */ - ctx->glUseProgramObjectARB(data->program); - for (i = 0; i < num_tmus_bound; ++i) { - char tex_name[10]; - SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i); - location = ctx->glGetUniformLocationARB(data->program, tex_name); - if (location >= 0) { - ctx->glUniform1iARB(location, i); - } - } - ctx->glUseProgramObjectARB(0); - - return (ctx->glGetError() == GL_NO_ERROR); -} - -static void -DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data) -{ - ctx->glDeleteObjectARB(data->vert_shader); - ctx->glDeleteObjectARB(data->frag_shader); - ctx->glDeleteObjectARB(data->program); -} - -GL_ShaderContext * -GL_CreateShaderContext() -{ - GL_ShaderContext *ctx; - SDL_bool shaders_supported; - int i; - - ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx)); - if (!ctx) { - return NULL; - } - - if (!SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two") && - (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") || - SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle"))) { - ctx->GL_ARB_texture_rectangle_supported = SDL_TRUE; - } - - /* Check for shader support */ - shaders_supported = SDL_FALSE; - if (SDL_GL_ExtensionSupported("GL_ARB_shader_objects") && - SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") && - SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") && - SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) { - ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError"); - ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB"); - ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB"); - ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB"); - ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB"); - ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB"); - ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB"); - ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB"); - ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB"); - ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB"); - ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB"); - ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB"); - ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB"); - ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB"); - if (ctx->glGetError && - ctx->glAttachObjectARB && - ctx->glCompileShaderARB && - ctx->glCreateProgramObjectARB && - ctx->glCreateShaderObjectARB && - ctx->glDeleteObjectARB && - ctx->glGetInfoLogARB && - ctx->glGetObjectParameterivARB && - ctx->glGetUniformLocationARB && - ctx->glLinkProgramARB && - ctx->glShaderSourceARB && - ctx->glUniform1iARB && - ctx->glUniform1fARB && - ctx->glUseProgramObjectARB) { - shaders_supported = SDL_TRUE; - } - } - - if (!shaders_supported) { - SDL_free(ctx); - return NULL; - } - - /* Compile all the shaders */ - for (i = 0; i < NUM_SHADERS; ++i) { - if (!CompileShaderProgram(ctx, i, &ctx->shaders[i])) { - GL_DestroyShaderContext(ctx); - return NULL; - } - } - - /* We're done! */ - return ctx; -} - -void -GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader) -{ - ctx->glUseProgramObjectARB(ctx->shaders[shader].program); -} - -void -GL_DestroyShaderContext(GL_ShaderContext *ctx) -{ - int i; - - for (i = 0; i < NUM_SHADERS; ++i) { - DestroyShaderProgram(ctx, &ctx->shaders[i]); - } - SDL_free(ctx); -} - -#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.c b/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.c deleted file mode 100644 index 0c01a8c64e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.c +++ /dev/null @@ -1,906 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED - -#include "SDL_video.h" -#include "SDL_opengles2.h" -#include "SDL_shaders_gles2.h" -#include "SDL_stdinc.h" - -/************************************************************************************************* - * Vertex/fragment shader source * - *************************************************************************************************/ - -static const Uint8 GLES2_VertexSrc_Default_[] = " \ - uniform mat4 u_projection; \ - attribute vec2 a_position; \ - attribute vec2 a_texCoord; \ - attribute float a_angle; \ - attribute vec2 a_center; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - float angle = radians(a_angle); \ - float c = cos(angle); \ - float s = sin(angle); \ - mat2 rotationMatrix = mat2(c, -s, s, c); \ - vec2 position = rotationMatrix * (a_position - a_center) + a_center; \ - v_texCoord = a_texCoord; \ - gl_Position = u_projection * vec4(position, 0.0, 1.0);\ - gl_PointSize = 1.0; \ - } \ -"; - -static const Uint8 GLES2_FragmentSrc_SolidSrc_[] = " \ - precision mediump float; \ - uniform vec4 u_color; \ - \ - void main() \ - { \ - gl_FragColor = u_color; \ - } \ -"; - -static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - gl_FragColor = texture2D(u_texture, v_texCoord); \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* ARGB to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - vec4 abgr = texture2D(u_texture, v_texCoord); \ - gl_FragColor = abgr; \ - gl_FragColor.r = abgr.b; \ - gl_FragColor.b = abgr.r; \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* RGB to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - vec4 abgr = texture2D(u_texture, v_texCoord); \ - gl_FragColor = abgr; \ - gl_FragColor.r = abgr.b; \ - gl_FragColor.b = abgr.r; \ - gl_FragColor.a = 1.0; \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* BGR to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - vec4 abgr = texture2D(u_texture, v_texCoord); \ - gl_FragColor = abgr; \ - gl_FragColor.a = 1.0; \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* YUV to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureYUVSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform sampler2D u_texture_v; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.y = texture2D(u_texture_u, v_texCoord).r - 0.5; \ - yuv.z = texture2D(u_texture_v, v_texCoord).r - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* NV12 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV12Src_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ra - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; - -/* NV21 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV21Src_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; - -static const GLES2_ShaderInstance GLES2_VertexSrc_Default = { - GL_VERTEX_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_VertexSrc_Default_), - GLES2_VertexSrc_Default_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_SolidSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_SolidSrc_), - GLES2_FragmentSrc_SolidSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureABGRSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureABGRSrc_), - GLES2_FragmentSrc_TextureABGRSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureARGBSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureARGBSrc_), - GLES2_FragmentSrc_TextureARGBSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureRGBSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureRGBSrc_), - GLES2_FragmentSrc_TextureRGBSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureBGRSrc_), - GLES2_FragmentSrc_TextureBGRSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVSrc = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureYUVSrc_), - GLES2_FragmentSrc_TextureYUVSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12Src = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV12Src_), - GLES2_FragmentSrc_TextureNV12Src_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21Src = { - GL_FRAGMENT_SHADER, - GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV21Src_), - GLES2_FragmentSrc_TextureNV21Src_ -}; - - -/************************************************************************************************* - * Vertex/fragment shader binaries (NVIDIA Tegra 1/2) * - *************************************************************************************************/ - -#if GLES2_INCLUDE_NVIDIA_SHADERS - -#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B - -static const Uint8 GLES2_VertexTegra_Default_[] = { - 243, 193, 1, 142, 31, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 85, 0, 0, 0, 2, 0, 0, 0, 24, 0, 0, 0, 3, 0, 0, 0, - 91, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 5, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 95, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, - 13, 0, 0, 0, 102, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 32, 0, 0, 0, 17, 0, 0, 0, 112, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 112, 0, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 19, 0, 0, 0, 132, 0, - 0, 0, 104, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, - 95, 112, 111, 115, 105, 116, 105, 111, 110, 0, 97, 95, 116, 101, 120, 67, 111, 111, 114, 100, - 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 0, 0, 0, 0, 0, 0, 82, 139, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 80, 139, 0, - 0, 1, 0, 0, 0, 22, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 33, 0, 0, 0, 92, 139, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 240, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 64, 0, 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 193, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 66, 24, 0, 6, 34, 108, 28, - 0, 0, 42, 16, 128, 0, 195, 192, 6, 129, 252, 255, 65, 96, 108, 28, 0, 0, 0, 0, 0, 1, 195, 192, - 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 8, 1, 64, 0, 131, 192, 6, 1, 156, 159, 65, 96, 108, - 28, 0, 0, 85, 32, 0, 1, 195, 192, 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 0, 64, 64, 0, 131, - 192, 134, 1, 152, 31, 65, 96, 108, 156, 31, 64, 127, 48, 0, 1, 195, 192, 6, 129, 129, 255, 33, - 96 -}; - -static const Uint8 GLES2_FragmentTegra_None_SolidSrc_[] = { - 155, 191, 159, 1, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, 0, 240, 0, 0, - 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, - 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, 0, 0, - 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 0, 40, 0, 0, 0, 242, 65, 63, - 192, 200, 0, 0, 0, 242, 65, 63, 128, 168, 0, 0, 0, 242, 65, 63, 64, 72, 0, 0, 0, 242, 65, 63, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_SolidSrc_[] = { - 169, 153, 195, 28, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 220, 0, 0, 0, 220, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 118, 118, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 65, 37, 8, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 21, 0, - 0, 0, 0, 3, 0, 1, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 39, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, 9, 0, 0, 0, 24, 0, 4, 40, 232, 231, 15, - 0, 0, 242, 65, 62, 194, 72, 1, 0, 0, 250, 65, 63, 194, 40, 1, 0, 0, 250, 65, 63, 192, 168, 1, - 0, 0, 242, 1, 64, 192, 168, 1, 0, 0, 242, 1, 68, 168, 32, 0, 0, 0, 50, 64, 0, 192, 168, 15, - 0, 0, 242, 1, 66, 168, 64, 0, 16, 0, 242, 65, 1, 232, 231, 15, 0, 0, 242, 65, 62, 168, 160, - 0, 0, 0, 50, 64, 2, 104, 192, 0, 0, 36, 48, 66, 4, 232, 231, 15, 0, 0, 242, 65, 62, 3, 0, 6, - 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 41, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_SolidSrc_[] = { - 59, 71, 42, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 22, 22, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, - 0, 0, 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 192, 200, 0, 0, 0, 26, - 0, 70, 192, 40, 0, 0, 0, 2, 0, 64, 192, 72, 0, 0, 0, 10, 0, 66, 192, 168, 0, 0, 0, 18, 0, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_SolidSrc_[] = { - 37, 191, 49, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 32, 32, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, - 0, 0, 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, - 1, 70, 8, 32, 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_None_TextureSrc_[] = { - 220, 217, 41, 211, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, - 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 1, 0, 0, 0, 2, 0, 4, 38, 186, 81, 78, 16, 2, 1, 0, 0, 1, 0, - 1, 39, 0, 4, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, 1, 70, 8, 32, - 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, 1, 0, 6, 40, - 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_TextureSrc_[] = { - 71, 202, 114, 229, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 118, 118, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, - 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, - 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, - 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, - 81, 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, - 0, 0, 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, - 0, 242, 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 154, 192, 0, 0, 37, 34, 64, 3, 8, 32, 0, 0, 5, 58, - 208, 4, 40, 64, 0, 0, 5, 50, 208, 4, 72, 160, 0, 0, 37, 42, 208, 4, 2, 0, 6, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_TextureSrc_[] = { - 161, 234, 193, 234, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 22, 22, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, 8, 0, - 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, 81, - 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, - 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 104, 32, 1, 0, 0, 242, 1, 70, 8, 192, 1, 0, 0, 242, - 1, 64, 72, 64, 1, 0, 0, 242, 1, 68, 136, 192, 0, 0, 0, 26, 64, 4, 136, 32, 0, 0, 0, 2, 64, 7, - 136, 64, 0, 0, 0, 10, 64, 6, 136, 160, 0, 0, 0, 18, 64, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_TextureSrc_[] = { - 75, 132, 201, 227, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 32, 32, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, 8, 0, - 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, 81, - 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, - 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, 0, 242, - 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 104, 192, 0, 0, 0, 242, 65, 4, 232, 32, 0, 0, 0, 242, 65, - 0, 40, 64, 0, 0, 0, 242, 65, 6, 72, 160, 0, 0, 0, 242, 65, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const GLES2_ShaderInstance GLES2_VertexTegra_Default = { - GL_VERTEX_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_VertexTegra_Default_), - GLES2_VertexTegra_Default_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_SolidSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_SolidSrc_), - GLES2_FragmentTegra_None_SolidSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_SolidSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_SolidSrc_), - GLES2_FragmentTegra_Alpha_SolidSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_SolidSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_SolidSrc_), - GLES2_FragmentTegra_Additive_SolidSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_SolidSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_SolidSrc_), - GLES2_FragmentTegra_Modulated_SolidSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_TextureSrc_), - GLES2_FragmentTegra_None_TextureSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_TextureSrc_), - GLES2_FragmentTegra_Alpha_TextureSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_TextureSrc_), - GLES2_FragmentTegra_Additive_TextureSrc_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_TextureSrc_), - GLES2_FragmentTegra_Modulated_TextureSrc_ -}; - -#endif /* GLES2_INCLUDE_NVIDIA_SHADERS */ - -/************************************************************************************************* - * Vertex/fragment shader definitions * - *************************************************************************************************/ - -static GLES2_Shader GLES2_VertexShader_Default = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_VertexTegra_Default, -#endif - &GLES2_VertexSrc_Default - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Alpha_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureBGRSrc = { - 1, - { - &GLES2_FragmentSrc_TextureBGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureBGRSrc = { - 1, - { - &GLES2_FragmentSrc_TextureBGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureBGRSrc = { - 1, - { - &GLES2_FragmentSrc_TextureBGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureBGRSrc = { - 1, - { - &GLES2_FragmentSrc_TextureBGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_TextureYUVSrc = { - 1, - { - &GLES2_FragmentSrc_TextureYUVSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_TextureNV12Src = { - 1, - { - &GLES2_FragmentSrc_TextureNV12Src - } -}; - -static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = { - 1, - { - &GLES2_FragmentSrc_TextureNV21Src - } -}; - - -/************************************************************************************************* - * Shader selector * - *************************************************************************************************/ - -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode) -{ - switch (type) { - case GLES2_SHADER_VERTEX_DEFAULT: - return &GLES2_VertexShader_Default; - case GLES2_SHADER_FRAGMENT_SOLID_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_SolidSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_SolidSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_SolidSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_SolidSrc; - default: - return NULL; - } - case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureABGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureABGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureABGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureABGRSrc; - default: - return NULL; - } - case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureARGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureARGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureARGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureARGBSrc; - default: - return NULL; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureRGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureRGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureRGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureRGBSrc; - default: - return NULL; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureBGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureBGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureBGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureBGRSrc; - default: - return NULL; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC: - { - return &GLES2_FragmentShader_TextureYUVSrc; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC: - { - return &GLES2_FragmentShader_TextureNV12Src; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC: - { - return &GLES2_FragmentShader_TextureNV21Src; - } - - default: - return NULL; - } -} - -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_qsort.c b/3rdparty/sdl2-2.0.4/src/stdlib/SDL_qsort.c deleted file mode 100644 index 0d1978424d..0000000000 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_qsort.c +++ /dev/null @@ -1,481 +0,0 @@ -/* qsort.c - * (c) 1998 Gareth McCaughan - * - * This is a drop-in replacement for the C library's |qsort()| routine. - * - * Features: - * - Median-of-three pivoting (and more) - * - Truncation and final polishing by a single insertion sort - * - Early truncation when no swaps needed in pivoting step - * - Explicit recursion, guaranteed not to overflow - * - A few little wrinkles stolen from the GNU |qsort()|. - * - separate code for non-aligned / aligned / word-size objects - * - * This code may be reproduced freely provided - * - this file is retained unaltered apart from minor - * changes for portability and efficiency - * - no changes are made to this comment - * - any changes that *are* made are clearly flagged - * - the _ID string below is altered by inserting, after - * the date, the string " altered" followed at your option - * by other material. (Exceptions: you may change the name - * of the exported routine without changing the ID string. - * You may change the values of the macros TRUNC_* and - * PIVOT_THRESHOLD without changing the ID string, provided - * they remain constants with TRUNC_nonaligned, TRUNC_aligned - * and TRUNC_words/WORD_BYTES between 8 and 24, and - * PIVOT_THRESHOLD between 32 and 200.) - * - * You may use it in anything you like; you may make money - * out of it; you may distribute it in object form or as - * part of an executable without including source code; - * you don't have to credit me. (But it would be nice if - * you did.) - * - * If you find problems with this code, or find ways of - * making it significantly faster, please let me know! - * My e-mail address, valid as of early 1998 and certainly - * OK for at least the next 18 months, is - * gjm11@dpmms.cam.ac.uk - * Thanks! - * - * Gareth McCaughan Peterhouse Cambridge 1998 - */ - -#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) -#define SDL_DISABLE_ANALYZE_MACROS 1 -#endif - -#include "../SDL_internal.h" - -/* -#include -#include -#include -*/ -#include "SDL_stdinc.h" -#include "SDL_assert.h" - -#if defined(HAVE_QSORT) -void -SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) -{ - qsort(base, nmemb, size, compare); -} -#else - -#ifdef assert -#undef assert -#endif -#define assert(X) SDL_assert(X) -#ifdef malloc -#undef malloc -#endif -#define malloc SDL_malloc -#ifdef free -#undef free -#endif -#define free SDL_free -#ifdef memcpy -#undef memcpy -#endif -#define memcpy SDL_memcpy -#ifdef memmove -#undef memmove -#endif -#define memmove SDL_memmove -#ifdef qsort -#undef qsort -#endif -#define qsort SDL_qsort - -static const char _ID[] = ""; - -/* How many bytes are there per word? (Must be a power of 2, - * and must in fact equal sizeof(int).) - */ -#define WORD_BYTES sizeof(int) - -/* How big does our stack need to be? Answer: one entry per - * bit in a |size_t|. - */ -#define STACK_SIZE (8*sizeof(size_t)) - -/* Different situations have slightly different requirements, - * and we make life epsilon easier by using different truncation - * points for the three different cases. - * So far, I have tuned TRUNC_words and guessed that the same - * value might work well for the other two cases. Of course - * what works well on my machine might work badly on yours. - */ -#define TRUNC_nonaligned 12 -#define TRUNC_aligned 12 -#define TRUNC_words 12*WORD_BYTES /* nb different meaning */ - -/* We use a simple pivoting algorithm for shortish sub-arrays - * and a more complicated one for larger ones. The threshold - * is PIVOT_THRESHOLD. - */ -#define PIVOT_THRESHOLD 40 - -typedef struct -{ - char *first; - char *last; -} stack_entry; -#define pushLeft {stack[stacktop].first=ffirst;stack[stacktop++].last=last;} -#define pushRight {stack[stacktop].first=first;stack[stacktop++].last=llast;} -#define doLeft {first=ffirst;llast=last;continue;} -#define doRight {ffirst=first;last=llast;continue;} -#define pop {if (--stacktop<0) break;\ - first=ffirst=stack[stacktop].first;\ - last=llast=stack[stacktop].last;\ - continue;} - -/* Some comments on the implementation. - * 1. When we finish partitioning the array into "low" - * and "high", we forget entirely about short subarrays, - * because they'll be done later by insertion sort. - * Doing lots of little insertion sorts might be a win - * on large datasets for locality-of-reference reasons, - * but it makes the code much nastier and increases - * bookkeeping overhead. - * 2. We always save the shorter and get to work on the - * longer. This guarantees that every time we push - * an item onto the stack its size is <= 1/2 of that - * of its parent; so the stack can't need more than - * log_2(max-array-size) entries. - * 3. We choose a pivot by looking at the first, last - * and middle elements. We arrange them into order - * because it's easy to do that in conjunction with - * choosing the pivot, and it makes things a little - * easier in the partitioning step. Anyway, the pivot - * is the middle of these three. It's still possible - * to construct datasets where the algorithm takes - * time of order n^2, but it simply never happens in - * practice. - * 3' Newsflash: On further investigation I find that - * it's easy to construct datasets where median-of-3 - * simply isn't good enough. So on large-ish subarrays - * we do a more sophisticated pivoting: we take three - * sets of 3 elements, find their medians, and then - * take the median of those. - * 4. We copy the pivot element to a separate place - * because that way we can always do our comparisons - * directly against a pointer to that separate place, - * and don't have to wonder "did we move the pivot - * element?". This makes the inner loop better. - * 5. It's possible to make the pivoting even more - * reliable by looking at more candidates when n - * is larger. (Taking this to its logical conclusion - * results in a variant of quicksort that doesn't - * have that n^2 worst case.) However, the overhead - * from the extra bookkeeping means that it's just - * not worth while. - * 6. This is pretty clean and portable code. Here are - * all the potential portability pitfalls and problems - * I know of: - * - In one place (the insertion sort) I construct - * a pointer that points just past the end of the - * supplied array, and assume that (a) it won't - * compare equal to any pointer within the array, - * and (b) it will compare equal to a pointer - * obtained by stepping off the end of the array. - * These might fail on some segmented architectures. - * - I assume that there are 8 bits in a |char| when - * computing the size of stack needed. This would - * fail on machines with 9-bit or 16-bit bytes. - * - I assume that if |((int)base&(sizeof(int)-1))==0| - * and |(size&(sizeof(int)-1))==0| then it's safe to - * get at array elements via |int*|s, and that if - * actually |size==sizeof(int)| as well then it's - * safe to treat the elements as |int|s. This might - * fail on systems that convert pointers to integers - * in non-standard ways. - * - I assume that |8*sizeof(size_t)<=INT_MAX|. This - * would be false on a machine with 8-bit |char|s, - * 16-bit |int|s and 4096-bit |size_t|s. :-) - */ - -/* The recursion logic is the same in each case: */ -#define Recurse(Trunc) \ - { size_t l=last-ffirst,r=llast-first; \ - if (l=Trunc) doRight \ - else pop \ - } \ - else if (l<=r) { pushLeft; doRight } \ - else if (r>=Trunc) { pushRight; doLeft }\ - else doLeft \ - } - -/* and so is the pivoting logic: */ -#define Pivot(swapper,sz) \ - if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ - else { \ - if (compare(first,mid)<0) { \ - if (compare(mid,last)>0) { \ - swapper(mid,last); \ - if (compare(first,mid)>0) swapper(first,mid);\ - } \ - } \ - else { \ - if (compare(mid,last)>0) swapper(first,last)\ - else { \ - swapper(first,mid); \ - if (compare(mid,last)>0) swapper(mid,last);\ - } \ - } \ - first+=sz; last-=sz; \ - } - -#ifdef DEBUG_QSORT -#include -#endif - -/* and so is the partitioning logic: */ -#define Partition(swapper,sz) { \ - int swapped=0; \ - do { \ - while (compare(first,pivot)<0) first+=sz; \ - while (compare(pivot,last)<0) last-=sz; \ - if (firstlimit ? limit : nmemb-1)*sz;\ - while (last!=base) { \ - if (compare(first,last)>0) first=last; \ - last-=sz; } \ - if (first!=base) swapper(first,(char*)base); - -/* and so is the insertion sort, in the first two cases: */ -#define Insertion(swapper) \ - last=((char*)base)+nmemb*size; \ - for (first=((char*)base)+size;first!=last;first+=size) { \ - char *test; \ - /* Find the right place for |first|. \ - * My apologies for var reuse. */ \ - for (test=first-size;compare(test,first)>0;test-=size) ; \ - test+=size; \ - if (test!=first) { \ - /* Shift everything in [test,first) \ - * up by one, and place |first| \ - * where |test| is. */ \ - memcpy(pivot,first,size); \ - memmove(test+size,test,first-test); \ - memcpy(test,pivot,size); \ - } \ - } - -#define SWAP_nonaligned(a,b) { \ - register char *aa=(a),*bb=(b); \ - register size_t sz=size; \ - do { register char t=*aa; *aa++=*bb; *bb++=t; } while (--sz); } - -#define SWAP_aligned(a,b) { \ - register int *aa=(int*)(a),*bb=(int*)(b); \ - register size_t sz=size; \ - do { register int t=*aa;*aa++=*bb; *bb++=t; } while (sz-=WORD_BYTES); } - -#define SWAP_words(a,b) { \ - register int t=*((int*)a); *((int*)a)=*((int*)b); *((int*)b)=t; } - -/* ---------------------------------------------------------------------- */ - -static char * -pivot_big(char *first, char *mid, char *last, size_t size, - int compare(const void *, const void *)) -{ - size_t d = (((last - first) / size) >> 3) * size; - char *m1, *m2, *m3; - { - char *a = first, *b = first + d, *c = first + 2 * d; -#ifdef DEBUG_QSORT - fprintf(stderr, "< %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); -#endif - m1 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } - { - char *a = mid - d, *b = mid, *c = mid + d; -#ifdef DEBUG_QSORT - fprintf(stderr, ". %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); -#endif - m2 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } - { - char *a = last - 2 * d, *b = last - d, *c = last; -#ifdef DEBUG_QSORT - fprintf(stderr, "> %d %d %d\n", *(int *) a, *(int *) b, *(int *) c); -#endif - m3 = compare(a, b) < 0 ? - (compare(b, c) < 0 ? b : (compare(a, c) < 0 ? c : a)) - : (compare(a, c) < 0 ? a : (compare(b, c) < 0 ? c : b)); - } -#ifdef DEBUG_QSORT - fprintf(stderr, "-> %d %d %d\n", *(int *) m1, *(int *) m2, *(int *) m3); -#endif - return compare(m1, m2) < 0 ? - (compare(m2, m3) < 0 ? m2 : (compare(m1, m3) < 0 ? m3 : m1)) - : (compare(m1, m3) < 0 ? m1 : (compare(m2, m3) < 0 ? m3 : m2)); -} - -/* ---------------------------------------------------------------------- */ - -static void -qsort_nonaligned(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ - - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(size); - size_t trunc = TRUNC_nonaligned * size; - assert(pivot != 0); - - first = (char *) base; - last = first + (nmemb - 1) * size; - - if ((size_t) (last - first) > trunc) { - char *ffirst = first, *llast = last; - while (1) { - /* Select pivot */ - { - char *mid = first + size * ((last - first) / size >> 1); - Pivot(SWAP_nonaligned, size); - memcpy(pivot, mid, size); - } - /* Partition. */ - Partition(SWAP_nonaligned, size); - /* Prepare to recurse/iterate. */ - Recurse(trunc)} - } - PreInsertion(SWAP_nonaligned, TRUNC_nonaligned, size); - Insertion(SWAP_nonaligned); - free(pivot); -} - -static void -qsort_aligned(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ - - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(size); - size_t trunc = TRUNC_aligned * size; - assert(pivot != 0); - - first = (char *) base; - last = first + (nmemb - 1) * size; - - if ((size_t) (last - first) > trunc) { - char *ffirst = first, *llast = last; - while (1) { - /* Select pivot */ - { - char *mid = first + size * ((last - first) / size >> 1); - Pivot(SWAP_aligned, size); - memcpy(pivot, mid, size); - } - /* Partition. */ - Partition(SWAP_aligned, size); - /* Prepare to recurse/iterate. */ - Recurse(trunc)} - } - PreInsertion(SWAP_aligned, TRUNC_aligned, size); - Insertion(SWAP_aligned); - free(pivot); -} - -static void -qsort_words(void *base, size_t nmemb, - int (*compare) (const void *, const void *)) -{ - - stack_entry stack[STACK_SIZE]; - int stacktop = 0; - char *first, *last; - char *pivot = malloc(WORD_BYTES); - assert(pivot != 0); - - first = (char *) base; - last = first + (nmemb - 1) * WORD_BYTES; - - if (last - first > TRUNC_words) { - char *ffirst = first, *llast = last; - while (1) { -#ifdef DEBUG_QSORT - fprintf(stderr, "Doing %d:%d: ", - (first - (char *) base) / WORD_BYTES, - (last - (char *) base) / WORD_BYTES); -#endif - /* Select pivot */ - { - char *mid = - first + WORD_BYTES * ((last - first) / (2 * WORD_BYTES)); - Pivot(SWAP_words, WORD_BYTES); - *(int *) pivot = *(int *) mid; - } -#ifdef DEBUG_QSORT - fprintf(stderr, "pivot=%d\n", *(int *) pivot); -#endif - /* Partition. */ - Partition(SWAP_words, WORD_BYTES); - /* Prepare to recurse/iterate. */ - Recurse(TRUNC_words)} - } - PreInsertion(SWAP_words, (TRUNC_words / WORD_BYTES), WORD_BYTES); - /* Now do insertion sort. */ - last = ((char *) base) + nmemb * WORD_BYTES; - for (first = ((char *) base) + WORD_BYTES; first != last; - first += WORD_BYTES) { - /* Find the right place for |first|. My apologies for var reuse */ - int *pl = (int *) (first - WORD_BYTES), *pr = (int *) first; - *(int *) pivot = *(int *) first; - for (; compare(pl, pivot) > 0; pr = pl, --pl) { - *pr = *pl; - } - if (pr != (int *) first) - *pr = *(int *) pivot; - } - free(pivot); -} - -/* ---------------------------------------------------------------------- */ - -void -qsort(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, const void *)) -{ - - if (nmemb <= 1) - return; - if (((uintptr_t) base | size) & (WORD_BYTES - 1)) - qsort_nonaligned(base, nmemb, size, compare); - else if (size != WORD_BYTES) - qsort_aligned(base, nmemb, size, compare); - else - qsort_words(base, nmemb, compare); -} - -#endif /* !SDL_qsort */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.c b/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.c deleted file mode 100644 index 3e9c0aff57..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_ANDROID - -#include "SDL_androidmouse.h" - -#include "SDL_events.h" -#include "../../events/SDL_mouse_c.h" - -#include "../../core/android/SDL_android.h" - -#define ACTION_DOWN 0 -#define ACTION_UP 1 -#define ACTION_HOVER_MOVE 7 -#define ACTION_SCROLL 8 -#define BUTTON_PRIMARY 1 -#define BUTTON_SECONDARY 2 -#define BUTTON_TERTIARY 4 - -void Android_OnMouse( int androidButton, int action, float x, float y) { - static Uint8 SDLButton; - - if (!Android_Window) { - return; - } - - switch(action) { - case ACTION_DOWN: - // Determine which button originated the event, and store it for ACTION_UP - SDLButton = SDL_BUTTON_LEFT; - if (androidButton == BUTTON_SECONDARY) { - SDLButton = SDL_BUTTON_RIGHT; - } else if (androidButton == BUTTON_TERTIARY) { - SDLButton = SDL_BUTTON_MIDDLE; - } - SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, SDLButton); - break; - - case ACTION_UP: - // Android won't give us the button that originated the ACTION_DOWN event, so we'll - // assume it's the one we stored - SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, SDLButton); - break; - - case ACTION_HOVER_MOVE: - SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - break; - - case ACTION_SCROLL: - SDL_SendMouseWheel(Android_Window, 0, x, y, SDL_MOUSEWHEEL_NORMAL); - break; - - default: - break; - } -} - -#endif /* SDL_VIDEO_DRIVER_ANDROID */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.cc deleted file mode 100644 index fcd1caa269..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - -/* BWindow based framebuffer implementation */ - -#include -#include - -#include "SDL_BWin.h" -#include "SDL_timer.h" -#include "../SDL_sysvideo.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int BE_SetClipboardText(_THIS, const char *text) { - BMessage *clip = NULL; - if(be_clipboard->Lock()) { - be_clipboard->Clear(); - if((clip = be_clipboard->Data())) { - /* Presumably the string of characters is ascii-format */ - ssize_t asciiLength = 0; - for(; text[asciiLength] != 0; ++asciiLength) {} - clip->AddData("text/plain", B_MIME_TYPE, &text, asciiLength); - be_clipboard->Commit(); - } - be_clipboard->Unlock(); - } - return 0; -} - -char *BE_GetClipboardText(_THIS) { - BMessage *clip = NULL; - const char *text = NULL; - ssize_t length; - char *result; - if(be_clipboard->Lock()) { - if((clip = be_clipboard->Data())) { - /* Presumably the string of characters is ascii-format */ - clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text, - &length); - } else { - be_clipboard->Unlock(); - } - be_clipboard->Unlock(); - } - - if (!text) { - result = SDL_strdup(""); - } else { - /* Copy the data and pass on to SDL */ - result = (char*)SDL_calloc(1, sizeof(char*)*length); - SDL_strlcpy(result, text, length); - } - - return result; -} - -SDL_bool BE_HasClipboardText(_THIS) { - SDL_bool result = SDL_FALSE; - char *text = BE_GetClipboardText(_this); - if (text) { - result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE; - SDL_free(text); - } - return result; -} - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.cc deleted file mode 100644 index 5e6a300e8e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.cc +++ /dev/null @@ -1,254 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - -#include "SDL_bframebuffer.h" - -#include -#include -#include "SDL_bmodes.h" -#include "SDL_BWin.h" - -#include "../../main/haiku/SDL_BApp.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32 BE_UpdateOnce(SDL_Window *window); - -static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); -} - -static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); -} - -int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, - Uint32 * format, - void ** pixels, int *pitch) { - SDL_BWin *bwin = _ToBeWin(window); - BScreen bscreen; - if(!bscreen.IsValid()) { - return -1; - } - - while(!bwin->Connected()) { snooze(100); } - - /* Make sure we have exclusive access to frame buffer data */ - bwin->LockBuffer(); - - /* format */ - display_mode bmode; - bscreen.GetMode(&bmode); - int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode.space); - *format = BE_BPPToSDLPxFormat(bpp); - - /* Create the new bitmap object */ - BBitmap *bitmap = bwin->GetBitmap(); - - if(bitmap) { - delete bitmap; - } - bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space, - false, /* Views not accepted */ - true); /* Contiguous memory required */ - - if(bitmap->InitCheck() != B_OK) { - return SDL_SetError("Could not initialize back buffer!\n"); - } - - - bwin->SetBitmap(bitmap); - - /* Set the pixel pointer */ - *pixels = bitmap->Bits(); - - /* pitch = width of window, in bytes */ - *pitch = bitmap->BytesPerRow(); - - bwin->SetBufferExists(true); - bwin->SetTrashBuffer(false); - bwin->UnlockBuffer(); - return 0; -} - - - -int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - const SDL_Rect * rects, int numrects) { - if(!window) - return 0; - - SDL_BWin *bwin = _ToBeWin(window); - -#ifdef DRAWTHREAD - bwin->LockBuffer(); - bwin->SetBufferDirty(true); - bwin->UnlockBuffer(); -#else - bwin->SetBufferDirty(true); - BE_UpdateOnce(window); -#endif - - return 0; -} - -int32 BE_DrawThread(void *data) { - SDL_BWin *bwin = (SDL_BWin*)data; - - BScreen bscreen; - if(!bscreen.IsValid()) { - return -1; - } - - while(bwin->ConnectionEnabled()) { - if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) { - bwin->LockBuffer(); - BBitmap *bitmap = NULL; - bitmap = bwin->GetBitmap(); - int32 windowPitch = bitmap->BytesPerRow(); - int32 bufferPitch = bwin->GetRowBytes(); - uint8 *windowpx; - uint8 *bufferpx; - - int32 BPP = bwin->GetBytesPerPx(); - int32 windowSub = bwin->GetFbX() * BPP + - bwin->GetFbY() * windowPitch; - clipping_rect *clips = bwin->GetClips(); - int32 numClips = bwin->GetNumClips(); - int i, y; - - /* Blit each clipping rectangle */ - bscreen.WaitForRetrace(); - for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; - /* Get addresses of the start of each clipping rectangle */ - int32 width = clips[i].right - clips[i].left + 1; - int32 height = clips[i].bottom - clips[i].top + 1; - bufferpx = bwin->GetBufferPx() + - clips[i].top * bufferPitch + clips[i].left * BPP; - windowpx = (uint8*)bitmap->Bits() + - clips[i].top * windowPitch + clips[i].left * BPP - - windowSub; - - /* Copy each row of pixels from the window buffer into the frame - buffer */ - for(y = 0; y < height; ++y) - { - - if(bwin->CanTrashWindowBuffer()) { - goto escape; /* Break out before the buffer is killed */ - } - - memcpy(bufferpx, windowpx, width * BPP); - bufferpx += bufferPitch; - windowpx += windowPitch; - } - } - - bwin->SetBufferDirty(false); -escape: - bwin->UnlockBuffer(); - } else { - snooze(16000); - } - } - - return B_OK; -} - -void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { - SDL_BWin *bwin = _ToBeWin(window); - - bwin->LockBuffer(); - - /* Free and clear the window buffer */ - BBitmap *bitmap = bwin->GetBitmap(); - delete bitmap; - bwin->SetBitmap(NULL); - bwin->SetBufferExists(false); - bwin->UnlockBuffer(); -} - - -/* - * TODO: - * This was written to test if certain errors were caused by threading issues. - * The specific issues have since become rare enough that they may have been - * solved, but I doubt it- they were pretty sporadic before now. - */ -int32 BE_UpdateOnce(SDL_Window *window) { - SDL_BWin *bwin = _ToBeWin(window); - BScreen bscreen; - if(!bscreen.IsValid()) { - return -1; - } - - if(bwin->ConnectionEnabled() && bwin->Connected()) { - bwin->LockBuffer(); - int32 windowPitch = window->surface->pitch; - int32 bufferPitch = bwin->GetRowBytes(); - uint8 *windowpx; - uint8 *bufferpx; - - int32 BPP = bwin->GetBytesPerPx(); - uint8 *windowBaseAddress = (uint8*)window->surface->pixels; - int32 windowSub = bwin->GetFbX() * BPP + - bwin->GetFbY() * windowPitch; - clipping_rect *clips = bwin->GetClips(); - int32 numClips = bwin->GetNumClips(); - int i, y; - - /* Blit each clipping rectangle */ - bscreen.WaitForRetrace(); - for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; - /* Get addresses of the start of each clipping rectangle */ - int32 width = clips[i].right - clips[i].left + 1; - int32 height = clips[i].bottom - clips[i].top + 1; - bufferpx = bwin->GetBufferPx() + - clips[i].top * bufferPitch + clips[i].left * BPP; - windowpx = windowBaseAddress + - clips[i].top * windowPitch + clips[i].left * BPP - windowSub; - - /* Copy each row of pixels from the window buffer into the frame - buffer */ - for(y = 0; y < height; ++y) - { - memcpy(bufferpx, windowpx, width * BPP); - bufferpx += bufferPitch; - windowpx += windowPitch; - } - } - bwin->UnlockBuffer(); - } - return 0; -} - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.cc deleted file mode 100644 index 0ae3d3fc10..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include "SDL_events.h" -#include "SDL_keycode.h" - -#include "SDL_bkeyboard.h" - - -#define KEYMAP_SIZE 128 - - -static SDL_Scancode keymap[KEYMAP_SIZE]; -static int8 keystate[KEYMAP_SIZE]; - -void BE_InitOSKeymap() { - for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { - keymap[i] = SDL_SCANCODE_UNKNOWN; - } - - for( uint i = 0; i < KEYMAP_SIZE; ++i ) { - keystate[i] = SDL_RELEASED; - } - - keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE); - keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1); - keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2); - keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3); - keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4); - keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5); - keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6); - keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7); - keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8); - keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9); - keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10); - keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11); - keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12); - keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN); - keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK); - keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE); - keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE); - keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1); - keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2); - keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3); - keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4); - keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5); - keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6); - keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7); - keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8); - keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9); - keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0); - keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS); - keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS); - keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE); - keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT); - keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME); - keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP); - keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR); - keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE); - keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY); - keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS); - keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB); - keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q); - keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w); - keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e); - keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r); - keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t); - keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y); - keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u); - keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i); - keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o); - keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p); - keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET); - keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET); - keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH); - keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE); - keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END); - keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN); - keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7); - keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8); - keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9); - keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS); - keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK); - keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a); - keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s); - keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d); - keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f); - keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g); - keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h); - keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j); - keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k); - keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l); - keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON); - keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE); - keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN); - keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4); - keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5); - keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6); - keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT); - keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z); - keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x); - keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c); - keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v); - keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b); - keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n); - keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m); - keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA); - keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD); - keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH); - keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT); - keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP); - keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1); - keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2); - keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3); - keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER); - keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL); - keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT); - keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE); - keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT); - keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL); - keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT); - keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN); - keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT); - keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0); - keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD); - keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI); - keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI); - keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU); - keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */ - keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS); - keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER); -} - -SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey) { - if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) { - return keymap[bkey]; - } else { - return SDL_SCANCODE_UNKNOWN; - } -} - -int8 BE_GetKeyState(int32 bkey) { - if(bkey > 0 && bkey < KEYMAP_SIZE) { - return keystate[bkey]; - } else { - return SDL_RELEASED; - } -} - -void BE_SetKeyState(int32 bkey, int8 state) { - if(bkey > 0 && bkey < KEYMAP_SIZE) { - keystate[bkey] = state; - } -} - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.cc deleted file mode 100644 index 84aeb1f07b..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.cc +++ /dev/null @@ -1,331 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - -#include -#include -#include "SDL_bmodes.h" -#include "SDL_BWin.h" - -#if SDL_VIDEO_OPENGL -#include "SDL_bopengl.h" -#endif - -#include "../../main/haiku/SDL_BApp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */ - -#if WRAP_BMODE -/* This wrapper is here so that the driverdata can be freed without freeing - the display_mode structure */ -typedef struct SDL_DisplayModeData { - display_mode *bmode; -}; -#endif - -static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); -} - -static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); -} - -static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) { -#if WRAP_BMODE - return ((SDL_DisplayModeData*)mode->driverdata)->bmode; -#else - return (display_mode*)(mode->driverdata); -#endif -} - -/* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */ -static float get_refresh_rate(display_mode &mode) { - return float(mode.timing.pixel_clock * 1000) - / float(mode.timing.h_total * mode.timing.v_total); -} - - -#if 0 -/* TODO: - * This is a useful debugging tool. Uncomment and insert into code as needed. - */ -void _SpoutModeData(display_mode *bmode) { - printf("BMode:\n"); - printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height); - printf("\th,v = (%i,%i)\n", bmode->h_display_start, - bmode->v_display_start); - if(bmode->flags) { - printf("\tFlags:\n"); - if(bmode->flags & B_SCROLL) { - printf("\t\tB_SCROLL\n"); - } - if(bmode->flags & B_8_BIT_DAC) { - printf("\t\tB_8_BIT_DAC\n"); - } - if(bmode->flags & B_HARDWARE_CURSOR) { - printf("\t\tB_HARDWARE_CURSOR\n"); - } - if(bmode->flags & B_PARALLEL_ACCESS) { - printf("\t\tB_PARALLEL_ACCESS\n"); - } - if(bmode->flags & B_DPMS) { - printf("\t\tB_DPMS\n"); - } - if(bmode->flags & B_IO_FB_NA) { - printf("\t\tB_IO_FB_NA\n"); - } - } - printf("\tTiming:\n"); - printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock); - printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n", - bmode->timing.h_display, bmode->timing.h_sync_start, - bmode->timing.h_sync_end, bmode->timing.h_total); - printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n", - bmode->timing.v_display, bmode->timing.v_sync_start, - bmode->timing.v_sync_end, bmode->timing.v_total); - if(bmode->timing.flags) { - printf("\t\tFlags:\n"); - if(bmode->timing.flags & B_BLANK_PEDESTAL) { - printf("\t\t\tB_BLANK_PEDESTAL\n"); - } - if(bmode->timing.flags & B_TIMING_INTERLACED) { - printf("\t\t\tB_TIMING_INTERLACED\n"); - } - if(bmode->timing.flags & B_POSITIVE_HSYNC) { - printf("\t\t\tB_POSITIVE_HSYNC\n"); - } - if(bmode->timing.flags & B_POSITIVE_VSYNC) { - printf("\t\t\tB_POSITIVE_VSYNC\n"); - } - if(bmode->timing.flags & B_SYNC_ON_GREEN) { - printf("\t\t\tB_SYNC_ON_GREEN\n"); - } - } -} -#endif - - - -int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace) -{ - int bitsperpixel; - - bitsperpixel = 0; - switch (colorspace) { - case B_CMAP8: - bitsperpixel = 8; - break; - case B_RGB15: - case B_RGBA15: - case B_RGB15_BIG: - case B_RGBA15_BIG: - bitsperpixel = 15; - break; - case B_RGB16: - case B_RGB16_BIG: - bitsperpixel = 16; - break; - case B_RGB32: - case B_RGBA32: - case B_RGB32_BIG: - case B_RGBA32_BIG: - bitsperpixel = 32; - break; - default: - break; - } - return(bitsperpixel); -} - -int32 BE_BPPToSDLPxFormat(int32 bpp) { - /* Translation taken from SDL_windowsmodes.c */ - switch (bpp) { - case 32: - return SDL_PIXELFORMAT_RGB888; - break; - case 24: /* May not be supported by Haiku */ - return SDL_PIXELFORMAT_RGB24; - break; - case 16: - return SDL_PIXELFORMAT_RGB565; - break; - case 15: - return SDL_PIXELFORMAT_RGB555; - break; - case 8: - return SDL_PIXELFORMAT_INDEX8; - break; - case 4: /* May not be supported by Haiku */ - return SDL_PIXELFORMAT_INDEX4LSB; - break; - } - - /* May never get here, but safer and needed to shut up compiler */ - SDL_SetError("Invalid bpp value"); - return 0; -} - -static void _BDisplayModeToSdlDisplayMode(display_mode *bmode, - SDL_DisplayMode *mode) { - mode->w = bmode->virtual_width; - mode->h = bmode->virtual_height; - mode->refresh_rate = (int)get_refresh_rate(*bmode); - -#if WRAP_BMODE - SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, - sizeof(SDL_DisplayModeData)); - data->bmode = bmode; - - mode->driverdata = data; - -#else - - mode->driverdata = bmode; -#endif - - /* Set the format */ - int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode->space); - mode->format = BE_BPPToSDLPxFormat(bpp); -} - -/* Later, there may be more than one monitor available */ -static void _AddDisplay(BScreen *screen) { - SDL_VideoDisplay display; - SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1, - sizeof(SDL_DisplayMode)); - display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode)); - screen->GetMode(bmode); - - _BDisplayModeToSdlDisplayMode(bmode, mode); - - SDL_zero(display); - display.desktop_mode = *mode; - display.current_mode = *mode; - - SDL_AddVideoDisplay(&display); -} - -/* - * Functions called by SDL - */ - -int BE_InitModes(_THIS) { - BScreen screen; - - /* TODO: When Haiku supports multiple display screens, call - _AddDisplayScreen() for each of them. */ - _AddDisplay(&screen); - return 0; -} - -int BE_QuitModes(_THIS) { - /* FIXME: Nothing really needs to be done here at the moment? */ - return 0; -} - - -int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) { - BScreen bscreen; - BRect rc = bscreen.Frame(); - rect->x = (int)rc.left; - rect->y = (int)rc.top; - rect->w = (int)rc.Width() + 1; - rect->h = (int)rc.Height() + 1; - return 0; -} - -void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) { - /* Get the current screen */ - BScreen bscreen; - - /* Iterate through all of the modes */ - SDL_DisplayMode mode; - display_mode this_bmode; - display_mode *bmodes; - uint32 count, i; - - /* Get graphics-hardware supported modes */ - bscreen.GetModeList(&bmodes, &count); - bscreen.GetMode(&this_bmode); - - for(i = 0; i < count; ++i) { - // FIXME: Apparently there are errors with colorspace changes - if (bmodes[i].space == this_bmode.space) { - _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode); - SDL_AddDisplayMode(display, &mode); - } - } - free(bmodes); -} - - -int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ - /* Get the current screen */ - BScreen bscreen; - if(!bscreen.IsValid()) { - printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__); - } - - /* Set the mode using the driver data */ - display_mode *bmode = _ExtractBMode(mode); - - - /* FIXME: Is the first option always going to be the right one? */ - uint32 c = 0, i; - display_mode *bmode_list; - bscreen.GetModeList(&bmode_list, &c); - for(i = 0; i < c; ++i) { - if( bmode_list[i].space == bmode->space && - bmode_list[i].virtual_width == bmode->virtual_width && - bmode_list[i].virtual_height == bmode->virtual_height ) { - bmode = &bmode_list[i]; - break; - } - } - - if(bscreen.SetMode(bmode) != B_OK) { - return SDL_SetError("Bad video mode\n"); - } - - free(bmode_list); - -#if SDL_VIDEO_OPENGL - /* FIXME: Is there some way to reboot the OpenGL context? This doesn't - help */ -// BE_GL_RebootContexts(_this); -#endif - - return 0; -} - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.cc deleted file mode 100644 index 15454f1007..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - -#include "SDL_bopengl.h" - -#include -#include -#include -#include "SDL_BWin.h" -#include "../../main/haiku/SDL_BApp.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#define BGL_FLAGS BGL_RGB | BGL_DOUBLE - -static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); -} - -static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); -} - -/* Passing a NULL path means load pointers from the application */ -int BE_GL_LoadLibrary(_THIS, const char *path) -{ -/* FIXME: Is this working correctly? */ - image_info info; - int32 cookie = 0; - while (get_next_image_info(0, &cookie, &info) == B_OK) { - void *location = NULL; - if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, - &location) == B_OK) { - - _this->gl_config.dll_handle = (void *) info.id; - _this->gl_config.driver_loaded = 1; - SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", - SDL_arraysize(_this->gl_config.driver_path)); - } - } - return 0; -} - -void *BE_GL_GetProcAddress(_THIS, const char *proc) -{ - if (_this->gl_config.dll_handle != NULL) { - void *location = NULL; - status_t err; - if ((err = - get_image_symbol((image_id) _this->gl_config.dll_handle, - proc, B_SYMBOL_TYPE_ANY, - &location)) == B_OK) { - return location; - } else { - SDL_SetError("Couldn't find OpenGL symbol"); - return NULL; - } - } else { - SDL_SetError("OpenGL library not loaded"); - return NULL; - } -} - - - - -void BE_GL_SwapWindow(_THIS, SDL_Window * window) { - _ToBeWin(window)->SwapBuffers(); -} - -int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView()); - return 0; -} - - -SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) { - /* FIXME: Not sure what flags should be included here; may want to have - most of them */ - SDL_BWin *bwin = _ToBeWin(window); - bwin->CreateGLView(BGL_FLAGS); - return (SDL_GLContext)(bwin); -} - -void BE_GL_DeleteContext(_THIS, SDL_GLContext context) { - /* Currently, automatically unlocks the view */ - ((SDL_BWin*)context)->RemoveGLView(); -} - - -int BE_GL_SetSwapInterval(_THIS, int interval) { - /* TODO: Implement this, if necessary? */ - return 0; -} - -int BE_GL_GetSwapInterval(_THIS) { - /* TODO: Implement this, if necessary? */ - return 0; -} - - -void BE_GL_UnloadLibrary(_THIS) { - /* TODO: Implement this, if necessary? */ -} - - -/* FIXME: This function is meant to clear the OpenGL context when the video - mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not - currently in use. */ -void BE_GL_RebootContexts(_THIS) { - SDL_Window *window = _this->windows; - while(window) { - SDL_BWin *bwin = _ToBeWin(window); - if(bwin->GetGLView()) { - bwin->LockLooper(); - bwin->RemoveGLView(); - bwin->CreateGLView(BGL_FLAGS); - bwin->UnlockLooper(); - } - window = window->next; - } -} - - -#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */ - - int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value) - { - /* - FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values - */ - switch (attrib) { - case SDL_GL_RED_SIZE: - glGetIntegerv(GL_RED_BITS, (GLint *) value); - break; - case SDL_GL_GREEN_SIZE: - glGetIntegerv(GL_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_BLUE_SIZE: - glGetIntegerv(GL_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ALPHA_SIZE: - glGetIntegerv(GL_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_DOUBLEBUFFER: - glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value); - break; - case SDL_GL_BUFFER_SIZE: - int v; - glGetIntegerv(GL_RED_BITS, (GLint *) & v); - *value = v; - glGetIntegerv(GL_GREEN_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_BLUE_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v); - *value += v; - break; - case SDL_GL_DEPTH_SIZE: - glGetIntegerv(GL_DEPTH_BITS, (GLint *) value); /* Mesa creates 16 only? r5 always 32 */ - break; - case SDL_GL_STENCIL_SIZE: - glGetIntegerv(GL_STENCIL_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_RED_SIZE: - glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_GREEN_SIZE: - glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_BLUE_SIZE: - glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_ALPHA_SIZE: - glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_STEREO: - case SDL_GL_MULTISAMPLEBUFFERS: - case SDL_GL_MULTISAMPLESAMPLES: - default: - *value = 0; - return (-1); - } - return 0; - } - -#endif - - - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.cc deleted file mode 100644 index 8c243b7a04..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "SDL_bkeyboard.h" -#include "SDL_bwindow.h" -#include "SDL_bclipboard.h" -#include "SDL_bvideo.h" -#include "SDL_bopengl.h" -#include "SDL_bmodes.h" -#include "SDL_bframebuffer.h" -#include "SDL_bevents.h" - -/* FIXME: Undefined functions */ -// #define BE_PumpEvents NULL - #define BE_StartTextInput NULL - #define BE_StopTextInput NULL - #define BE_SetTextInputRect NULL - -// #define BE_DeleteDevice NULL - -/* End undefined functions */ - -static SDL_VideoDevice * -BE_CreateDevice(int devindex) -{ - SDL_VideoDevice *device; - /*SDL_VideoData *data;*/ - - /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); - - device->driverdata = NULL; /* FIXME: Is this the cause of some of the - SDL_Quit() errors? */ - -/* TODO: Figure out if any initialization needs to go here */ - - /* Set the function pointers */ - device->VideoInit = BE_VideoInit; - device->VideoQuit = BE_VideoQuit; - device->GetDisplayBounds = BE_GetDisplayBounds; - device->GetDisplayModes = BE_GetDisplayModes; - device->SetDisplayMode = BE_SetDisplayMode; - device->PumpEvents = BE_PumpEvents; - - device->CreateWindow = BE_CreateWindow; - device->CreateWindowFrom = BE_CreateWindowFrom; - device->SetWindowTitle = BE_SetWindowTitle; - device->SetWindowIcon = BE_SetWindowIcon; - device->SetWindowPosition = BE_SetWindowPosition; - device->SetWindowSize = BE_SetWindowSize; - device->ShowWindow = BE_ShowWindow; - device->HideWindow = BE_HideWindow; - device->RaiseWindow = BE_RaiseWindow; - device->MaximizeWindow = BE_MaximizeWindow; - device->MinimizeWindow = BE_MinimizeWindow; - device->RestoreWindow = BE_RestoreWindow; - device->SetWindowBordered = BE_SetWindowBordered; - device->SetWindowFullscreen = BE_SetWindowFullscreen; - device->SetWindowGammaRamp = BE_SetWindowGammaRamp; - device->GetWindowGammaRamp = BE_GetWindowGammaRamp; - device->SetWindowGrab = BE_SetWindowGrab; - device->DestroyWindow = BE_DestroyWindow; - device->GetWindowWMInfo = BE_GetWindowWMInfo; - device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer; - device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer; - device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer; - - device->shape_driver.CreateShaper = NULL; - device->shape_driver.SetWindowShape = NULL; - device->shape_driver.ResizeWindowShape = NULL; - - - device->GL_LoadLibrary = BE_GL_LoadLibrary; - device->GL_GetProcAddress = BE_GL_GetProcAddress; - device->GL_UnloadLibrary = BE_GL_UnloadLibrary; - device->GL_CreateContext = BE_GL_CreateContext; - device->GL_MakeCurrent = BE_GL_MakeCurrent; - device->GL_SetSwapInterval = BE_GL_SetSwapInterval; - device->GL_GetSwapInterval = BE_GL_GetSwapInterval; - device->GL_SwapWindow = BE_GL_SwapWindow; - device->GL_DeleteContext = BE_GL_DeleteContext; - - device->StartTextInput = BE_StartTextInput; - device->StopTextInput = BE_StopTextInput; - device->SetTextInputRect = BE_SetTextInputRect; - - device->SetClipboardText = BE_SetClipboardText; - device->GetClipboardText = BE_GetClipboardText; - device->HasClipboardText = BE_HasClipboardText; - - device->free = BE_DeleteDevice; - - return device; -} - -VideoBootStrap HAIKU_bootstrap = { - "haiku", "Haiku graphics", - BE_Available, BE_CreateDevice -}; - -void BE_DeleteDevice(SDL_VideoDevice * device) -{ - SDL_free(device->driverdata); - SDL_free(device); -} - -int BE_VideoInit(_THIS) -{ - /* Initialize the Be Application for appserver interaction */ - if (SDL_InitBeApp() < 0) { - return -1; - } - - /* Initialize video modes */ - BE_InitModes(_this); - - /* Init the keymap */ - BE_InitOSKeymap(); - - -#if SDL_VIDEO_OPENGL - /* testgl application doesn't load library, just tries to load symbols */ - /* is it correct? if so we have to load library here */ - BE_GL_LoadLibrary(_this, NULL); -#endif - - /* We're done! */ - return (0); -} - -int BE_Available(void) -{ - return (1); -} - -void BE_VideoQuit(_THIS) -{ - - BE_QuitModes(_this); - - SDL_QuitBeApp(); -} - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.cc b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.cc deleted file mode 100644 index 287eac9653..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.cc +++ /dev/null @@ -1,223 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_HAIKU -#include "../SDL_sysvideo.h" - -#include "SDL_BWin.h" -#include - -/* Define a path to window's BWIN data */ -#ifdef __cplusplus -extern "C" { -#endif - -static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); -} - -static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); -} - -static int _InitWindow(_THIS, SDL_Window *window) { - uint32 flags = 0; - window_look look = B_BORDERED_WINDOW_LOOK; - - BRect bounds( - window->x, - window->y, - window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing - window->y + window->h - 1 - ); - - if(window->flags & SDL_WINDOW_FULLSCREEN) { - /* TODO: Add support for this flag */ - printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__); - } - if(window->flags & SDL_WINDOW_OPENGL) { - /* TODO: Add support for this flag */ - } - if(!(window->flags & SDL_WINDOW_RESIZABLE)) { - flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE; - } - if(window->flags & SDL_WINDOW_BORDERLESS) { - look = B_NO_BORDER_WINDOW_LOOK; - } - - SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); - if(bwin == NULL) - return ENOMEM; - - window->driverdata = bwin; - int32 winID = _GetBeApp()->GetID(window); - bwin->SetID(winID); - - return 0; -} - -int BE_CreateWindow(_THIS, SDL_Window *window) { - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; - - /* Start window loop */ - _ToBeWin(window)->Show(); - return 0; -} - -int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { - - SDL_BWin *otherBWin = (SDL_BWin*)data; - if(!otherBWin->LockLooper()) - return -1; - - /* Create the new window and initialize its members */ - window->x = (int)otherBWin->Frame().left; - window->y = (int)otherBWin->Frame().top; - window->w = (int)otherBWin->Frame().Width(); - window->h = (int)otherBWin->Frame().Height(); - - /* Set SDL flags */ - if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) { - window->flags |= SDL_WINDOW_RESIZABLE; - } - - /* If we are out of memory, return the error code */ - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; - - /* TODO: Add any other SDL-supported window attributes here */ - _ToBeWin(window)->SetTitle(otherBWin->Title()); - - /* Start window loop and unlock the other window */ - _ToBeWin(window)->Show(); - - otherBWin->UnlockLooper(); - return 0; -} - -void BE_SetWindowTitle(_THIS, SDL_Window * window) { - BMessage msg(BWIN_SET_TITLE); - msg.AddString("window-title", window->title); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) { - /* FIXME: Icons not supported by Haiku */ -} - -void BE_SetWindowPosition(_THIS, SDL_Window * window) { - BMessage msg(BWIN_MOVE_WINDOW); - msg.AddInt32("window-x", window->x); - msg.AddInt32("window-y", window->y); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_SetWindowSize(_THIS, SDL_Window * window) { - BMessage msg(BWIN_RESIZE_WINDOW); - msg.AddInt32("window-w", window->w - 1); - msg.AddInt32("window-h", window->h - 1); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { - BMessage msg(BWIN_SET_BORDERED); - msg.AddBool("window-border", bordered != SDL_FALSE); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_ShowWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_SHOW_WINDOW); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_HideWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_HIDE_WINDOW); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_RaiseWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */ - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_MaximizeWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_MAXIMIZE_WINDOW); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_MinimizeWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_MINIMIZE_WINDOW); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_RestoreWindow(_THIS, SDL_Window * window) { - BMessage msg(BWIN_RESTORE_WINDOW); - _ToBeWin(window)->PostMessage(&msg); -} - -void BE_SetWindowFullscreen(_THIS, SDL_Window * window, - SDL_VideoDisplay * display, SDL_bool fullscreen) { - /* Haiku tracks all video display information */ - BMessage msg(BWIN_FULLSCREEN); - msg.AddBool("fullscreen", fullscreen); - _ToBeWin(window)->PostMessage(&msg); - -} - -int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { - /* FIXME: Not Haiku supported */ - return -1; -} - -int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) { - /* FIXME: Not Haiku supported */ - return -1; -} - - -void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { - /* TODO: Implement this! */ -} - -void BE_DestroyWindow(_THIS, SDL_Window * window) { - _ToBeWin(window)->LockLooper(); /* This MUST be locked */ - _GetBeApp()->ClearID(_ToBeWin(window)); - _ToBeWin(window)->Quit(); - window->driverdata = NULL; -} - -SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, - struct SDL_SysWMinfo *info) { - /* FIXME: What is the point of this? What information should be included? */ - return SDL_FALSE; -} - - - - - -#ifdef __cplusplus -} -#endif - -#endif /* SDL_VIDEO_DRIVER_HAIKU */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.h b/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.h deleted file mode 100644 index f64530ab7b..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bwindow.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_BWINDOW_H -#define SDL_BWINDOW_H - - -#include "../SDL_sysvideo.h" - - -extern int BE_CreateWindow(_THIS, SDL_Window *window); -extern int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); -extern void BE_SetWindowTitle(_THIS, SDL_Window * window); -extern void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); -extern void BE_SetWindowPosition(_THIS, SDL_Window * window); -extern void BE_SetWindowSize(_THIS, SDL_Window * window); -extern void BE_ShowWindow(_THIS, SDL_Window * window); -extern void BE_HideWindow(_THIS, SDL_Window * window); -extern void BE_RaiseWindow(_THIS, SDL_Window * window); -extern void BE_MaximizeWindow(_THIS, SDL_Window * window); -extern void BE_MinimizeWindow(_THIS, SDL_Window * window); -extern void BE_RestoreWindow(_THIS, SDL_Window * window); -extern void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); -extern void BE_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); -extern int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); -extern int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); -extern void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); -extern void BE_DestroyWindow(_THIS, SDL_Window * window); -extern SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, - struct SDL_SysWMinfo *info); - - - -#endif - diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.c b/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.c deleted file mode 100644 index 708f8ffdec..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Contributed by Brandon Schaefer, -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_MIR - -#include "../../events/SDL_events_c.h" -#include "../../events/SDL_keyboard_c.h" -#include "../../events/SDL_touch_c.h" -#include "../../events/scancodes_xfree86.h" - -#include "SDL_mirevents.h" -#include "SDL_mirwindow.h" - -#include - -#include "SDL_mirdyn.h" - -static void -HandleKeyText(int32_t key_code) -{ - char text[8]; - int size = 0; - - size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text); - - if (size > 0) { - text[size] = '\0'; - SDL_SendKeyboardText(text); - } -} - -static void -CheckKeyboardFocus(SDL_Window* sdl_window) -{ - SDL_Window* keyboard_window = SDL_GetKeyboardFocus(); - - if (keyboard_window != sdl_window) - SDL_SetKeyboardFocus(sdl_window); -} - - -/* FIXME - Mir still needs to implement its IM API, for now we assume - a single key press produces a character. -*/ -static void -HandleKeyEvent(MirKeyEvent const ev, SDL_Window* window) -{ - uint32_t scancode = SDL_SCANCODE_UNKNOWN; - Uint8 key_state = ev.action == mir_key_action_up ? SDL_RELEASED : SDL_PRESSED; - - CheckKeyboardFocus(window); - - if (ev.scan_code < SDL_arraysize(xfree86_scancode_table2)) - scancode = xfree86_scancode_table2[ev.scan_code]; - - if (scancode != SDL_SCANCODE_UNKNOWN) - SDL_SendKeyboardKey(key_state, scancode); - - if (key_state == SDL_PRESSED) - HandleKeyText(ev.key_code); -} - -static void -HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirMotionButton button_state) -{ - static uint32_t last_sdl_button; - uint32_t sdl_button; - - switch (button_state) { - case mir_motion_button_primary: - sdl_button = SDL_BUTTON_LEFT; - break; - case mir_motion_button_secondary: - sdl_button = SDL_BUTTON_RIGHT; - break; - case mir_motion_button_tertiary: - sdl_button = SDL_BUTTON_MIDDLE; - break; - case mir_motion_button_forward: - sdl_button = SDL_BUTTON_X1; - break; - case mir_motion_button_back: - sdl_button = SDL_BUTTON_X2; - break; - default: - sdl_button = last_sdl_button; - break; - } - - last_sdl_button = sdl_button; - SDL_SendMouseButton(sdl_window, 0, state, sdl_button); -} - -static void -HandleMouseMotion(SDL_Window* sdl_window, int x, int y) -{ - SDL_SendMouseMotion(sdl_window, 0, 0, x, y); -} - -static void -HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure) -{ - SDL_SendTouch(device_id, source_id, down, x, y, pressure); -} - -static void -HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure) -{ - SDL_SendTouchMotion(device_id, source_id, x, y, pressure); -} - -static void -HandleMouseScroll(SDL_Window* sdl_window, int hscroll, int vscroll) -{ - SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL); -} - -static void -AddTouchDevice(int device_id) -{ - if (SDL_AddTouch(device_id, "") < 0) - SDL_SetError("Error: can't add touch %s, %d", __FILE__, __LINE__); -} - -static void -HandleTouchEvent(MirMotionEvent const motion, int cord_index, SDL_Window* sdl_window) -{ - int device_id = motion.device_id; - int id = motion.pointer_coordinates[cord_index].id; - - int width = sdl_window->w; - int height = sdl_window->h; - float x = motion.pointer_coordinates[cord_index].x; - float y = motion.pointer_coordinates[cord_index].y; - - float n_x = x / width; - float n_y = y / height; - float pressure = motion.pointer_coordinates[cord_index].pressure; - - AddTouchDevice(motion.device_id); - - switch (motion.action) { - case mir_motion_action_down: - case mir_motion_action_pointer_down: - HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure); - break; - case mir_motion_action_up: - case mir_motion_action_pointer_up: - HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure); - break; - case mir_motion_action_hover_move: - case mir_motion_action_move: - HandleTouchMotion(device_id, id, n_x, n_y, pressure); - break; - default: - break; - } -} - -static void -HandleMouseEvent(MirMotionEvent const motion, int cord_index, SDL_Window* sdl_window) -{ - SDL_SetMouseFocus(sdl_window); - - switch (motion.action) { - case mir_motion_action_down: - case mir_motion_action_pointer_down: - HandleMouseButton(sdl_window, SDL_PRESSED, motion.button_state); - break; - case mir_motion_action_up: - case mir_motion_action_pointer_up: - HandleMouseButton(sdl_window, SDL_RELEASED, motion.button_state); - break; - case mir_motion_action_hover_move: - case mir_motion_action_move: - HandleMouseMotion(sdl_window, - motion.pointer_coordinates[cord_index].x, - motion.pointer_coordinates[cord_index].y); - break; - case mir_motion_action_outside: - SDL_SetMouseFocus(NULL); - break; - case mir_motion_action_scroll: - HandleMouseScroll(sdl_window, - motion.pointer_coordinates[cord_index].hscroll, - motion.pointer_coordinates[cord_index].vscroll); - break; - case mir_motion_action_cancel: - case mir_motion_action_hover_enter: - case mir_motion_action_hover_exit: - break; - default: - break; - } -} - -static void -HandleMotionEvent(MirMotionEvent const motion, SDL_Window* sdl_window) -{ - int cord_index; - for (cord_index = 0; cord_index < motion.pointer_count; cord_index++) { - if (motion.pointer_coordinates[cord_index].tool_type == mir_motion_tool_type_finger) { - HandleTouchEvent(motion, cord_index, sdl_window); - } - else { - HandleMouseEvent(motion, cord_index, sdl_window); - } - } -} - -void -MIR_HandleInput(MirSurface* surface, MirEvent const* ev, void* context) -{ - SDL_Window* window = (SDL_Window*)context; - switch (ev->type) { - case (mir_event_type_key): - HandleKeyEvent(ev->key, window); - break; - case (mir_event_type_motion): - HandleMotionEvent(ev->motion, window); - break; - default: - break; - } -} - -#endif /* SDL_VIDEO_DRIVER_MIR */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.c b/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.c deleted file mode 100644 index bb8dc6c4e2..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Contributed by Brandon Schaefer, -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_MIR - -#include "SDL_mirmouse.h" - -#include "../../events/SDL_mouse_c.h" -#include "SDL_assert.h" - -#include "SDL_mirdyn.h" - -static SDL_Cursor* -MIR_CreateDefaultCursor() -{ - SDL_Cursor* cursor; - - cursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (cursor) { - } - else { - SDL_OutOfMemory(); - } - - return cursor; -} - -static SDL_Cursor* -MIR_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) -{ - return MIR_CreateDefaultCursor(); -} - -static SDL_Cursor* -MIR_CreateSystemCursor(SDL_SystemCursor id) -{ - switch(id) { - case SDL_SYSTEM_CURSOR_ARROW: - break; - case SDL_SYSTEM_CURSOR_IBEAM: - break; - case SDL_SYSTEM_CURSOR_WAIT: - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - break; - case SDL_SYSTEM_CURSOR_SIZENS: - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - break; - case SDL_SYSTEM_CURSOR_NO: - break; - case SDL_SYSTEM_CURSOR_HAND: - break; - default: - SDL_assert(0); - return NULL; - } - - return MIR_CreateDefaultCursor(); -} - -static void -MIR_FreeCursor(SDL_Cursor* cursor) -{ - if (cursor) - SDL_free(cursor); -} - -static int -MIR_ShowCursor(SDL_Cursor* cursor) -{ - return 0; -} - -static void -MIR_WarpMouse(SDL_Window* window, int x, int y) -{ - SDL_Unsupported(); -} - -static int -MIR_WarpMouseGlobal(int x, int y) -{ - return SDL_Unsupported(); -} - -static int -MIR_SetRelativeMouseMode(SDL_bool enabled) -{ - return SDL_Unsupported(); -} - -/* TODO Actually implement the cursor, need to wait for mir support */ -void -MIR_InitMouse() -{ - SDL_Mouse* mouse = SDL_GetMouse(); - - mouse->CreateCursor = MIR_CreateCursor; - mouse->ShowCursor = MIR_ShowCursor; - mouse->FreeCursor = MIR_FreeCursor; - mouse->WarpMouse = MIR_WarpMouse; - mouse->WarpMouseGlobal = MIR_WarpMouseGlobal; - mouse->CreateSystemCursor = MIR_CreateSystemCursor; - mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode; - - SDL_SetDefaultCursor(MIR_CreateDefaultCursor()); -} - -void -MIR_FiniMouse() -{ - SDL_Mouse* mouse = SDL_GetMouse(); - - MIR_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; -} - -#endif /* SDL_VIDEO_DRIVER_MIR */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirsym.h b/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirsym.h deleted file mode 100644 index d0aaf70a32..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirsym.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* *INDENT-OFF* */ - -SDL_MIR_MODULE(MIR_CLIENT) -SDL_MIR_SYM(MirDisplayConfiguration*,mir_connection_create_display_config,(MirConnection *connection)) -SDL_MIR_SYM(MirSurface *,mir_connection_create_surface_sync,(MirConnection *connection, MirSurfaceParameters const *params)) -SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats)) -SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection)) -SDL_MIR_SYM(MirBool,mir_connection_is_valid,(MirConnection *connection)) -SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection)) -SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name)) -SDL_MIR_SYM(void,mir_display_config_destroy,(MirDisplayConfiguration* display_configuration)) -SDL_MIR_SYM(MirEGLNativeWindowType,mir_surface_get_egl_native_window,(MirSurface *surface)) -SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_get_graphics_region,(MirSurface *surface, MirGraphicsRegion *graphics_region)) -SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *parameters)) -SDL_MIR_SYM(MirBool,mir_surface_is_valid,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, MirEventDelegate const *event_handler)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_set_type,(MirSurface *surface, MirSurfaceType type)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_set_state,(MirSurface *surface, MirSurfaceState state)) -SDL_MIR_SYM(void,mir_surface_swap_buffers_sync,(MirSurface *surface)) - -SDL_MIR_MODULE(XKBCOMMON) -SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size)) - -/* *INDENT-ON* */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.c b/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.c deleted file mode 100644 index b6160fd923..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Contributed by Brandon Schaefer, -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_MIR - -#include "SDL_video.h" - -#include "SDL_mirframebuffer.h" -#include "SDL_mirmouse.h" -#include "SDL_miropengl.h" -#include "SDL_mirvideo.h" -#include "SDL_mirwindow.h" - -#include "SDL_mirdyn.h" - -#define MIR_DRIVER_NAME "mir" - -static int -MIR_VideoInit(_THIS); - -static void -MIR_VideoQuit(_THIS); - -static int -MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect); - -static void -MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display); - -static int -MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode); - -static SDL_WindowShaper* -MIR_CreateShaper(SDL_Window* window) -{ - /* FIXME Im not sure if mir support this atm, will have to come back to this */ - return NULL; -} - -static int -MIR_SetWindowShape(SDL_WindowShaper* shaper, SDL_Surface* shape, SDL_WindowShapeMode* shape_mode) -{ - return SDL_Unsupported(); -} - -static int -MIR_ResizeWindowShape(SDL_Window* window) -{ - return SDL_Unsupported(); -} - -static int -MIR_Available() -{ - int available = 0; - - if (SDL_MIR_LoadSymbols()) { - /* !!! FIXME: try to make a MirConnection here. */ - available = 1; - SDL_MIR_UnloadSymbols(); - } - - return available; -} - -static void -MIR_DeleteDevice(SDL_VideoDevice* device) -{ - SDL_free(device); - SDL_MIR_UnloadSymbols(); -} - -void -MIR_PumpEvents(_THIS) -{ -} - -static SDL_VideoDevice* -MIR_CreateDevice(int device_index) -{ - MIR_Data* mir_data; - SDL_VideoDevice* device = NULL; - - if (!SDL_MIR_LoadSymbols()) { - return NULL; - } - - device = SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_MIR_UnloadSymbols(); - SDL_OutOfMemory(); - return NULL; - } - - mir_data = SDL_calloc(1, sizeof(MIR_Data)); - if (!mir_data) { - SDL_free(device); - SDL_MIR_UnloadSymbols(); - SDL_OutOfMemory(); - return NULL; - } - - device->driverdata = mir_data; - - /* mirvideo */ - device->VideoInit = MIR_VideoInit; - device->VideoQuit = MIR_VideoQuit; - device->GetDisplayBounds = MIR_GetDisplayBounds; - device->GetDisplayModes = MIR_GetDisplayModes; - device->SetDisplayMode = MIR_SetDisplayMode; - device->free = MIR_DeleteDevice; - - /* miropengles */ - device->GL_SwapWindow = MIR_GL_SwapWindow; - device->GL_MakeCurrent = MIR_GL_MakeCurrent; - device->GL_CreateContext = MIR_GL_CreateContext; - device->GL_DeleteContext = MIR_GL_DeleteContext; - device->GL_LoadLibrary = MIR_GL_LoadLibrary; - device->GL_UnloadLibrary = MIR_GL_UnloadLibrary; - device->GL_GetSwapInterval = MIR_GL_GetSwapInterval; - device->GL_SetSwapInterval = MIR_GL_SetSwapInterval; - device->GL_GetProcAddress = MIR_GL_GetProcAddress; - - /* mirwindow */ - device->CreateWindow = MIR_CreateWindow; - device->DestroyWindow = MIR_DestroyWindow; - device->GetWindowWMInfo = MIR_GetWindowWMInfo; - device->SetWindowFullscreen = MIR_SetWindowFullscreen; - device->MaximizeWindow = MIR_MaximizeWindow; - device->MinimizeWindow = MIR_MinimizeWindow; - device->RestoreWindow = MIR_RestoreWindow; - - device->CreateWindowFrom = NULL; - device->SetWindowTitle = NULL; - device->SetWindowIcon = NULL; - device->SetWindowPosition = NULL; - device->SetWindowSize = NULL; - device->SetWindowMinimumSize = NULL; - device->SetWindowMaximumSize = NULL; - device->ShowWindow = NULL; - device->HideWindow = NULL; - device->RaiseWindow = NULL; - device->SetWindowBordered = NULL; - device->SetWindowGammaRamp = NULL; - device->GetWindowGammaRamp = NULL; - device->SetWindowGrab = NULL; - device->OnWindowEnter = NULL; - - /* mirframebuffer */ - device->CreateWindowFramebuffer = MIR_CreateWindowFramebuffer; - device->UpdateWindowFramebuffer = MIR_UpdateWindowFramebuffer; - device->DestroyWindowFramebuffer = MIR_DestroyWindowFramebuffer; - - device->shape_driver.CreateShaper = MIR_CreateShaper; - device->shape_driver.SetWindowShape = MIR_SetWindowShape; - device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape; - - device->PumpEvents = MIR_PumpEvents; - - device->SuspendScreenSaver = NULL; - - device->StartTextInput = NULL; - device->StopTextInput = NULL; - device->SetTextInputRect = NULL; - - device->HasScreenKeyboardSupport = NULL; - device->ShowScreenKeyboard = NULL; - device->HideScreenKeyboard = NULL; - device->IsScreenKeyboardShown = NULL; - - device->SetClipboardText = NULL; - device->GetClipboardText = NULL; - device->HasClipboardText = NULL; - - device->ShowMessageBox = NULL; - - return device; -} - -VideoBootStrap MIR_bootstrap = { - MIR_DRIVER_NAME, "SDL Mir video driver", - MIR_Available, MIR_CreateDevice -}; - -static void -MIR_SetCurrentDisplayMode(MirDisplayOutput const* out, SDL_VideoDisplay* display) -{ - SDL_DisplayMode mode = { - .format = SDL_PIXELFORMAT_RGB888, - .w = out->modes[out->current_mode].horizontal_resolution, - .h = out->modes[out->current_mode].vertical_resolution, - .refresh_rate = out->modes[out->current_mode].refresh_rate, - .driverdata = NULL - }; - - display->desktop_mode = mode; - display->current_mode = mode; -} - -static void -MIR_AddAllModesFromDisplay(MirDisplayOutput const* out, SDL_VideoDisplay* display) -{ - int n_mode; - for (n_mode = 0; n_mode < out->num_modes; ++n_mode) { - SDL_DisplayMode mode = { - .format = SDL_PIXELFORMAT_RGB888, - .w = out->modes[n_mode].horizontal_resolution, - .h = out->modes[n_mode].vertical_resolution, - .refresh_rate = out->modes[n_mode].refresh_rate, - .driverdata = NULL - }; - - SDL_AddDisplayMode(display, &mode); - } -} - -static void -MIR_InitDisplays(_THIS) -{ - MIR_Data* mir_data = _this->driverdata; - int d; - - MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection); - - for (d = 0; d < display_config->num_outputs; d++) { - MirDisplayOutput const* out = display_config->outputs + d; - - SDL_VideoDisplay display; - SDL_zero(display); - - if (out->used && - out->connected && - out->num_modes && - out->current_mode < out->num_modes) { - - MIR_SetCurrentDisplayMode(out, &display); - MIR_AddAllModesFromDisplay(out, &display); - - SDL_AddVideoDisplay(&display); - } - } - - MIR_mir_display_config_destroy(display_config); -} - -int -MIR_VideoInit(_THIS) -{ - MIR_Data* mir_data = _this->driverdata; - - mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); - mir_data->software = SDL_FALSE; - - if (!MIR_mir_connection_is_valid(mir_data->connection)) - return SDL_SetError("Failed to connect to the Mir Server"); - - MIR_InitDisplays(_this); - MIR_InitMouse(); - - return 0; -} - -void -MIR_VideoQuit(_THIS) -{ - MIR_Data* mir_data = _this->driverdata; - - MIR_FiniMouse(); - - MIR_GL_DeleteContext(_this, NULL); - MIR_GL_UnloadLibrary(_this); - - MIR_mir_connection_release(mir_data->connection); - - SDL_free(mir_data); - _this->driverdata = NULL; -} - -static int -MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect) -{ - MIR_Data* mir_data = _this->driverdata; - int d; - - MirDisplayConfiguration* display_config = MIR_mir_connection_create_display_config(mir_data->connection); - - for (d = 0; d < display_config->num_outputs; d++) { - MirDisplayOutput const* out = display_config->outputs + d; - - if (out->used && - out->connected && - out->num_modes && - out->current_mode < out->num_modes) { - - rect->x = out->position_x; - rect->y = out->position_y; - rect->w = out->modes->horizontal_resolution; - rect->h = out->modes->vertical_resolution; - } - } - - MIR_mir_display_config_destroy(display_config); - - return 0; -} - -static void -MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display) -{ -} - -static int -MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode) -{ - return 0; -} - -#endif /* SDL_VIDEO_DRIVER_MIR */ - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.c b/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.c deleted file mode 100644 index 0eb54be014..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* - Contributed by Brandon Schaefer, -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_MIR - -#include "../SDL_egl_c.h" -#include "../SDL_sysvideo.h" - -#include "SDL_mirevents.h" -#include "SDL_mirwindow.h" - -#include "SDL_mirdyn.h" - -int -IsSurfaceValid(MIR_Window* mir_window) -{ - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); - } - - return 0; -} - -MirPixelFormat -FindValidPixelFormat(MIR_Data* mir_data) -{ - unsigned int pf_size = 32; - unsigned int valid_formats; - unsigned int f; - - MirPixelFormat formats[pf_size]; - MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats, - pf_size, &valid_formats); - - for (f = 0; f < valid_formats; f++) { - MirPixelFormat cur_pf = formats[f]; - - if (cur_pf == mir_pixel_format_abgr_8888 || - cur_pf == mir_pixel_format_xbgr_8888 || - cur_pf == mir_pixel_format_argb_8888 || - cur_pf == mir_pixel_format_xrgb_8888) { - - return cur_pf; - } - } - - return mir_pixel_format_invalid; -} - -int -MIR_CreateWindow(_THIS, SDL_Window* window) -{ - MIR_Window* mir_window; - MIR_Data* mir_data; - - MirSurfaceParameters surfaceparm = - { - .name = "MirSurface", - .width = window->w, - .height = window->h, - .pixel_format = mir_pixel_format_invalid, - .buffer_usage = mir_buffer_usage_hardware, - .output_id = mir_display_output_id_invalid - }; - - MirEventDelegate delegate = { - MIR_HandleInput, - window - }; - - mir_window = SDL_calloc(1, sizeof(MIR_Window)); - if (!mir_window) - return SDL_OutOfMemory(); - - mir_data = _this->driverdata; - window->driverdata = mir_window; - - if (mir_data->software) - surfaceparm.buffer_usage = mir_buffer_usage_software; - - if (window->x == SDL_WINDOWPOS_UNDEFINED) - window->x = 0; - - if (window->y == SDL_WINDOWPOS_UNDEFINED) - window->y = 0; - - mir_window->mir_data = mir_data; - mir_window->sdl_window = window; - - surfaceparm.pixel_format = FindValidPixelFormat(mir_data); - if (surfaceparm.pixel_format == mir_pixel_format_invalid) { - return SDL_SetError("Failed to find a valid pixel format."); - } - - mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm); - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); - } - - if (window->flags & SDL_WINDOW_OPENGL) { - EGLNativeWindowType egl_native_window = - (EGLNativeWindowType)MIR_mir_surface_get_egl_native_window(mir_window->surface); - - mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window); - - if (mir_window->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("Failed to created a window surface %p", - _this->egl_data->egl_display); - } - } - else { - mir_window->egl_surface = EGL_NO_SURFACE; - } - - MIR_mir_surface_set_event_handler(mir_window->surface, &delegate); - - return 0; -} - -void -MIR_DestroyWindow(_THIS, SDL_Window* window) -{ - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - - if (mir_data) { - SDL_EGL_DestroySurface(_this, mir_window->egl_surface); - MIR_mir_surface_release_sync(mir_window->surface); - - SDL_free(mir_window); - } - window->driverdata = NULL; -} - -SDL_bool -MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) -{ - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { - MIR_Window* mir_window = window->driverdata; - - info->subsystem = SDL_SYSWM_MIR; - info->info.mir.connection = mir_window->mir_data->connection; - info->info.mir.surface = mir_window->surface; - - return SDL_TRUE; - } - - return SDL_FALSE; -} - -void -MIR_SetWindowFullscreen(_THIS, SDL_Window* window, - SDL_VideoDisplay* display, - SDL_bool fullscreen) -{ - MIR_Window* mir_window = window->driverdata; - - if (IsSurfaceValid(mir_window) < 0) - return; - - if (fullscreen) { - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_fullscreen); - } else { - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored); - } -} - -void -MIR_MaximizeWindow(_THIS, SDL_Window* window) -{ - MIR_Window* mir_window = window->driverdata; - - if (IsSurfaceValid(mir_window) < 0) - return; - - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_maximized); -} - -void -MIR_MinimizeWindow(_THIS, SDL_Window* window) -{ - MIR_Window* mir_window = window->driverdata; - - if (IsSurfaceValid(mir_window) < 0) - return; - - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_minimized); -} - -void -MIR_RestoreWindow(_THIS, SDL_Window * window) -{ - MIR_Window* mir_window = window->driverdata; - - if (IsSurfaceValid(mir_window) < 0) - return; - - MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored); -} - -#endif /* SDL_VIDEO_DRIVER_MIR */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.m b/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.m deleted file mode 100644 index 4f3c7dc432..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.m +++ /dev/null @@ -1,183 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_UIKIT - -#import - -#include "SDL_video.h" -#include "SDL_mouse.h" -#include "SDL_hints.h" -#include "../SDL_sysvideo.h" -#include "../SDL_pixels_c.h" -#include "../../events/SDL_events_c.h" - -#include "SDL_uikitvideo.h" -#include "SDL_uikitevents.h" -#include "SDL_uikitmodes.h" -#include "SDL_uikitwindow.h" -#include "SDL_uikitopengles.h" - -#define UIKITVID_DRIVER_NAME "uikit" - -/* Initialization/Query functions */ -static int UIKit_VideoInit(_THIS); -static void UIKit_VideoQuit(_THIS); - -/* DUMMY driver bootstrap functions */ - -static int -UIKit_Available(void) -{ - return 1; -} - -static void UIKit_DeleteDevice(SDL_VideoDevice * device) -{ - SDL_free(device); -} - -static SDL_VideoDevice * -UIKit_CreateDevice(int devindex) -{ - SDL_VideoDevice *device; - - /* Initialize all variables that we clean on shutdown */ - device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_free(device); - SDL_OutOfMemory(); - return (0); - } - - /* Set the function pointers */ - device->VideoInit = UIKit_VideoInit; - device->VideoQuit = UIKit_VideoQuit; - device->GetDisplayModes = UIKit_GetDisplayModes; - device->SetDisplayMode = UIKit_SetDisplayMode; - device->PumpEvents = UIKit_PumpEvents; - device->SuspendScreenSaver = UIKit_SuspendScreenSaver; - device->CreateWindow = UIKit_CreateWindow; - device->SetWindowTitle = UIKit_SetWindowTitle; - device->ShowWindow = UIKit_ShowWindow; - device->HideWindow = UIKit_HideWindow; - device->RaiseWindow = UIKit_RaiseWindow; - device->SetWindowBordered = UIKit_SetWindowBordered; - device->SetWindowFullscreen = UIKit_SetWindowFullscreen; - device->DestroyWindow = UIKit_DestroyWindow; - device->GetWindowWMInfo = UIKit_GetWindowWMInfo; - -#if SDL_IPHONE_KEYBOARD - device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; - device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; - device->HideScreenKeyboard = UIKit_HideScreenKeyboard; - device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; - device->SetTextInputRect = UIKit_SetTextInputRect; -#endif - - /* OpenGL (ES) functions */ - device->GL_MakeCurrent = UIKit_GL_MakeCurrent; - device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; - device->GL_SwapWindow = UIKit_GL_SwapWindow; - device->GL_CreateContext = UIKit_GL_CreateContext; - device->GL_DeleteContext = UIKit_GL_DeleteContext; - device->GL_GetProcAddress = UIKit_GL_GetProcAddress; - device->GL_LoadLibrary = UIKit_GL_LoadLibrary; - device->free = UIKit_DeleteDevice; - - device->gl_config.accelerated = 1; - - return device; -} - -VideoBootStrap UIKIT_bootstrap = { - UIKITVID_DRIVER_NAME, "SDL UIKit video driver", - UIKit_Available, UIKit_CreateDevice -}; - - -int -UIKit_VideoInit(_THIS) -{ - _this->gl_config.driver_loaded = 1; - - if (UIKit_InitModes(_this) < 0) { - return -1; - } - return 0; -} - -void -UIKit_VideoQuit(_THIS) -{ - UIKit_QuitModes(_this); -} - -void -UIKit_SuspendScreenSaver(_THIS) -{ - @autoreleasepool { - /* Ignore ScreenSaver API calls if the idle timer hint has been set. */ - /* FIXME: The idle timer hint should be deprecated for SDL 2.1. */ - if (SDL_GetHint(SDL_HINT_IDLE_TIMER_DISABLED) == NULL) { - UIApplication *app = [UIApplication sharedApplication]; - - /* Prevent the display from dimming and going to sleep. */ - app.idleTimerDisabled = (_this->suspend_screensaver != SDL_FALSE); - } - } -} - -BOOL -UIKit_IsSystemVersionAtLeast(double version) -{ - return [[UIDevice currentDevice].systemVersion doubleValue] >= version; -} - -CGRect -UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) -{ - BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0); - - if (hasiOS7 || (window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { - /* The view should always show behind the status bar in iOS 7+. */ - return screen.bounds; - } else { - return screen.applicationFrame; - } -} - -/* - * iOS log support. - * - * This doesn't really have aything to do with the interfaces of the SDL video - * subsystem, but we need to stuff this into an Objective-C source code file. - */ - -void SDL_NSLog(const char *text) -{ - NSLog(@"%s", text); -} - -#endif /* SDL_VIDEO_DRIVER_UIKIT */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.h b/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.h deleted file mode 100644 index c78396802e..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ - -#import - -#include "../SDL_sysvideo.h" - -#include "SDL_touch.h" - -#if SDL_IPHONE_KEYBOARD -@interface SDL_uikitviewcontroller : UIViewController -#else -@interface SDL_uikitviewcontroller : UIViewController -#endif - -@property (nonatomic, assign) SDL_Window *window; - -- (instancetype)initWithSDLWindow:(SDL_Window *)_window; - -- (void)setAnimationCallback:(int)interval - callback:(void (*)(void*))callback - callbackParam:(void*)callbackParam; - -- (void)startAnimation; -- (void)stopAnimation; - -- (void)doLoop:(CADisplayLink*)sender; - -- (void)loadView; -- (void)viewDidLayoutSubviews; -- (NSUInteger)supportedInterfaceOrientations; -- (BOOL)prefersStatusBarHidden; - -#if SDL_IPHONE_KEYBOARD -- (void)showKeyboard; -- (void)hideKeyboard; -- (void)initKeyboard; -- (void)deinitKeyboard; - -- (void)keyboardWillShow:(NSNotification *)notification; -- (void)keyboardWillHide:(NSNotification *)notification; - -- (void)updateKeyboard; - -@property (nonatomic, assign, getter=isKeyboardVisible) BOOL keyboardVisible; -@property (nonatomic, assign) SDL_Rect textInputRect; -@property (nonatomic, assign) int keyboardHeight; -#endif - -@end - -#if SDL_IPHONE_KEYBOARD -SDL_bool UIKit_HasScreenKeyboardSupport(_THIS); -void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window); -void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window); -SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window); -void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect); -#endif diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents.c b/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents.c deleted file mode 100644 index 53b0ac9078..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents.c +++ /dev/null @@ -1,459 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_WAYLAND - -#include "SDL_stdinc.h" -#include "SDL_assert.h" - -#include "../../events/SDL_sysevents.h" -#include "../../events/SDL_events_c.h" -#include "../../events/scancodes_xfree86.h" - -#include "SDL_waylandvideo.h" -#include "SDL_waylandevents_c.h" -#include "SDL_waylandwindow.h" - -#include "SDL_waylanddyn.h" - -#include -#include -#include -#include -#include -#include -#include - -struct SDL_WaylandInput { - SDL_VideoData *display; - struct wl_seat *seat; - struct wl_pointer *pointer; - struct wl_keyboard *keyboard; - SDL_WindowData *pointer_focus; - SDL_WindowData *keyboard_focus; - - /* Last motion location */ - wl_fixed_t sx_w; - wl_fixed_t sy_w; - - struct { - struct xkb_keymap *keymap; - struct xkb_state *state; - } xkb; -}; - -void -Wayland_PumpEvents(_THIS) -{ - SDL_VideoData *d = _this->driverdata; - struct pollfd pfd[1]; - - pfd[0].fd = WAYLAND_wl_display_get_fd(d->display); - pfd[0].events = POLLIN; - poll(pfd, 1, 0); - - if (pfd[0].revents & POLLIN) - WAYLAND_wl_display_dispatch(d->display); - else - WAYLAND_wl_display_dispatch_pending(d->display); -} - -static void -pointer_handle_enter(void *data, struct wl_pointer *pointer, - uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx_w, wl_fixed_t sy_w) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window; - - if (!surface) { - /* enter event for a window we've just destroyed */ - return; - } - - /* This handler will be called twice in Wayland 1.4 - * Once for the window surface which has valid user data - * and again for the mouse cursor surface which does not have valid user data - * We ignore the later - */ - - window = (SDL_WindowData *)wl_surface_get_user_data(surface); - - if (window) { - input->pointer_focus = window; - SDL_SetMouseFocus(window->sdlwindow); - } -} - -static void -pointer_handle_leave(void *data, struct wl_pointer *pointer, - uint32_t serial, struct wl_surface *surface) -{ - struct SDL_WaylandInput *input = data; - - if (input->pointer_focus) { - SDL_SetMouseFocus(NULL); - input->pointer_focus = NULL; - } -} - -static void -pointer_handle_motion(void *data, struct wl_pointer *pointer, - uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window = input->pointer_focus; - input->sx_w = sx_w; - input->sy_w = sy_w; - if (input->pointer_focus) { - const int sx = wl_fixed_to_int(sx_w); - const int sy = wl_fixed_to_int(sy_w); - SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); - } -} - -static SDL_bool -ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) -{ - SDL_WindowData *window_data = input->pointer_focus; - SDL_Window *window = window_data->sdlwindow; - - if (window->hit_test) { - const SDL_Point point = { wl_fixed_to_int(input->sx_w), wl_fixed_to_int(input->sy_w) }; - const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); - static const uint32_t directions[] = { - WL_SHELL_SURFACE_RESIZE_TOP_LEFT, WL_SHELL_SURFACE_RESIZE_TOP, - WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, WL_SHELL_SURFACE_RESIZE_RIGHT, - WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM, - WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, WL_SHELL_SURFACE_RESIZE_LEFT - }; - switch (rc) { - case SDL_HITTEST_DRAGGABLE: - wl_shell_surface_move(window_data->shell_surface, input->seat, serial); - return SDL_TRUE; - - case SDL_HITTEST_RESIZE_TOPLEFT: - case SDL_HITTEST_RESIZE_TOP: - case SDL_HITTEST_RESIZE_TOPRIGHT: - case SDL_HITTEST_RESIZE_RIGHT: - case SDL_HITTEST_RESIZE_BOTTOMRIGHT: - case SDL_HITTEST_RESIZE_BOTTOM: - case SDL_HITTEST_RESIZE_BOTTOMLEFT: - case SDL_HITTEST_RESIZE_LEFT: - wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); - return SDL_TRUE; - - default: return SDL_FALSE; - } - } - - return SDL_FALSE; -} - -static void -pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, - uint32_t time, uint32_t button, uint32_t state_w) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window = input->pointer_focus; - enum wl_pointer_button_state state = state_w; - uint32_t sdl_button; - - if (input->pointer_focus) { - switch (button) { - case BTN_LEFT: - sdl_button = SDL_BUTTON_LEFT; - if (ProcessHitTest(data, serial)) { - return; /* don't pass this event on to app. */ - } - break; - case BTN_MIDDLE: - sdl_button = SDL_BUTTON_MIDDLE; - break; - case BTN_RIGHT: - sdl_button = SDL_BUTTON_RIGHT; - break; - case BTN_SIDE: - sdl_button = SDL_BUTTON_X1; - break; - case BTN_EXTRA: - sdl_button = SDL_BUTTON_X2; - break; - default: - return; - } - - SDL_SendMouseButton(window->sdlwindow, 0, - state ? SDL_PRESSED : SDL_RELEASED, sdl_button); - } -} - -static void -pointer_handle_axis(void *data, struct wl_pointer *pointer, - uint32_t time, uint32_t axis, wl_fixed_t value) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window = input->pointer_focus; - enum wl_pointer_axis a = axis; - int x, y; - - if (input->pointer_focus) { - switch (a) { - case WL_POINTER_AXIS_VERTICAL_SCROLL: - x = 0; - y = wl_fixed_to_int(value); - break; - case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - x = wl_fixed_to_int(value); - y = 0; - break; - default: - return; - } - - SDL_SendMouseWheel(window->sdlwindow, 0, x, y, SDL_MOUSEWHEEL_NORMAL); - } -} - -static const struct wl_pointer_listener pointer_listener = { - pointer_handle_enter, - pointer_handle_leave, - pointer_handle_motion, - pointer_handle_button, - pointer_handle_axis, -}; - -static void -keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, - uint32_t format, int fd, uint32_t size) -{ - struct SDL_WaylandInput *input = data; - char *map_str; - - if (!data) { - close(fd); - return; - } - - if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { - close(fd); - return; - } - - map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - if (map_str == MAP_FAILED) { - close(fd); - return; - } - - input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context, - map_str, - XKB_KEYMAP_FORMAT_TEXT_V1, - 0); - munmap(map_str, size); - close(fd); - - if (!input->xkb.keymap) { - fprintf(stderr, "failed to compile keymap\n"); - return; - } - - input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); - if (!input->xkb.state) { - fprintf(stderr, "failed to create XKB state\n"); - WAYLAND_xkb_keymap_unref(input->xkb.keymap); - input->xkb.keymap = NULL; - return; - } -} - -static void -keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, - uint32_t serial, struct wl_surface *surface, - struct wl_array *keys) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window; - - if (!surface) { - /* enter event for a window we've just destroyed */ - return; - } - - window = wl_surface_get_user_data(surface); - - input->keyboard_focus = window; - window->keyboard_device = input; - if (window) { - SDL_SetKeyboardFocus(window->sdlwindow); - } -} - -static void -keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, - uint32_t serial, struct wl_surface *surface) -{ - SDL_SetKeyboardFocus(NULL); -} - -static void -keyboard_handle_key(void *data, struct wl_keyboard *keyboard, - uint32_t serial, uint32_t time, uint32_t key, - uint32_t state_w) -{ - struct SDL_WaylandInput *input = data; - SDL_WindowData *window = input->keyboard_focus; - enum wl_keyboard_key_state state = state_w; - const xkb_keysym_t *syms; - uint32_t scancode; - char text[8]; - int size; - - if (key < SDL_arraysize(xfree86_scancode_table2)) { - scancode = xfree86_scancode_table2[key]; - - // TODO when do we get WL_KEYBOARD_KEY_STATE_REPEAT? - if (scancode != SDL_SCANCODE_UNKNOWN) - SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? - SDL_PRESSED : SDL_RELEASED, scancode); - } - - if (!window || window->keyboard_device != input || !input->xkb.state) - return; - - // TODO can this happen? - if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1) - return; - - if (state) { - size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text); - - if (size > 0) { - text[size] = 0; - SDL_SendKeyboardText(text); - } - } -} - -static void -keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, - uint32_t serial, uint32_t mods_depressed, - uint32_t mods_latched, uint32_t mods_locked, - uint32_t group) -{ - struct SDL_WaylandInput *input = data; - - WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, - mods_locked, 0, 0, group); -} - -static const struct wl_keyboard_listener keyboard_listener = { - keyboard_handle_keymap, - keyboard_handle_enter, - keyboard_handle_leave, - keyboard_handle_key, - keyboard_handle_modifiers, -}; - -static void -seat_handle_capabilities(void *data, struct wl_seat *seat, - enum wl_seat_capability caps) -{ - struct SDL_WaylandInput *input = data; - - if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { - input->pointer = wl_seat_get_pointer(seat); - input->display->pointer = input->pointer; - wl_pointer_set_user_data(input->pointer, input); - wl_pointer_add_listener(input->pointer, &pointer_listener, - input); - } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { - wl_pointer_destroy(input->pointer); - input->pointer = NULL; - } - - if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { - input->keyboard = wl_seat_get_keyboard(seat); - wl_keyboard_set_user_data(input->keyboard, input); - wl_keyboard_add_listener(input->keyboard, &keyboard_listener, - input); - } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { - wl_keyboard_destroy(input->keyboard); - input->keyboard = NULL; - } -} - -static const struct wl_seat_listener seat_listener = { - seat_handle_capabilities, -}; - -void -Wayland_display_add_input(SDL_VideoData *d, uint32_t id) -{ - struct SDL_WaylandInput *input; - - input = SDL_calloc(1, sizeof *input); - if (input == NULL) - return; - - input->display = d; - input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1); - input->sx_w = wl_fixed_from_int(0); - input->sy_w = wl_fixed_from_int(0); - d->input = input; - - wl_seat_add_listener(input->seat, &seat_listener, input); - wl_seat_set_user_data(input->seat, input); - - WAYLAND_wl_display_flush(d->display); -} - -void Wayland_display_destroy_input(SDL_VideoData *d) -{ - struct SDL_WaylandInput *input = d->input; - - if (!input) - return; - - if (input->keyboard) - wl_keyboard_destroy(input->keyboard); - - if (input->pointer) - wl_pointer_destroy(input->pointer); - - if (input->seat) - wl_seat_destroy(input->seat); - - if (input->xkb.state) - WAYLAND_xkb_state_unref(input->xkb.state); - - if (input->xkb.keymap) - WAYLAND_xkb_keymap_unref(input->xkb.keymap); - - SDL_free(input); - d->input = NULL; -} - -#endif /* SDL_VIDEO_DRIVER_WAYLAND */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.c b/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.c deleted file mode 100644 index b59759a7c0..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL - -#include "../SDL_sysvideo.h" -#include "../../events/SDL_windowevents_c.h" -#include "../SDL_egl_c.h" -#include "SDL_waylandwindow.h" -#include "SDL_waylandvideo.h" -#include "SDL_waylandtouch.h" -#include "SDL_waylanddyn.h" - -static void -handle_ping(void *data, struct wl_shell_surface *shell_surface, - uint32_t serial) -{ - wl_shell_surface_pong(shell_surface, serial); -} - -static void -handle_configure(void *data, struct wl_shell_surface *shell_surface, - uint32_t edges, int32_t width, int32_t height) -{ - SDL_WindowData *wind = (SDL_WindowData *)data; - SDL_Window *window = wind->sdlwindow; - struct wl_region *region; - - window->w = width; - window->h = height; - WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); - - region = wl_compositor_create_region(wind->waylandData->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(wind->surface, region); - wl_region_destroy(region); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, window->w, window->h); -} - -static void -handle_popup_done(void *data, struct wl_shell_surface *shell_surface) -{ -} - -static const struct wl_shell_surface_listener shell_surface_listener = { - handle_ping, - handle_configure, - handle_popup_done -}; - -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH -static void -handle_onscreen_visibility(void *data, - struct qt_extended_surface *qt_extended_surface, int32_t visible) -{ -} - -static void -handle_set_generic_property(void *data, - struct qt_extended_surface *qt_extended_surface, const char *name, - struct wl_array *value) -{ -} - -static void -handle_close(void *data, struct qt_extended_surface *qt_extended_surface) -{ - SDL_WindowData *window = (SDL_WindowData *)data; - SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); -} - -static const struct qt_extended_surface_listener extended_surface_listener = { - handle_onscreen_visibility, - handle_set_generic_property, - handle_close, -}; -#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - -SDL_bool -Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) -{ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - - info->info.wl.display = data->waylandData->display; - info->info.wl.surface = data->surface; - info->info.wl.shell_surface = data->shell_surface; - info->subsystem = SDL_SYSWM_WAYLAND; - - return SDL_TRUE; -} - -int -Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) -{ - return 0; /* just succeed, the real work is done elsewhere. */ -} - -void Wayland_ShowWindow(_THIS, SDL_Window *window) -{ - SDL_WindowData *wind = window->driverdata; - - if (window->flags & SDL_WINDOW_FULLSCREEN) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - 0, (struct wl_output *)window->fullscreen_mode.driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); - - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); -} - -void -Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, - SDL_VideoDisplay * _display, SDL_bool fullscreen) -{ - SDL_WindowData *wind = window->driverdata; - - if (fullscreen) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, - 0, (struct wl_output *)_display->driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); - - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); -} - -int Wayland_CreateWindow(_THIS, SDL_Window *window) -{ - SDL_WindowData *data; - SDL_VideoData *c; - struct wl_region *region; - - data = calloc(1, sizeof *data); - if (data == NULL) - return SDL_OutOfMemory(); - - c = _this->driverdata; - window->driverdata = data; - - if (!(window->flags & SDL_WINDOW_OPENGL)) { - SDL_GL_LoadLibrary(NULL); - window->flags |= SDL_WINDOW_OPENGL; - } - - if (window->x == SDL_WINDOWPOS_UNDEFINED) { - window->x = 0; - } - if (window->y == SDL_WINDOWPOS_UNDEFINED) { - window->y = 0; - } - - data->waylandData = c; - data->sdlwindow = window; - - data->surface = - wl_compositor_create_surface(c->compositor); - wl_surface_set_user_data(data->surface, data); - data->shell_surface = wl_shell_get_shell_surface(c->shell, - data->surface); -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (c->surface_extension) { - data->extended_surface = qt_surface_extension_get_extended_surface( - c->surface_extension, data->surface); - } -#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - - data->egl_window = WAYLAND_wl_egl_window_create(data->surface, - window->w, window->h); - - /* Create the GLES window surface */ - data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); - - if (data->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("failed to create a window surface"); - } - - if (data->shell_surface) { - wl_shell_surface_set_user_data(data->shell_surface, data); - wl_shell_surface_add_listener(data->shell_surface, - &shell_surface_listener, data); - } - -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (data->extended_surface) { - qt_extended_surface_set_user_data(data->extended_surface, data); - qt_extended_surface_add_listener(data->extended_surface, - &extended_surface_listener, data); - } -#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - - region = wl_compositor_create_region(c->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - - WAYLAND_wl_display_flush(c->display); - - return 0; -} - -void Wayland_SetWindowSize(_THIS, SDL_Window * window) -{ - SDL_VideoData *data = _this->driverdata; - SDL_WindowData *wind = window->driverdata; - struct wl_region *region; - - WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); - - region =wl_compositor_create_region(data->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(wind->surface, region); - wl_region_destroy(region); -} - -void Wayland_DestroyWindow(_THIS, SDL_Window *window) -{ - SDL_VideoData *data = _this->driverdata; - SDL_WindowData *wind = window->driverdata; - - if (data) { - SDL_EGL_DestroySurface(_this, wind->egl_surface); - WAYLAND_wl_egl_window_destroy(wind->egl_window); - - if (wind->shell_surface) - wl_shell_surface_destroy(wind->shell_surface); - -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (wind->extended_surface) - qt_extended_surface_destroy(wind->extended_surface); -#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - wl_surface_destroy(wind->surface); - - SDL_free(wind); - WAYLAND_wl_display_flush(data->display); - } - window->driverdata = NULL; -} - -#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.c b/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.c deleted file mode 100644 index b39df32fc6..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.c +++ /dev/null @@ -1,482 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_WINDOWS - -#include "../../core/windows/SDL_windows.h" - -#include "SDL_assert.h" -#include "SDL_windowsvideo.h" - - -#ifndef SS_EDITCONTROL -#define SS_EDITCONTROL 0x2000 -#endif - -/* Display a Windows message box */ - -#pragma pack(push, 1) - -typedef struct -{ - WORD dlgVer; - WORD signature; - DWORD helpID; - DWORD exStyle; - DWORD style; - WORD cDlgItems; - short x; - short y; - short cx; - short cy; -} DLGTEMPLATEEX; - -typedef struct -{ - DWORD helpID; - DWORD exStyle; - DWORD style; - short x; - short y; - short cx; - short cy; - DWORD id; -} DLGITEMTEMPLATEEX; - -#pragma pack(pop) - -typedef struct -{ - DLGTEMPLATEEX* lpDialog; - Uint8 *data; - size_t size; - size_t used; -} WIN_DialogData; - - -static INT_PTR MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam) -{ - switch ( iMessage ) { - case WM_COMMAND: - /* Return the ID of the button that was pushed */ - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - - default: - break; - } - return FALSE; -} - -static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space) -{ - size_t size = dialog->size; - - if (size == 0) { - size = space; - } else { - while ((dialog->used + space) > size) { - size *= 2; - } - } - if (size > dialog->size) { - void *data = SDL_realloc(dialog->data, size); - if (!data) { - SDL_OutOfMemory(); - return SDL_FALSE; - } - dialog->data = data; - dialog->size = size; - dialog->lpDialog = (DLGTEMPLATEEX*)dialog->data; - } - return SDL_TRUE; -} - -static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size) -{ - size_t padding = (dialog->used % size); - - if (!ExpandDialogSpace(dialog, padding)) { - return SDL_FALSE; - } - - dialog->used += padding; - - return SDL_TRUE; -} - -static SDL_bool AddDialogData(WIN_DialogData *dialog, const void *data, size_t size) -{ - if (!ExpandDialogSpace(dialog, size)) { - return SDL_FALSE; - } - - SDL_memcpy(dialog->data+dialog->used, data, size); - dialog->used += size; - - return SDL_TRUE; -} - -static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string) -{ - WCHAR *wstring; - WCHAR *p; - size_t count; - SDL_bool status; - - if (!string) { - string = ""; - } - - wstring = WIN_UTF8ToString(string); - if (!wstring) { - return SDL_FALSE; - } - - /* Find out how many characters we have, including null terminator */ - count = 0; - for (p = wstring; *p; ++p) { - ++count; - } - ++count; - - status = AddDialogData(dialog, wstring, count*sizeof(WCHAR)); - SDL_free(wstring); - return status; -} - -static int s_BaseUnitsX; -static int s_BaseUnitsY; -static void Vec2ToDLU(short *x, short *y) -{ - SDL_assert(s_BaseUnitsX != 0); /* we init in WIN_ShowMessageBox(), which is the only public function... */ - - *x = MulDiv(*x, 4, s_BaseUnitsX); - *y = MulDiv(*y, 8, s_BaseUnitsY); -} - - -static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption) -{ - DLGITEMTEMPLATEEX item; - WORD marker = 0xFFFF; - WORD extraData = 0; - - SDL_zero(item); - item.style = style; - item.exStyle = exStyle; - item.x = x; - item.y = y; - item.cx = w; - item.cy = h; - item.id = id; - - Vec2ToDLU(&item.x, &item.y); - Vec2ToDLU(&item.cx, &item.cy); - - if (!AlignDialogData(dialog, sizeof(DWORD))) { - return SDL_FALSE; - } - if (!AddDialogData(dialog, &item, sizeof(item))) { - return SDL_FALSE; - } - if (!AddDialogData(dialog, &marker, sizeof(marker))) { - return SDL_FALSE; - } - if (!AddDialogData(dialog, &type, sizeof(type))) { - return SDL_FALSE; - } - if (!AddDialogString(dialog, caption)) { - return SDL_FALSE; - } - if (!AddDialogData(dialog, &extraData, sizeof(extraData))) { - return SDL_FALSE; - } - ++dialog->lpDialog->cDlgItems; - - return SDL_TRUE; -} - -static SDL_bool AddDialogStatic(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text) -{ - DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX | SS_EDITCONTROL; - return AddDialogControl(dialog, 0x0082, style, 0, x, y, w, h, -1, text); -} - -static SDL_bool AddDialogButton(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text, int id, SDL_bool isDefault) -{ - DWORD style = WS_VISIBLE | WS_CHILD; - if (isDefault) { - style |= BS_DEFPUSHBUTTON; - } else { - style |= BS_PUSHBUTTON; - } - return AddDialogControl(dialog, 0x0080, style, 0, x, y, w, h, id, text); -} - -static void FreeDialogData(WIN_DialogData *dialog) -{ - SDL_free(dialog->data); - SDL_free(dialog); -} - -static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) -{ - WIN_DialogData *dialog; - DLGTEMPLATEEX dialogTemplate; - WORD WordToPass; - - SDL_zero(dialogTemplate); - dialogTemplate.dlgVer = 1; - dialogTemplate.signature = 0xffff; - dialogTemplate.style = (WS_CAPTION | DS_CENTER | DS_SHELLFONT); - dialogTemplate.x = 0; - dialogTemplate.y = 0; - dialogTemplate.cx = w; - dialogTemplate.cy = h; - Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy); - - dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog)); - if (!dialog) { - return NULL; - } - - if (!AddDialogData(dialog, &dialogTemplate, sizeof(dialogTemplate))) { - FreeDialogData(dialog); - return NULL; - } - - /* No menu */ - WordToPass = 0; - if (!AddDialogData(dialog, &WordToPass, 2)) { - FreeDialogData(dialog); - return NULL; - } - - /* No custom class */ - if (!AddDialogData(dialog, &WordToPass, 2)) { - FreeDialogData(dialog); - return NULL; - } - - /* title */ - if (!AddDialogString(dialog, caption)) { - FreeDialogData(dialog); - return NULL; - } - - /* Font stuff */ - { - /* - * We want to use the system messagebox font. - */ - BYTE ToPass; - - NONCLIENTMETRICSA NCM; - NCM.cbSize = sizeof(NCM); - SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0); - - /* Font size - convert to logical font size for dialog parameter. */ - { - HDC ScreenDC = GetDC(NULL); - int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY); - if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */ - LogicalPixelsY = 72; - WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY); - ReleaseDC(NULL, ScreenDC); - } - - if (!AddDialogData(dialog, &WordToPass, 2)) { - FreeDialogData(dialog); - return NULL; - } - - /* Font weight */ - WordToPass = (WORD)NCM.lfMessageFont.lfWeight; - if (!AddDialogData(dialog, &WordToPass, 2)) { - FreeDialogData(dialog); - return NULL; - } - - /* italic? */ - ToPass = NCM.lfMessageFont.lfItalic; - if (!AddDialogData(dialog, &ToPass, 1)) { - FreeDialogData(dialog); - return NULL; - } - - /* charset? */ - ToPass = NCM.lfMessageFont.lfCharSet; - if (!AddDialogData(dialog, &ToPass, 1)) { - FreeDialogData(dialog); - return NULL; - } - - /* font typeface. */ - if (!AddDialogString(dialog, NCM.lfMessageFont.lfFaceName)) { - FreeDialogData(dialog); - return NULL; - } - } - - return dialog; -} - -int -WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) -{ - WIN_DialogData *dialog; - int i, x, y; - UINT_PTR which; - const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; - HFONT DialogFont; - SIZE Size; - RECT TextSize; - wchar_t* wmessage; - TEXTMETRIC TM; - - - const int ButtonWidth = 88; - const int ButtonHeight = 26; - const int TextMargin = 16; - const int ButtonMargin = 12; - - - /* Jan 25th, 2013 - dant@fleetsa.com - * - * - * I've tried to make this more reasonable, but I've run in to a lot - * of nonsense. - * - * The original issue is the code was written in pixels and not - * dialog units (DLUs). All DialogBox functions use DLUs, which - * vary based on the selected font (yay). - * - * According to MSDN, the most reliable way to convert is via - * MapDialogUnits, which requires an HWND, which we don't have - * at time of template creation. - * - * We do however have: - * The system font (DLU width 8 for me) - * The font we select for the dialog (DLU width 6 for me) - * - * Based on experimentation, *neither* of these return the value - * actually used. Stepping in to MapDialogUnits(), the conversion - * is fairly clear, and uses 7 for me. - * - * As a result, some of this is hacky to ensure the sizing is - * somewhat correct. - * - * Honestly, a long term solution is to use CreateWindow, not CreateDialog. - * - - * - * In order to get text dimensions we need to have a DC with the desired font. - * I'm assuming a dialog box in SDL is rare enough we can to the create. - */ - HDC FontDC = CreateCompatibleDC(0); - - { - /* Create a duplicate of the font used in system message boxes. */ - LOGFONT lf; - NONCLIENTMETRICS NCM; - NCM.cbSize = sizeof(NCM); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0); - lf = NCM.lfMessageFont; - DialogFont = CreateFontIndirect(&lf); - } - - /* Select the font in to our DC */ - SelectObject(FontDC, DialogFont); - - { - /* Get the metrics to try and figure our DLU conversion. */ - GetTextMetrics(FontDC, &TM); - s_BaseUnitsX = TM.tmAveCharWidth + 1; - s_BaseUnitsY = TM.tmHeight; - } - - /* Measure the *pixel* size of the string. */ - wmessage = WIN_UTF8ToString(messageboxdata->message); - SDL_zero(TextSize); - Size.cx = DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); - - /* Add some padding for hangs, etc. */ - TextSize.right += 2; - TextSize.bottom += 2; - - /* Done with the DC, and the string */ - DeleteDC(FontDC); - SDL_free(wmessage); - - /* Increase the size of the dialog by some border spacing around the text. */ - Size.cx = TextSize.right - TextSize.left; - Size.cy = TextSize.bottom - TextSize.top; - Size.cx += TextMargin * 2; - Size.cy += TextMargin * 2; - - /* Ensure the size is wide enough for all of the buttons. */ - if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin) - Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin; - - /* Add vertical space for the buttons and border. */ - Size.cy += ButtonHeight + TextMargin; - - dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title); - if (!dialog) { - return -1; - } - - if (!AddDialogStatic(dialog, TextMargin, TextMargin, TextSize.right - TextSize.left, TextSize.bottom - TextSize.top, messageboxdata->message)) { - FreeDialogData(dialog); - return -1; - } - - /* Align the buttons to the right/bottom. */ - x = Size.cx - ButtonWidth - ButtonMargin; - y = Size.cy - ButtonHeight - ButtonMargin; - for (i = 0; i < messageboxdata->numbuttons; ++i) { - SDL_bool isDefault; - - if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { - isDefault = SDL_TRUE; - } else { - isDefault = SDL_FALSE; - } - if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, i, isDefault)) { - FreeDialogData(dialog); - return -1; - } - x -= ButtonWidth + ButtonMargin; - } - - /* FIXME: If we have a parent window, get the Instance and HWND for them */ - which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); - *buttonid = buttons[which].buttonid; - - FreeDialogData(dialog); - return 0; -} - -#endif /* SDL_VIDEO_DRIVER_WINDOWS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.h b/3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.h deleted file mode 100644 index cc684c2e3f..0000000000 --- a/3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _imKStoUCS_h -#define _imKStoUCS_h - -/* Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from the XFree86 -Project. -*/ - -extern unsigned int X11_KeySymToUcs4(KeySym keysym); - -#endif /* _imKStoUCS_h */ diff --git a/3rdparty/sdl2-2.0.4/test/axis.bmp b/3rdparty/sdl2-2.0.4/test/axis.bmp deleted file mode 100644 index c7addd3ed9..0000000000 Binary files a/3rdparty/sdl2-2.0.4/test/axis.bmp and /dev/null differ diff --git a/3rdparty/sdl2-2.0.4/test/controllermap.c b/3rdparty/sdl2-2.0.4/test/controllermap.c deleted file mode 100644 index 3fb30d68a3..0000000000 --- a/3rdparty/sdl2-2.0.4/test/controllermap.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely. -*/ - -/* Game controller mapping generator */ -/* Gabriel Jacobo */ - -#include -#include -#include - -#include "SDL.h" - -#ifndef SDL_JOYSTICK_DISABLED - -#ifdef __IPHONEOS__ -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 480 -#else -#define SCREEN_WIDTH 512 -#define SCREEN_HEIGHT 317 -#endif - -#define MAP_WIDTH 512 -#define MAP_HEIGHT 317 - -#define MARKER_BUTTON 1 -#define MARKER_AXIS 2 - -typedef struct MappingStep -{ - int x, y; - double angle; - int marker; - char *field; - int axis, button, hat, hat_value; - char mapping[4096]; -}MappingStep; - - -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) -{ - SDL_Surface *temp; - SDL_Texture *texture; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return NULL; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - } - - /* Create textures from the image */ - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return NULL; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return texture; -} - -static SDL_bool -WatchJoystick(SDL_Joystick * joystick) -{ - SDL_Window *window = NULL; - SDL_Renderer *screen = NULL; - SDL_Texture *background, *button, *axis, *marker; - const char *name = NULL; - SDL_bool retval = SDL_FALSE; - SDL_bool done = SDL_FALSE, next=SDL_FALSE; - SDL_Event event; - SDL_Rect dst; - int s, _s; - Uint8 alpha=200, alpha_step = -1; - Uint32 alpha_ticks = 0; - char mapping[4096], temp[4096]; - MappingStep *step, *prev_step; - MappingStep steps[] = { - {342, 132, 0.0, MARKER_BUTTON, "x", -1, -1, -1, -1, ""}, - {387, 167, 0.0, MARKER_BUTTON, "a", -1, -1, -1, -1, ""}, - {431, 132, 0.0, MARKER_BUTTON, "b", -1, -1, -1, -1, ""}, - {389, 101, 0.0, MARKER_BUTTON, "y", -1, -1, -1, -1, ""}, - {174, 132, 0.0, MARKER_BUTTON, "back", -1, -1, -1, -1, ""}, - {233, 132, 0.0, MARKER_BUTTON, "guide", -1, -1, -1, -1, ""}, - {289, 132, 0.0, MARKER_BUTTON, "start", -1, -1, -1, -1, ""}, - {116, 217, 0.0, MARKER_BUTTON, "dpleft", -1, -1, -1, -1, ""}, - {154, 249, 0.0, MARKER_BUTTON, "dpdown", -1, -1, -1, -1, ""}, - {186, 217, 0.0, MARKER_BUTTON, "dpright", -1, -1, -1, -1, ""}, - {154, 188, 0.0, MARKER_BUTTON, "dpup", -1, -1, -1, -1, ""}, - {77, 40, 0.0, MARKER_BUTTON, "leftshoulder", -1, -1, -1, -1, ""}, - {91, 0, 0.0, MARKER_BUTTON, "lefttrigger", -1, -1, -1, -1, ""}, - {396, 36, 0.0, MARKER_BUTTON, "rightshoulder", -1, -1, -1, -1, ""}, - {375, 0, 0.0, MARKER_BUTTON, "righttrigger", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_BUTTON, "leftstick", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_BUTTON, "rightstick", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_AXIS, "leftx", -1, -1, -1, -1, ""}, - {75, 154, 90.0, MARKER_AXIS, "lefty", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_AXIS, "rightx", -1, -1, -1, -1, ""}, - {305, 230, 90.0, MARKER_AXIS, "righty", -1, -1, -1, -1, ""}, - }; - - /* Create a window to display joystick axis position */ - window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, - SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, - SCREEN_HEIGHT, 0); - if (window == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); - return SDL_FALSE; - } - - screen = SDL_CreateRenderer(window, -1, 0); - if (screen == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); - SDL_DestroyWindow(window); - return SDL_FALSE; - } - - background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); - button = LoadTexture(screen, "button.bmp", SDL_TRUE); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); - SDL_RaiseWindow(window); - - /* scale for platforms that don't give you the window size you asked for. */ - SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT); - - /* Print info about the joystick we are watching */ - name = SDL_JoystickName(joystick); - SDL_Log("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick), - name ? name : "Unknown Joystick"); - SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n", - SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick), - SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick)); - - SDL_Log("\n\n\ - ====================================================================================\n\ - Press the buttons on your controller when indicated\n\ - (Your controller may look different than the picture)\n\ - If you want to correct a mistake, press backspace or the back button on your device\n\ - To skip a button, press SPACE or click/touch the screen\n\ - To exit, press ESC\n\ - ====================================================================================\n"); - - /* Initialize mapping with GUID and name */ - SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, SDL_arraysize(temp)); - SDL_snprintf(mapping, SDL_arraysize(mapping), "%s,%s,platform:%s,", - temp, name ? name : "Unknown Joystick", SDL_GetPlatform()); - - /* Loop, getting joystick events! */ - for(s=0; smapping, mapping, SDL_arraysize(step->mapping)); - step->axis = -1; - step->button = -1; - step->hat = -1; - step->hat_value = -1; - - switch(step->marker) { - case MARKER_AXIS: - marker = axis; - break; - case MARKER_BUTTON: - marker = button; - break; - default: - break; - } - - dst.x = step->x; - dst.y = step->y; - SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h); - next=SDL_FALSE; - - SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); - - while (!done && !next) { - if (SDL_GetTicks() - alpha_ticks > 5) { - alpha_ticks = SDL_GetTicks(); - alpha += alpha_step; - if (alpha == 255) { - alpha_step = -1; - } - if (alpha < 128) { - alpha_step = 1; - } - } - - SDL_RenderClear(screen); - SDL_RenderCopy(screen, background, NULL, NULL); - SDL_SetTextureAlphaMod(marker, alpha); - SDL_SetTextureColorMod(marker, 10, 255, 21); - SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, 0); - SDL_RenderPresent(screen); - - if (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_JOYAXISMOTION: - if ((event.jaxis.value > 20000 || event.jaxis.value < -20000) && event.jaxis.value != -32768) { - for (_s = 0; _s < s; _s++) { - if (steps[_s].axis == event.jaxis.axis) { - break; - } - } - if (_s == s) { - step->axis = event.jaxis.axis; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":a%u,", event.jaxis.axis); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - } - - break; - case SDL_JOYHATMOTION: - if (event.jhat.value == SDL_HAT_CENTERED) { - break; /* ignore centering, we're probably just coming back to the center from the previous item we set. */ - } - for (_s = 0; _s < s; _s++) { - if (steps[_s].hat == event.jhat.hat && steps[_s].hat_value == event.jhat.value) { - break; - } - } - if (_s == s) { - step->hat = event.jhat.hat; - step->hat_value = event.jhat.value; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":h%u.%u,", event.jhat.hat, event.jhat.value ); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_JOYBALLMOTION: - break; - case SDL_JOYBUTTONUP: - for (_s = 0; _s < s; _s++) { - if (steps[_s].button == event.jbutton.button) { - break; - } - } - if (_s == s) { - step->button = event.jbutton.button; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":b%u,", event.jbutton.button); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_FINGERDOWN: - case SDL_MOUSEBUTTONDOWN: - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { - /* Undo! */ - if (s > 0) { - prev_step = &steps[--s]; - SDL_strlcpy(mapping, prev_step->mapping, SDL_arraysize(prev_step->mapping)); - next = SDL_TRUE; - } - break; - } - if (event.key.keysym.sym == SDLK_SPACE) { - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - } - - if ((event.key.keysym.sym != SDLK_ESCAPE)) { - break; - } - /* Fall through to signal quit */ - case SDL_QUIT: - done = SDL_TRUE; - break; - default: - break; - } - } - } - - } - - if (s == SDL_arraysize(steps) ) { - SDL_Log("Mapping:\n\n%s\n\n", mapping); - /* Print to stdout as well so the user can cat the output somewhere */ - printf("%s\n", mapping); - } - - while(SDL_PollEvent(&event)) {}; - - SDL_DestroyRenderer(screen); - SDL_DestroyWindow(window); - return retval; -} - -int -main(int argc, char *argv[]) -{ - const char *name; - int i; - SDL_Joystick *joystick; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - - /* Initialize SDL (Note: video is required to start event loop) */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); - exit(1); - } - - /* Print information about the joysticks */ - SDL_Log("There are %d joysticks attached\n", SDL_NumJoysticks()); - for (i = 0; i < SDL_NumJoysticks(); ++i) { - name = SDL_JoystickNameForIndex(i); - SDL_Log("Joystick %d: %s\n", i, name ? name : "Unknown Joystick"); - joystick = SDL_JoystickOpen(i); - if (joystick == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_JoystickOpen(%d) failed: %s\n", i, - SDL_GetError()); - } else { - char guid[64]; - SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), - guid, sizeof (guid)); - SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick)); - SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); - SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); - SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); - SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); - SDL_Log(" guid: %s\n", guid); - SDL_JoystickClose(joystick); - } - } - -#ifdef __ANDROID__ - if (SDL_NumJoysticks() > 0) { -#else - if (argv[1]) { -#endif - SDL_bool reportederror = SDL_FALSE; - SDL_bool keepGoing = SDL_TRUE; - SDL_Event event; - int device; -#ifdef __ANDROID__ - device = 0; -#else - device = atoi(argv[1]); -#endif - joystick = SDL_JoystickOpen(device); - - while ( keepGoing ) { - if (joystick == NULL) { - if ( !reportederror ) { - SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); - keepGoing = SDL_FALSE; - reportederror = SDL_TRUE; - } - } else { - reportederror = SDL_FALSE; - keepGoing = WatchJoystick(joystick); - SDL_JoystickClose(joystick); - } - - joystick = NULL; - if (keepGoing) { - SDL_Log("Waiting for attach\n"); - } - while (keepGoing) { - SDL_WaitEvent(&event); - if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN) - || (event.type == SDL_MOUSEBUTTONDOWN)) { - keepGoing = SDL_FALSE; - } else if (event.type == SDL_JOYDEVICEADDED) { - joystick = SDL_JoystickOpen(device); - break; - } - } - } - } - else { - SDL_Log("\n\nUsage: ./controllermap number\nFor example: ./controllermap 0\nOr: ./controllermap 0 >> gamecontrollerdb.txt"); - } - SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); - - return 0; -} - -#else - -int -main(int argc, char *argv[]) -{ - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n"); - exit(1); -} - -#endif diff --git a/3rdparty/sdl2-2.0.4/test/testime.c b/3rdparty/sdl2-2.0.4/test/testime.c deleted file mode 100644 index d6e7ea1f26..0000000000 --- a/3rdparty/sdl2-2.0.4/test/testime.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely. -*/ -/* A simple program to test the Input Method support in the SDL library (2.0+) */ - -#include -#include -#include - -#include "SDL.h" -#ifdef HAVE_SDL_TTF -#include "SDL_ttf.h" -#endif - -#include "SDL_test_common.h" - -#define DEFAULT_PTSIZE 30 -#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" -#define MAX_TEXT_LENGTH 256 - -static SDLTest_CommonState *state; -static SDL_Rect textRect, markedRect; -static SDL_Color lineColor = {0,0,0,0}; -static SDL_Color backColor = {255,255,255,0}; -static SDL_Color textColor = {0,0,0,0}; -static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; -static int cursor = 0; -#ifdef HAVE_SDL_TTF -static TTF_Font *font; -#endif - -size_t utf8_length(unsigned char c) -{ - c = (unsigned char)(0xff & c); - if (c < 0x80) - return 1; - else if ((c >> 5) ==0x6) - return 2; - else if ((c >> 4) == 0xe) - return 3; - else if ((c >> 3) == 0x1e) - return 4; - else - return 0; -} - -char *utf8_next(char *p) -{ - size_t len = utf8_length(*p); - size_t i = 0; - if (!len) - return 0; - - for (; i < len; ++i) - { - ++p; - if (!*p) - return 0; - } - return p; -} - -char *utf8_advance(char *p, size_t distance) -{ - size_t i = 0; - for (; i < distance && p; ++i) - { - p = utf8_next(p); - } - return p; -} - -void usage() -{ - SDL_Log("usage: testime [--font fontfile]\n"); - exit(0); -} - -void InitInput() -{ - - /* Prepare a rect for text input */ - textRect.x = textRect.y = 100; - textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x; - textRect.h = 50; - - text[0] = 0; - markedRect = textRect; - markedText[0] = 0; - - SDL_StartTextInput(); -} - -void CleanupVideo() -{ - SDL_StopTextInput(); -#ifdef HAVE_SDL_TTF - TTF_CloseFont(font); - TTF_Quit(); -#endif -} - - -void _Redraw(SDL_Renderer * renderer) { - int w = 0, h = textRect.h; - SDL_Rect cursorRect, underlineRect; - - SDL_SetRenderDrawColor(renderer, 255,255,255,255); - SDL_RenderFillRect(renderer,&textRect); - -#ifdef HAVE_SDL_TTF - if (*text) - { - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); - SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h }; - - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); - SDL_FreeSurface(textSur); - - SDL_RenderCopy(renderer,texture,NULL,&dest); - SDL_DestroyTexture(texture); - TTF_SizeUTF8(font, text, &w, &h); - } -#endif - - markedRect.x = textRect.x + w; - markedRect.w = textRect.w - w; - if (markedRect.w < 0) - { - /* Stop text input because we cannot hold any more characters */ - SDL_StopTextInput(); - return; - } - else - { - SDL_StartTextInput(); - } - - cursorRect = markedRect; - cursorRect.w = 2; - cursorRect.h = h; - - SDL_SetRenderDrawColor(renderer, 255,255,255,255); - SDL_RenderFillRect(renderer,&markedRect); - - if (markedText[0]) - { -#ifdef HAVE_SDL_TTF - if (cursor) - { - char *p = utf8_advance(markedText, cursor); - char c = 0; - if (!p) - p = &markedText[strlen(markedText)]; - - c = *p; - *p = 0; - TTF_SizeUTF8(font, markedText, &w, 0); - cursorRect.x += w; - *p = c; - } - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); - SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h }; - TTF_SizeUTF8(font, markedText, &w, &h); - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); - SDL_FreeSurface(textSur); - - SDL_RenderCopy(renderer,texture,NULL,&dest); - SDL_DestroyTexture(texture); -#endif - - underlineRect = markedRect; - underlineRect.y += (h - 2); - underlineRect.h = 2; - underlineRect.w = w; - - SDL_SetRenderDrawColor(renderer, 0,0,0,0); - SDL_RenderFillRect(renderer,&markedRect); - } - - SDL_SetRenderDrawColor(renderer, 0,0,0,0); - SDL_RenderFillRect(renderer,&cursorRect); - - SDL_SetTextInputRect(&markedRect); -} - -void Redraw() { - int i; - for (i = 0; i < state->num_windows; ++i) { - SDL_Renderer *renderer = state->renderers[i]; - if (state->windows[i] == NULL) - continue; - SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); - SDL_RenderClear(renderer); - - _Redraw(renderer); - - SDL_RenderPresent(renderer); - } -} - -int main(int argc, char *argv[]) { - int i, done; - SDL_Event event; - const char *fontname = DEFAULT_FONT; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - - /* Initialize test framework */ - state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (!state) { - return 1; - } - for (i = 1; i < argc;i++) { - SDLTest_CommonArg(state, i); - } - for (argc--, argv++; argc > 0; argc--, argv++) - { - if (strcmp(argv[0], "--help") == 0) { - usage(); - return 0; - } - - else if (strcmp(argv[0], "--font") == 0) - { - argc--; - argv++; - - if (argc > 0) - fontname = argv[0]; - else { - usage(); - return 0; - } - } - } - - if (!SDLTest_CommonInit(state)) { - return 2; - } - - -#ifdef HAVE_SDL_TTF - /* Initialize fonts */ - TTF_Init(); - - font = TTF_OpenFont(fontname, DEFAULT_PTSIZE); - if (! font) - { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); - exit(-1); - } -#endif - - SDL_Log("Using font: %s\n", fontname); - atexit(SDL_Quit); - - InitInput(); - /* Create the windows and initialize the renderers */ - for (i = 0; i < state->num_windows; ++i) { - SDL_Renderer *renderer = state->renderers[i]; - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); - SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); - SDL_RenderClear(renderer); - } - Redraw(); - /* Main render loop */ - done = 0; - while (!done) { - /* Check for events */ - while (SDL_PollEvent(&event)) { - SDLTest_CommonEvent(state, &event, &done); - switch(event.type) { - case SDL_KEYDOWN: { - switch (event.key.keysym.sym) - { - case SDLK_RETURN: - text[0]=0x00; - Redraw(); - break; - case SDLK_BACKSPACE: - { - size_t textlen = SDL_strlen(text); - - do { - if (textlen==0) - { - break; - } - if ((text[textlen-1] & 0x80) == 0x00) - { - /* One byte */ - text[textlen-1]=0x00; - break; - } - if ((text[textlen-1] & 0xC0) == 0x80) - { - /* Byte from the multibyte sequence */ - text[textlen-1]=0x00; - textlen--; - } - if ((text[textlen-1] & 0xC0) == 0xC0) - { - /* First byte of multibyte sequence */ - text[textlen-1]=0x00; - break; - } - } while(1); - - Redraw(); - } - break; - } - - if (done) - { - break; - } - - SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n", - event.key.keysym.scancode, - SDL_GetScancodeName(event.key.keysym.scancode), - event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym)); - break; - - case SDL_TEXTINPUT: - if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || - markedRect.w < 0) - break; - - SDL_Log("Keyboard: text input \"%s\"\n", event.text.text); - - if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text)) - SDL_strlcat(text, event.text.text, sizeof(text)); - - SDL_Log("text inputed: %s\n", text); - - /* After text inputed, we can clear up markedText because it */ - /* is committed */ - markedText[0] = 0; - Redraw(); - break; - - case SDL_TEXTEDITING: - SDL_Log("text editing \"%s\", selected range (%d, %d)\n", - event.edit.text, event.edit.start, event.edit.length); - - strcpy(markedText, event.edit.text); - cursor = event.edit.start; - Redraw(); - break; - } - break; - - } - } - } - CleanupVideo(); - SDLTest_CommonQuit(state); - return 0; -} - - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/testplatform.c b/3rdparty/sdl2-2.0.4/test/testplatform.c deleted file mode 100644 index 14acac4b11..0000000000 --- a/3rdparty/sdl2-2.0.4/test/testplatform.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely. -*/ - -#include - -#include "SDL.h" - -/* - * Watcom C flags these as Warning 201: "Unreachable code" if you just - * compare them directly, so we push it through a function to keep the - * compiler quiet. --ryan. - */ -static int -badsize(size_t sizeoftype, size_t hardcodetype) -{ - return sizeoftype != hardcodetype; -} - -int -TestTypes(SDL_bool verbose) -{ - int error = 0; - - if (badsize(sizeof(Uint8), 1)) { - if (verbose) - SDL_Log("sizeof(Uint8) != 1, instead = %u\n", - (unsigned int)sizeof(Uint8)); - ++error; - } - if (badsize(sizeof(Uint16), 2)) { - if (verbose) - SDL_Log("sizeof(Uint16) != 2, instead = %u\n", - (unsigned int)sizeof(Uint16)); - ++error; - } - if (badsize(sizeof(Uint32), 4)) { - if (verbose) - SDL_Log("sizeof(Uint32) != 4, instead = %u\n", - (unsigned int)sizeof(Uint32)); - ++error; - } - if (badsize(sizeof(Uint64), 8)) { - if (verbose) - SDL_Log("sizeof(Uint64) != 8, instead = %u\n", - (unsigned int)sizeof(Uint64)); - ++error; - } - if (verbose && !error) - SDL_Log("All data types are the expected size.\n"); - - return (error ? 1 : 0); -} - -int -TestEndian(SDL_bool verbose) -{ - int error = 0; - Uint16 value = 0x1234; - int real_byteorder; - Uint16 value16 = 0xCDAB; - Uint16 swapped16 = 0xABCD; - Uint32 value32 = 0xEFBEADDE; - Uint32 swapped32 = 0xDEADBEEF; - Uint64 value64, swapped64; - - value64 = 0xEFBEADDE; - value64 <<= 32; - value64 |= 0xCDAB3412; - swapped64 = 0x1234ABCD; - swapped64 <<= 32; - swapped64 |= 0xDEADBEEF; - - if (verbose) { - SDL_Log("Detected a %s endian machine.\n", - (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big"); - } - if ((*((char *) &value) >> 4) == 0x1) { - real_byteorder = SDL_BIG_ENDIAN; - } else { - real_byteorder = SDL_LIL_ENDIAN; - } - if (real_byteorder != SDL_BYTEORDER) { - if (verbose) { - SDL_Log("Actually a %s endian machine!\n", - (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big"); - } - ++error; - } - if (verbose) { - SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16, - SDL_Swap16(value16)); - } - if (SDL_Swap16(value16) != swapped16) { - if (verbose) { - SDL_Log("16 bit value swapped incorrectly!\n"); - } - ++error; - } - if (verbose) { - SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32, - SDL_Swap32(value32)); - } - if (SDL_Swap32(value32) != swapped32) { - if (verbose) { - SDL_Log("32 bit value swapped incorrectly!\n"); - } - ++error; - } - if (verbose) { - SDL_Log("Value 64 = 0x%"SDL_PRIX64", swapped = 0x%"SDL_PRIX64"\n", value64, - SDL_Swap64(value64)); - } - if (SDL_Swap64(value64) != swapped64) { - if (verbose) { - SDL_Log("64 bit value swapped incorrectly!\n"); - } - ++error; - } - return (error ? 1 : 0); -} - - -int -TestCPUInfo(SDL_bool verbose) -{ - if (verbose) { - SDL_Log("CPU count: %d\n", SDL_GetCPUCount()); - SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize()); - SDL_Log("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected"); - SDL_Log("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected"); - SDL_Log("MMX %s\n", SDL_HasMMX()? "detected" : "not detected"); - SDL_Log("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected"); - SDL_Log("SSE %s\n", SDL_HasSSE()? "detected" : "not detected"); - SDL_Log("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected"); - SDL_Log("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected"); - SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected"); - SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); - SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected"); - SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); - } - return (0); -} - -int -TestAssertions(SDL_bool verbose) -{ - SDL_assert(1); - SDL_assert_release(1); - SDL_assert_paranoid(1); - SDL_assert(0 || 1); - SDL_assert_release(0 || 1); - SDL_assert_paranoid(0 || 1); - -#if 0 /* enable this to test assertion failures. */ - SDL_assert_release(1 == 2); - SDL_assert_release(5 < 4); - SDL_assert_release(0 && "This is a test"); -#endif - - { - const SDL_AssertData *item = SDL_GetAssertionReport(); - while (item) { - SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", - item->condition, item->function, item->filename, - item->linenum, item->trigger_count, - item->always_ignore ? "yes" : "no"); - item = item->next; - } - } - return (0); -} - -int -main(int argc, char *argv[]) -{ - SDL_bool verbose = SDL_TRUE; - int status = 0; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - - if (argv[1] && (SDL_strcmp(argv[1], "-q") == 0)) { - verbose = SDL_FALSE; - } - if (verbose) { - SDL_Log("This system is running %s\n", SDL_GetPlatform()); - } - - status += TestTypes(verbose); - status += TestEndian(verbose); - status += TestCPUInfo(verbose); - status += TestAssertions(verbose); - - return status; -} diff --git a/3rdparty/sdl2-2.0.4/Android.mk b/3rdparty/sdl2-2.0.9/Android.mk old mode 100755 new mode 100644 similarity index 66% rename from 3rdparty/sdl2-2.0.4/Android.mk rename to 3rdparty/sdl2-2.0.9/Android.mk index 13d765f579..9ce879a111 --- a/3rdparty/sdl2-2.0.4/Android.mk +++ b/3rdparty/sdl2-2.0.9/Android.mk @@ -20,7 +20,7 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/audio/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \ - $(LOCAL_PATH)/src/atomic/SDL_atomic.c \ + $(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \ $(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \ $(wildcard $(LOCAL_PATH)/src/core/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \ @@ -28,13 +28,16 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/events/*.c) \ $(wildcard $(LOCAL_PATH)/src/file/*.c) \ $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \ - $(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \ + $(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \ $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/sensor/*.c) \ + $(wildcard $(LOCAL_PATH)/src/sensor/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/render/*.c) \ $(wildcard $(LOCAL_PATH)/src/render/*/*.c) \ $(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \ @@ -44,11 +47,18 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \ $(wildcard $(LOCAL_PATH)/src/test/*.c)) +LOCAL_SHARED_LIBRARIES := hidapi + LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +ifeq ($(NDK_DEBUG),1) + cmd-strip := +endif + include $(BUILD_SHARED_LIBRARY) ########################### @@ -61,9 +71,40 @@ LOCAL_MODULE := SDL2_static LOCAL_MODULE_FILENAME := libSDL2 -LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(LOCAL_PATH)/src/main/android/SDL_android_main.c) - LOCAL_LDLIBS := -LOCAL_EXPORT_LDLIBS := -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid + +include $(BUILD_STATIC_LIBRARY) + +########################### +# +# SDL main static library +# +########################### + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include + +LOCAL_MODULE := SDL2_main + +LOCAL_MODULE_FILENAME := libSDL2main include $(BUILD_STATIC_LIBRARY) + +########################### +# +# hidapi library +# +########################### + +include $(CLEAR_VARS) + +LOCAL_CPPFLAGS += -std=c++11 + +LOCAL_SRC_FILES := src/hidapi/android/hid.cpp + +LOCAL_MODULE := libhidapi +LOCAL_LDLIBS := -llog + +include $(BUILD_SHARED_LIBRARY) diff --git a/3rdparty/sdl2-2.0.4/BUGS.txt b/3rdparty/sdl2-2.0.9/BUGS.txt similarity index 64% rename from 3rdparty/sdl2-2.0.4/BUGS.txt rename to 3rdparty/sdl2-2.0.9/BUGS.txt index 7ef5538752..57d953ffea 100644 --- a/3rdparty/sdl2-2.0.4/BUGS.txt +++ b/3rdparty/sdl2-2.0.9/BUGS.txt @@ -1,15 +1,15 @@ Bugs are now managed in the SDL bug tracker, here: - http://bugzilla.libsdl.org/ + https://bugzilla.libsdl.org/ You may report bugs there, and search to see if a given issue has already been reported, discussed, and maybe even fixed. -You may also find help on the SDL mailing list. Subscription information: +You may also find help at the SDL forums/mailing list: - http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org + https://discourse.libsdl.org/ Bug reports are welcome here, but we really appreciate if you use Bugzilla, as bugs discussed on the mailing list may be forgotten or missed. diff --git a/3rdparty/sdl2-2.0.4/CMakeLists.txt b/3rdparty/sdl2-2.0.9/CMakeLists.txt old mode 100755 new mode 100644 similarity index 74% rename from 3rdparty/sdl2-2.0.4/CMakeLists.txt rename to 3rdparty/sdl2-2.0.9/CMakeLists.txt index 74356b60f0..0128c7ac7d --- a/3rdparty/sdl2-2.0.4/CMakeLists.txt +++ b/3rdparty/sdl2-2.0.9/CMakeLists.txt @@ -2,19 +2,32 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") endif() -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.11) project(SDL2 C) + +# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property +# !!! FIXME: for the SDL2 shared library (so you get an +# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib" +# !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm +# !!! FIXME: punting for now and leaving the existing behavior. Until this +# !!! FIXME: properly resolved, this line silences a warning in CMake 3.0+. +# !!! FIXME: remove it and this comment entirely once the problem is +# !!! FIXME: properly resolved. +#cmake_policy(SET CMP0042 OLD) + include(CheckFunctionExists) include(CheckLibraryExists) include(CheckIncludeFiles) include(CheckIncludeFile) include(CheckSymbolExists) +include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckTypeSize) include(CheckStructHasMember) include(CMakeDependentOption) include(FindPkgConfig) +include(GNUInstallDirs) set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) @@ -29,10 +42,19 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 4) +set(SDL_MICRO_VERSION 9) set(SDL_INTERFACE_AGE 0) -set(SDL_BINARY_AGE 4) +set(SDL_BINARY_AGE 9) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") +# the following should match the versions in Xcode project file: +set(DYLIB_CURRENT_VERSION 10.0.0) +set(DYLIB_COMPATIBILITY_VERSION 1.0.0) + +# Set defaults preventing destination file conflicts +set(SDL_CMAKE_DEBUG_POSTFIX "d" + CACHE STRING "Name suffix for debug builds") + +mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) # Calculate a libtool-like version number math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") @@ -125,7 +147,9 @@ endif() # Default option knobs if(APPLE OR ARCH_64) - set(OPT_DEF_SSEMATH ON) + if(NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm") + set(OPT_DEF_SSEMATH ON) + endif() endif() if(UNIX OR MINGW OR MSYS) set(OPT_DEF_LIBC ON) @@ -145,10 +169,16 @@ else() set(OPT_DEF_ASM FALSE) endif() +if(USE_GCC OR USE_CLANG) + set(OPT_DEF_GCC_ATOMICS ON) +endif() + # Default flags, if not set otherwise if("$ENV{CFLAGS}" STREQUAL "") - if(USE_GCC OR USE_CLANG) - set(CMAKE_C_FLAGS "-g -O3") + if(CMAKE_BUILD_TYPE STREQUAL "") + if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "-g -O3") + endif() endif() else() set(CMAKE_C_FLAGS "$ENV{CFLAGS}") @@ -183,8 +213,14 @@ endif() set(SDL_LIBS "-lSDL2") set(SDL_CFLAGS "") -# Emscripten toolchain has a nonempty default value for this, and the checks -# in this file need to change that, so remember the original value, and +# When building shared lib for Windows with MinGW, +# avoid the DLL having a "lib" prefix +if(WINDOWS) + set(CMAKE_SHARED_LIBRARY_PREFIX "") +endif() + +# Emscripten toolchain has a nonempty default value for this, and the checks +# in this file need to change that, so remember the original value, and # restore back to that afterwards. For check_function_exists() to work in # Emscripten, this value must be at its default value. set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) @@ -192,7 +228,7 @@ set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) if(CYGWIN) # We build SDL on cygwin without the UNIX emulation layer include_directories("-I/usr/include/mingw") - set(CMAKE_REQUIRED_FLAGS "-mno-cygwin") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin") check_c_source_compiles("int main(int argc, char **argv) {}" HAVE_GCC_NO_CYGWIN) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) @@ -206,13 +242,18 @@ endif() add_definitions(-DUSING_GENERATED_CONFIG_H) # General includes include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include) +if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter ${SDL2_SOURCE_DIR}/src/video/khronos") +else() + include_directories(${SDL2_SOURCE_DIR}/src/video/khronos) +endif() # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so # you only need to have a platform override them if they are disabling. set(OPT_DEF_ASM TRUE) if(EMSCRIPTEN) # Set up default values for the currently supported set of subsystems: - # Emscripten/Javascript does not have assembly support, a dynamic library + # Emscripten/Javascript does not have assembly support, a dynamic library # loading architecture, low-level CPU inspection or multithreading. set(OPT_DEF_ASM FALSE) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) @@ -229,7 +270,7 @@ endif() set(SDL_SUBSYSTEMS Atomic Audio Video Render Events Joystick Haptic Power Threads Timers - File Loadso CPUinfo Filesystem Dlopen) + File Loadso CPUinfo Filesystem Dlopen Sensor) foreach(_SUB ${SDL_SUBSYSTEMS}) string(TOUPPER ${_SUB} _OPT) if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT) @@ -241,20 +282,19 @@ endforeach() option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") #set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC}) -set_option(GCC_ATOMICS "Use gcc builtin atomics" ${USE_GCC}) +set_option(GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS}) set_option(ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM}) set_option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) set_option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) set_option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) +set_option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM}) set_option(DISKAUDIO "Support the disk writer audio driver" ON) set_option(DUMMYAUDIO "Support the dummy audio driver" ON) set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF) dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF) -set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) -dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) set_option(VIDEO_DUMMY "Use dummy video driver" ON) set_option(VIDEO_OPENGL "Include OpenGL support" ON) set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON) @@ -264,6 +304,8 @@ set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOP set_option(OSS "Support the OSS audio API" ${UNIX_SYS}) set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS}) dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF) +set_option(JACK "Support the JACK audio API" ${UNIX_SYS}) +dep_option(JACK_SHARED "Dynamically load JACK audio support" ON "JACK" OFF) set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF) set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) @@ -273,6 +315,10 @@ dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" O set_option(NAS "Support the NAS audio API" ${UNIX_SYS}) set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS}) set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS}) +set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) +dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) +set_option(LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) +dep_option(LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "LIBSAMPLERATE" OFF) set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF) set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS}) @@ -291,14 +337,21 @@ foreach(_SUB ${SDL_X11_OPTIONS}) endforeach() set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) +set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS}) set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) +dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF) +set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS}) +dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") +dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) +set_option(SDL_TEST "Build the test directory" OFF) + # General source files file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/*.c @@ -314,7 +367,8 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/stdlib/*.c ${SDL2_SOURCE_DIR}/src/thread/*.c ${SDL2_SOURCE_DIR}/src/timer/*.c - ${SDL2_SOURCE_DIR}/src/video/*.c) + ${SDL2_SOURCE_DIR}/src/video/*.c + ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) if(ASSERTIONS STREQUAL "auto") @@ -334,6 +388,24 @@ set(HAVE_ASSERTIONS ${ASSERTIONS}) # Compiler option evaluation if(USE_GCC OR USE_CLANG) + # Check for -Wall first, so later things can override pieces of it. + check_c_compiler_flag(-Wall HAVE_GCC_WALL) + if(HAVE_GCC_WALL) + list(APPEND EXTRA_CFLAGS "-Wall") + if(HAIKU) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") + endif() + endif() + + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() + list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") + endif() + if(DEPENDENCY_TRACKING) check_c_source_compiles(" #if !defined(__GNUC__) || __GNUC__ < 3 @@ -375,23 +447,22 @@ if(USE_GCC OR USE_CLANG) endif() set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - check_c_compiler_flag(-Wall HAVE_GCC_WALL) - if(HAVE_GCC_WALL) - list(APPEND EXTRA_CFLAGS "-Wall") - if(HAIKU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") - endif() - endif() check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW) if(HAVE_GCC_WSHADOW) list(APPEND EXTRA_CFLAGS "-Wshadow") endif() - set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") - check_c_compiler_flag("" HAVE_NO_UNDEFINED) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - if(HAVE_NO_UNDEFINED) - list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + if(APPLE) + list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error") + list(APPEND EXTRA_LDFLAGS "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") + list(APPEND EXTRA_LDFLAGS "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") + else() + set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") + check_c_compiler_flag("" HAVE_NO_UNDEFINED) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_NO_UNDEFINED) + list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + endif() endif() endif() @@ -487,15 +558,43 @@ if(ASSEMBLY) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() - if(SSEMATH) - if(SSE OR SSE2) + if(SSE3) + set(CMAKE_REQUIRED_FLAGS "-msse3") + check_c_source_compiles(" + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE3__ + #error Assembler CPP flag not enabled + #endif + int main(int argc, char **argv) { }" HAVE_SSE3) + if(HAVE_SSE3) + list(APPEND EXTRA_CFLAGS "-msse3") + endif() + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + endif() + + if(NOT SSEMATH) + if(SSE OR SSE2 OR SSE3) if(USE_GCC) - list(APPEND EXTRA_CFLAGS "-mfpmath=387") + check_c_compiler_flag(-mfpmath=387 HAVE_FP_387) + if(HAVE_FP_387) + list(APPEND EXTRA_CFLAGS "-mfpmath=387") + endif() endif() set(HAVE_SSEMATH TRUE) endif() endif() + check_include_file("immintrin.h" HAVE_IMMINTRIN_H) + if(ALTIVEC) set(CMAKE_REQUIRED_FLAGS "-maltivec") check_c_source_compiles(" @@ -528,12 +627,13 @@ if(ASSEMBLY) endif() set(HAVE_SSE TRUE) set(HAVE_SSE2 TRUE) + set(HAVE_SSE3 TRUE) set(SDL_ASSEMBLY_ROUTINES 1) endif() # TODO: #else() # if(USE_GCC OR USE_CLANG) -# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") +# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-sse3" "-mno-mmx") # endif() endif() @@ -542,7 +642,7 @@ endif() if(LIBC) if(WINDOWS AND NOT MINGW) set(HAVE_LIBC TRUE) - foreach(_HEADER stdio.h string.h ctype.h math.h) + foreach(_HEADER stdio.h string.h wchar.h ctype.h math.h limits.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) set(${_HAVE_H} 1) @@ -550,10 +650,13 @@ if(LIBC) set(HAVE_SIGNAL_H 1) foreach(_FN malloc calloc realloc free qsort abs memset memcpy memmove memcmp + wcslen wcscmp strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp - _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos - cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + _stricmp _strnicmp sscanf + acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf + copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf + log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) string(TOUPPER ${_FN} _UPPER) set(HAVE_${_UPPER} 1) endforeach() @@ -567,8 +670,8 @@ if(LIBC) set(HAVE_LIBC TRUE) check_include_file(sys/types.h HAVE_SYS_TYPES_H) foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h - strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h + strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) @@ -584,11 +687,11 @@ if(LIBC) foreach(_FN strtod malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat - strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa + _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp - vsscanf vsnprintf fseeko fseeko64 sigaction setjmp - nanosleep sysconf sysctlbyname + vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp + nanosleep sysconf sysctlbyname getauxval poll ) string(TOUPPER ${_FN} _UPPER) set(_HAVEVAR "HAVE_${_UPPER}") @@ -652,6 +755,10 @@ if(SDL_HAPTIC) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) endif() +if(SDL_SENSOR) + file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES}) +endif() if(SDL_POWER) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) @@ -698,8 +805,19 @@ endif() if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES}) + + # SDL_spinlock.c Needs to be compiled in ARM mode. + # There seems to be no better way currently to set the ARM mode. + # see: https://issuetracker.google.com/issues/62264618 + # Another option would be to set ARM mode to all compiled files + check_c_compiler_flag(-marm HAVE_ARM_MODE) + if(HAVE_ARM_MODE) + set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + endif() + file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MAIN_SOURCES}) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${ANDROID_MAIN_SOURCES}) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) @@ -712,33 +830,84 @@ if(ANDROID) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() + if(SDL_HAPTIC) + set(SDL_HAPTIC_ANDROID 1) + file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES}) + set(HAVE_SDL_HAPTIC TRUE) + endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) - file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c) + file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() + if(SDL_LOADSO) + set(SDL_LOADSO_DLOPEN 1) + file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + set(HAVE_SDL_LOADSO TRUE) + endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() + if(SDL_TIMERS) + set(SDL_TIMER_UNIX 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + endif() + if(SDL_SENSOR) + set(SDL_SENSOR_ANDROID 1) + set(HAVE_SDL_SENSORS TRUE) + file(GLOB ANDROID_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/android/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_SENSOR_SOURCES}) + endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) + # Core stuff + find_library(ANDROID_DL_LIBRARY dl) + find_library(ANDROID_LOG_LIBRARY log) + find_library(ANDROID_LIBRARY_LIBRARY android) + list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY}) + add_definitions(-DGL_GLEXT_PROTOTYPES) + #enable gles if(VIDEO_OPENGLES) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_VIDEO_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1) + + find_library(OpenGLES1_LIBRARY GLESv1_CM) + find_library(OpenGLES2_LIBRARY GLESv2) + list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) + endif() + + CHECK_C_SOURCE_COMPILES(" + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + int main() + { + return 0; + } + " VULKAN_PASSED_ANDROID_CHECKS) + if(NOT VULKAN_PASSED_ANDROID_CHECKS) + set(VIDEO_VULKAN OFF) + message(STATUS "Vulkan doesn't work on this configuration") endif() endif() - list(APPEND EXTRA_LDFLAGS "-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit") + + CheckPTHREAD() + endif() # Platform-specific options and settings @@ -770,6 +939,16 @@ if(EMSCRIPTEN) set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() + if(SDL_TIMERS) + set(SDL_TIMER_UNIX 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + + if(CLOCK_GETTIME) + set(HAVE_CLOCK_GETTIME 1) + endif() + endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) @@ -784,17 +963,17 @@ if(EMSCRIPTEN) set(SDL_VIDEO_RENDER_OGL_ES2 1) endif() endif() -elseif(UNIX AND NOT APPLE) +elseif(UNIX AND NOT APPLE AND NOT ANDROID) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) - elseif(NETBSD OR OPENBSD) - set(SDL_AUDIO_DRIVER_BSD 1) - file(GLOB BSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/bsd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${BSD_AUDIO_SOURCES}) + elseif(NETBSD) + set(SDL_AUDIO_DRIVER_NETBSD 1) + file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) @@ -804,12 +983,14 @@ elseif(UNIX AND NOT APPLE) endif() CheckOSS() CheckALSA() + CheckJACK() CheckPulseAudio() CheckESD() CheckARTS() CheckNAS() CheckSNDIO() CheckFusionSound() + CheckLibSampleRate() endif() if(SDL_VIDEO) @@ -822,6 +1003,12 @@ elseif(UNIX AND NOT APPLE) CheckOpenGLESX11() CheckWayland() CheckVivante() + CheckKMSDRM() + endif() + + if(UNIX) + file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES}) endif() if(LINUX) @@ -836,15 +1023,15 @@ elseif(UNIX AND NOT APPLE) #include #include - int main(int argc, char **argv) + int main(int argc, char **argv) { struct kbentry kbe; kbe.kb_table = KG_CTRL; ioctl(0, KDGKBENT, &kbe); }" HAVE_INPUT_KD) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + file(GLOB CORE_LINUX_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_LINUX_SOURCES}) if(HAVE_INPUT_EVENTS) set(SDL_INPUT_LINUXEV 1) @@ -863,8 +1050,29 @@ elseif(UNIX AND NOT APPLE) check_include_file("libudev.h" HAVE_LIBUDEV_H) - # !!! FIXME: this needs pkg-config to find the include path, I think. - check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H) + if(PKG_CONFIG_FOUND) + pkg_search_module(DBUS dbus-1 dbus) + if(DBUS_FOUND) + set(HAVE_DBUS_DBUS_H TRUE) + include_directories(${DBUS_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBS ${DBUS_LIBRARIES}) + endif() + + pkg_search_module(IBUS ibus-1.0 ibus) + if(IBUS_FOUND) + set(HAVE_IBUS_IBUS_H TRUE) + include_directories(${IBUS_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES}) + endif() + if(HAVE_LIBUNWIND_H) + # We've already found the header, so REQUIRE the lib to be present + pkg_search_module(UNWIND REQUIRED libunwind) + pkg_search_module(UNWIND_GENERIC REQUIRED libunwind-generic) + list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) + endif() + endif() + + check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H) endif() if(INPUT_TSLIB) @@ -881,7 +1089,7 @@ elseif(UNIX AND NOT APPLE) CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -933,7 +1141,14 @@ elseif(UNIX AND NOT APPLE) if(RPATH) set(SDL_RLD_FLAGS "") if(BSDI OR FREEBSD OR LINUX OR NETBSD) - set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags") + check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_ENABLE_NEW_DTAGS) + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir} -Wl,--enable-new-dtags") + else() + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + endif() elseif(SOLARIS) set(SDL_RLD_FLAGS "-R\${libdir}") endif() @@ -953,9 +1168,9 @@ elseif(WINDOWS) if(MSVC) # Prevent codegen that would use the VC runtime libraries. - add_definitions(/GS-) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") if(NOT ARCH_64) - add_definitions(/arch:SSE) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") endif() endif() @@ -977,6 +1192,16 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { }" HAVE_XINPUT_H) + check_c_source_compiles(" + #include + #include + XINPUT_GAMEPAD_EX x1; + int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX) + check_c_source_compiles(" + #include + #include + XINPUT_STATE_EX s1; + int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX) else() check_include_file(xinput.h HAVE_XINPUT_H) endif() @@ -986,9 +1211,8 @@ elseif(WINDOWS) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - check_include_file(xaudio2.h HAVE_XAUDIO2_H) check_include_file(dxgi.h HAVE_DXGI_H) - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) + if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks @@ -999,6 +1223,11 @@ elseif(WINDOWS) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() + # headers needed elsewhere ... + check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) + check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) + check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) @@ -1011,10 +1240,10 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) endif() - if(HAVE_XAUDIO2_H) - set(SDL_AUDIO_DRIVER_XAUDIO2 1) - file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES}) + if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) + set(SDL_AUDIO_DRIVER_WASAPI 1) + file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES}) endif() endif() @@ -1063,7 +1292,7 @@ elseif(WINDOWS) endif() # Libraries for Win32 native and MinGW - list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid) + list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 shell32) # TODO: in configure.in the check for timers is set on # cygwin | mingw32* - does this include mingw32CE? @@ -1105,7 +1334,7 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) - list(APPEND EXTRA_LIBS dinput8 dxguid) + list(APPEND EXTRA_LIBS dinput8) if(CMAKE_COMPILER_IS_MINGW) list(APPEND EXTRA_LIBS dxerr8) elseif (NOT USE_WINSDK_DIRECTX) @@ -1147,15 +1376,25 @@ elseif(WINDOWS) list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") endif() elseif(APPLE) - # TODO: rework this for proper MacOS X, iOS and Darwin support + # TODO: rework this all for proper MacOS X, iOS and Darwin support + + # We always need these libs on macOS at the moment. + # !!! FIXME: we need Carbon for some very old API calls in + # !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out + # !!! FIXME: how to dump those. + if(NOT IOS) + set(SDL_FRAMEWORK_COCOA 1) + set(SDL_FRAMEWORK_CARBON 1) + endif() # Requires the darwin file implementation if(SDL_FILE) file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) set(HAVE_SDL_FILE TRUE) - set(SDL_FRAMEWORK_COCOA 1) + # !!! FIXME: why is COREVIDEO inside this if() block? set(SDL_FRAMEWORK_COREVIDEO 1) else() message_error("SDL_FILE must be enabled to build on MacOS X") @@ -1163,16 +1402,22 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c) + file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${AUDIO_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) - set(SDL_FRAMEWORK_AUDIOUNIT 1) + set(SDL_FRAMEWORK_AUDIOTOOLBOX 1) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_IOKIT 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) + if (IOS) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + else() + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) set(SDL_FRAMEWORK_IOKIT 1) @@ -1181,7 +1426,12 @@ elseif(APPLE) if(SDL_HAPTIC) set(SDL_HAPTIC_IOKIT 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + if (IOS) + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + set(SDL_HAPTIC_DUMMY 1) + else() + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) set(SDL_FRAMEWORK_IOKIT 1) @@ -1193,10 +1443,13 @@ elseif(APPLE) if(SDL_POWER) set(SDL_POWER_MACOSX 1) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + if (IOS) + file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m) + else() + file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) - set(SDL_FRAMEWORK_CARBON 1) set(SDL_FRAMEWORK_IOKIT 1) endif() @@ -1210,6 +1463,7 @@ elseif(APPLE) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) @@ -1240,19 +1494,32 @@ elseif(APPLE) find_library(COREAUDIO CoreAudio) list(APPEND EXTRA_LIBS ${COREAUDIO}) endif() - if(SDL_FRAMEWORK_AUDIOUNIT) - find_library(AUDIOUNIT AudioUnit) - list(APPEND EXTRA_LIBS ${AUDIOUNIT}) + if(SDL_FRAMEWORK_AUDIOTOOLBOX) + find_library(AUDIOTOOLBOX AudioToolbox) + list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX}) endif() # iOS hack needed - http://code.google.com/p/ios-cmake/ ? if(SDL_VIDEO) - CheckCOCOA() - if(VIDEO_OPENGL) - set(SDL_VIDEO_OPENGL 1) - set(SDL_VIDEO_OPENGL_CGL 1) - set(SDL_VIDEO_RENDER_OGL 1) - set(HAVE_VIDEO_OPENGL TRUE) + if (IOS) + set(SDL_VIDEO_DRIVER_UIKIT 1) + file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) + set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES}) + else() + CheckCOCOA() + if(VIDEO_OPENGL) + set(SDL_VIDEO_OPENGL 1) + set(SDL_VIDEO_OPENGL_CGL 1) + set(SDL_VIDEO_RENDER_OGL 1) + set(HAVE_VIDEO_OPENGL TRUE) + endif() + + if(VIDEO_OPENGLES) + set(SDL_VIDEO_OPENGL_EGL 1) + set(SDL_VIDEO_OPENGL_ES2 1) + set(SDL_VIDEO_RENDER_OGL_ES2 1) + set(HAVE_VIDEO_OPENGLES TRUE) + endif() endif() endif() @@ -1289,6 +1556,11 @@ elseif(HAIKU) CheckPTHREAD() endif() +if(VIDEO_VULKAN) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VIDEO_VULKAN TRUE) +endif() + # Dummies # configure.in does it differently: # if not have X @@ -1298,7 +1570,7 @@ endif() # This leads to missing internal references on building, since the # src/X/*.c does not get included. if(NOT HAVE_SDL_JOYSTICK) - set(SDL_JOYSTICK_DISABLED 1) + set(SDL_JOYSTICK_DUMMY 1) if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) @@ -1306,10 +1578,15 @@ if(NOT HAVE_SDL_JOYSTICK) endif() endif() if(NOT HAVE_SDL_HAPTIC) - set(SDL_HAPTIC_DISABLED 1) + set(SDL_HAPTIC_DUMMY 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) endif() +if(NOT HAVE_SDL_SENSORS) + set(SDL_SENSOR_DUMMY 1) + file(GLOB SENSORS_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/dummy/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${SENSORS_SOURCES}) +endif() if(NOT HAVE_SDL_LOADSO) set(SDL_LOADSO_DISABLED 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) @@ -1439,6 +1716,9 @@ message(STATUS " EXTRA_LIBS: ${EXTRA_LIBS}") message(STATUS "") message(STATUS " Build Shared Library: ${SDL_SHARED}") message(STATUS " Build Static Library: ${SDL_STATIC}") +if(SDL_STATIC) + message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}") +endif() message(STATUS "") if(UNIX) message(STATUS "If something was not detected, although the libraries") @@ -1452,11 +1732,19 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) +target_include_directories(SDL2main PUBLIC "$" $) set(_INSTALL_LIBS "SDL2main") +if (NOT ANDROID) + set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) +endif() if(SDL_SHARED) - add_library(SDL2 SHARED ${SOURCE_FILES}) - if(UNIX) + add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + if(APPLE) + set_target_properties(SDL2 PROPERTIES + MACOSX_RPATH 1 + OUTPUT_NAME "SDL2-${LT_RELEASE}") + elseif(UNIX AND NOT ANDROID) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} SOVERSION ${LT_REVISION} @@ -1467,7 +1755,7 @@ if(SDL_SHARED) SOVERSION ${LT_REVISION} OUTPUT_NAME "SDL2") endif() - if(MSVC) + if(MSVC AND NOT LIBC) # Don't try to link with the default set of libraries. set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") @@ -1475,13 +1763,24 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2 PUBLIC "$" $) + if (NOT ANDROID) + set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() endif() if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") - if(MSVC) + if (NOT SDL_SHARED OR NOT WIN32) + set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + # Note: Apparently, OUTPUT_NAME must really be unique; even when + # CMAKE_IMPORT_LIBRARY_SUFFIX or the like are given. Otherwise + # the static build may race with the import lib and one will get + # clobbered, when the suffix is realized via subsequent rename. + endif() + set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) + if(MSVC AND NOT LIBC) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") @@ -1490,14 +1789,55 @@ if(SDL_STATIC) # libraries - do we need to consider this? set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2-static PUBLIC "$" $) + if (NOT ANDROID) + set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() +endif() + +##### Tests ##### + +if(SDL_TEST) + file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) + add_library(SDL2_test STATIC ${TEST_SOURCES}) + + add_subdirectory(test) endif() ##### Installation targets ##### -install(TARGETS ${_INSTALL_LIBS} +install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" RUNTIME DESTINATION bin) +##### Export files ##### +if (APPLE) + set(PKG_PREFIX "SDL2.framework/Resources") +elseif (WINDOWS) + set(PKG_PREFIX "cmake") +else () + set(PKG_PREFIX "lib/cmake/SDL2") +endif () + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + VERSION ${SDL_VERSION} + COMPATIBILITY AnyNewerVersion +) + +install(EXPORT SDL2Targets + FILE SDL2Targets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} +) +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake + ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake + DESTINATION ${PKG_PREFIX} + COMPONENT Devel +) + file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) foreach(_FNAME ${BIN_INCLUDE_FILES}) @@ -1507,12 +1847,24 @@ endforeach() list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2) -if(NOT WINDOWS OR CYGWIN) +string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) +if (UPPER_BUILD_TYPE MATCHES DEBUG) + set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") +else() + set(SOPOSTFIX "") +endif() + +if(NOT (WINDOWS OR CYGWIN)) if(SDL_SHARED) - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.so\" \"libSDL2.so\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") + set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. + get_target_property(SONAME SDL2 OUTPUT_NAME) + if(NOT ANDROID) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\")" + WORKING_DIR "${SDL2_BINARY_DIR}") + install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "lib${LIB_SUFFIX}") + endif() endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig @@ -1523,15 +1875,17 @@ if(NOT WINDOWS OR CYGWIN) endif() install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin) # TODO: what about the .spec file? Is it only needed for RPM creation? - install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal") + install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal") endif() ##### Uninstall target ##### -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) -add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() diff --git a/3rdparty/sdl2-2.0.4/COPYING.txt b/3rdparty/sdl2-2.0.9/COPYING.txt similarity index 91% rename from 3rdparty/sdl2-2.0.4/COPYING.txt rename to 3rdparty/sdl2-2.0.9/COPYING.txt index 04f14eed55..44a60ed73e 100644 --- a/3rdparty/sdl2-2.0.4/COPYING.txt +++ b/3rdparty/sdl2-2.0.9/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga +Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/CREDITS.txt b/3rdparty/sdl2-2.0.9/CREDITS.txt similarity index 100% rename from 3rdparty/sdl2-2.0.4/CREDITS.txt rename to 3rdparty/sdl2-2.0.9/CREDITS.txt diff --git a/3rdparty/sdl2-2.0.4/INSTALL.txt b/3rdparty/sdl2-2.0.9/INSTALL.txt similarity index 81% rename from 3rdparty/sdl2-2.0.4/INSTALL.txt rename to 3rdparty/sdl2-2.0.9/INSTALL.txt index 2df10bdd70..398fc1191f 100644 --- a/3rdparty/sdl2-2.0.4/INSTALL.txt +++ b/3rdparty/sdl2-2.0.9/INSTALL.txt @@ -5,7 +5,7 @@ To compile and install SDL: * Read VisualC.html Windows with gcc, either native or cross-compiling: - * Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows + * Read the FAQ at https://wiki.libsdl.org/moin.fcg/FAQWindows * Run './configure; make; make install' Mac OS X with Xcode: @@ -27,14 +27,14 @@ To compile and install SDL: * Read docs/README-cmake.md 2. Look at the example programs in ./test, and check out the online - documentation at http://wiki.libsdl.org/ + documentation at https://wiki.libsdl.org/ 3. Join the SDL developer mailing list by sending E-mail to sdl-request@libsdl.org and put "subscribe" in the subject of the message. Or alternatively you can use the web interface: - http://www.libsdl.org/mailing-list.php + https://www.libsdl.org/mailing-list.php That's it! Sam Lantinga diff --git a/3rdparty/sdl2-2.0.4/Makefile.in b/3rdparty/sdl2-2.0.9/Makefile.in similarity index 84% rename from 3rdparty/sdl2-2.0.4/Makefile.in rename to 3rdparty/sdl2-2.0.9/Makefile.in index b66e0f5e24..4eb6e63239 100644 --- a/3rdparty/sdl2-2.0.4/Makefile.in +++ b/3rdparty/sdl2-2.0.9/Makefile.in @@ -3,6 +3,7 @@ top_builddir = . srcdir = @srcdir@ objects = build +gen = gen prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ @@ -31,15 +32,19 @@ WINDRES = @WINDRES@ TARGET = libSDL2.la OBJECTS = @OBJECTS@ +GEN_HEADERS = @GEN_HEADERS@ +GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ -SDLMAIN_TARGET = libSDL2main.a +SDLMAIN_TARGET = libSDL2main.la SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ -SDLTEST_TARGET = libSDL2_test.a +SDLTEST_TARGET = libSDL2_test.la SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ -SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS +WAYLAND_SCANNER = @WAYLAND_SCANNER@ + +SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) @@ -48,6 +53,7 @@ RUN_CMD_CC = @echo " CC " $@; RUN_CMD_CXX = @echo " CXX " $@; RUN_CMD_LTLINK = @echo " LTLINK" $@; RUN_CMD_RANLIB = @echo " RANLIB" $@; +RUN_CMD_GEN = @echo " GEN " $@; LIBTOOL += --quiet endif @@ -95,6 +101,7 @@ HDRS = \ SDL_render.h \ SDL_rwops.h \ SDL_scancode.h \ + SDL_sensor.h \ SDL_shape.h \ SDL_stdinc.h \ SDL_surface.h \ @@ -106,6 +113,7 @@ HDRS = \ SDL_types.h \ SDL_version.h \ SDL_video.h \ + SDL_vulkan.h \ begin_code.h \ close_code.h @@ -115,14 +123,12 @@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ -LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(srcdir)/configure: $(srcdir)/configure.in - @echo "Warning, configure.in is out of date" - #(cd $(srcdir) && sh autogen.sh && sh configure) - @sleep 3 + @echo "Warning, configure is out of date, please re-run autogen.sh" Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -137,16 +143,14 @@ update-revision: .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d) -$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS) - $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) +$(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS) + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir) $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLTEST_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir) install: all install-bin install-hdrs install-lib install-data install-bin: @@ -167,10 +171,8 @@ install-hdrs: update-revision install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir) $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) install-data: $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 @@ -200,6 +202,7 @@ uninstall-data: clean: rm -rf $(objects) + rm -rf $(gen) if test -f test/Makefile; then (cd test; $(MAKE) $@); fi distclean: clean diff --git a/3rdparty/sdl2-2.0.4/Makefile.minimal b/3rdparty/sdl2-2.0.9/Makefile.minimal similarity index 94% rename from 3rdparty/sdl2-2.0.4/Makefile.minimal rename to 3rdparty/sdl2-2.0.9/Makefile.minimal index 6ec1ce81cb..7f02649740 100644 --- a/3rdparty/sdl2-2.0.4/Makefile.minimal +++ b/3rdparty/sdl2-2.0.9/Makefile.minimal @@ -22,6 +22,8 @@ SOURCES = \ src/filesystem/dummy/*.c \ src/render/*.c \ src/render/software/*.c \ + src/sensor/*.c \ + src/sensor/dummy/*.c \ src/stdlib/*.c \ src/thread/*.c \ src/thread/generic/*.c \ diff --git a/3rdparty/sdl2-2.0.9/Makefile.os2 b/3rdparty/sdl2-2.0.9/Makefile.os2 new file mode 100644 index 0000000000..95c5cef591 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/Makefile.os2 @@ -0,0 +1,126 @@ +# Open Watcom makefile to build SDL2.dll for OS/2: +# wmake -f Makefile.os2 + +LIBNAME = SDL2 +VERSION = 2.0.9 +DESCRIPTION = Simple DirectMedia Layer 2 + +LIBHOME = . +LIBPATH = $(LIBHOME)/lib +DLLFILE = $(LIBHOME)/$(LIBNAME).dll +LIBFILE = $(LIBHOME)/$(LIBNAME).lib +LNKFILE = $(LIBNAME).lnk + +INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" +INCPATH+= -I"$(LIBHOME)/h" +INCPATH+= -Iinclude + +LIBS = mmpm2.lib libuls.lib libconv.lib + +CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei +# max warnings: +CFLAGS+= -wx +# building dll: +CFLAGS+= -bd +# the include paths : +CFLAGS+= $(INCPATH) +# building SDL itself: +CFLAGS+= -DBUILD_SDL + +SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c +SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c +SRCS+= SDL_rwops.c SDL_power.c +SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c +SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & + SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & + SDL_sensor.c SDL_touch.c +SRCS+= SDL_haptic.c SDL_gamecontroller.c SDL_joystick.c +SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & + SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & + SDL_render_sw.c SDL_rotate.c +SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & + SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & + SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & + SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c + +SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c +SRCS+= SDL_systimer.c +SRCS+= SDL_sysloadso.c +SRCS+= SDL_sysfilesystem.c +SRCS+= SDL_syshaptic.c SDL_sysjoystick.c +SRCS+= SDL_dummyaudio.c SDL_diskaudio.c +SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c +SRCS+= SDL_dummysensor.c + +SRCS+= SDL_dynapi.c + +OBJS = $(SRCS:.c=.obj) + +.extensions: +.extensions: .lib .dll .obj .c .asm + +.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; +.c: ./src/haptic/dummy;./src/joystick/dummy;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; +.c: ./src/loadso/dummy;./src/filesystem/dummy;./src/timer/dummy;./src/thread/generic; + +all: $(DLLFILE) $(LIBFILE) .symbolic + +$(DLLFILE): $(OBJS) $(LNKFILE) + @echo * Linking: $@ + wlink @$(LNKFILE) + +$(LIBFILE): $(DLLFILE) + @echo * Creating LIB file: $@ + wlib -q -b -n -c -pa -s -t -zld -ii -io $* $(DLLFILE) + +.c.obj: + wcc386 $(CFLAGS) -fo=$^@ $< + +SDL_cpuinfo.obj: SDL_cpuinfo.c + wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $< + +SDL_rwops.obj: SDL_rwops.c + wcc386 $(CFLAGS) -wcd=136 -fo=$^@ $< + +SDL_blendfillrect.obj: SDL_blendfillrect.c + wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $< + +SDL_blendline.obj: SDL_blendline.c + wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $< + +SDL_blendpoint.obj: SDL_blendpoint.c + wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $< + +SDL_RLEaccel.obj: SDL_RLEaccel.c + wcc386 $(CFLAGS) -wcd=201 -fo=$^@ $< + +$(LNKFILE): + @echo * Creating linker file: $@ + @%create $@ + @%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE + @%append $@ NAME $(DLLFILE) + @for %i in ($(OBJS)) do @%append $@ FILE %i + @%append $@ LIBPATH $(%LIB);$(LIBPATH) + @for %i in ($(LIBS)) do @%append $@ LIB %i + @%append $@ OPTION QUIET + @%append $@ OPTION IMPF=$(LIBHOME)/$^&.exp + @%append $@ OPTION MAP=$(LIBHOME)/$^&.map + @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)' + @%append $@ OPTION QUIET + @%append $@ OPTION ELIMINATE + @%append $@ OPTION MANYAUTODATA + @%append $@ OPTION OSNAME='OS/2 and eComStation' + @%append $@ OPTION SHOWDEAD + +clean: .SYMBOLIC + @ echo * Clean: $(LIBNAME) + @if exist *.obj rm *.obj + @if exist *.err rm *.err + @if exist $(LNKFILE) rm $(LNKFILE) + +distclean: .SYMBOLIC clean + @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp + @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map + @if exist $(LIBFILE) rm $(LIBFILE) + @if exist $(DLLFILE) rm $(DLLFILE) diff --git a/3rdparty/sdl2-2.0.9/Makefile.pandora b/3rdparty/sdl2-2.0.9/Makefile.pandora new file mode 100644 index 0000000000..f4cb66848b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/Makefile.pandora @@ -0,0 +1,60 @@ +# Makefile to build the pandora SDL library + +AR = arm-none-linux-gnueabi-ar +RANLIB = arm-none-linux-gnueabi-ranlib +CC = arm-none-linux-gnueabi-gcc +CXX = arm-none-linux-gnueabi-g++ +STRIP = arm-none-linux-gnueabi-strip + +CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ + -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ + -I./include -I$(PNDSDK)/usr/include + +TARGET = libSDL.a + +SOURCES = + ./src/*.c \ + ./src/atomic/*.c \ + ./src/audio/*.c \ + ./src/audio/disk/*.c \ + ./src/audio/dsp/*.c \ + ./src/audio/dummy/*.c \ + ./src/cpuinfo/*.c \ + ./src/events/*.c \ + ./src/file/*.c \ + ./src/filesystem/unix/*.c \ + ./src/haptic/*.c \ + ./src/haptic/linux/*.c \ + ./src/joystick/*.c \ + ./src/joystick/linux/*.c \ + ./src/loadso/dlopen/*.c \ + ./src/power/*.c \ + ./src/sensor/*.c \ + ./src/sensor/dummy/*.c \ + ./src/stdlib/*.c \ + ./src/thread/*.c \ + ./src/thread/pthread/SDL_syscond.c \ + ./src/thread/pthread/SDL_sysmutex.c \ + ./src/thread/pthread/SDL_syssem.c \ + ./src/thread/pthread/SDL_systhread.c \ + ./src/timer/*.c \ + ./src/timer/unix/*.c \ + ./src/video/*.c \ + ./src/video/dummy/*.c \ + ./src/video/pandora/SDL_pandora.o \ + ./src/video/pandora/SDL_pandora_events.o \ + ./src/video/x11/*.c \ + + +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') + +CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h) + +all: $(TARGET) + +$(TARGET): $(CONFIG_H) $(OBJECTS) + $(AR) crv $@ $^ + $(RANLIB) $@ + +clean: + rm -f $(TARGET) $(OBJECTS) diff --git a/3rdparty/sdl2-2.0.4/Makefile.psp b/3rdparty/sdl2-2.0.9/Makefile.psp similarity index 96% rename from 3rdparty/sdl2-2.0.4/Makefile.psp rename to 3rdparty/sdl2-2.0.9/Makefile.psp index 5e7dcd29ae..de0e50e2ff 100644 --- a/3rdparty/sdl2-2.0.4/Makefile.psp +++ b/3rdparty/sdl2-2.0.9/Makefile.psp @@ -42,6 +42,8 @@ OBJS= src/SDL.o \ src/render/software/SDL_drawpoint.o \ src/render/software/SDL_render_sw.o \ src/render/software/SDL_rotate.o \ + src/sensor/SDL_sensor.o \ + src/sensor/dummy/SDL_dummysensor.o \ src/stdlib/SDL_getenv.o \ src/stdlib/SDL_iconv.o \ src/stdlib/SDL_malloc.o \ @@ -49,6 +51,7 @@ OBJS= src/SDL.o \ src/stdlib/SDL_stdlib.o \ src/stdlib/SDL_string.o \ src/thread/SDL_thread.o \ + src/thread/generic/SDL_systls.o \ src/thread/psp/SDL_syssem.o \ src/thread/psp/SDL_systhread.o \ src/thread/psp/SDL_sysmutex.o \ diff --git a/3rdparty/sdl2-2.0.4/Makefile.wiz b/3rdparty/sdl2-2.0.9/Makefile.wiz similarity index 66% rename from 3rdparty/sdl2-2.0.4/Makefile.wiz rename to 3rdparty/sdl2-2.0.9/Makefile.wiz index bb7705789f..8ed58ee761 100644 --- a/3rdparty/sdl2-2.0.4/Makefile.wiz +++ b/3rdparty/sdl2-2.0.9/Makefile.wiz @@ -9,17 +9,36 @@ STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip CFLAGS = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE -TARGET_STATIC = libSDL13.a -TARGET_SHARED = libSDL13.so - -SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ - ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \ - ./src/joystick/*.c ./src/haptic/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \ - ./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \ - ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \ - ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \ - ./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \ - ./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o +TARGET_STATIC = libSDL2.a +TARGET_SHARED = libSDL2.so + +SOURCES = \ + ./src/*.c \ + ./src/audio/*.c \ + ./src/audio/disk/*.c \ + ./src/audio/dsp/*.c \ + ./src/audio/dummy/*.c \ + ./src/cpuinfo/*.c \ + ./src/events/*.c \ + ./src/file/*.c \ + ./src/haptic/*.c \ + ./src/haptic/linux/*.c \ + ./src/joystick/*.c \ + ./src/joystick/linux/*.c \ + ./src/loadso/dlopen/*.c \ + ./src/sensor/*.c \ + ./src/sensor/dummy/*.c \ + ./src/stdlib/*.c \ + ./src/thread/*.c \ + ./src/thread/pthread/SDL_syscond.c \ + ./src/thread/pthread/SDL_sysmutex.c \ + ./src/thread/pthread/SDL_syssem.c \ + ./src/thread/pthread/SDL_systhread.c \ + ./src/timer/*.c \ + ./src/timer/unix/*.c \ + ./src/video/*.c \ + ./src/video/dummy/*.c \ + ./src/video/pandora/*.c \ OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') @@ -43,7 +62,7 @@ clean: install: mkdir -p $(WIZSDK)/lib - mkdir -p $(WIZSDK)/include/SDL13 + mkdir -p $(WIZSDK)/include/SDL2 cp -f $(TARGET_STATIC) $(WIZSDK)/lib cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED) @@ -57,5 +76,5 @@ install: ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED) cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0 - cp -f include/*.h $(WIZSDK)/include/SDL13/ - cp -f include/*.h ../../toolchain/include/SDL13/ + cp -f include/*.h $(WIZSDK)/include/SDL2/ + cp -f include/*.h ../../toolchain/include/SDL2/ diff --git a/3rdparty/sdl2-2.0.4/README-SDL.txt b/3rdparty/sdl2-2.0.9/README-SDL.txt similarity index 86% rename from 3rdparty/sdl2-2.0.4/README-SDL.txt rename to 3rdparty/sdl2-2.0.9/README-SDL.txt index 0630395e5d..2984b145ee 100644 --- a/3rdparty/sdl2-2.0.4/README-SDL.txt +++ b/3rdparty/sdl2-2.0.9/README-SDL.txt @@ -2,11 +2,11 @@ Please distribute this file with the SDL runtime environment: The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games and -emulators. +designed to make it easy to write multi-media software, such as games +and emulators. The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ +https://www.libsdl.org/ This library is distributed under the terms of the zlib license: http://www.zlib.net/zlib_license.html diff --git a/3rdparty/sdl2-2.0.4/README.txt b/3rdparty/sdl2-2.0.9/README.txt similarity index 93% rename from 3rdparty/sdl2-2.0.4/README.txt rename to 3rdparty/sdl2-2.0.9/README.txt index 84c335c2bd..e8630c713a 100644 --- a/3rdparty/sdl2-2.0.4/README.txt +++ b/3rdparty/sdl2-2.0.9/README.txt @@ -6,7 +6,7 @@ Version 2.0 --- -http://www.libsdl.org/ +https://www.libsdl.org/ Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics diff --git a/3rdparty/sdl2-2.0.4/SDL2.spec b/3rdparty/sdl2-2.0.9/SDL2.spec similarity index 99% rename from 3rdparty/sdl2-2.0.4/SDL2.spec rename to 3rdparty/sdl2-2.0.9/SDL2.spec index 0fe57540f1..67e819690c 100644 --- a/3rdparty/sdl2-2.0.4/SDL2.spec +++ b/3rdparty/sdl2-2.0.9/SDL2.spec @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.0.4 +Version: 2.0.9 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff --git a/3rdparty/sdl2-2.0.4/SDL2.spec.in b/3rdparty/sdl2-2.0.9/SDL2.spec.in similarity index 100% rename from 3rdparty/sdl2-2.0.4/SDL2.spec.in rename to 3rdparty/sdl2-2.0.9/SDL2.spec.in diff --git a/3rdparty/sdl2-2.0.9/SDL2Config.cmake b/3rdparty/sdl2-2.0.9/SDL2Config.cmake new file mode 100644 index 0000000000..4a5f646020 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/SDL2Config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") diff --git a/3rdparty/sdl2-2.0.4/TODO.txt b/3rdparty/sdl2-2.0.9/TODO.txt similarity index 100% rename from 3rdparty/sdl2-2.0.4/TODO.txt rename to 3rdparty/sdl2-2.0.9/TODO.txt diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2-WinRT.nuspec b/3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2-WinRT.nuspec similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2-WinRT.nuspec rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2-WinRT.nuspec diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2-WinRT.targets b/3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2-WinRT.targets similarity index 90% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2-WinRT.targets rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2-WinRT.targets index f0b9e97318..b9f274b1a2 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2-WinRT.targets +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2-WinRT.targets @@ -2,7 +2,6 @@ - WinRT80 WinRT81 WinPhone80 WinPhone81 diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec b/3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets b/3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets diff --git a/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.sln b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.sln new file mode 100644 index 0000000000..e3ab7f7245 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-UWP", "SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32 + {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj similarity index 93% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj index 305a3ca5f1..ede896fe30 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj @@ -67,6 +67,7 @@ + @@ -81,12 +82,10 @@ - - - + @@ -99,6 +98,7 @@ + @@ -118,7 +118,7 @@ - + @@ -133,10 +133,14 @@ + + + + @@ -155,11 +159,14 @@ + + + @@ -172,8 +179,8 @@ - - + + true true true @@ -210,6 +217,7 @@ + @@ -250,11 +258,11 @@ true true + - @@ -265,9 +273,12 @@ + + + @@ -303,6 +314,7 @@ + true true @@ -311,6 +323,14 @@ true true + + true + true + true + true + true + true + true true @@ -359,6 +379,7 @@ true true + {89e9b32e-a86a-47c3-a948-d2b1622925ce} diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters similarity index 89% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters index b8c6d712d9..7a26d851a0 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters @@ -174,9 +174,6 @@ Source Files - - Source Files - Source Files @@ -186,9 +183,6 @@ Source Files - - Source Files - Source Files @@ -270,9 +264,6 @@ Source Files - - Source Files - Source Files @@ -396,10 +387,46 @@ Source Files - - - - + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Header Files + + + Source Files + + + Source Files + + + Source Files + + Source Files @@ -434,7 +461,7 @@ Source Files - + Source Files @@ -542,9 +569,6 @@ Source Files - - Source Files - Source Files @@ -710,10 +734,40 @@ Source Files - - - - + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + Source Files diff --git a/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.sln b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.sln new file mode 100644 index 0000000000..8157755cd7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-WinPhone81", "SDL-WinPhone81.vcxproj", "{48FADC0E-964D-4DAB-BCED-372E0AD19577}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Debug|ARM.ActiveCfg = Debug|ARM + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Debug|ARM.Build.0 = Debug|ARM + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Debug|Win32.ActiveCfg = Debug|Win32 + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Debug|Win32.Build.0 = Debug|Win32 + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Release|ARM.ActiveCfg = Release|ARM + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Release|ARM.Build.0 = Release|ARM + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Release|Win32.ActiveCfg = Release|Win32 + {48FADC0E-964D-4DAB-BCED-372E0AD19577}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj similarity index 90% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj index 573bc4286c..a7df73bd42 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj @@ -59,6 +59,7 @@ + @@ -73,11 +74,10 @@ - - + @@ -88,6 +88,7 @@ + @@ -102,7 +103,7 @@ - + @@ -117,10 +118,14 @@ + + + + @@ -138,11 +143,14 @@ + + + @@ -155,8 +163,8 @@ - - + + true true true @@ -184,6 +192,7 @@ + @@ -215,11 +224,11 @@ true true + - @@ -230,9 +239,12 @@ + + + @@ -269,12 +281,19 @@ + true true true true + + true + true + true + true + true true @@ -311,6 +330,7 @@ true true + {48fadc0e-964d-4dab-bced-372e0ad19577} @@ -395,7 +415,7 @@ Console false false - DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + DXGI.lib;d3d11.lib;mmdevapi.lib;%(AdditionalDependencies) @@ -409,7 +429,7 @@ Console false false - DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + DXGI.lib;d3d11.lib;mmdevapi.lib;%(AdditionalDependencies) @@ -423,7 +443,7 @@ Console false false - DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + DXGI.lib;d3d11.lib;mmdevapi.lib;%(AdditionalDependencies) @@ -437,7 +457,7 @@ Console false false - DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + DXGI.lib;d3d11.lib;mmdevapi.lib;%(AdditionalDependencies) diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters similarity index 89% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters index 907e1bfb7f..dba8edd3f1 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters @@ -174,9 +174,6 @@ Source Files - - Source Files - Source Files @@ -186,7 +183,7 @@ Source Files - + Source Files @@ -255,9 +252,6 @@ Source Files - - Source Files - Source Files @@ -381,6 +375,36 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Header Files + + + Source Files + @@ -413,10 +437,10 @@ Source Files - + Source Files - + Source Files @@ -512,9 +536,6 @@ Source Files - - Source Files - Source Files @@ -686,5 +707,29 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.sln b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.sln new file mode 100644 index 0000000000..2099f262dc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-WinRT81", "SDL-WinRT81.vcxproj", "{C8DF6173-06A1-4F56-A9BC-2002596B30E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|ARM.ActiveCfg = Debug|ARM + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|ARM.Build.0 = Debug|ARM + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|Win32.ActiveCfg = Debug|Win32 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|Win32.Build.0 = Debug|Win32 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|x64.ActiveCfg = Debug|x64 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Debug|x64.Build.0 = Debug|x64 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|ARM.ActiveCfg = Release|ARM + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|ARM.Build.0 = Release|ARM + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|Win32.ActiveCfg = Release|Win32 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|Win32.Build.0 = Release|Win32 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|x64.ActiveCfg = Release|x64 + {C8DF6173-06A1-4F56-A9BC-2002596B30E9}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj similarity index 90% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj index a56516ead6..84b06d5d02 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj @@ -67,6 +67,7 @@ + @@ -81,11 +82,10 @@ - - + @@ -98,6 +98,7 @@ + @@ -117,7 +118,7 @@ - + @@ -132,10 +133,14 @@ + + + + @@ -152,11 +157,14 @@ + + + @@ -169,8 +177,8 @@ - - + + true true true @@ -207,6 +215,7 @@ + @@ -247,11 +256,11 @@ true true + - @@ -262,9 +271,12 @@ + + + @@ -301,6 +313,7 @@ + true true @@ -309,6 +322,14 @@ true true + + true + true + true + true + true + true + true true @@ -357,6 +378,7 @@ true true + {c8df6173-06a1-4f56-a9bc-2002596b30e9} @@ -470,7 +492,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) @@ -484,7 +506,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) @@ -498,7 +520,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) @@ -512,7 +534,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) @@ -526,7 +548,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) @@ -540,7 +562,7 @@ Console false false - xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) + xinput.lib;mmdevapi.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies) diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters similarity index 89% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters index a36811dd4b..6a52b1caae 100644 --- a/3rdparty/sdl2-2.0.4/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters +++ b/3rdparty/sdl2-2.0.9/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters @@ -174,9 +174,6 @@ Source Files - - Source Files - Source Files @@ -186,7 +183,7 @@ Source Files - + Source Files @@ -255,9 +252,6 @@ Source Files - - Source Files - Source Files @@ -387,12 +381,48 @@ Source Files - - - Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Header Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -425,10 +455,10 @@ Source Files - + Source Files - + Source Files @@ -524,9 +554,6 @@ Source Files - - Source Files - Source Files @@ -692,9 +719,6 @@ Source Files - - - Source Files @@ -710,5 +734,38 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/Logo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/Logo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/Logo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/Logo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Package.appxmanifest b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Package.appxmanifest similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/Package.appxmanifest rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/Package.appxmanifest diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/Logo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/Logo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/Logo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/Logo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Package.appxmanifest b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Package.appxmanifest similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/Package.appxmanifest rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/Package.appxmanifest diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx b/3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx rename to 3rdparty/sdl2-2.0.9/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx diff --git a/3rdparty/sdl2-2.0.4/VisualC.html b/3rdparty/sdl2-2.0.9/VisualC.html similarity index 97% rename from 3rdparty/sdl2-2.0.4/VisualC.html rename to 3rdparty/sdl2-2.0.9/VisualC.html index 89035d6776..0631832e80 100644 --- a/3rdparty/sdl2-2.0.4/VisualC.html +++ b/3rdparty/sdl2-2.0.9/VisualC.html @@ -21,7 +21,7 @@

There are different solution files for the various - versions of the IDE. Please use the appropiate version + versions of the IDE. Please use the appropriate version 2008, 2010, 2012 or 2013.

@@ -101,7 +101,7 @@

files to project")

Instead of adding the files to your project it is more - desireable to add them to the linker options: Project|Properties|Linker|Command + desirable to add them to the linker options: Project|Properties|Linker|Command Line and type the names of the libraries to link with in the "Additional Options:" box.  Note: This must be done for each build configuration (e.g. Release,Debug).

diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDL.sln b/3rdparty/sdl2-2.0.9/VisualC/SDL.sln similarity index 92% rename from 3rdparty/sdl2-2.0.4/VisualC/SDL.sln rename to 3rdparty/sdl2-2.0.9/VisualC/SDL.sln index a15f16beaf..22692b1f6a 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/SDL.sln +++ b/3rdparty/sdl2-2.0.9/VisualC/SDL.sln @@ -48,6 +48,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgles2", "tests\testgles EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controllermap", "tests\controllermap\controllermap.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08306}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvulkan", "tests\testvulkan\testvulkan.vcxproj", "{0D604DFD-AAB6-442C-9368-F91A344146AB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testyuv", "tests\testyuv\testyuv.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C97635682}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -240,6 +244,22 @@ Global {55812185-D13C-4022-9C81-32E0F4A08306}.Release|Win32.Build.0 = Release|Win32 {55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.ActiveCfg = Release|x64 {55812185-D13C-4022-9C81-32E0F4A08306}.Release|x64.Build.0 = Release|x64 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|Win32.ActiveCfg = Debug|Win32 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|Win32.Build.0 = Debug|Win32 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|x64.ActiveCfg = Debug|x64 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Debug|x64.Build.0 = Debug|x64 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.ActiveCfg = Release|Win32 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.Build.0 = Release|Win32 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.ActiveCfg = Release|x64 + {0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.Build.0 = Release|x64 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.ActiveCfg = Debug|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.Build.0 = Debug|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.ActiveCfg = Debug|x64 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.Build.0 = Debug|x64 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.ActiveCfg = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.Build.0 = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.ActiveCfg = Release|x64 + {40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -265,5 +285,7 @@ Global {55812185-D13C-4022-9C81-32E0F4A08305} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {E9558DFE-1961-4DD4-B09B-DD0EEFD5C315} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} {55812185-D13C-4022-9C81-32E0F4A08306} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + {0D604DFD-AAB6-442C-9368-F91A344146AB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + {40FB7794-D3C3-4CFE-BCF4-A80C97635682} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} EndGlobalSection EndGlobal diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj similarity index 87% rename from 3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj index 595e2d4430..505adcd27b 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj @@ -1,4 +1,4 @@ - + @@ -78,6 +78,19 @@ AllRules.ruleset + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath) + + + D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath) + + + D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath) + + + D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath) @@ -108,7 +121,7 @@ _DEBUG;%(PreprocessorDefinitions) - winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) + setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) true true Windows @@ -139,7 +152,7 @@ _DEBUG;%(PreprocessorDefinitions) - winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) + setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) true true Windows @@ -173,7 +186,7 @@ NDEBUG;%(PreprocessorDefinitions) - winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) + setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) true true Windows @@ -205,7 +218,7 @@ NDEBUG;%(PreprocessorDefinitions) - winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) + setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies) true true Windows @@ -263,6 +276,7 @@ + @@ -286,77 +300,90 @@ - - - - - - - - - - - - - - - - - - - - + - - - - - + + + + + + + + + - + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + - - - - - @@ -364,17 +391,63 @@ + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -390,16 +463,52 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -410,81 +519,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - @@ -493,14 +541,9 @@ + - - - - - - - + @@ -508,4 +551,4 @@ - + \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj.filters b/3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj.filters similarity index 88% rename from 3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj.filters rename to 3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj.filters index a2ba2cb5cc..75a9e4fb9d 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/SDL/SDL.vcxproj.filters +++ b/3rdparty/sdl2-2.0.9/VisualC/SDL/SDL.vcxproj.filters @@ -1,444 +1,479 @@ - - - - - {395b3af0-33d0-411b-b153-de1676bf1ef8} - - - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - API Headers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + {395b3af0-33d0-411b-b153-de1676bf1ef8} + + + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/SDLmain/SDLmain.vcxproj similarity index 99% rename from 3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/SDLmain/SDLmain.vcxproj index 239a76ef9f..adf5b8d707 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/SDLmain/SDLmain.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC/SDLmain/SDLmain.vcxproj @@ -1,4 +1,4 @@ - + diff --git a/3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/SDLtest/SDLtest.vcxproj similarity index 97% rename from 3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/SDLtest/SDLtest.vcxproj index 6190a7dfa7..e2e39f935f 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/SDLtest/SDLtest.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC/SDLtest/SDLtest.vcxproj @@ -164,9 +164,10 @@ + - \ No newline at end of file + diff --git a/3rdparty/sdl2-2.0.4/VisualC/clean.sh b/3rdparty/sdl2-2.0.9/VisualC/clean.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/clean.sh rename to 3rdparty/sdl2-2.0.9/VisualC/clean.sh diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/checkkeys/checkkeys.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/checkkeys/checkkeys.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/checkkeys/checkkeys.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/checkkeys/checkkeys.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/controllermap/controllermap.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/controllermap/controllermap.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/controllermap/controllermap.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/controllermap/controllermap.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/loopwave/loopwave.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/loopwave/loopwave.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/loopwave/loopwave.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/loopwave/loopwave.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testatomic/testatomic.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testatomic/testatomic.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testatomic/testatomic.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testatomic/testatomic.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testautomation/testautomation.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testautomation/testautomation.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testautomation/testautomation.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testautomation/testautomation.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testdraw2/testdraw2.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testdraw2/testdraw2.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testdraw2/testdraw2.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testdraw2/testdraw2.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testfile/testfile.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testfile/testfile.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testfile/testfile.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testfile/testfile.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgesture/testgesture.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testgesture/testgesture.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testgesture/testgesture.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testgesture/testgesture.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgl2/testgl2.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testgl2/testgl2.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testgl2/testgl2.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testgl2/testgl2.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testgles2/testgles2.vcxproj similarity index 95% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testgles2/testgles2.vcxproj index 186f6affd6..f1c633a439 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testgles2/testgles2.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC/tests/testgles2/testgles2.vcxproj @@ -189,6 +189,12 @@ false true + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + @@ -196,4 +202,4 @@ - \ No newline at end of file + diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testjoystick/testjoystick.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testjoystick/testjoystick.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testjoystick/testjoystick.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testjoystick/testjoystick.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testoverlay2/testoverlay2.vcxproj similarity index 97% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testoverlay2/testoverlay2.vcxproj index b17f64c015..6879544b6b 100644 --- a/3rdparty/sdl2-2.0.4/VisualC/tests/testoverlay2/testoverlay2.vcxproj +++ b/3rdparty/sdl2-2.0.9/VisualC/tests/testoverlay2/testoverlay2.vcxproj @@ -212,8 +212,9 @@ + - \ No newline at end of file + diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testplatform/testplatform.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testplatform/testplatform.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testplatform/testplatform.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testplatform/testplatform.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testpower/testpower.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testpower/testpower.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testpower/testpower.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testpower/testpower.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testrendertarget/testrendertarget.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testrendertarget/testrendertarget.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testrendertarget/testrendertarget.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testrendertarget/testrendertarget.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testrumble/testrumble.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testrumble/testrumble.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testrumble/testrumble.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testrumble/testrumble.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testscale/testscale.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testscale/testscale.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testscale/testscale.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testscale/testscale.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testshape/testshape.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testshape/testshape.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testshape/testshape.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testshape/testshape.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/tests/testsprite2/testsprite2.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testsprite2/testsprite2.vcxproj similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/tests/testsprite2/testsprite2.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/tests/testsprite2/testsprite2.vcxproj diff --git a/3rdparty/sdl2-2.0.9/VisualC/tests/testvulkan/testvulkan.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testvulkan/testvulkan.vcxproj new file mode 100644 index 0000000000..6cf0fdb0dc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/VisualC/tests/testvulkan/testvulkan.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0D604DFD-AAB6-442C-9368-F91A344146AB} + testvulkan + + + + Application + + + Application + + + Application + + + Application + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/testvulkan.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + _DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Debug/testvulkan.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + _DEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/testvulkan.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Release/testvulkan.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + NDEBUG;WIN32;_WINDOWS;HAVE_OPENGL;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + false + + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/VisualC/tests/testyuv/testyuv.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/tests/testyuv/testyuv.vcxproj new file mode 100644 index 0000000000..c5738c67dc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/VisualC/tests/testyuv/testyuv.vcxproj @@ -0,0 +1,229 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {40FB7794-D3C3-4CFE-BCF4-A80C97635682} + testyuv + + + + Application + + + Application + + + Application + + + Application + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/testyuv.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Release/testyuv.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/testyuv.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Debug/testyuv.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + + + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + false + true + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + false + false + true + + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + + + + + Copying %(Filename)%(Extension) + copy %(FullPath) $(ProjectDir)\ + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + copy %(FullPath) $(ProjectDir)\ + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + copy %(FullPath) $(ProjectDir)\ + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + copy %(FullPath) $(ProjectDir)\ + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.4/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj diff --git a/3rdparty/sdl2-2.0.4/VisualC/visualtest/visualtest_VS2012.vcxproj b/3rdparty/sdl2-2.0.9/VisualC/visualtest/visualtest_VS2012.vcxproj old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/VisualC/visualtest/visualtest_VS2012.vcxproj rename to 3rdparty/sdl2-2.0.9/VisualC/visualtest/visualtest_VS2012.vcxproj diff --git a/3rdparty/sdl2-2.0.9/WhatsNew.txt b/3rdparty/sdl2-2.0.9/WhatsNew.txt new file mode 100644 index 0000000000..56de7b6781 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/WhatsNew.txt @@ -0,0 +1,434 @@ + +This is a list of major changes in SDL's version history. + +--------------------------------------------------------------------------- +2.0.9: +--------------------------------------------------------------------------- + +General: +* Added a new sensor API, initialized by passing SDL_INIT_SENSOR to SDL_Init(), and defined in SDL_sensor.h +* Added an event SDL_SENSORUPDATE which is sent when a sensor is updated +* Added SDL_GetDisplayOrientation() to return the current display orientation +* Added an event SDL_DISPLAYEVENT which is sent when the display orientation changes +* Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms. (Thanks to Valve for contributing the PS4 and Nintendo Switch Pro controller support) +* Added support for many other popular game controllers +* Added SDL_JoystickGetDevicePlayerIndex(), SDL_JoystickGetPlayerIndex(), and SDL_GameControllerGetPlayerIndex() to get the player index for a controller. For XInput controllers this returns the XInput index for the controller. +* Added SDL_GameControllerRumble() and SDL_JoystickRumble() which allow simple rumble without using the haptics API +* Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened +* Added the hint SDL_HINT_MOUSE_DOUBLE_CLICK_TIME to control the mouse double-click time +* Added the hint SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to control the mouse double-click radius, in pixels +* Added SDL_HasColorKey() to return whether a surface has a colorkey active +* Added SDL_HasAVX512F() to return whether the CPU has AVX-512F features +* Added SDL_IsTablet() to return whether the application is running on a tablet +* Added SDL_THREAD_PRIORITY_TIME_CRITICAL for threads that must run at the highest priority + +Mac OS X: +* Fixed black screen at start on Mac OS X Mojave + +Linux: +* Added SDL_LinuxSetThreadPriority() to allow adjusting the thread priority of native threads using RealtimeKit if available. + +iOS: +* Fixed Asian IME input + +Android: +* Updated required Android SDK to API 26, to match Google's new App Store requirements +* Added support for wired USB Xbox, PS4, and Nintendo Switch Pro controllers +* Added support for relative mouse mode on Android 7.0 and newer (except where it's broken, on Chromebooks and when in DeX mode with Samsung Experience 9.0) +* Added support for custom mouse cursors on Android 7.0 and newer +* Added the hint SDL_HINT_ANDROID_TRAP_BACK_BUTTON to control whether the back button will back out of the app (the default) or be passed to the application as SDL_SCANCODE_AC_BACK +* Added SDL_AndroidBackButton() to trigger the Android system back button behavior when handling the back button in the application +* Added SDL_IsChromebook() to return whether the app is running in the Chromebook Android runtime +* Added SDL_IsDeXMode() to return whether the app is running while docked in the Samsung DeX + + +--------------------------------------------------------------------------- +2.0.8: +--------------------------------------------------------------------------- + +General: +* Added SDL_fmod() and SDL_log10() +* Each of the SDL math functions now has the corresponding float version +* Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709 + +Windows: +* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation +* Added resampling support on WASAPI on Windows 7 and above + +Windows UWP: +* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on + +Mac OS X: +* Added support for the Vulkan SDK for Mac: + https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/ +* Added support for OpenGL ES using ANGLE when it's available + +Mac OS X / iOS / tvOS: +* Added a Metal 2D render implementation +* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation + +iOS: +* Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications. + +iOS / Android: +* Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default) + +Android: +* SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant +* SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1) +* Added SDL_IsAndroidTV() to tell whether the application is running on Android TV + +Android / tvOS: +* Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events. + +Linux: +* Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1" +* Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default) + + +--------------------------------------------------------------------------- +2.0.7: +--------------------------------------------------------------------------- + +General: +* Added audio stream conversion functions: + SDL_NewAudioStream + SDL_AudioStreamPut + SDL_AudioStreamGet + SDL_AudioStreamAvailable + SDL_AudioStreamFlush + SDL_AudioStreamClear + SDL_FreeAudioStream +* Added functions to query and set the SDL memory allocation functions: + SDL_GetMemoryFunctions() + SDL_SetMemoryFunctions() + SDL_GetNumAllocations() +* Added locking functions for multi-threaded access to the joystick and game controller APIs: + SDL_LockJoysticks() + SDL_UnlockJoysticks() +* The following functions are now thread-safe: + SDL_SetEventFilter() + SDL_GetEventFilter() + SDL_AddEventWatch() + SDL_DelEventWatch() + + +General: +--------------------------------------------------------------------------- +2.0.6: +--------------------------------------------------------------------------- + +General: +* Added cross-platform Vulkan graphics support in SDL_vulkan.h + SDL_Vulkan_LoadLibrary() + SDL_Vulkan_GetVkGetInstanceProcAddr() + SDL_Vulkan_GetInstanceExtensions() + SDL_Vulkan_CreateSurface() + SDL_Vulkan_GetDrawableSize() + SDL_Vulkan_UnloadLibrary() + This is all the platform-specific code you need to bring up Vulkan on all SDL platforms. You can look at an example in test/testvulkan.c +* Added SDL_ComposeCustomBlendMode() to create custom blend modes for 2D rendering +* Added SDL_HasNEON() which returns whether the CPU has NEON instruction support +* Added support for many game controllers, including the Nintendo Switch Pro Controller +* Added support for inverted axes and separate axis directions in game controller mappings +* Added functions to return information about a joystick before it's opened: + SDL_JoystickGetDeviceVendor() + SDL_JoystickGetDeviceProduct() + SDL_JoystickGetDeviceProductVersion() + SDL_JoystickGetDeviceType() + SDL_JoystickGetDeviceInstanceID() +* Added functions to return information about an open joystick: + SDL_JoystickGetVendor() + SDL_JoystickGetProduct() + SDL_JoystickGetProductVersion() + SDL_JoystickGetType() + SDL_JoystickGetAxisInitialState() +* Added functions to return information about an open game controller: + SDL_GameControllerGetVendor() + SDL_GameControllerGetProduct() + SDL_GameControllerGetProductVersion() +* Added SDL_GameControllerNumMappings() and SDL_GameControllerMappingForIndex() to be able to enumerate the built-in game controller mappings +* Added SDL_LoadFile() and SDL_LoadFile_RW() to load a file into memory +* Added SDL_DuplicateSurface() to make a copy of a surface +* Added an experimental JACK audio driver +* Implemented non-power-of-two audio resampling, optionally using libsamplerate to perform the resampling +* Added the hint SDL_HINT_AUDIO_RESAMPLING_MODE to control the quality of resampling +* Added the hint SDL_HINT_RENDER_LOGICAL_SIZE_MODE to control the scaling policy for SDL_RenderSetLogicalSize(): + "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen (the default) + "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen +* Added the hints SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the mouse speed when being read from raw mouse input +* Added the hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether SDL will synthesize mouse events from touch events + +Windows: +* The new default audio driver on Windows is WASAPI and supports hot-plugging devices and changing the default audio device +* The old XAudio2 audio driver is deprecated and will be removed in the next release +* Added hints SDL_HINT_WINDOWS_INTRESOURCE_ICON and SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL to specify a custom icon resource ID for SDL windows +* The hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING is now on by default for compatibility with .NET languages and various Windows debuggers +* Updated the GUID format for game controller mappings, older mappings will be automatically converted on load +* Implemented the SDL_WINDOW_ALWAYS_ON_TOP flag on Windows + +Linux: +* Added an experimental KMS/DRM video driver for embedded development + +iOS: +* Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category, determining whether the phone mute switch affects the audio + +--------------------------------------------------------------------------- +2.0.5: +--------------------------------------------------------------------------- + +General: +* Implemented audio capture support for some platforms +* Added SDL_DequeueAudio() to retrieve audio when buffer queuing is turned on for audio capture +* Added events for dragging and dropping text +* Added events for dragging and dropping multiple items +* By default the click raising a window will not be delivered to the SDL application. You can set the hint SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH to "1" to allow that click through to the window. +* Saving a surface with an alpha channel as a BMP will use a newer BMP format that supports alpha information. You can set the hint SDL_HINT_BMP_SAVE_LEGACY_FORMAT to "1" to use the old format. +* Added SDL_GetHintBoolean() to get the boolean value of a hint +* Added SDL_RenderSetIntegerScale() to set whether to smoothly scale or use integral multiples of the viewport size when scaling the rendering output +* Added SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() to create an SDL surface with a specific pixel format +* Added SDL_GetDisplayUsableBounds() which returns the area usable for windows. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock. +* Added SDL_GetWindowBordersSize() which returns the size of the window's borders around the client area +* Added a window event SDL_WINDOWEVENT_HIT_TEST when a window had a hit test that wasn't SDL_HITTEST_NORMAL (e.g. in the title bar or window frame) +* Added SDL_SetWindowResizable() to change whether a window is resizable +* Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity() to affect the window transparency +* Added SDL_SetWindowModalFor() to set a window as modal for another window +* Added support for AUDIO_U16LSB and AUDIO_U16MSB to SDL_MixAudioFormat() +* Fixed flipped images when reading back from target textures when using the OpenGL renderer +* Fixed texture color modulation with SDL_BLENDMODE_NONE when using the OpenGL renderer +* Fixed bug where the alpha value of colorkeys was ignored when blitting in some cases + +Windows: +* Added a hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING to prevent SDL from raising a debugger exception to name threads. This exception can cause problems with .NET applications when running under a debugger. +* The hint SDL_HINT_THREAD_STACK_SIZE is now supported on Windows +* Fixed XBox controller triggers automatically being pulled at startup +* The first icon from the executable is used as the default window icon at runtime +* Fixed SDL log messages being printed twice if SDL was built with C library support +* Reset dead keys when the SDL window loses focus, so dead keys pressed in SDL applications don't affect text input into other applications. + +Mac OS X: +* Fixed selecting the dummy video driver +* The caps lock key now generates a pressed event when pressed and a released event when released, instead of a press/release event pair when pressed. +* Fixed mouse wheel events on Mac OS X 10.12 +* The audio driver has been updated to use AVFoundation for better compatibility with newer versions of Mac OS X + +Linux: +* Added support for the Fcitx IME +* Added a window event SDL_WINDOWEVENT_TAKE_FOCUS when a window manager asks the SDL window whether it wants to take focus. +* Refresh rates are now rounded instead of truncated, e.g. 59.94 Hz is rounded up to 60 Hz instead of 59. +* Added initial support for touchscreens on Raspberry Pi + +OpenBSD: +* SDL_GetBasePath() is now implemented on OpenBSD + +iOS: +* Added support for dynamically loaded objects on iOS 8 and newer + +tvOS: +* Added support for Apple TV +* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote. + +Android: +* Fixed SDL not resizing window when Android screen resolution changes +* Corrected the joystick Z axis reporting for the accelerometer + +Emscripten (running in a web browser): +* Many bug fixes and improvements + + +--------------------------------------------------------------------------- +2.0.4: +--------------------------------------------------------------------------- + +General: +* Added support for web applications using Emscripten, see docs/README-emscripten.md for more information +* Added support for web applications using Native Client (NaCl), see docs/README-nacl.md for more information +* Added an API to queue audio instead of using the audio callback: + SDL_QueueAudio(), SDL_GetQueuedAudioSize(), SDL_ClearQueuedAudio() +* Added events for audio device hot plug support: + SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED +* Added SDL_PointInRect() +* Added SDL_HasAVX2() to detect CPUs with AVX2 support +* Added SDL_SetWindowHitTest() to let apps treat parts of their SDL window like traditional window decorations (drag areas, resize areas) +* Added SDL_GetGrabbedWindow() to get the window that currently has input grab, if any +* Added SDL_RenderIsClipEnabled() to tell whether clipping is currently enabled in a renderer +* Added SDL_CaptureMouse() to capture the mouse to get events while the mouse is not in your window +* Added SDL_WarpMouseGlobal() to warp the mouse cursor in global screen space +* Added SDL_GetGlobalMouseState() to get the current mouse state outside of an SDL window +* Added a direction field to mouse wheel events to tell whether they are flipped (natural) or not +* Added GL_CONTEXT_RELEASE_BEHAVIOR GL attribute (maps to [WGL|GLX]_ARB_context_flush_control extension) +* Added EGL_KHR_create_context support to allow OpenGL ES version selection on some platforms +* Added NV12 and NV21 YUV texture support for OpenGL and OpenGL ES 2.0 renderers +* Added a Vivante video driver that is used on various SoC platforms +* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers when the D3D device is lost, and from Android's event loop when the GLES context had to be recreated +* Added a hint SDL_HINT_NO_SIGNAL_HANDLERS to disable SDL's built in signal handling +* Added a hint SDL_HINT_THREAD_STACK_SIZE to set the stack size of SDL's threads +* Added SDL_sqrtf(), SDL_tan(), and SDL_tanf() to the stdlib routines +* Improved support for WAV and BMP files with unusual chunks in them +* Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertState +* Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden +* Added SDL_GetDisplayDPI() to get the DPI information for a display +* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick +* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to. +* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to. + +Windows: +* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform) +* Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint +* SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds +* Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage() +* Added a hint SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP to control whether SDL_PumpEvents() processes the Windows message loop +* You can distinguish between real mouse and touch events by looking for SDL_TOUCH_MOUSEID in the mouse event "which" field +* SDL_SysWMinfo now contains the window HDC +* Added support for Unicode command line options +* Prevent beeping when Alt-key combos are pressed +* SDL_SetTextInputRect() re-positions the OS-rendered IME +* Added a hint SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to prevent generating SDL_WINDOWEVENT_CLOSE events when Alt-F4 is pressed +* Added a hint SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING to use the old axis and button mapping for XInput devices (deprecated) + +Mac OS X: +* Implemented drag-and-drop support +* Improved joystick hot-plug detection +* The SDL_WINDOWEVENT_EXPOSED window event is triggered in the appropriate situations +* Fixed relative mouse mode when the application loses/regains focus +* Fixed bugs related to transitioning to and from Spaces-aware fullscreen-desktop mode +* Fixed the refresh rate of display modes +* SDL_SysWMInfo is now ARC-compatible +* Added a hint SDL_HINT_MAC_BACKGROUND_APP to prevent forcing the application to become a foreground process + +Linux: +* Enabled building with Mir and Wayland support by default. +* Added IBus IME support +* Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events +* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow() +* Added support for multiple audio devices when using Pulseaudio +* Fixed duplicate mouse events when using relative mouse motion + +iOS: +* Added support for iOS 8 +* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels +* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior) +* Added native resolution support for the iPhone 6 Plus +* Added support for MFi game controllers +* Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK +* Added sRGB OpenGL ES context support on iOS 7+ +* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER +* SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view +* Fixed various rotation and orientation issues +* Fixed memory leaks + +Android: +* Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events +* Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION +* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER +* Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox() + +Raspberry Pi: +* Added support for the Raspberry Pi 2 + + +--------------------------------------------------------------------------- +2.0.3: +--------------------------------------------------------------------------- + +Mac OS X: +* Fixed creating an OpenGL context by default on Mac OS X 10.6 + + +--------------------------------------------------------------------------- +2.0.2: +--------------------------------------------------------------------------- +General: +* Added SDL_GL_ResetAttributes() to reset OpenGL attributes to default values +* Added an API to load a database of game controller mappings from a file: + SDL_GameControllerAddMappingsFromFile(), SDL_GameControllerAddMappingsFromRW() +* Added game controller mappings for the PS4 and OUYA controllers +* Added SDL_GetDefaultAssertionHandler() and SDL_GetAssertionHandler() +* Added SDL_DetachThread() +* Added SDL_HasAVX() to determine if the CPU has AVX features +* Added SDL_vsscanf(), SDL_acos(), and SDL_asin() to the stdlib routines +* EGL can now create/manage OpenGL and OpenGL ES 1.x/2.x contexts, and share + them using SDL_GL_SHARE_WITH_CURRENT_CONTEXT +* Added a field "clicks" to the mouse button event which records whether the event is a single click, double click, etc. +* The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior. +* Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping. +* testgl2 does not need to link with libGL anymore +* Added testgles2 test program to demonstrate working with OpenGL ES 2.0 +* Added controllermap test program to visually map a game controller + +Windows: +* Support for OpenGL ES 2.x contexts using either WGL or EGL (natively via + the driver or emulated through ANGLE) +* Added a hint SDL_HINT_VIDEO_WIN_D3DCOMPILER to specify which D3D shader compiler to use for OpenGL ES 2 support through ANGLE +* Added a hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that is useful when creating multiple windows that should share the same OpenGL context. +* Added an event SDL_RENDER_TARGETS_RESET that is sent when D3D9 render targets are reset after the device has been restored. + +Mac OS X: +* Added a hint SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK to control whether Ctrl+click should be treated as a right click on Mac OS X. This is off by default. + +Linux: +* Fixed fullscreen and focused behavior when receiving NotifyGrab events +* Added experimental Wayland and Mir support, disabled by default + +Android: +* Joystick support (minimum SDK version required to build SDL is now 12, + the required runtime version remains at 10, but on such devices joystick + support won't be available). +* Hotplugging support for joysticks +* Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default. + + +--------------------------------------------------------------------------- +2.0.1: +--------------------------------------------------------------------------- + +General: +* Added an API to get common filesystem paths in SDL_filesystem.h: + SDL_GetBasePath(), SDL_GetPrefPath() +* Added an API to do optimized YV12 and IYUV texture updates: + SDL_UpdateYUVTexture() +* Added an API to get the amount of RAM on the system: + SDL_GetSystemRAM() +* Added a macro to perform timestamp comparisons with SDL_GetTicks(): + SDL_TICKS_PASSED() +* Dramatically improved OpenGL ES 2.0 rendering performance +* Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE + +Windows: +* Created a static library configuration for the Visual Studio 2010 project +* Added a hint to create the Direct3D device with support for multi-threading: + SDL_HINT_RENDER_DIRECT3D_THREADSAFE +* Added a function to get the D3D9 adapter index for a display: + SDL_Direct3D9GetAdapterIndex() +* Added a function to get the D3D9 device for a D3D9 renderer: + SDL_RenderGetD3D9Device() +* Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred) +* Fixed crash when using two XInput controllers at the same time +* Fixed detecting a mixture of XInput and DirectInput controllers +* Fixed clearing a D3D render target larger than the window +* Improved support for format specifiers in SDL_snprintf() + +Mac OS X: +* Added support for retina displays: + Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately. +* Fixed mouse warping in fullscreen mode +* Right mouse click is emulated by holding the Ctrl key while left clicking + +Linux: +* Fixed float audio support with the PulseAudio driver +* Fixed missing line endpoints in the OpenGL renderer on some drivers +* X11 symbols are no longer defined to avoid collisions when linking statically + +iOS: +* Fixed status bar visibility on iOS 7 +* Flipped the accelerometer Y axis to match expected values + +Android: +IMPORTANT: You MUST get the updated SDLActivity.java to match C code +* Moved EGL initialization to native code +* Fixed the accelerometer axis rotation relative to the device rotation +* Fixed race conditions when handling the EGL context on pause/resume +* Touch devices are available for enumeration immediately after init + +Raspberry Pi: +* Added support for the Raspberry Pi, see README-raspberrypi.txt for details diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Default.png b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Default.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Default.png rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Default.png diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 78% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj index 569d2d1307..29390844b1 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj @@ -10,6 +10,27 @@ 1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; }; + FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; }; + FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; }; + FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD925B180E0F276600E92347 /* Icon.png */; }; + FA30DEB61BBF5AE6009C397F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD787AA00E22A5CC003E8E36 /* Default.png */; }; + FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA30DEAC1BBF59D9009C397F /* libSDL2.a */; }; + FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; }; + FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D7220E12D31800247964 /* AudioToolbox.framework */; }; + FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */; }; + FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96ED30DEFC9C700FAF19F /* OpenGLES.framework */; }; + FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; }; + FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D71D0E12D2AB00247964 /* CoreAudio.framework */; }; + FA86C0371D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C0381D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C0391D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C03A1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C03B1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C03C1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; + FA86C03D1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; }; FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; @@ -17,6 +38,14 @@ FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; }; + FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34D61D8B5E5A00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34D81D8B5E7700915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D71D8B5E7700915323 /* AVFoundation.framework */; }; + FABA34D91D8B5E7B00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34DA1D8B5E7F00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34DB1D8B5E8500915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34DC1D8B5E8900915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; + FABA34DD1D8B5E8D00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; }; FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; }; FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; }; FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; }; @@ -168,6 +197,20 @@ remoteGlobalIDString = FD6526620DE8FCCB002AD96B; remoteInfo = libSDL; }; + FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FAB598141BB5C1B100BE72C5; + remoteInfo = "libSDL-tv"; + }; + FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FAB598131BB5C1B100BE72C5; + remoteInfo = "libSDL-tv"; + }; FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */; @@ -183,7 +226,11 @@ 1D6058910D05DD3D006BFB54 /* Rectangles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rectangles.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FA30DE961BBF59D9009C397F /* Happy-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Happy-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "iOS Launch Screen.storyboard"; sourceTree = ""; }; FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + FABA34D31D8B5E5600915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + FABA34D71D8B5E7700915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; FD15FCB20E086866003BDF25 /* Happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Happy.app; sourceTree = BUILT_PRODUCTS_DIR; }; FD1B48920E313154007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; @@ -224,6 +271,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */, FD1B48DD0E313255007AB34E /* libSDL2.a in Frameworks */, FAE0E96A1BAF96A00098DFA4 /* GameController.framework in Frameworks */, FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -237,10 +285,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA30DE931BBF59D9009C397F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA34D81D8B5E7700915323 /* AVFoundation.framework in Frameworks */, + FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */, + FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */, + FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */, + FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */, + FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */, + FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */, + FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */, + FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */, + FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FD15FCB00E086866003BDF25 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34D61D8B5E5A00915323 /* AVFoundation.framework in Frameworks */, FD1B49980E313261007AB34E /* libSDL2.a in Frameworks */, FAE0E96C1BAF96A90098DFA4 /* GameController.framework in Frameworks */, FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */, @@ -258,6 +324,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34D91D8B5E7B00915323 /* AVFoundation.framework in Frameworks */, FD1B499C0E313269007AB34E /* libSDL2.a in Frameworks */, FAE0E96D1BAF96AF0098DFA4 /* GameController.framework in Frameworks */, FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -275,6 +342,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34DD1D8B5E8D00915323 /* AVFoundation.framework in Frameworks */, FDB652000E43D1F300F688B5 /* libSDL2.a in Frameworks */, FAE0E9711BAF96BB0098DFA4 /* GameController.framework in Frameworks */, FA8B4BA91967073D00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -292,6 +360,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34DA1D8B5E7F00915323 /* AVFoundation.framework in Frameworks */, FD1B499E0E31326C007AB34E /* libSDL2.a in Frameworks */, FAE0E96E1BAF96B10098DFA4 /* GameController.framework in Frameworks */, FA8B4BA61967072100F8EB7C /* CoreMotion.framework in Frameworks */, @@ -309,6 +378,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34DC1D8B5E8900915323 /* AVFoundation.framework in Frameworks */, FD1B49A20E313273007AB34E /* libSDL2.a in Frameworks */, FAE0E9701BAF96B80098DFA4 /* GameController.framework in Frameworks */, FA8B4BA81967073400F8EB7C /* CoreMotion.framework in Frameworks */, @@ -326,6 +396,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34DB1D8B5E8500915323 /* AVFoundation.framework in Frameworks */, FD1B49A00E313270007AB34E /* libSDL2.a in Frameworks */, FAE0E96F1BAF96B50098DFA4 /* GameController.framework in Frameworks */, FA8B4BA71967072800F8EB7C /* CoreMotion.framework in Frameworks */, @@ -352,6 +423,7 @@ FDF0D6A40E12D05400247964 /* Mixer.app */, FDC52EDE0E2843D6008D768C /* Fireworks.app */, FDB6520C0E43D1F300F688B5 /* Keyboard.app */, + FA30DE961BBF59D9009C397F /* Happy-TV.app */, ); name = Products; sourceTree = ""; @@ -359,6 +431,7 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */, FD1B48920E313154007AB34E /* SDL.xcodeproj */, FD77A0040E26BC0500F39101 /* src */, 29B97317FDCFA39411CA2CEA /* Resources */, @@ -382,6 +455,8 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + FABA34D71D8B5E7700915323 /* AVFoundation.framework */, + FABA34D31D8B5E5600915323 /* AVFoundation.framework */, FAE0E9691BAF96A00098DFA4 /* GameController.framework */, FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */, FDF0D7220E12D31800247964 /* AudioToolbox.framework */, @@ -399,6 +474,7 @@ isa = PBXGroup; children = ( FD1B489E0E313154007AB34E /* libSDL2.a */, + FA30DEAC1BBF59D9009C397F /* libSDL2.a */, ); name = Products; sourceTree = ""; @@ -473,6 +549,24 @@ productReference = 1D6058910D05DD3D006BFB54 /* Rectangles.app */; productType = "com.apple.product-type.application"; }; + FA30DE951BBF59D9009C397F /* Happy-TV */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */; + buildPhases = ( + FA30DE921BBF59D9009C397F /* Sources */, + FA30DE941BBF59D9009C397F /* Resources */, + FA30DE931BBF59D9009C397F /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */, + ); + name = "Happy-TV"; + productName = "Happy-TV"; + productReference = FA30DE961BBF59D9009C397F /* Happy-TV.app */; + productType = "com.apple.product-type.application"; + }; FD15FCB10E086866003BDF25 /* Happy */ = { isa = PBXNativeTarget; buildConfigurationList = FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */; @@ -588,6 +682,14 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0630; + TargetAttributes = { + FA30DE951BBF59D9009C397F = { + CreatedOnToolsVersion = 7.1; + }; + FDC52EC60E2843D6008D768C = { + ProvisioningStyle = Automatic; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Demos" */; compatibilityVersion = "Xcode 3.2"; @@ -598,6 +700,7 @@ Japanese, French, German, + Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -611,6 +714,7 @@ targets = ( 1D6058900D05DD3D006BFB54 /* Rectangles */, FD15FCB10E086866003BDF25 /* Happy */, + FA30DE951BBF59D9009C397F /* Happy-TV */, FD5F9BE30E0DEBEA008E885B /* Accel */, FDC202DD0E107B1200ABAC90 /* Touch */, FDF0D6920E12D05400247964 /* Mixer */, @@ -621,6 +725,13 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + FA30DEAC1BBF59D9009C397F /* libSDL2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.a; + remoteRef = FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FD1B489E0E313154007AB34E /* libSDL2.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -635,16 +746,28 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + FA86C0371D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, FD925B1B0E0F276600E92347 /* Icon.png in Resources */, FD787AA20E22A5CC003E8E36 /* Default.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; + FA30DE941BBF59D9009C397F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */, + FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */, + FA30DEB61BBF5AE6009C397F /* Default.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FD15FCAE0E086866003BDF25 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( FDB651D00E43D1AD00F688B5 /* icon.bmp in Resources */, + FA86C0381D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, FD925B1A0E0F276600E92347 /* Icon.png in Resources */, FD787AA10E22A5CC003E8E36 /* Default.png in Resources */, ); @@ -658,6 +781,7 @@ FDB651D10E43D1B300F688B5 /* ship.bmp in Resources */, FD925B190E0F276600E92347 /* Icon.png in Resources */, FD787AA30E22A5CC003E8E36 /* Default.png in Resources */, + FA86C0391D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -669,6 +793,7 @@ FDB651FA0E43D1F300F688B5 /* Icon.png in Resources */, FDB651FB0E43D1F300F688B5 /* Default.png in Resources */, FDB652C70E43E25900F688B5 /* kromasky_16x16.bmp in Resources */, + FA86C03D1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -677,6 +802,7 @@ buildActionMask = 2147483647; files = ( FDB651D30E43D1BA00F688B5 /* stroke.bmp in Resources */, + FA86C03A1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, FDC202E10E107B1200ABAC90 /* Icon.png in Resources */, FD787AA40E22A5CC003E8E36 /* Default.png in Resources */, ); @@ -687,6 +813,7 @@ buildActionMask = 2147483647; files = ( FDB651D80E43D1D800F688B5 /* stroke.bmp in Resources */, + FA86C03C1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, FDC52EC80E2843D6008D768C /* Icon.png in Resources */, FDC52EC90E2843D6008D768C /* Default.png in Resources */, ); @@ -699,6 +826,7 @@ FDB651D40E43D1C500F688B5 /* ds_brush_snare.wav in Resources */, FDB651D50E43D1C500F688B5 /* ds_china.wav in Resources */, FDB651D60E43D1C500F688B5 /* ds_kick_big_amb.wav in Resources */, + FA86C03B1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */, FDB651D70E43D1C500F688B5 /* ds_loose_skin_mute.wav in Resources */, FDF0D6960E12D05400247964 /* Icon.png in Resources */, FD787AA50E22A5CC003E8E36 /* Default.png in Resources */, @@ -717,6 +845,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA30DE921BBF59D9009C397F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA30DEB01BBF5A8F009C397F /* common.c in Sources */, + FA30DEB11BBF5A93009C397F /* happy.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FD15FCAF0E086866003BDF25 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -809,6 +946,11 @@ name = libSDL; targetProxy = 049F36A0130CD8A000FF080F /* PBXContainerItemProxy */; }; + FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "libSDL-tv"; + targetProxy = FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -816,6 +958,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles; PRODUCT_NAME = Rectangles; }; name = Debug; @@ -824,6 +967,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles; PRODUCT_NAME = Rectangles; }; name = Release; @@ -831,6 +975,7 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; @@ -844,6 +989,7 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; HEADER_SEARCH_PATHS = ../../include; PRELINK_LIBS = ""; @@ -852,11 +998,100 @@ }; name = Release; }; + FA30DEA71BBF59D9009C397F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.Happy-TV"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + FA30DEA81BBF59D9009C397F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ""; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.Happy-TV"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; FD15FCB50E086866003BDF25 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_DYNAMIC_NO_PIC = NO; INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy; PRODUCT_NAME = Happy; SDKROOT = iphoneos; }; @@ -866,6 +1101,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy; PRODUCT_NAME = Happy; SDKROOT = iphoneos; }; @@ -875,6 +1111,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel; PRODUCT_NAME = Accel; SDKROOT = iphoneos; }; @@ -884,6 +1121,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel; PRODUCT_NAME = Accel; SDKROOT = iphoneos; }; @@ -893,6 +1131,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard; PRODUCT_NAME = Keyboard; SDKROOT = iphoneos; }; @@ -902,6 +1141,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard; PRODUCT_NAME = Keyboard; SDKROOT = iphoneos; }; @@ -911,6 +1151,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch; PRODUCT_NAME = Touch; SDKROOT = iphoneos; }; @@ -920,6 +1161,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch; PRODUCT_NAME = Touch; SDKROOT = iphoneos; }; @@ -928,7 +1170,10 @@ FDC52EDC0E2843D6008D768C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Fireworks; PRODUCT_NAME = Fireworks; SDKROOT = iphoneos; }; @@ -937,7 +1182,10 @@ FDC52EDD0E2843D6008D768C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Fireworks; PRODUCT_NAME = Fireworks; SDKROOT = iphoneos; }; @@ -947,6 +1195,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer; PRODUCT_NAME = Mixer; SDKROOT = iphoneos; }; @@ -956,6 +1205,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = Info.plist; + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer; PRODUCT_NAME = Mixer; SDKROOT = iphoneos; }; @@ -982,6 +1232,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA30DEA71BBF59D9009C397F /* Debug */, + FA30DEA81BBF59D9009C397F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Icon.png b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Icon.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Icon.png rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Icon.png diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Info.plist b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Info.plist similarity index 87% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Info.plist rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Info.plist index 0398f008b8..fbbaf7f938 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/Info.plist +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,6 +24,8 @@ 1.0 NSMainNibFile + UILaunchStoryboardName + iOS Launch Screen UISupportedInterfaceOrientations diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/README b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/README similarity index 87% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/README rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/README index 55f8066d66..da6fb74908 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/README +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/README @@ -2,15 +2,15 @@ About the iPhone OS Demo Applications ============================================================================== -Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 1.3 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. To run them on your favorite platform, you may wish to set the macros SCREEN_WIDTH and SCREEN_HEIGHT, located in common.h. +Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 2.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. Common files: - common.c and common.h contain code common to all demo applications. This includes macros about the screen dimensions (in pixels), simple error handling, and functions for generating random numbers. + common.c and common.h contain code common to all demo applications. This includes functions about delta timing (in seconds), simple error handling, and functions for generating random numbers. Rectangles (rectangles.c): - Draws randomly sized and colored rectangles all over the screen by using SDL_RenderFill. This is the simplest of all the demos. + Draws randomly sized and colored rectangles all over the screen by using SDL_RenderFillRect. This is the simplest of all the demos. Happy (happy.c): diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/bitmapfont/license.txt b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/bitmapfont/license.txt old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/bitmapfont/license.txt rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/bitmapfont/license.txt diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_china.wav b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_china.wav similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_china.wav rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_china.wav diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/icon.bmp b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/icon.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/icon.bmp rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/icon.bmp diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/ship.bmp b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/ship.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/ship.bmp rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/ship.bmp diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/space.bmp b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/space.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/space.bmp rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/space.bmp diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/stroke.bmp b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/stroke.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/data/stroke.bmp rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/data/stroke.bmp diff --git a/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/iOS Launch Screen.storyboard b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/iOS Launch Screen.storyboard new file mode 100644 index 0000000000..4d8722a667 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/iOS Launch Screen.storyboard @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/accelerometer.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/accelerometer.c similarity index 81% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/accelerometer.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/accelerometer.c index 3b7985faa0..2cc0123c29 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/accelerometer.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/accelerometer.c @@ -5,10 +5,9 @@ */ #include "SDL.h" -#include "math.h" +#include #include "common.h" -#define MILLESECONDS_PER_FRAME 16 /* about 60 frames per second */ #define DAMPING 0.5f; /* after bouncing off a wall, damping coefficient determines final speed */ #define FRICTION 0.0008f /* coefficient of acceleration that opposes direction of motion */ #define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */ @@ -31,9 +30,10 @@ static SDL_Texture *ship = 0; /* texture for spaceship */ static SDL_Texture *space = 0; /* texture for space (background */ void -render(SDL_Renderer *renderer, int w, int h) +render(SDL_Renderer *renderer, int w, int h, double deltaTime) { - + double deltaMilliseconds = deltaTime * 1000; + float speed; /* get joystick (accelerometer) axis values and normalize them */ float ax = SDL_JoystickGetAxis(accelerometer, 0); @@ -53,12 +53,12 @@ render(SDL_Renderer *renderer, int w, int h) */ shipData.vx += ax * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT * - MILLESECONDS_PER_FRAME; + deltaMilliseconds; shipData.vy += ay * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT * - MILLESECONDS_PER_FRAME; + deltaMilliseconds; - float speed = sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy); + speed = sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy); if (speed > 0) { /* compensate for friction */ @@ -66,10 +66,10 @@ render(SDL_Renderer *renderer, int w, int h) float diry = shipData.vy / speed; /* normalized y velocity */ /* update velocity due to friction */ - if (speed - FRICTION * MILLESECONDS_PER_FRAME > 0) { + if (speed - FRICTION * deltaMilliseconds > 0) { /* apply friction */ - shipData.vx -= dirx * FRICTION * MILLESECONDS_PER_FRAME; - shipData.vy -= diry * FRICTION * MILLESECONDS_PER_FRAME; + shipData.vx -= dirx * FRICTION * deltaMilliseconds; + shipData.vy -= diry * FRICTION * deltaMilliseconds; } else { /* applying friction would MORE than stop the ship, so just stop the ship */ shipData.vx = 0.0f; @@ -78,8 +78,8 @@ render(SDL_Renderer *renderer, int w, int h) } /* update ship location */ - shipData.x += shipData.vx * MILLESECONDS_PER_FRAME; - shipData.y += shipData.vy * MILLESECONDS_PER_FRAME; + shipData.x += shipData.vx * deltaMilliseconds; + shipData.y += shipData.vy * deltaMilliseconds; if (shipData.x > maxx) { shipData.x = maxx; @@ -160,9 +160,6 @@ main(int argc, char *argv[]) SDL_Window *window; /* main window */ SDL_Renderer *renderer; - Uint32 startFrame; /* time frame began to process */ - Uint32 endFrame; /* time frame ended processing */ - Sint32 delay; /* time to pause waiting to draw next frame */ int done; /* should we clean up and exit? */ int w, h; @@ -172,12 +169,11 @@ main(int argc, char *argv[]) } /* create main window and renderer */ - window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, - SDL_WINDOW_OPENGL | - SDL_WINDOW_FULLSCREEN); + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI); renderer = SDL_CreateRenderer(window, 0, 0); SDL_GetWindowSize(window, &w, &h); + SDL_RenderSetLogicalSize(renderer, w, h); /* print out some info about joysticks and try to open accelerometer for use */ printf("There are %d joysticks available\n", SDL_NumJoysticks()); @@ -207,24 +203,15 @@ main(int argc, char *argv[]) done = 0; /* enter main loop */ while (!done) { - startFrame = SDL_GetTicks(); + double deltaTime = updateDeltaTime(); SDL_Event event; while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { done = 1; } } - render(renderer, w, h); - endFrame = SDL_GetTicks(); - - /* figure out how much time we have left, and then sleep */ - delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame); - if (delay < 0) { - delay = 0; - } else if (delay > MILLESECONDS_PER_FRAME) { - delay = MILLESECONDS_PER_FRAME; - } - SDL_Delay(delay); + render(renderer, w, h, deltaTime); + SDL_Delay(1); } /* delete textures */ diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.c similarity index 57% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.c index b2d9634566..e15fb5ff19 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.c @@ -32,5 +32,25 @@ void fatalError(const char *string) { printf("%s: %s\n", string, SDL_GetError()); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, string, SDL_GetError(), NULL); exit(1); } + +static Uint64 prevTime = 0; + +double +updateDeltaTime(void) +{ + Uint64 curTime; + double deltaTime; + + if (prevTime == 0) { + prevTime = SDL_GetPerformanceCounter(); + } + + curTime = SDL_GetPerformanceCounter(); + deltaTime = (double) (curTime - prevTime) / (double) SDL_GetPerformanceFrequency(); + prevTime = curTime; + + return deltaTime; +} diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.h b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.h similarity index 80% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.h rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.h index 3e0d94ecf2..60475086e4 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/common.h +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/common.h @@ -4,9 +4,7 @@ * use however you want */ -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 480 - extern int randomInt(int min, int max); extern float randomFloat(float min, float max); extern void fatalError(const char *string); +extern double updateDeltaTime(void); diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/fireworks.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/fireworks.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/fireworks.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/fireworks.c index a5beada913..2c4f621f15 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/fireworks.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/fireworks.c @@ -10,13 +10,13 @@ #include #include -#define MILLESECONDS_PER_FRAME 16 /* about 60 frames per second */ #define ACCEL 0.0001f /* acceleration due to gravity, units in pixels per millesecond squared */ #define WIND_RESISTANCE 0.00005f /* acceleration per unit velocity due to wind resistance */ #define MAX_PARTICLES 2000 /* maximum number of particles displayed at once */ static GLuint particleTextureID; /* OpenGL particle texture id */ static SDL_bool pointSizeExtensionSupported; /* is GL_OES_point_size_array supported ? */ +static float pointSizeScale; /* used to describe what type of particle a given struct particle is. emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles. @@ -55,7 +55,7 @@ void initializeParticles(void); void initializeTexture(); int nextPowerOfTwo(int x); void drawParticles(); -void stepParticles(void); +void stepParticles(double deltaTime); /* helper function (used in texture loading) returns next power of two greater than or equal to x @@ -71,11 +71,12 @@ nextPowerOfTwo(int x) } /* - steps each active particle by timestep MILLESECONDS_PER_FRAME + steps each active particle by timestep deltaTime */ void -stepParticles(void) +stepParticles(double deltaTime) { + float deltaMilliseconds = deltaTime * 1000; int i; struct particle *slot = particles; struct particle *curr = particles; @@ -93,10 +94,10 @@ stepParticles(void) curr->isActive = 0; /* step velocity, then step position */ - curr->yvel += ACCEL * MILLESECONDS_PER_FRAME; + curr->yvel += ACCEL * deltaMilliseconds; curr->xvel += 0.0f; - curr->y += curr->yvel * MILLESECONDS_PER_FRAME; - curr->x += curr->xvel * MILLESECONDS_PER_FRAME; + curr->y += curr->yvel * deltaMilliseconds; + curr->x += curr->xvel * deltaMilliseconds; /* particle behavior */ if (curr->type == emitter) { @@ -111,29 +112,29 @@ stepParticles(void) sqrt(curr->xvel * curr->xvel + curr->yvel * curr->yvel); /* if wind resistance is not powerful enough to stop us completely, then apply winde resistance, otherwise just stop us completely */ - if (WIND_RESISTANCE * MILLESECONDS_PER_FRAME < speed) { + if (WIND_RESISTANCE * deltaMilliseconds < speed) { float normx = curr->xvel / speed; float normy = curr->yvel / speed; curr->xvel -= - normx * WIND_RESISTANCE * MILLESECONDS_PER_FRAME; + normx * WIND_RESISTANCE * deltaMilliseconds; curr->yvel -= - normy * WIND_RESISTANCE * MILLESECONDS_PER_FRAME; + normy * WIND_RESISTANCE * deltaMilliseconds; } else { curr->xvel = curr->yvel = 0; /* stop particle */ } - if (curr->color[3] <= MILLESECONDS_PER_FRAME * 0.1275f) { + if (curr->color[3] <= deltaMilliseconds * 0.1275f) { /* if this next step will cause us to fade out completely then just mark for deletion */ curr->isActive = 0; } else { /* otherwise, let's fade a bit more */ - curr->color[3] -= MILLESECONDS_PER_FRAME * 0.1275f; + curr->color[3] -= deltaMilliseconds * 0.1275f; } /* if we're a dust particle, shrink our size */ if (curr->type == dust) - curr->size -= MILLESECONDS_PER_FRAME * 0.010f; + curr->size -= deltaMilliseconds * 0.010f; } @@ -147,7 +148,7 @@ stepParticles(void) /* the number of active particles is computed as the difference between old number of active particles, where slot points, and the new size of the array, where particles points */ - num_active_particles = slot - particles; + num_active_particles = (int) (slot - particles); } /* @@ -206,7 +207,7 @@ explodeEmitter(struct particle *emitter) p->y = emitter->y + emitter->yvel; p->isActive = 1; p->type = dust; - p->size = 15; + p->size = 15 * pointSizeScale; /* inherit emitter's color */ p->color[0] = emitter->color[0]; p->color[1] = emitter->color[1]; @@ -244,7 +245,7 @@ spawnTrailFromEmitter(struct particle *emitter) p->color[3] = (0.7f) * 255; /* set other attributes */ - p->size = 10; + p->size = 10 * pointSizeScale; p->type = trail; p->isActive = 1; @@ -298,7 +299,7 @@ spawnEmitterParticle(GLfloat x, GLfloat y) p->xvel = 0; p->yvel = -sqrt(2 * ACCEL * (screen_h - y)); /* set other attributes */ - p->size = 10; + p->size = 10 * pointSizeScale; p->type = emitter; p->isActive = 1; /* our array has expanded at the end */ @@ -363,10 +364,7 @@ main(int argc, char *argv[]) { SDL_Window *window; /* main window */ SDL_GLContext context; - int w, h; - Uint32 startFrame; /* time frame began to process */ - Uint32 endFrame; /* time frame ended processing */ - Uint32 delay; /* time to pause waiting to draw next frame */ + int drawableW, drawableH; int done; /* should we clean up and exit? */ /* initialize SDL */ @@ -391,11 +389,19 @@ main(int argc, char *argv[]) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); /* create main window and renderer */ - window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, - SDL_WINDOW_OPENGL | - SDL_WINDOW_BORDERLESS); + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, + SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI); context = SDL_GL_CreateContext(window); + /* The window size and drawable size may be different when highdpi is enabled, + * due to the increased pixel density of the drawable. */ + SDL_GetWindowSize(window, &screen_w, &screen_h); + SDL_GL_GetDrawableSize(window, &drawableW, &drawableH); + + /* In OpenGL, point sizes are always in pixels. We don't want them looking + * tiny on a retina screen. */ + pointSizeScale = (float) drawableH / (float) screen_h; + /* load the particle texture */ initializeTexture(); @@ -412,8 +418,7 @@ main(int argc, char *argv[]) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - SDL_GetWindowSize(window, &screen_w, &screen_h); - glViewport(0, 0, screen_w, screen_h); + glViewport(0, 0, drawableW, drawableH); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -436,14 +441,14 @@ main(int argc, char *argv[]) glEnableClientState(GL_POINT_SIZE_ARRAY_OES); } else { /* if extension not available then all particles have size 10 */ - glPointSize(10); + glPointSize(10 * pointSizeScale); } done = 0; /* enter main loop */ while (!done) { - startFrame = SDL_GetTicks(); SDL_Event event; + double deltaTime = updateDeltaTime(); while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { done = 1; @@ -454,19 +459,10 @@ main(int argc, char *argv[]) spawnEmitterParticle(x, y); } } - stepParticles(); + stepParticles(deltaTime); drawParticles(); SDL_GL_SwapWindow(window); - endFrame = SDL_GetTicks(); - - /* figure out how much time we have left, and then sleep */ - delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame); - if (delay > MILLESECONDS_PER_FRAME) { - delay = MILLESECONDS_PER_FRAME; - } - if (delay > 0) { - SDL_Delay(delay); - } + SDL_Delay(1); } /* delete textures */ diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/happy.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/happy.c similarity index 71% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/happy.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/happy.c index ce661d9587..658a65f01b 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/happy.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/happy.c @@ -8,8 +8,7 @@ #include "common.h" #define NUM_HAPPY_FACES 100 /* number of faces to draw */ -#define MILLESECONDS_PER_FRAME 16 /* about 60 frames per second */ -#define HAPPY_FACE_SIZE 32 /* width and height of happyface (pixels) */ +#define HAPPY_FACE_SIZE 32 /* width and height of happyface */ static SDL_Texture *texture = 0; /* reference to texture holding happyface */ @@ -24,30 +23,37 @@ static struct units of velocity are pixels per millesecond */ void -initializeHappyFaces() +initializeHappyFaces(SDL_Renderer *renderer) { int i; + int w; + int h; + SDL_RenderGetLogicalSize(renderer, &w, &h); + for (i = 0; i < NUM_HAPPY_FACES; i++) { - faces[i].x = randomFloat(0.0f, SCREEN_WIDTH - HAPPY_FACE_SIZE); - faces[i].y = randomFloat(0.0f, SCREEN_HEIGHT - HAPPY_FACE_SIZE); - faces[i].xvel = randomFloat(-0.1f, 0.1f); - faces[i].yvel = randomFloat(-0.1f, 0.1f); + faces[i].x = randomFloat(0.0f, w - HAPPY_FACE_SIZE); + faces[i].y = randomFloat(0.0f, h - HAPPY_FACE_SIZE); + faces[i].xvel = randomFloat(-60.0f, 60.0f); + faces[i].yvel = randomFloat(-60.0f, 60.0f); } } void -render(SDL_Renderer *renderer) +render(SDL_Renderer *renderer, double deltaTime) { - int i; SDL_Rect srcRect; SDL_Rect dstRect; + int w; + int h; + + SDL_RenderGetLogicalSize(renderer, &w, &h); /* setup boundaries for happyface bouncing */ - Uint16 maxx = SCREEN_WIDTH - HAPPY_FACE_SIZE; - Uint16 maxy = SCREEN_HEIGHT - HAPPY_FACE_SIZE; - Uint16 minx = 0; - Uint16 miny = 0; + int maxx = w - HAPPY_FACE_SIZE; + int maxy = h - HAPPY_FACE_SIZE; + int minx = 0; + int miny = 0; /* setup rects for drawing */ srcRect.x = 0; @@ -68,8 +74,8 @@ render(SDL_Renderer *renderer) - draw */ for (i = 0; i < NUM_HAPPY_FACES; i++) { - faces[i].x += faces[i].xvel * MILLESECONDS_PER_FRAME; - faces[i].y += faces[i].yvel * MILLESECONDS_PER_FRAME; + faces[i].x += faces[i].xvel * deltaTime; + faces[i].y += faces[i].yvel * deltaTime; if (faces[i].x > maxx) { faces[i].x = maxx; faces[i].xvel = -faces[i].xvel; @@ -123,48 +129,45 @@ initializeTexture(SDL_Renderer *renderer) int main(int argc, char *argv[]) { - SDL_Window *window; SDL_Renderer *renderer; - Uint32 startFrame; - Uint32 endFrame; - Uint32 delay; int done; + int width; + int height; /* initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { fatalError("Could not initialize SDL"); } - window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, - SDL_WINDOW_OPENGL | - SDL_WINDOW_BORDERLESS); + + /* The specified window size doesn't matter - except for its aspect ratio, + * which determines whether the window is in portrait or landscape on iOS + * (if SDL_WINDOW_RESIZABLE isn't specified). */ + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI); renderer = SDL_CreateRenderer(window, -1, 0); + SDL_GetWindowSize(window, &width, &height); + SDL_RenderSetLogicalSize(renderer, width, height); + initializeTexture(renderer); - initializeHappyFaces(); + initializeHappyFaces(renderer); + /* main loop */ done = 0; while (!done) { - startFrame = SDL_GetTicks(); SDL_Event event; + double deltaTime = updateDeltaTime(); + while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { done = 1; } } - render(renderer); - endFrame = SDL_GetTicks(); - - /* figure out how much time we have left, and then sleep */ - delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame); - if (delay < 0) { - delay = 0; - } else if (delay > MILLESECONDS_PER_FRAME) { - delay = MILLESECONDS_PER_FRAME; - } - SDL_Delay(delay); + + render(renderer, deltaTime); + SDL_Delay(1); } /* cleanup */ diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/keyboard.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/keyboard.c similarity index 68% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/keyboard.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/keyboard.c index 4fb45b94ae..cfbe4e66b4 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/keyboard.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/keyboard.c @@ -4,23 +4,24 @@ * use however you want */ -#import "SDL.h" -#import "common.h" +#include "SDL.h" +#include "common.h" + +#define TEST_INPUT_RECT #define GLYPH_SIZE_IMAGE 16 /* size of glyphs (characters) in the bitmap font file */ #define GLYPH_SIZE_SCREEN 32 /* size of glyphs (characters) as shown on the screen */ -static SDL_Texture *texture; /* texture where we'll hold our font */ +#define MAX_CHARS 1024 -/* function declarations */ -void cleanup(void); -void drawBlank(int x, int y); +static SDL_Texture *texture; /* texture where we'll hold our font */ static SDL_Renderer *renderer; static int numChars = 0; /* number of characters we've typed so far */ -static SDL_bool lastCharWasColon = 0; /* we use this to detect sequences such as :) */ static SDL_Color bg_color = { 50, 50, 100, 255 }; /* color of background */ +static int glyphs[MAX_CHARS]; + /* this structure maps a scancode to an index in our bitmap font. it also contains data about under which modifiers the mapping is valid (for example, we don't want shift + 1 to produce the character '1', @@ -107,7 +108,7 @@ fontMapping map[TABLE_SIZE] = { If there is no entry for the key, -1 is returned */ int -keyToIndex(SDL_Keysym key) +keyToGlyphIndex(SDL_Keysym key) { int i, index = -1; for (i = 0; i < TABLE_SIZE; i++) { @@ -132,66 +133,36 @@ keyToIndex(SDL_Keysym key) void getPositionForCharNumber(int n, int *x, int *y) { + int renderW, renderH; + SDL_RenderGetLogicalSize(renderer, &renderW, &renderH); + int x_padding = 16; /* padding space on left and right side of screen */ int y_padding = 32; /* padding space at top of screen */ /* figure out the number of characters that can fit horizontally across the screen */ - int max_x_chars = (SCREEN_WIDTH - 2 * x_padding) / GLYPH_SIZE_SCREEN; + int max_x_chars = (renderW - 2 * x_padding) / GLYPH_SIZE_SCREEN; int line_separation = 5; /* pixels between each line */ *x = (n % max_x_chars) * GLYPH_SIZE_SCREEN + x_padding; - *y = (n / max_x_chars) * (GLYPH_SIZE_SCREEN + line_separation) + - y_padding; +#ifdef TEST_INPUT_RECT + *y = renderH - GLYPH_SIZE_SCREEN; +#else + *y = (n / max_x_chars) * (GLYPH_SIZE_SCREEN + line_separation) + y_padding; +#endif } void -drawIndex(int index) +drawGlyph(int glyph, int positionIndex) { int x, y; - getPositionForCharNumber(numChars, &x, &y); - SDL_Rect srcRect = - { GLYPH_SIZE_IMAGE * index, 0, GLYPH_SIZE_IMAGE, GLYPH_SIZE_IMAGE }; + getPositionForCharNumber(positionIndex, &x, &y); + SDL_Rect srcRect = { GLYPH_SIZE_IMAGE * glyph, 0, GLYPH_SIZE_IMAGE, GLYPH_SIZE_IMAGE }; SDL_Rect dstRect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN }; - drawBlank(x, y); SDL_RenderCopy(renderer, texture, &srcRect, &dstRect); } -/* draws the cursor icon at the current end position of the text */ -void -drawCursor(void) -{ - drawIndex(29); /* cursor is at index 29 in the bitmap font */ -} - -/* paints over a glyph sized region with the background color - in effect it erases the area -*/ -void -drawBlank(int x, int y) -{ - SDL_Rect rect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN }; - SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); - SDL_RenderFillRect(renderer, &rect); -} - -/* moves backwards one character, erasing the last one put down */ -void -backspace(void) -{ - int x, y; - if (numChars > 0) { - getPositionForCharNumber(numChars, &x, &y); - drawBlank(x, y); - numChars--; - getPositionForCharNumber(numChars, &x, &y); - drawBlank(x, y); - drawCursor(); - } -} - /* this function loads our font into an SDL_Texture and returns the SDL_Texture */ SDL_Texture* loadFont(void) { - SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp"); if (!surface) { @@ -211,8 +182,7 @@ loadFont(void) Bmask, Amask); SDL_BlitSurface(surface, NULL, converted, NULL); /* create our texture */ - texture = - SDL_CreateTextureFromSurface(renderer, converted); + texture = SDL_CreateTextureFromSurface(renderer, converted); if (texture == 0) { printf("texture creation failed: %s\n", SDL_GetError()); } else { @@ -225,86 +195,107 @@ loadFont(void) } } +void +draw() +{ + SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); + SDL_RenderClear(renderer); + + for (int i = 0; i < numChars; i++) { + drawGlyph(glyphs[i], i); + } + + drawGlyph(29, numChars); /* cursor is at index 29 in the bitmap font */ + + SDL_RenderPresent(renderer); +} + int main(int argc, char *argv[]) { - - int index; /* index of last key we pushed in the bitmap font */ SDL_Window *window; SDL_Event event; /* last event received */ - SDL_Keymod mod; /* key modifiers of last key we pushed */ SDL_Scancode scancode; /* scancode of last key we pushed */ + int width; + int height; + int done; + SDL_Rect textrect; if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("Error initializing SDL: %s", SDL_GetError()); } /* create window */ - window = SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0); + window = SDL_CreateWindow("iOS keyboard test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); /* create renderer */ - renderer = SDL_CreateRenderer(window, -1, 0); + renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC); + + SDL_GetWindowSize(window, &width, &height); + SDL_RenderSetLogicalSize(renderer, width, height); /* load up our font */ loadFont(); + + /* Show onscreen keyboard */ +#ifdef TEST_INPUT_RECT + textrect.x = 0; + textrect.y = height - GLYPH_SIZE_IMAGE; + textrect.w = width; + textrect.h = GLYPH_SIZE_IMAGE; + SDL_SetTextInputRect(&textrect); +#endif + SDL_StartTextInput(); - /* draw the background, we'll just paint over it */ - SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); - SDL_RenderFillRect(renderer, NULL); - SDL_RenderPresent(renderer); - - int done = 0; - /* loop till we get SDL_Quit */ - while (SDL_WaitEvent(&event)) { - switch (event.type) { - case SDL_QUIT: - done = 1; - break; - case SDL_KEYDOWN: - index = keyToIndex(event.key.keysym); - scancode = event.key.keysym.scancode; - mod = event.key.keysym.mod; - if (scancode == SDL_SCANCODE_DELETE) { - /* if user hit delete, delete the last character */ - backspace(); - lastCharWasColon = 0; - } else if (lastCharWasColon && scancode == SDL_SCANCODE_0 - && (mod & KMOD_SHIFT)) { - /* if our last key was a colon and this one is a close paren, the make a hoppy face */ - backspace(); - drawIndex(32); /* index for happy face */ - numChars++; - drawCursor(); - lastCharWasColon = 0; - } else if (index != -1) { - /* if we aren't doing a happy face, then just draw the normal character */ - drawIndex(index); - numChars++; - drawCursor(); - lastCharWasColon = - (event.key.keysym.scancode == SDL_SCANCODE_SEMICOLON - && (event.key.keysym.mod & KMOD_SHIFT)); - } - /* check if the key was a colon */ - /* draw our updates to the screen */ - SDL_RenderPresent(renderer); - break; - case SDL_MOUSEBUTTONUP: - /* mouse up toggles onscreen keyboard visibility */ - if (SDL_IsTextInputActive()) { - SDL_StopTextInput(); - } else { - SDL_StartTextInput(); + done = 0; + while (!done) { + while (SDL_PollEvent(&event)) { + switch (event.type) { + case SDL_QUIT: + done = 1; + break; + case SDL_WINDOWEVENT: + if (event.window.event == SDL_WINDOWEVENT_RESIZED) { + width = event.window.data1; + height = event.window.data2; + SDL_RenderSetLogicalSize(renderer, width, height); +#ifdef TEST_INPUT_RECT + textrect.x = 0; + textrect.y = height - GLYPH_SIZE_IMAGE; + textrect.w = width; + textrect.h = GLYPH_SIZE_IMAGE; + SDL_SetTextInputRect(&textrect); +#endif + } + break; + case SDL_KEYDOWN: + if (event.key.keysym.scancode == SDL_SCANCODE_BACKSPACE) { + if (numChars > 0) { + numChars--; + } + } else if (numChars + 1 < MAX_CHARS) { + int index = keyToGlyphIndex(event.key.keysym); + if (index >= 0) { + glyphs[numChars++] = index; + } + } + break; + case SDL_MOUSEBUTTONUP: + /* mouse up toggles onscreen keyboard visibility */ + if (SDL_IsTextInputActive()) { + SDL_StopTextInput(); + } else { + SDL_StartTextInput(); + } + break; } - break; } + + draw(); + SDL_Delay(15); } - cleanup(); - return 0; -} -/* clean up after ourselves like a good kiddy */ -void -cleanup(void) -{ SDL_DestroyTexture(texture); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); SDL_Quit(); + return 0; } diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/mixer.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/mixer.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/mixer.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/mixer.c index bd0cfb1dff..14945ad334 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/mixer.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/mixer.c @@ -4,12 +4,11 @@ * use however you want */ -#import "SDL.h" -#import "common.h" +#include "SDL.h" +#include "common.h" #define NUM_CHANNELS 8 /* max number of sounds we can play at once */ #define NUM_DRUMS 4 /* number of drums in our set */ -#define MILLESECONDS_PER_FRAME 16 /* about 60 frames per second */ static struct { @@ -33,7 +32,7 @@ static struct sound drums[NUM_DRUMS]; void handleMouseButtonDown(SDL_Event * event); void handleMouseButtonUp(SDL_Event * event); int playSound(struct sound *); -void initializeButtons(); +void initializeButtons(SDL_Renderer *); void audioCallback(void *userdata, Uint8 * stream, int len); void loadSound(const char *file, struct sound *s); @@ -52,19 +51,21 @@ struct /* sets up the buttons (color, position, state) */ void -initializeButtons() +initializeButtons(SDL_Renderer *renderer) { - int i; int spacing = 10; /* gap between drum buttons */ SDL_Rect buttonRect; /* keeps track of where to position drum */ SDL_Color upColor = { 86, 86, 140, 255 }; /* color of drum when not pressed */ SDL_Color downColor = { 191, 191, 221, 255 }; /* color of drum when pressed */ + int renderW, renderH; + + SDL_RenderGetLogicalSize(renderer, &renderW, &renderH); buttonRect.x = spacing; buttonRect.y = spacing; - buttonRect.w = SCREEN_WIDTH - 2 * spacing; - buttonRect.h = (SCREEN_HEIGHT - (NUM_DRUMS + 1) * spacing) / NUM_DRUMS; + buttonRect.w = renderW - 2 * spacing; + buttonRect.h = (renderH - (NUM_DRUMS + 1) * spacing) / NUM_DRUMS; /* setup each button */ for (i = 0; i < NUM_DRUMS; i++) { @@ -249,7 +250,7 @@ audioCallback(void *userdata, Uint8 * stream, int len) /* mix this sound effect with the output */ SDL_MixAudioFormat(stream, mixer.channels[i].position, - mixer.outputSpec.format, copy_amt, 150); + mixer.outputSpec.format, copy_amt, SDL_MIX_MAXVOLUME); /* update buffer position in sound effect and the number of bytes left */ mixer.channels[i].position += copy_amt; @@ -270,23 +271,23 @@ audioCallback(void *userdata, Uint8 * stream, int len) int main(int argc, char *argv[]) { - int done; /* has user tried to quit ? */ SDL_Window *window; /* main window */ SDL_Renderer *renderer; SDL_Event event; - Uint32 startFrame; /* holds when frame started processing */ - Uint32 endFrame; /* holds when frame ended processing */ - Uint32 delay; /* calculated delay, how long should we wait before next frame? */ + int i; + int width; + int height; if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { fatalError("could not initialize SDL"); } - window = - SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, - SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS); + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI); renderer = SDL_CreateRenderer(window, 0, 0); + SDL_GetWindowSize(window, &width, &height); + SDL_RenderSetLogicalSize(renderer, width, height); + /* initialize the mixer */ SDL_memset(&mixer, 0, sizeof(mixer)); /* setup output format */ @@ -309,12 +310,11 @@ main(int argc, char *argv[]) loadSound("ds_china.wav", &drums[0]); /* setup positions, colors, and state of buttons */ - initializeButtons(); + initializeButtons(renderer); /* enter main loop */ done = 0; while (!done) { - startFrame = SDL_GetTicks(); while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_MOUSEBUTTONDOWN: @@ -329,20 +329,11 @@ main(int argc, char *argv[]) } } render(renderer); /* draw buttons */ - endFrame = SDL_GetTicks(); - - /* figure out how much time we have left, and then sleep */ - delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame); - if (delay < 0) { - delay = 0; - } else if (delay > MILLESECONDS_PER_FRAME) { - delay = MILLESECONDS_PER_FRAME; - } - SDL_Delay(delay); + + SDL_Delay(1); } /* cleanup code, let's free up those sound buffers */ - int i; for (i = 0; i < NUM_DRUMS; i++) { SDL_free(drums[i].buffer); } diff --git a/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/rectangles.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/rectangles.c new file mode 100644 index 0000000000..10f9f851b3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/rectangles.c @@ -0,0 +1,92 @@ +/* + * rectangles.c + * written by Holmes Futrell + * use however you want +*/ + +#include "SDL.h" +#include +#include "common.h" + +void +render(SDL_Renderer *renderer) +{ + Uint8 r, g, b; + int renderW; + int renderH; + + SDL_RenderGetLogicalSize(renderer, &renderW, &renderH); + + /* Come up with a random rectangle */ + SDL_Rect rect; + rect.w = randomInt(64, 128); + rect.h = randomInt(64, 128); + rect.x = randomInt(0, renderW); + rect.y = randomInt(0, renderH); + + /* Come up with a random color */ + r = randomInt(50, 255); + g = randomInt(50, 255); + b = randomInt(50, 255); + + /* Fill the rectangle in the color */ + SDL_SetRenderDrawColor(renderer, r, g, b, 255); + SDL_RenderFillRect(renderer, &rect); + + /* update screen */ + SDL_RenderPresent(renderer); +} + +int +main(int argc, char *argv[]) +{ + + SDL_Window *window; + SDL_Renderer *renderer; + int done; + SDL_Event event; + int windowW; + int windowH; + + /* initialize SDL */ + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + fatalError("Could not initialize SDL"); + } + + /* seed random number generator */ + srand(time(NULL)); + + /* create window and renderer */ + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI); + if (window == 0) { + fatalError("Could not initialize Window"); + } + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + fatalError("Could not create renderer"); + } + + SDL_GetWindowSize(window, &windowW, &windowH); + SDL_RenderSetLogicalSize(renderer, windowW, windowH); + + /* Fill screen with black */ + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + + /* Enter render loop, waiting for user to quit */ + done = 0; + while (!done) { + while (SDL_PollEvent(&event)) { + if (event.type == SDL_QUIT) { + done = 1; + } + } + render(renderer); + SDL_Delay(1); + } + + /* shutdown SDL */ + SDL_Quit(); + + return 0; +} diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/touch.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/touch.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/touch.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/touch.c index c81dcbc223..470b9d1bdc 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Demos/src/touch.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Demos/src/touch.c @@ -5,7 +5,7 @@ */ #include "SDL.h" -#include "math.h" +#include #include "common.h" #define BRUSH_SIZE 32 /* width and height of the brush */ @@ -26,15 +26,17 @@ drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy) float dx_prime = dx / iterations; /* x-shift per iteration */ float dy_prime = dy / iterations; /* y-shift per iteration */ SDL_Rect dstRect; /* rect to draw brush sprite into */ + float x; + float y; + int i; dstRect.w = BRUSH_SIZE; dstRect.h = BRUSH_SIZE; /* setup x and y for the location of the first sprite */ - float x = startx - BRUSH_SIZE / 2.0f; - float y = starty - BRUSH_SIZE / 2.0f; + x = startx - BRUSH_SIZE / 2.0f; + y = starty - BRUSH_SIZE / 2.0f; - int i; /* draw a series of blots to form the line */ for (i = 0; i < iterations; i++) { dstRect.x = x; @@ -80,6 +82,7 @@ main(int argc, char *argv[]) SDL_Window *window; /* main window */ SDL_Renderer *renderer; int done; /* does user want to quit? */ + int w, h; /* initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { @@ -87,11 +90,12 @@ main(int argc, char *argv[]) } /* create main window and renderer */ - window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, - SDL_WINDOW_OPENGL | - SDL_WINDOW_BORDERLESS); + window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI); renderer = SDL_CreateRenderer(window, 0, 0); + SDL_GetWindowSize(window, &w, &h); + SDL_RenderSetLogicalSize(renderer, w, h); + /* load brush texture */ initializeTexture(renderer); diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 63% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj index 9f0d62e8a4..aace16b77b --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj @@ -18,6 +18,28 @@ name = PrepareXcodeProjectTemplate; productName = PrepareXcodeProjectTemplate; }; + C143576D1F4C4DAA000B792B /* All-iOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = C143576E1F4C4DAB000B792B /* Build configuration list for PBXAggregateTarget "All-iOS" */; + buildPhases = ( + C14357711F4C4DB2000B792B /* ShellScript */, + ); + dependencies = ( + ); + name = "All-iOS"; + productName = "All (iOS)"; + }; + C14357721F4C4F2A000B792B /* All-tvOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = C14357741F4C4F2A000B792B /* Build configuration list for PBXAggregateTarget "All-tvOS" */; + buildPhases = ( + C14357731F4C4F2A000B792B /* ShellScript */, + ); + dependencies = ( + ); + name = "All-tvOS"; + productName = "All (iOS)"; + }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ @@ -30,8 +52,6 @@ 041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; }; 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; }; 0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; - 04409BA612FA989600FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA212FA989600FB9AA8 /* mmx.h */; }; - 04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; }; 04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; }; 04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; }; 0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; }; @@ -67,6 +87,16 @@ 04F7808512FB753F00FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; }; 04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; }; 04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; }; + 4D7516FB1EE1C28A00820EEA /* SDL_uikitmetalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */; }; + 4D7516FC1EE1C28A00820EEA /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516F91EE1C28A00820EEA /* SDL_uikitvulkan.h */; }; + 4D7516FD1EE1C28A00820EEA /* SDL_uikitvulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */; }; + 4D7516FF1EE1C5B400820EEA /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */; }; + 4D75171A1EE1D32200820EEA /* SDL_uikitmetalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */; }; + 4D75171F1EE1D98200820EEA /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */; }; + 4D7517201EE1D98200820EEA /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */; }; + 55FFA91A2122302B00D7CBED /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FFA9192122302B00D7CBED /* SDL_syspower.h */; }; + 566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; }; + 566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */; }; 56A6702E18565E450007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6702D18565E450007D20F /* SDL_internal.h */; }; 56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */; }; 56A6703618565E760007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703218565E760007D20F /* SDL_dynapi_procs.h */; }; @@ -74,17 +104,35 @@ 56A6703818565E760007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703418565E760007D20F /* SDL_dynapi.h */; }; 56C181DF17C44D5E00406AE3 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */; }; 56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; }; - 56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */; }; + 56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; }; 56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */; }; 56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; }; 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; }; + 56F9D5601DF73BA400C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; }; 93CB792313FC5E5200BD3E05 /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; }; 93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; }; + A704172E20F7E74800A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; }; + A704172F20F7E76000A82227 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; }; + A7C19D29212E552C00DF2152 /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */; }; + A7C19D2A212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; }; + A7C19D2B212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; }; + A7F629241FE06523002F9CC9 /* SDL_uikitmetalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */; }; AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; }; AA0AD06516647BD400CE5896 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */; }; AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; }; AA126AD41617C5E7005ABC8F /* SDL_uikitmodes.h in Headers */ = {isa = PBXBuildFile; fileRef = AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */; }; AA126AD51617C5E7005ABC8F /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; }; + AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */; }; + AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */; }; + AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */; }; + AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */; }; + AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */; }; + AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */; }; + AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; }; + AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */; }; + AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */; }; + AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */; }; + AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; }; AA628ADB159369E3005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; }; AA628ADC159369E3005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628ADA159369E3005138DD /* SDL_rotate.h */; }; AA704DD6162AA90A0076D1C1 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */; }; @@ -143,7 +191,133 @@ AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */; }; AABCC3951640643D00AB8930 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; }; AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */; }; - FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; settings = {ASSET_TAGS = (); }; }; + AADC5A5D1FDA104400960936 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; }; + AADC5A5E1FDA105300960936 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; }; + AADC5A5F1FDA105600960936 /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */; }; + AADC5A601FDA10A400960936 /* SDL_uikitvulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */; }; + AADC5A631FDA10C800960936 /* SDL_shaders_metal_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */; }; + AADC5A641FDA10C800960936 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A621FDA10C800960936 /* SDL_render_metal.m */; }; + AADC5A651FDA10CB00960936 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A621FDA10C800960936 /* SDL_render_metal.m */; }; + F30D9C99212CD0360047DF2E /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C98212CD0360047DF2E /* SDL_sensor.h */; }; + F30D9C9E212CD0990047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9B212CD0980047DF2E /* SDL_sensor_c.h */; }; + F30D9C9F212CD0990047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C9C212CD0990047DF2E /* SDL_syssensor.h */; }; + F30D9CA0212CD0990047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C9D212CD0990047DF2E /* SDL_sensor.c */; }; + F30D9CA1212CD0990047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C9D212CD0990047DF2E /* SDL_sensor.c */; }; + F30D9CA5212CD0BF0047DF2E /* SDL_coremotionsensor.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */; }; + F30D9CA6212CD0BF0047DF2E /* SDL_coremotionsensor.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */; }; + F30D9CA7212CD0BF0047DF2E /* SDL_coremotionsensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CA4212CD0BF0047DF2E /* SDL_coremotionsensor.h */; }; + F30D9CC6212CE92C0047DF2E /* hid.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CC5212CE92C0047DF2E /* hid.m */; }; + F30D9CC7212CE92C0047DF2E /* hid.m in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CC5212CE92C0047DF2E /* hid.m */; }; + F36839CC214790950000F255 /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F36839CA214790950000F255 /* SDL_dummysensor.h */; }; + F36839CD214790950000F255 /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F36839CB214790950000F255 /* SDL_dummysensor.c */; }; + F36839CE214790950000F255 /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F36839CB214790950000F255 /* SDL_dummysensor.c */; }; + F3BDD79220F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */; }; + F3BDD79320F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */; }; + F3BDD79420F51CB8004ECBF3 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */; }; + F3BDD79520F51CB8004ECBF3 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */; }; + F3BDD79620F51CB8004ECBF3 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */; }; + F3BDD79720F51CB8004ECBF3 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */; }; + F3BDD79820F51CB8004ECBF3 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */; }; + F3BDD79920F51CB8004ECBF3 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */; }; + F3BDD79B20F51CB8004ECBF3 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */; }; + F3BDD79C20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; + F3BDD79D20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; }; + FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; }; + FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; + FAB5981D1BB5C31500BE72C5 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; }; + FAB5981E1BB5C31500BE72C5 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; }; + FAB5981F1BB5C31500BE72C5 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; }; + FAB598211BB5C31500BE72C5 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B91D0DD52EDC00FB1D6B /* SDL_dummyaudio.c */; }; + FAB598231BB5C31500BE72C5 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */; }; + FAB598251BB5C31500BE72C5 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9460DD52EDC00FB1D6B /* SDL_audiocvt.c */; }; + FAB598271BB5C31500BE72C5 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94A0DD52EDC00FB1D6B /* SDL_audiotypecvt.c */; }; + FAB598281BB5C31500BE72C5 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B94B0DD52EDC00FB1D6B /* SDL_mixer.c */; }; + FAB5982A1BB5C31500BE72C5 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9530DD52EDC00FB1D6B /* SDL_wave.c */; }; + FAB5982C1BB5C31500BE72C5 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B98B0DD52EDC00FB1D6B /* SDL_cpuinfo.c */; }; + FAB5982F1BB5C31500BE72C5 /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6703318565E760007D20F /* SDL_dynapi.c */; }; + FAB598361BB5C31500BE72C5 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; + FAB598381BB5C31500BE72C5 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = AA704DD5162AA90A0076D1C1 /* SDL_dropevents.c */; }; + FAB5983A1BB5C31500BE72C5 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9930DD52EDC00FB1D6B /* SDL_events.c */; }; + FAB5983C1BB5C31500BE72C5 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6011EF474A00B60E01 /* SDL_gesture.c */; }; + FAB5983E1BB5C31500BE72C5 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */; }; + FAB598401BB5C31500BE72C5 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9970DD52EDC00FB1D6B /* SDL_mouse.c */; }; + FAB598421BB5C31500BE72C5 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9990DD52EDC00FB1D6B /* SDL_quit.c */; }; + FAB598441BB5C31500BE72C5 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BA9D6211EF474A00B60E01 /* SDL_touch.c */; }; + FAB598461BB5C31500BE72C5 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99B0DD52EDC00FB1D6B /* SDL_windowevents.c */; }; + FAB598491BB5C31600BE72C5 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006E9887119552DD001DE610 /* SDL_rwopsbundlesupport.m */; }; + FAB5984A1BB5C31600BE72C5 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B99E0DD52EDC00FB1D6B /* SDL_rwops.c */; }; + FAB5984B1BB5C31600BE72C5 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; }; + FAB5984C1BB5C31600BE72C5 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B80EA76A31008ABAF1 /* SDL_syshaptic.c */; }; + FAB5984D1BB5C31600BE72C5 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 047677B90EA76A31008ABAF1 /* SDL_haptic.c */; }; + FAB598501BB5C31600BE72C5 /* SDL_sysjoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */; }; + FAB598521BB5C31600BE72C5 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FD5F9D1E0E0E08B3008E885B /* SDL_joystick.c */; }; + FAB598551BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 047AF1B20EA98D6C00811173 /* SDL_sysloadso.c */; }; + FAB598561BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = FD8BD8190E27E25900B52CD5 /* SDL_sysloadso.c */; }; + FAB598571BB5C31600BE72C5 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; }; + FAB598581BB5C31600BE72C5 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; }; + FAB598591BB5C31600BE72C5 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5212FE1C28004C9285 /* SDL_render_gles.c */; }; + FAB5985A1BB5C31600BE72C5 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85512FE70C600CECEE3 /* SDL_render_gles2.c */; }; + FAB5985B1BB5C31600BE72C5 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0402A85612FE70C600CECEE3 /* SDL_shaders_gles2.c */; }; + FAB5985D1BB5C31600BE72C5 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806A12FB751400FC43C0 /* SDL_blendfillrect.c */; }; + FAB5985F1BB5C31600BE72C5 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806C12FB751400FC43C0 /* SDL_blendline.c */; }; + FAB598611BB5C31600BE72C5 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7806E12FB751400FC43C0 /* SDL_blendpoint.c */; }; + FAB598641BB5C31600BE72C5 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807112FB751400FC43C0 /* SDL_drawline.c */; }; + FAB598661BB5C31600BE72C5 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7807312FB751400FC43C0 /* SDL_drawpoint.c */; }; + FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; }; + FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; }; + FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; }; + FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; }; + FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; }; + FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; }; + FAB598741BB5C31600BE72C5 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; }; + FAB598751BB5C31600BE72C5 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A730DEA620800C5B771 /* SDL_qsort.c */; }; + FAB598761BB5C31600BE72C5 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A740DEA620800C5B771 /* SDL_stdlib.c */; }; + FAB598771BB5C31600BE72C5 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A750DEA620800C5B771 /* SDL_string.c */; }; + FAB598781BB5C31600BE72C5 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA070DD52EDC00FB1D6B /* SDL_syscond.c */; }; + FAB598791BB5C31600BE72C5 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA080DD52EDC00FB1D6B /* SDL_sysmutex.c */; }; + FAB5987B1BB5C31600BE72C5 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0A0DD52EDC00FB1D6B /* SDL_syssem.c */; }; + FAB5987C1BB5C31600BE72C5 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA0B0DD52EDC00FB1D6B /* SDL_systhread.c */; }; + FAB5987E1BB5C31600BE72C5 /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; }; + FAB598801BB5C31600BE72C5 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */; }; + FAB598821BB5C31600BE72C5 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA310DD52EDC00FB1D6B /* SDL_systimer.c */; }; + FAB598831BB5C31600BE72C5 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */; }; + FAB598871BB5C31600BE72C5 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */; }; + FAB598891BB5C31600BE72C5 /* SDL_uikitevents.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */; }; + FAB5988B1BB5C31600BE72C5 /* SDL_uikitmessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */; }; + FAB5988D1BB5C31600BE72C5 /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; }; + FAB5988F1BB5C31600BE72C5 /* SDL_uikitopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0F0E26E5D900F90B21 /* SDL_uikitopengles.m */; }; + FAB598911BB5C31600BE72C5 /* SDL_uikitopenglview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F170E26E5D900F90B21 /* SDL_uikitopenglview.m */; }; + FAB598931BB5C31600BE72C5 /* SDL_uikitvideo.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F110E26E5D900F90B21 /* SDL_uikitvideo.m */; }; + FAB598951BB5C31600BE72C5 /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F130E26E5D900F90B21 /* SDL_uikitview.m */; }; + FAB598971BB5C31600BE72C5 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; }; + FAB598991BB5C31600BE72C5 /* SDL_uikitwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F150E26E5D900F90B21 /* SDL_uikitwindow.m */; }; + FAB5989A1BB5C31600BE72C5 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; }; + FAB5989D1BB5C31600BE72C5 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; }; + FAB5989E1BB5C31600BE72C5 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; }; + FAB598A01BB5C31600BE72C5 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683000DF2374E00F98A1A /* SDL_blit.c */; }; + FAB598A21BB5C31600BE72C5 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683020DF2374E00F98A1A /* SDL_blit_0.c */; }; + FAB598A31BB5C31600BE72C5 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683030DF2374E00F98A1A /* SDL_blit_1.c */; }; + FAB598A41BB5C31600BE72C5 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683040DF2374E00F98A1A /* SDL_blit_A.c */; }; + FAB598A51BB5C31600BE72C5 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683050DF2374E00F98A1A /* SDL_blit_auto.c */; }; + FAB598A71BB5C31600BE72C5 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683070DF2374E00F98A1A /* SDL_blit_copy.c */; }; + FAB598A91BB5C31600BE72C5 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683090DF2374E00F98A1A /* SDL_blit_N.c */; }; + FAB598AA1BB5C31600BE72C5 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */; }; + FAB598AC1BB5C31600BE72C5 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */; }; + FAB598AD1BB5C31600BE72C5 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 044E5FB711E606EB0076F181 /* SDL_clipboard.c */; }; + FAB598AE1BB5C31600BE72C5 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */; }; + FAB598AF1BB5C31600BE72C5 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */; }; + FAB598B11BB5C31600BE72C5 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683110DF2374E00F98A1A /* SDL_rect.c */; }; + FAB598B21BB5C31600BE72C5 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */; }; + FAB598B41BB5C31600BE72C5 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683170DF2374E00F98A1A /* SDL_stretch.c */; }; + FAB598B51BB5C31600BE72C5 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; }; + FAB598B71BB5C31600BE72C5 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; }; + FAB598B91BB5C31600BE72C5 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */; }; + FAB598BC1BB5C31600BE72C5 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */; }; + FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5412FE1C3F004C9285 /* SDL_hints.c */; }; + FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC09B1300C1290055DE28 /* SDL_log.c */; }; + FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99B9D80DD52EDC00FB1D6B /* SDL.c */; }; + FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */; }; + FAFDF8C61D88D4530083E6F2 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; }; FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; }; FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; }; FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A720DEA620800C5B771 /* SDL_malloc.c */; }; @@ -227,28 +401,26 @@ 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = ""; }; 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = ""; }; 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = ""; }; - 04409BA212FA989600FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; }; - 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; }; 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; }; 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; }; 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render_sw_c.h; sourceTree = ""; }; 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_sw.c; sourceTree = ""; }; 0442EC5212FE1C28004C9285 /* SDL_render_gles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gles.c; sourceTree = ""; }; - 0442EC5412FE1C3F004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = ../../src/SDL_hints.c; sourceTree = SOURCE_ROOT; }; + 0442EC5412FE1C3F004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hints.c; sourceTree = ""; }; 044E5FB711E606EB0076F181 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = ""; }; 0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_slow.h; sourceTree = ""; }; 0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_fillrect.c; sourceTree = ""; }; 047677B80EA76A31008ABAF1 /* SDL_syshaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syshaptic.c; sourceTree = ""; }; - 047677B90EA76A31008ABAF1 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_haptic.c; path = ../../src/haptic/SDL_haptic.c; sourceTree = SOURCE_ROOT; }; - 047677BA0EA76A31008ABAF1 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syshaptic.h; path = ../../src/haptic/SDL_syshaptic.h; sourceTree = SOURCE_ROOT; }; + 047677B90EA76A31008ABAF1 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_haptic.c; sourceTree = ""; }; + 047677BA0EA76A31008ABAF1 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic.h; sourceTree = ""; }; 047AF1B20EA98D6C00811173 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; 04BA9D5F11EF474A00B60E01 /* SDL_gesture_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gesture_c.h; sourceTree = ""; }; 04BA9D6011EF474A00B60E01 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gesture.c; sourceTree = ""; }; 04BA9D6111EF474A00B60E01 /* SDL_touch_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_touch_c.h; sourceTree = ""; }; 04BA9D6211EF474A00B60E01 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_touch.c; sourceTree = ""; }; - 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; }; - 04BAC09B1300C1290055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; }; - 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; + 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_assert_c.h; sourceTree = ""; }; + 04BAC09B1300C1290055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_log.c; sourceTree = ""; }; + 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_assert.c; sourceTree = ""; }; 04F7806A12FB751400FC43C0 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; 04F7806B12FB751400FC43C0 /* SDL_blendfillrect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendfillrect.h; sourceTree = ""; }; 04F7806C12FB751400FC43C0 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = ""; }; @@ -264,24 +436,48 @@ 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullframebuffer.c; sourceTree = ""; }; 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = ""; }; 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; - 56A6702D18565E450007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = ""; }; - 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = ""; }; - 56A6703218565E760007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = ""; }; - 56A6703318565E760007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = ""; }; - 56A6703418565E760007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = ""; }; + 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmetalview.m; sourceTree = ""; }; + 4D7516F91EE1C28A00820EEA /* SDL_uikitvulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitvulkan.h; sourceTree = ""; }; + 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitvulkan.m; sourceTree = ""; }; + 4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan.h; sourceTree = ""; }; + 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmetalview.h; sourceTree = ""; }; + 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan_internal.h; sourceTree = ""; }; + 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_vulkan_utils.c; sourceTree = ""; }; + 55FFA9192122302B00D7CBED /* SDL_syspower.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syspower.h; sourceTree = ""; }; + 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dataqueue.c; sourceTree = ""; }; + 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = ""; }; + 56A6702D18565E450007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_internal.h; sourceTree = ""; }; + 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_overrides.h; sourceTree = ""; }; + 56A6703218565E760007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_procs.h; sourceTree = ""; }; + 56A6703318565E760007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dynapi.c; sourceTree = ""; }; + 56A6703418565E760007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi.h; sourceTree = ""; }; 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = ""; }; - 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; - 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_coreaudio.c; path = coreaudio/SDL_coreaudio.c; sourceTree = ""; }; - 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_coreaudio.h; path = coreaudio/SDL_coreaudio.h; sourceTree = ""; }; - 56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = ../../src/power/SDL_power.c; sourceTree = SOURCE_ROOT; }; - 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_syspower.m; path = ../../src/power/uikit/SDL_syspower.m; sourceTree = SOURCE_ROOT; }; + 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; + 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = ""; }; + 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = ""; }; + 56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = ""; }; + 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syspower.m; sourceTree = ""; }; 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitviewcontroller.h; sourceTree = ""; }; 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitviewcontroller.m; sourceTree = ""; }; + A704172D20F7E74800A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = ""; }; + A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_displayevents_c.h; sourceTree = ""; }; + A7C19D28212E552B00DF2152 /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_displayevents.c; sourceTree = ""; }; AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = ""; }; AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; AA0F8494178D5F1A00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = ""; }; AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmodes.h; sourceTree = ""; }; AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmodes.m; sourceTree = ""; }; + AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = ""; }; + AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = ""; }; + AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = ""; }; + AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_c.h; sourceTree = ""; }; + AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = ""; }; + AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = ""; }; + AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = ""; }; + AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_std_func.h; sourceTree = ""; }; + AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_sse_func.h; sourceTree = ""; }; + AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = ""; }; + AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = ""; }; AA628AD9159369E3005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = ""; }; AA628ADA159369E3005138DD /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = ""; }; AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = ""; }; @@ -340,6 +536,26 @@ AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmessagebox.h; sourceTree = ""; }; AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmessagebox.m; sourceTree = ""; }; AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; + AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_metal_ios.h; sourceTree = ""; }; + AADC5A621FDA10C800960936 /* SDL_render_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_render_metal.m; sourceTree = ""; }; + F30D9C98212CD0360047DF2E /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = ""; }; + F30D9C9B212CD0980047DF2E /* SDL_sensor_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor_c.h; sourceTree = ""; }; + F30D9C9C212CD0990047DF2E /* SDL_syssensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syssensor.h; sourceTree = ""; }; + F30D9C9D212CD0990047DF2E /* SDL_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sensor.c; sourceTree = ""; }; + F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coremotionsensor.m; sourceTree = ""; }; + F30D9CA4212CD0BF0047DF2E /* SDL_coremotionsensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coremotionsensor.h; sourceTree = ""; }; + F30D9CC5212CE92C0047DF2E /* hid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = hid.m; sourceTree = ""; }; + F36839CA214790950000F255 /* SDL_dummysensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummysensor.h; sourceTree = ""; }; + F36839CB214790950000F255 /* SDL_dummysensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummysensor.c; sourceTree = ""; }; + F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xbox360.c; sourceTree = ""; }; + F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_switch.c; sourceTree = ""; }; + F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xboxone.c; sourceTree = ""; }; + F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = ""; }; + F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = ""; }; + F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = ""; }; + FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitclipboard.h; sourceTree = ""; }; + FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = ""; }; + FAB598141BB5C1B100BE72C5 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = ""; }; FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = ""; }; FD3F4A700DEA620800C5B771 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = ""; }; @@ -372,7 +588,6 @@ FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = ""; }; FD99B9450DD52EDC00FB1D6B /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = ""; }; FD99B9460DD52EDC00FB1D6B /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = ""; }; - FD99B9490DD52EDC00FB1D6B /* SDL_audiomem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiomem.h; sourceTree = ""; }; FD99B94A0DD52EDC00FB1D6B /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = ""; }; FD99B94B0DD52EDC00FB1D6B /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = ""; }; FD99B9520DD52EDC00FB1D6B /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = ""; }; @@ -395,9 +610,9 @@ FD99B99B0DD52EDC00FB1D6B /* SDL_windowevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_windowevents.c; sourceTree = ""; }; FD99B99C0DD52EDC00FB1D6B /* SDL_windowevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_windowevents_c.h; sourceTree = ""; }; FD99B99E0DD52EDC00FB1D6B /* SDL_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rwops.c; sourceTree = ""; }; - FD99B9D40DD52EDC00FB1D6B /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = ../../src/SDL_error_c.h; sourceTree = ""; }; - FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = ../../src/SDL_error.c; sourceTree = ""; }; - FD99B9D80DD52EDC00FB1D6B /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = ""; }; + FD99B9D40DD52EDC00FB1D6B /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_error_c.h; sourceTree = ""; }; + FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_error.c; sourceTree = ""; }; + FD99B9D80DD52EDC00FB1D6B /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL.c; sourceTree = ""; }; FD99BA070DD52EDC00FB1D6B /* SDL_syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syscond.c; sourceTree = ""; }; FD99BA080DD52EDC00FB1D6B /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysmutex.c; sourceTree = ""; }; FD99BA090DD52EDC00FB1D6B /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysmutex_c.h; sourceTree = ""; }; @@ -461,19 +676,17 @@ 041B2CE312FA0F680087D585 /* render */ = { isa = PBXGroup; children = ( + AADC5A5C1FDA100800960936 /* metal */, 041B2CE812FA0F680087D585 /* opengles */, 0402A85412FE70C600CECEE3 /* opengles2 */, 041B2CEC12FA0F680087D585 /* software */, - 04409BA212FA989600FB9AA8 /* mmx.h */, 041B2CEA12FA0F680087D585 /* SDL_render.c */, 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */, - 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */, 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */, 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */, ); - name = render; - path = ../../src/render; - sourceTree = SOURCE_ROOT; + path = render; + sourceTree = ""; }; 041B2CE812FA0F680087D585 /* opengles */ = { isa = PBXGroup; @@ -512,7 +725,7 @@ 047677B90EA76A31008ABAF1 /* SDL_haptic.c */, 047677BA0EA76A31008ABAF1 /* SDL_syshaptic.h */, ); - name = haptic; + path = haptic; sourceTree = ""; }; 047677B70EA76A31008ABAF1 /* dummy */ = { @@ -520,9 +733,8 @@ children = ( 047677B80EA76A31008ABAF1 /* SDL_syshaptic.c */, ); - name = dummy; - path = ../../src/haptic/dummy; - sourceTree = SOURCE_ROOT; + path = dummy; + sourceTree = ""; }; 047AF1B10EA98D6C00811173 /* dummy */ = { isa = PBXGroup; @@ -538,14 +750,14 @@ 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */, 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */, ); - name = atomic; - path = ../../src/atomic; - sourceTree = SOURCE_ROOT; + path = atomic; + sourceTree = ""; }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( FD6526630DE8FCCB002AD96B /* libSDL2.a */, + FAB598141BB5C1B100BE72C5 /* libSDL2.a */, ); name = Products; sourceTree = ""; @@ -569,7 +781,7 @@ 56A6703318565E760007D20F /* SDL_dynapi.c */, 56A6703418565E760007D20F /* SDL_dynapi.h */, ); - name = dynapi; + path = dynapi; sourceTree = ""; }; 56C181E017C44D6900406AE3 /* filesystem */ = { @@ -577,16 +789,16 @@ children = ( 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */, ); - name = filesystem; + path = filesystem; sourceTree = ""; }; 56EA86F813E9EBF9002E47EB /* coreaudio */ = { isa = PBXGroup; children = ( - 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */, + 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */, 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */, ); - name = coreaudio; + path = coreaudio; sourceTree = ""; }; 56ED04DE118A8E9A00A56AA6 /* power */ = { @@ -595,15 +807,95 @@ 56ED04E0118A8EE200A56AA6 /* SDL_power.c */, 56ED04DF118A8EB700A56AA6 /* uikit */, ); - name = power; + path = power; sourceTree = ""; }; 56ED04DF118A8EB700A56AA6 /* uikit */ = { isa = PBXGroup; children = ( + 55FFA9192122302B00D7CBED /* SDL_syspower.h */, 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */, ); - name = uikit; + path = uikit; + sourceTree = ""; + }; + AA13B3521FB8B41700D9FEE6 /* yuv2rgb */ = { + isa = PBXGroup; + children = ( + AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */, + AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */, + AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */, + AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */, + ); + path = yuv2rgb; + sourceTree = ""; + }; + AADC5A5C1FDA100800960936 /* metal */ = { + isa = PBXGroup; + children = ( + AADC5A621FDA10C800960936 /* SDL_render_metal.m */, + AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */, + ); + path = metal; + sourceTree = ""; + }; + F30D9C9A212CD0590047DF2E /* sensor */ = { + isa = PBXGroup; + children = ( + F30D9CA2212CD09E0047DF2E /* coremotion */, + F36839C9214790740000F255 /* dummy */, + F30D9C9B212CD0980047DF2E /* SDL_sensor_c.h */, + F30D9C9D212CD0990047DF2E /* SDL_sensor.c */, + F30D9C9C212CD0990047DF2E /* SDL_syssensor.h */, + ); + path = sensor; + sourceTree = ""; + }; + F30D9CA2212CD09E0047DF2E /* coremotion */ = { + isa = PBXGroup; + children = ( + F30D9CA4212CD0BF0047DF2E /* SDL_coremotionsensor.h */, + F30D9CA3212CD0BF0047DF2E /* SDL_coremotionsensor.m */, + ); + path = coremotion; + sourceTree = ""; + }; + F35CEA6E20F51B7F003ECE98 /* hidapi */ = { + isa = PBXGroup; + children = ( + F3BDD77420F51C18004ECBF3 /* ios */, + ); + path = hidapi; + sourceTree = ""; + }; + F36839C9214790740000F255 /* dummy */ = { + isa = PBXGroup; + children = ( + F36839CB214790950000F255 /* SDL_dummysensor.c */, + F36839CA214790950000F255 /* SDL_dummysensor.h */, + ); + path = dummy; + sourceTree = ""; + }; + F3BDD77420F51C18004ECBF3 /* ios */ = { + isa = PBXGroup; + children = ( + F30D9CC5212CE92C0047DF2E /* hid.m */, + ); + path = ios; + sourceTree = ""; + }; + F3BDD78A20F51C8D004ECBF3 /* hidapi */ = { + isa = PBXGroup; + children = ( + F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */, + F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */, + F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */, + F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */, + F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */, + F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */, + ); + path = hidapi; sourceTree = ""; }; FD3F4A6F0DEA620800C5B771 /* stdlib */ = { @@ -616,22 +908,22 @@ FD3F4A740DEA620800C5B771 /* SDL_stdlib.c */, FD3F4A750DEA620800C5B771 /* SDL_string.c */, ); - name = stdlib; - path = ../../src/stdlib; - sourceTree = SOURCE_ROOT; + path = stdlib; + sourceTree = ""; }; FD5F9D080E0E08B3008E885B /* joystick */ = { isa = PBXGroup; children = ( + F3BDD78A20F51C8D004ECBF3 /* hidapi */, FD689EFF0E26E5B600F90B21 /* iphoneos */, + A704172D20F7E74800A82227 /* controller_type.h */, AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */, FD5F9D1E0E0E08B3008E885B /* SDL_joystick.c */, FD5F9D1F0E0E08B3008E885B /* SDL_joystick_c.h */, FD5F9D200E0E08B3008E885B /* SDL_sysjoystick.h */, ); - name = joystick; - path = ../../src/joystick; - sourceTree = SOURCE_ROOT; + path = joystick; + sourceTree = ""; }; FD689EFF0E26E5B600F90B21 /* iphoneos */ = { isa = PBXGroup; @@ -648,10 +940,14 @@ FDC261780E3A3FC8001C4554 /* keyinfotable.h */, FD689FCD0E26E9D400F90B21 /* SDL_uikitappdelegate.h */, FD689FCC0E26E9D400F90B21 /* SDL_uikitappdelegate.m */, + FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */, + FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */, FD689F0C0E26E5D900F90B21 /* SDL_uikitevents.h */, FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */, AABCC3921640643D00AB8930 /* SDL_uikitmessagebox.h */, AABCC3931640643D00AB8930 /* SDL_uikitmessagebox.m */, + 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */, + 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */, AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */, AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */, FD689F0E0E26E5D900F90B21 /* SDL_uikitopengles.h */, @@ -664,6 +960,8 @@ FD689F130E26E5D900F90B21 /* SDL_uikitview.m */, 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */, 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */, + 4D7516F91EE1C28A00820EEA /* SDL_uikitvulkan.h */, + 4D7516FA1EE1C28A00820EEA /* SDL_uikitvulkan.m */, FD689F140E26E5D900F90B21 /* SDL_uikitwindow.h */, FD689F150E26E5D900F90B21 /* SDL_uikitwindow.m */, ); @@ -676,9 +974,8 @@ 047AF1B10EA98D6C00811173 /* dummy */, FD8BD8180E27E25900B52CD5 /* dlopen */, ); - name = loadso; - path = ../../src/loadso; - sourceTree = SOURCE_ROOT; + path = loadso; + sourceTree = ""; }; FD8BD8180E27E25900B52CD5 /* dlopen */ = { isa = PBXGroup; @@ -734,6 +1031,7 @@ AA7558891595D55500BBD41B /* SDL_revision.h */, AA75588A1595D55500BBD41B /* SDL_rwops.h */, AA75588B1595D55500BBD41B /* SDL_scancode.h */, + F30D9C98212CD0360047DF2E /* SDL_sensor.h */, AA75588C1595D55500BBD41B /* SDL_shape.h */, AA75588D1595D55500BBD41B /* SDL_stdinc.h */, AA75588E1595D55500BBD41B /* SDL_surface.h */, @@ -745,6 +1043,7 @@ AA7558941595D55500BBD41B /* SDL_types.h */, AA7558951595D55500BBD41B /* SDL_version.h */, AA7558961595D55500BBD41B /* SDL_video.h */, + 4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */, ); name = "Public Headers"; path = ../../include; @@ -761,10 +1060,12 @@ FD99B99D0DD52EDC00FB1D6B /* file */, 56C181E017C44D6900406AE3 /* filesystem */, 047677B60EA769DF008ABAF1 /* haptic */, + F35CEA6E20F51B7F003ECE98 /* hidapi */, FD5F9D080E0E08B3008E885B /* joystick */, FD8BD8150E27E25900B52CD5 /* loadso */, 56ED04DE118A8E9A00A56AA6 /* power */, 041B2CE312FA0F680087D585 /* render */, + F30D9C9A212CD0590047DF2E /* sensor */, FD3F4A6F0DEA620800C5B771 /* stdlib */, FD99B9E00DD52EDC00FB1D6B /* thread */, FD99BA1E0DD52EDC00FB1D6B /* timer */, @@ -772,6 +1073,8 @@ 56A6702D18565E450007D20F /* SDL_internal.h */, 04F2AF551104ABD200D6DDF7 /* SDL_assert.c */, 04BAC09A1300C1290055DE28 /* SDL_assert_c.h */, + 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */, + 566726441DF72CF5001DD3DB /* SDL_dataqueue.h */, FD99B9D40DD52EDC00FB1D6B /* SDL_error_c.h */, FD99B9D50DD52EDC00FB1D6B /* SDL_error.c */, 0442EC5412FE1C3F004C9285 /* SDL_hints.c */, @@ -779,6 +1082,7 @@ FD99B9D80DD52EDC00FB1D6B /* SDL.c */, ); name = "Library Source"; + path = ../../src; sourceTree = ""; }; FD99B8FB0DD52EDC00FB1D6B /* audio */ = { @@ -789,15 +1093,13 @@ FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */, FD99B9450DD52EDC00FB1D6B /* SDL_audio_c.h */, FD99B9460DD52EDC00FB1D6B /* SDL_audiocvt.c */, - FD99B9490DD52EDC00FB1D6B /* SDL_audiomem.h */, FD99B94A0DD52EDC00FB1D6B /* SDL_audiotypecvt.c */, FD99B94B0DD52EDC00FB1D6B /* SDL_mixer.c */, FD99B9520DD52EDC00FB1D6B /* SDL_sysaudio.h */, FD99B9530DD52EDC00FB1D6B /* SDL_wave.c */, FD99B9540DD52EDC00FB1D6B /* SDL_wave.h */, ); - name = audio; - path = ../../src/audio; + path = audio; sourceTree = ""; }; FD99B91C0DD52EDC00FB1D6B /* dummy */ = { @@ -814,8 +1116,7 @@ children = ( FD99B98B0DD52EDC00FB1D6B /* SDL_cpuinfo.c */, ); - name = cpuinfo; - path = ../../src/cpuinfo; + path = cpuinfo; sourceTree = ""; }; FD99B98C0DD52EDC00FB1D6B /* events */ = { @@ -828,6 +1129,8 @@ FD99B9920DD52EDC00FB1D6B /* scancodes_xfree86.h */, 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */, 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */, + A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */, + A7C19D28212E552B00DF2152 /* SDL_displayevents.c */, AA704DD5162AA90A0076D1C1 /* SDL_dropevents.c */, AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */, FD99B9930DD52EDC00FB1D6B /* SDL_events.c */, @@ -845,8 +1148,7 @@ FD99B99B0DD52EDC00FB1D6B /* SDL_windowevents.c */, FD99B99C0DD52EDC00FB1D6B /* SDL_windowevents_c.h */, ); - name = events; - path = ../../src/events; + path = events; sourceTree = ""; }; FD99B99D0DD52EDC00FB1D6B /* file */ = { @@ -855,8 +1157,7 @@ 006E9885119552DD001DE610 /* cocoa */, FD99B99E0DD52EDC00FB1D6B /* SDL_rwops.c */, ); - name = file; - path = ../../src/file; + path = file; sourceTree = ""; }; FD99B9E00DD52EDC00FB1D6B /* thread */ = { @@ -867,8 +1168,7 @@ FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */, FD99BA160DD52EDC00FB1D6B /* SDL_thread_c.h */, ); - name = thread; - path = ../../src/thread; + path = thread; sourceTree = ""; }; FD99BA060DD52EDC00FB1D6B /* pthread */ = { @@ -892,8 +1192,7 @@ FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */, FD99BA2F0DD52EDC00FB1D6B /* SDL_timer_c.h */, ); - name = timer; - path = ../../src/timer; + path = timer; sourceTree = ""; }; FD99BA300DD52EDC00FB1D6B /* unix */ = { @@ -907,10 +1206,9 @@ FDA682420DF2374D00F98A1A /* video */ = { isa = PBXGroup; children = ( - FD689F090E26E5D900F90B21 /* uikit */, FDA685F40DF244C800F98A1A /* dummy */, - FDA683000DF2374E00F98A1A /* SDL_blit.c */, - FDA683010DF2374E00F98A1A /* SDL_blit.h */, + FD689F090E26E5D900F90B21 /* uikit */, + AA13B3521FB8B41700D9FEE6 /* yuv2rgb */, FDA683020DF2374E00F98A1A /* SDL_blit_0.c */, FDA683030DF2374E00F98A1A /* SDL_blit_1.c */, FDA683040DF2374E00F98A1A /* SDL_blit_A.c */, @@ -921,22 +1219,32 @@ FDA683090DF2374E00F98A1A /* SDL_blit_N.c */, FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */, 0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */, + FDA683000DF2374E00F98A1A /* SDL_blit.c */, + FDA683010DF2374E00F98A1A /* SDL_blit.h */, FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */, 044E5FB711E606EB0076F181 /* SDL_clipboard.c */, + AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */, + AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */, 0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */, - FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */, FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */, + FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */, + AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */, FDA683110DF2374E00F98A1A /* SDL_rect.c */, - FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */, FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */, + FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */, + AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */, + AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */, FDA683170DF2374E00F98A1A /* SDL_stretch.c */, FDA683190DF2374E00F98A1A /* SDL_surface.c */, FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */, FDA6831B0DF2374E00F98A1A /* SDL_video.c */, + 4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */, + 4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */, + AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */, + AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */, ); - name = video; - path = ../../src/video; - sourceTree = SOURCE_ROOT; + path = video; + sourceTree = ""; }; FDA685F40DF244C800F98A1A /* dummy */ = { isa = PBXGroup; @@ -959,6 +1267,8 @@ buildActionMask = 2147483647; files = ( FDA6844E0DF2374E00F98A1A /* SDL_blit.h in Headers */, + 4D75171A1EE1D32200820EEA /* SDL_uikitmetalview.h in Headers */, + 4D75171F1EE1D98200820EEA /* SDL_vulkan_internal.h in Headers */, FDA684530DF2374E00F98A1A /* SDL_blit_auto.h in Headers */, FDA684550DF2374E00F98A1A /* SDL_blit_copy.h in Headers */, FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */, @@ -977,23 +1287,29 @@ 56A6703818565E760007D20F /* SDL_dynapi.h in Headers */, FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */, 56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */, + AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */, 047677BD0EA76A31008ABAF1 /* SDL_syshaptic.h in Headers */, 046387420F0B5B7D0041FD65 /* SDL_blit_slow.h in Headers */, 006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */, + AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */, + AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */, 04BA9D6311EF474A00B60E01 /* SDL_gesture_c.h in Headers */, 04BA9D6511EF474A00B60E01 /* SDL_touch_c.h in Headers */, 041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */, - 04409BA612FA989600FB9AA8 /* mmx.h in Headers */, 04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */, + AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */, 04F7807712FB751400FC43C0 /* SDL_blendfillrect.h in Headers */, 04F7807912FB751400FC43C0 /* SDL_blendline.h in Headers */, + F3BDD79B20F51CB8004ECBF3 /* SDL_hidapijoystick_c.h in Headers */, 04F7807B12FB751400FC43C0 /* SDL_blendpoint.h in Headers */, 04F7807C12FB751400FC43C0 /* SDL_draw.h in Headers */, 04F7807E12FB751400FC43C0 /* SDL_drawline.h in Headers */, + AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */, 04F7808012FB751400FC43C0 /* SDL_drawpoint.h in Headers */, 04F7808412FB753F00FC43C0 /* SDL_nullframebuffer_c.h in Headers */, 0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */, + FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */, 0402A85A12FE70C600CECEE3 /* SDL_shaders_gles2.h in Headers */, 04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */, 56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */, @@ -1004,11 +1320,14 @@ AA75589A1595D55500BBD41B /* SDL_assert.h in Headers */, AA75589B1595D55500BBD41B /* SDL_atomic.h in Headers */, AA75589C1595D55500BBD41B /* SDL_audio.h in Headers */, + 55FFA91A2122302B00D7CBED /* SDL_syspower.h in Headers */, AA75589D1595D55500BBD41B /* SDL_blendmode.h in Headers */, + F30D9C9E212CD0990047DF2E /* SDL_sensor_c.h in Headers */, AA75589E1595D55500BBD41B /* SDL_clipboard.h in Headers */, AA75589F1595D55500BBD41B /* SDL_config_iphoneos.h in Headers */, AA7558A01595D55500BBD41B /* SDL_config.h in Headers */, AA7558A11595D55500BBD41B /* SDL_copying.h in Headers */, + AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */, AA7558A21595D55500BBD41B /* SDL_cpuinfo.h in Headers */, AA7558A31595D55500BBD41B /* SDL_endian.h in Headers */, AA7558A41595D55500BBD41B /* SDL_error.h in Headers */, @@ -1017,17 +1336,24 @@ AA7558A61595D55500BBD41B /* SDL_gesture.h in Headers */, AA7558A71595D55500BBD41B /* SDL_haptic.h in Headers */, AA7558A81595D55500BBD41B /* SDL_hints.h in Headers */, + 566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */, + F30D9C9F212CD0990047DF2E /* SDL_syssensor.h in Headers */, AA7558AA1595D55500BBD41B /* SDL_joystick.h in Headers */, + AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */, AA7558AB1595D55500BBD41B /* SDL_keyboard.h in Headers */, + A704172E20F7E74800A82227 /* controller_type.h in Headers */, AA7558AC1595D55500BBD41B /* SDL_keycode.h in Headers */, AA7558AD1595D55500BBD41B /* SDL_loadso.h in Headers */, AA7558AE1595D55500BBD41B /* SDL_log.h in Headers */, + F30D9CA7212CD0BF0047DF2E /* SDL_coremotionsensor.h in Headers */, AA7558AF1595D55500BBD41B /* SDL_main.h in Headers */, AA7558B01595D55500BBD41B /* SDL_mouse.h in Headers */, + A7C19D29212E552C00DF2152 /* SDL_displayevents_c.h in Headers */, AA7558B11595D55500BBD41B /* SDL_mutex.h in Headers */, AA7558B21595D55500BBD41B /* SDL_name.h in Headers */, AA7558B31595D55500BBD41B /* SDL_opengl.h in Headers */, AA7558B41595D55500BBD41B /* SDL_opengles.h in Headers */, + AADC5A631FDA10C800960936 /* SDL_shaders_metal_ios.h in Headers */, AA7558B51595D55500BBD41B /* SDL_opengles2.h in Headers */, AA7558B61595D55500BBD41B /* SDL_pixels.h in Headers */, AA7558B71595D55500BBD41B /* SDL_platform.h in Headers */, @@ -1043,19 +1369,23 @@ FAD4F7021BA3C4E8008346CE /* SDL_sysjoystick_c.h in Headers */, AA7558C11595D55500BBD41B /* SDL_surface.h in Headers */, AA7558C21595D55500BBD41B /* SDL_system.h in Headers */, + F30D9C99212CD0360047DF2E /* SDL_sensor.h in Headers */, AA7558C31595D55500BBD41B /* SDL_syswm.h in Headers */, AA7558C41595D55500BBD41B /* SDL_thread.h in Headers */, AA7558C51595D55500BBD41B /* SDL_timer.h in Headers */, AA7558C61595D55500BBD41B /* SDL_touch.h in Headers */, AA7558C71595D55500BBD41B /* SDL_types.h in Headers */, AA7558C81595D55500BBD41B /* SDL_version.h in Headers */, + 4D7516FF1EE1C5B400820EEA /* SDL_vulkan.h in Headers */, AA7558C91595D55500BBD41B /* SDL_video.h in Headers */, AA7558CA1595D55500BBD41B /* SDL.h in Headers */, + 4D7516FC1EE1C28A00820EEA /* SDL_uikitvulkan.h in Headers */, AA126AD41617C5E7005ABC8F /* SDL_uikitmodes.h in Headers */, AA704DD6162AA90A0076D1C1 /* SDL_dropevents_c.h in Headers */, AA9FF9511637C6E5000DF050 /* SDL_messagebox.h in Headers */, AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */, AA0AD06516647BD400CE5896 /* SDL_gamecontroller.h in Headers */, + F36839CC214790950000F255 /* SDL_dummysensor.h in Headers */, AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */, 56C181DF17C44D5E00406AE3 /* SDL_filesystem.h in Headers */, ); @@ -1064,9 +1394,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - FD6526620DE8FCCB002AD96B /* libSDL */ = { + FAB598131BB5C1B100BE72C5 /* libSDL-tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = FD6526990DE8FD14002AD96B /* Build configuration list for PBXNativeTarget "libSDL" */; + buildConfigurationList = FAB5981A1BB5C1B100BE72C5 /* Build configuration list for PBXNativeTarget "libSDL-tvOS" */; + buildPhases = ( + FAB598101BB5C1B100BE72C5 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "libSDL-tvOS"; + productName = "libSDL-tvOS"; + productReference = FAB598141BB5C1B100BE72C5 /* libSDL2.a */; + productType = "com.apple.product-type.library.static"; + }; + FD6526620DE8FCCB002AD96B /* libSDL-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = FD6526990DE8FD14002AD96B /* Build configuration list for PBXNativeTarget "libSDL-iOS" */; buildPhases = ( FD65265F0DE8FCCB002AD96B /* Headers */, FD6526600DE8FCCB002AD96B /* Sources */, @@ -1075,7 +1420,7 @@ ); dependencies = ( ); - name = libSDL; + name = "libSDL-iOS"; productName = iPhoneSDLStaticLib; productReference = FD6526630DE8FCCB002AD96B /* libSDL2.a */; productType = "com.apple.product-type.library.static"; @@ -1086,7 +1431,19 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0630; + LastUpgradeCheck = 0900; + TargetAttributes = { + 00B4F48B12F6A69C0084EC00 = { + DevelopmentTeam = UZ5V327NE3; + }; + FAB598131BB5C1B100BE72C5 = { + CreatedOnToolsVersion = 7.1; + DevelopmentTeam = UZ5V327NE3; + }; + FD6526620DE8FCCB002AD96B = { + DevelopmentTeam = UZ5V327NE3; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDL" */; compatibilityVersion = "Xcode 3.2"; @@ -1102,8 +1459,11 @@ projectDirPath = ""; projectRoot = ../..; targets = ( - FD6526620DE8FCCB002AD96B /* libSDL */, + FD6526620DE8FCCB002AD96B /* libSDL-iOS */, + FAB598131BB5C1B100BE72C5 /* libSDL-tvOS */, 00B4F48B12F6A69C0084EC00 /* PrepareXcodeProjectTemplate */, + C143576D1F4C4DAA000B792B /* All-iOS */, + C14357721F4C4F2A000B792B /* All-tvOS */, ); }; /* End PBXProject section */ @@ -1123,15 +1483,164 @@ shellPath = /bin/sh; shellScript = "# clean up the framework, remove headers, extra files\n\ntemp=$BUILD_DIR/$BUILD_STYLE-template\n# Wrong! 1. Can't assume location of Xcode directory (use xcode-select)\n# 2. Project templates should go in Application Support directories anyway.\ntemplate_dir_name=\"SDL iOS Application\"\n# dest=\"$(HOME)/Library/Application Support/Developer/Shared/Xcode/Project Templates/SDL/SDL iOS Application\"\nrsync_flags=\"--exclude *.svn --links -r\"\n\n# mkdir -p $dest\nmkdir -p $temp\nmkdir -p \"$temp/$template_dir_name/SDL/lib/\"\nmkdir -p \"$temp/$template_dir_name/SDL/include\"\n\n# copy template\nrsync $rsync_flags \"../template/$template_dir_name\" $temp/\n\n# copy Universal libSDL.a\nrsync $rsync_flags -r $SYMROOT/$CONFIGURATION-Universal/libSDL.a \"$temp/$template_dir_name/SDL/lib/\"\n\n# copy headers\nrsync $rsync_flags ../../include/ \"$temp/$template_dir_name/SDL/include\"\n\n#install (nah, don't install)\n# cp -fr \"$temp/$template_dir_name\" \"$dest\""; }; + C14357711F4C4DB2000B792B /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + output/iOS/debug/libSDL2.a, + output/iOS/release/libSDL2.a, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "TARGET=libSDL-iOS\nOUTPUT=libSDL2.a\n\nxcodebuild -target \"$TARGET\" -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" -configuration Release -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" ONLY_ACTIVE_ARCH=NO -configuration Debug -sdk iphoneos BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" ONLY_ACTIVE_ARCH=NO -configuration Release -sdk iphoneos BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\n\n# make output folders\nmkdir -p output/iOS/debug\nmkdir -p output/iOS/release\n\n# combine lib files for various platforms into one\necho \"Creating output/iOS/debug/$OUTPUT\"\nlipo -create \"${TARGET_BUILD_DIR}/../Debug-iphoneos/$OUTPUT\" \"${TARGET_BUILD_DIR}/../Debug-iphonesimulator/$OUTPUT\" -output \"output/iOS/debug/$OUTPUT\"\necho \"Creating output/iOS/release/$OUTPUT\"\nlipo -create \"${TARGET_BUILD_DIR}/../Release-iphoneos/$OUTPUT\" \"${TARGET_BUILD_DIR}/../Release-iphonesimulator/$OUTPUT\" -output \"output/iOS/release/$OUTPUT\"\n"; + }; + C14357731F4C4F2A000B792B /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + output/tvOS/debug/libSDL2.a, + output/tvOS/release/libSDL2.a, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "TARGET=libSDL-tvOS\nOUTPUT=libSDL2.a\n\nxcodebuild -target \"$TARGET\" -configuration Debug -sdk appletvsimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" -configuration Release -sdk appletvsimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" ONLY_ACTIVE_ARCH=NO -configuration Debug -sdk appletvos BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\nxcodebuild -target \"$TARGET\" ONLY_ACTIVE_ARCH=NO -configuration Release -sdk appletvos BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" clean build\n\n# make output folders\nmkdir -p output/tvOS/debug\nmkdir -p output/tvOS/release\n\n# combine lib files for various platforms into one\necho \"Creating output/tvOS/debug/$OUTPUT\"\nlipo -create \"${TARGET_BUILD_DIR}/../Debug-appletvos/$OUTPUT\" \"${TARGET_BUILD_DIR}/../Debug-appletvsimulator/$OUTPUT\" -output \"output/tvOS/debug/$OUTPUT\"\necho \"Creating output/tvOS/release/$OUTPUT\"\nlipo -create \"${TARGET_BUILD_DIR}/../Release-appletvos/$OUTPUT\" \"${TARGET_BUILD_DIR}/../Release-appletvsimulator/$OUTPUT\" -output \"output/tvOS/release/$OUTPUT\"\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + FAB598101BB5C1B100BE72C5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FAB5981D1BB5C31500BE72C5 /* SDL_atomic.c in Sources */, + FAB5981E1BB5C31500BE72C5 /* SDL_spinlock.c in Sources */, + FAB5981F1BB5C31500BE72C5 /* SDL_coreaudio.m in Sources */, + FAB598211BB5C31500BE72C5 /* SDL_dummyaudio.c in Sources */, + FAB598231BB5C31500BE72C5 /* SDL_audio.c in Sources */, + FAB598251BB5C31500BE72C5 /* SDL_audiocvt.c in Sources */, + FAB598271BB5C31500BE72C5 /* SDL_audiotypecvt.c in Sources */, + FAB598281BB5C31500BE72C5 /* SDL_mixer.c in Sources */, + F3BDD79720F51CB8004ECBF3 /* SDL_hidapi_xboxone.c in Sources */, + FAB5982A1BB5C31500BE72C5 /* SDL_wave.c in Sources */, + FAFDF8C61D88D4530083E6F2 /* SDL_uikitclipboard.m in Sources */, + FAB5982C1BB5C31500BE72C5 /* SDL_cpuinfo.c in Sources */, + FAB5982F1BB5C31500BE72C5 /* SDL_dynapi.c in Sources */, + FAB598361BB5C31500BE72C5 /* SDL_clipboardevents.c in Sources */, + FAB598381BB5C31500BE72C5 /* SDL_dropevents.c in Sources */, + FAB5983A1BB5C31500BE72C5 /* SDL_events.c in Sources */, + A7F629241FE06523002F9CC9 /* SDL_uikitmetalview.m in Sources */, + FAB5983C1BB5C31500BE72C5 /* SDL_gesture.c in Sources */, + FAB5983E1BB5C31500BE72C5 /* SDL_keyboard.c in Sources */, + F3BDD79520F51CB8004ECBF3 /* SDL_hidapi_switch.c in Sources */, + FAB598401BB5C31500BE72C5 /* SDL_mouse.c in Sources */, + A704172F20F7E76000A82227 /* SDL_gamecontroller.c in Sources */, + FAB598421BB5C31500BE72C5 /* SDL_quit.c in Sources */, + FAB598441BB5C31500BE72C5 /* SDL_touch.c in Sources */, + FAB598461BB5C31500BE72C5 /* SDL_windowevents.c in Sources */, + F30D9CC7212CE92C0047DF2E /* hid.m in Sources */, + FAB598491BB5C31600BE72C5 /* SDL_rwopsbundlesupport.m in Sources */, + FAB5984A1BB5C31600BE72C5 /* SDL_rwops.c in Sources */, + FAB5984B1BB5C31600BE72C5 /* SDL_sysfilesystem.m in Sources */, + AADC5A5D1FDA104400960936 /* yuv_rgb.c in Sources */, + FAB5984C1BB5C31600BE72C5 /* SDL_syshaptic.c in Sources */, + AADC5A5F1FDA105600960936 /* SDL_vulkan_utils.c in Sources */, + AADC5A5E1FDA105300960936 /* SDL_yuv.c in Sources */, + FAB5984D1BB5C31600BE72C5 /* SDL_haptic.c in Sources */, + F3BDD79320F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */, + FAB598501BB5C31600BE72C5 /* SDL_sysjoystick.m in Sources */, + FAB598521BB5C31600BE72C5 /* SDL_joystick.c in Sources */, + FAB598551BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */, + AADC5A651FDA10CB00960936 /* SDL_render_metal.m in Sources */, + FAB598561BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */, + FAB598571BB5C31600BE72C5 /* SDL_power.c in Sources */, + F30D9CA1212CD0990047DF2E /* SDL_sensor.c in Sources */, + FAB598581BB5C31600BE72C5 /* SDL_syspower.m in Sources */, + 56F9D5601DF73BA400C15B5D /* SDL_dataqueue.c in Sources */, + FAB598591BB5C31600BE72C5 /* SDL_render_gles.c in Sources */, + F30D9CA6212CD0BF0047DF2E /* SDL_coremotionsensor.m in Sources */, + FAB5985A1BB5C31600BE72C5 /* SDL_render_gles2.c in Sources */, + FAB5985B1BB5C31600BE72C5 /* SDL_shaders_gles2.c in Sources */, + FAB5985D1BB5C31600BE72C5 /* SDL_blendfillrect.c in Sources */, + FAB5985F1BB5C31600BE72C5 /* SDL_blendline.c in Sources */, + FAB598611BB5C31600BE72C5 /* SDL_blendpoint.c in Sources */, + FAB598641BB5C31600BE72C5 /* SDL_drawline.c in Sources */, + FAB598661BB5C31600BE72C5 /* SDL_drawpoint.c in Sources */, + FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */, + FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */, + FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */, + FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */, + FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */, + FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */, + FAB598741BB5C31600BE72C5 /* SDL_malloc.c in Sources */, + FAB598751BB5C31600BE72C5 /* SDL_qsort.c in Sources */, + F36839CE214790950000F255 /* SDL_dummysensor.c in Sources */, + A7C19D2B212E552C00DF2152 /* SDL_displayevents.c in Sources */, + FAB598761BB5C31600BE72C5 /* SDL_stdlib.c in Sources */, + FAB598771BB5C31600BE72C5 /* SDL_string.c in Sources */, + FAB598781BB5C31600BE72C5 /* SDL_syscond.c in Sources */, + F3BDD79D20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */, + AADC5A601FDA10A400960936 /* SDL_uikitvulkan.m in Sources */, + FAB598791BB5C31600BE72C5 /* SDL_sysmutex.c in Sources */, + FAB5987B1BB5C31600BE72C5 /* SDL_syssem.c in Sources */, + FAB5987C1BB5C31600BE72C5 /* SDL_systhread.c in Sources */, + FAB5987E1BB5C31600BE72C5 /* SDL_systls.c in Sources */, + FAB598801BB5C31600BE72C5 /* SDL_thread.c in Sources */, + FAB598821BB5C31600BE72C5 /* SDL_systimer.c in Sources */, + FAB598831BB5C31600BE72C5 /* SDL_timer.c in Sources */, + FAB598871BB5C31600BE72C5 /* SDL_uikitappdelegate.m in Sources */, + F3BDD79920F51CB8004ECBF3 /* SDL_hidapi_ps4.c in Sources */, + FAB598891BB5C31600BE72C5 /* SDL_uikitevents.m in Sources */, + FAB5988B1BB5C31600BE72C5 /* SDL_uikitmessagebox.m in Sources */, + FAB5988D1BB5C31600BE72C5 /* SDL_uikitmodes.m in Sources */, + FAB5988F1BB5C31600BE72C5 /* SDL_uikitopengles.m in Sources */, + FAB598911BB5C31600BE72C5 /* SDL_uikitopenglview.m in Sources */, + FAB598931BB5C31600BE72C5 /* SDL_uikitvideo.m in Sources */, + FAB598951BB5C31600BE72C5 /* SDL_uikitview.m in Sources */, + FAB598971BB5C31600BE72C5 /* SDL_uikitviewcontroller.m in Sources */, + FAB598991BB5C31600BE72C5 /* SDL_uikitwindow.m in Sources */, + FAB5989A1BB5C31600BE72C5 /* SDL_nullevents.c in Sources */, + FAB5989D1BB5C31600BE72C5 /* SDL_nullframebuffer.c in Sources */, + FAB5989E1BB5C31600BE72C5 /* SDL_nullvideo.c in Sources */, + FAB598A01BB5C31600BE72C5 /* SDL_blit.c in Sources */, + FAB598A21BB5C31600BE72C5 /* SDL_blit_0.c in Sources */, + FAB598A31BB5C31600BE72C5 /* SDL_blit_1.c in Sources */, + FAB598A41BB5C31600BE72C5 /* SDL_blit_A.c in Sources */, + FAB598A51BB5C31600BE72C5 /* SDL_blit_auto.c in Sources */, + FAB598A71BB5C31600BE72C5 /* SDL_blit_copy.c in Sources */, + FAB598A91BB5C31600BE72C5 /* SDL_blit_N.c in Sources */, + FAB598AA1BB5C31600BE72C5 /* SDL_blit_slow.c in Sources */, + FAB598AC1BB5C31600BE72C5 /* SDL_bmp.c in Sources */, + FAB598AD1BB5C31600BE72C5 /* SDL_clipboard.c in Sources */, + FAB598AE1BB5C31600BE72C5 /* SDL_fillrect.c in Sources */, + FAB598AF1BB5C31600BE72C5 /* SDL_pixels.c in Sources */, + FAB598B11BB5C31600BE72C5 /* SDL_rect.c in Sources */, + FAB598B21BB5C31600BE72C5 /* SDL_RLEaccel.c in Sources */, + FAB598B41BB5C31600BE72C5 /* SDL_stretch.c in Sources */, + FAB598B51BB5C31600BE72C5 /* SDL_surface.c in Sources */, + FAB598B71BB5C31600BE72C5 /* SDL_video.c in Sources */, + FAB598B91BB5C31600BE72C5 /* SDL_assert.c in Sources */, + FAB598BC1BB5C31600BE72C5 /* SDL_error.c in Sources */, + FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */, + FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */, + FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FD6526600DE8FCCB002AD96B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( FD6526810DE8FCDD002AD96B /* SDL_systimer.c in Sources */, FD6526800DE8FCDD002AD96B /* SDL_timer.c in Sources */, + F30D9CA5212CD0BF0047DF2E /* SDL_coremotionsensor.m in Sources */, FD3F4A7B0DEA620800C5B771 /* SDL_string.c in Sources */, FD6526660DE8FCDD002AD96B /* SDL_dummyaudio.c in Sources */, FD6526670DE8FCDD002AD96B /* SDL_audio.c in Sources */, @@ -1139,6 +1648,8 @@ FD65266A0DE8FCDD002AD96B /* SDL_audiotypecvt.c in Sources */, FD65266B0DE8FCDD002AD96B /* SDL_mixer.c in Sources */, FD65266F0DE8FCDD002AD96B /* SDL_wave.c in Sources */, + 4D7516FD1EE1C28A00820EEA /* SDL_uikitvulkan.m in Sources */, + FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */, FD6526700DE8FCDD002AD96B /* SDL_cpuinfo.c in Sources */, FD6526710DE8FCDD002AD96B /* SDL_events.c in Sources */, FD6526720DE8FCDD002AD96B /* SDL_keyboard.c in Sources */, @@ -1146,10 +1657,14 @@ FD6526730DE8FCDD002AD96B /* SDL_mouse.c in Sources */, FD6526740DE8FCDD002AD96B /* SDL_quit.c in Sources */, FD6526750DE8FCDD002AD96B /* SDL_windowevents.c in Sources */, + 4D7516FB1EE1C28A00820EEA /* SDL_uikitmetalview.m in Sources */, FD6526760DE8FCDD002AD96B /* SDL_rwops.c in Sources */, + F30D9CC6212CE92C0047DF2E /* hid.m in Sources */, + 4D7517201EE1D98200820EEA /* SDL_vulkan_utils.c in Sources */, FD6526780DE8FCDD002AD96B /* SDL_error.c in Sources */, FD65267A0DE8FCDD002AD96B /* SDL.c in Sources */, FD65267B0DE8FCDD002AD96B /* SDL_syscond.c in Sources */, + AADC5A641FDA10C800960936 /* SDL_render_metal.m in Sources */, FD65267C0DE8FCDD002AD96B /* SDL_sysmutex.c in Sources */, FD65267D0DE8FCDD002AD96B /* SDL_syssem.c in Sources */, FD65267E0DE8FCDD002AD96B /* SDL_systhread.c in Sources */, @@ -1157,11 +1672,15 @@ FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */, FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */, FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */, + F3BDD79220F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */, FD3F4A790DEA620800C5B771 /* SDL_qsort.c in Sources */, + F3BDD79820F51CB8004ECBF3 /* SDL_hidapi_ps4.c in Sources */, FD3F4A7A0DEA620800C5B771 /* SDL_stdlib.c in Sources */, FDA6844D0DF2374E00F98A1A /* SDL_blit.c in Sources */, FDA6844F0DF2374E00F98A1A /* SDL_blit_0.c in Sources */, + AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */, FDA684500DF2374E00F98A1A /* SDL_blit_1.c in Sources */, + 566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */, FDA684510DF2374E00F98A1A /* SDL_blit_A.c in Sources */, FDA684520DF2374E00F98A1A /* SDL_blit_auto.c in Sources */, FDA684540DF2374E00F98A1A /* SDL_blit_copy.c in Sources */, @@ -1172,6 +1691,7 @@ FDA6845E0DF2374E00F98A1A /* SDL_rect.c in Sources */, FDA684620DF2374E00F98A1A /* SDL_RLEaccel.c in Sources */, FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */, + AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */, FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */, FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */, FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */, @@ -1179,18 +1699,22 @@ FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */, FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */, FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */, + AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */, FD689F1F0E26E5D900F90B21 /* SDL_uikitopengles.m in Sources */, FD689F210E26E5D900F90B21 /* SDL_uikitvideo.m in Sources */, FD689F230E26E5D900F90B21 /* SDL_uikitview.m in Sources */, + A7C19D2A212E552C00DF2152 /* SDL_displayevents.c in Sources */, FD689F250E26E5D900F90B21 /* SDL_uikitwindow.m in Sources */, FD689F270E26E5D900F90B21 /* SDL_uikitopenglview.m in Sources */, FD689FCE0E26E9D400F90B21 /* SDL_uikitappdelegate.m in Sources */, FD8BD8250E27E25900B52CD5 /* SDL_sysloadso.c in Sources */, + F3BDD79C20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */, 047677BB0EA76A31008ABAF1 /* SDL_syshaptic.c in Sources */, 047677BC0EA76A31008ABAF1 /* SDL_haptic.c in Sources */, 047AF1B30EA98D6C00811173 /* SDL_sysloadso.c in Sources */, 046387460F0B5B7D0041FD65 /* SDL_fillrect.c in Sources */, 04F2AF561104ABD200D6DDF7 /* SDL_assert.c in Sources */, + F3BDD79620F51CB8004ECBF3 /* SDL_hidapi_xboxone.c in Sources */, 56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */, 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */, 006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */, @@ -1201,7 +1725,6 @@ 04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */, 04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */, 041B2CF112FA0F680087D585 /* SDL_render.c in Sources */, - 04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */, 04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */, 04F7807612FB751400FC43C0 /* SDL_blendfillrect.c in Sources */, 04F7807812FB751400FC43C0 /* SDL_blendline.c in Sources */, @@ -1212,10 +1735,14 @@ 0442EC5112FE1C1E004C9285 /* SDL_render_sw.c in Sources */, 0442EC5312FE1C28004C9285 /* SDL_render_gles.c in Sources */, 0442EC5512FE1C3F004C9285 /* SDL_hints.c in Sources */, + AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */, 0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */, + F36839CD214790950000F255 /* SDL_dummysensor.c in Sources */, 0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */, 04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */, - 56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */, + 56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.m in Sources */, + F30D9CA0212CD0990047DF2E /* SDL_sensor.c in Sources */, + F3BDD79420F51CB8004ECBF3 /* SDL_hidapi_switch.c in Sources */, 93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */, AA628ADB159369E3005138DD /* SDL_rotate.c in Sources */, AA126AD51617C5E7005ABC8F /* SDL_uikitmodes.m in Sources */, @@ -1253,32 +1780,200 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Release; + }; + C143576F1F4C4DAB000B792B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + C14357701F4C4DAB000B792B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + C14357751F4C4F2A000B792B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_BITCODE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + C14357761F4C4F2A000B792B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_BITCODE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + FAB5981B1BB5C1B100BE72C5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = SDL2; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + }; + name = Debug; + }; + FAB5981C1BB5C1B100BE72C5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = SDL2; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + VALIDATE_PRODUCT = YES; }; name = Release; }; FD6526640DE8FCCB002AD96B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; @@ -1286,6 +1981,7 @@ GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; }; @@ -1294,6 +1990,7 @@ FD6526650DE8FCCB002AD96B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; @@ -1301,6 +1998,7 @@ GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; + HEADER_SEARCH_PATHS = "$(VULKAN_SDK)/include"; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; }; @@ -1327,7 +2025,34 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - FD6526990DE8FD14002AD96B /* Build configuration list for PBXNativeTarget "libSDL" */ = { + C143576E1F4C4DAB000B792B /* Build configuration list for PBXAggregateTarget "All-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C143576F1F4C4DAB000B792B /* Debug */, + C14357701F4C4DAB000B792B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C14357741F4C4F2A000B792B /* Build configuration list for PBXAggregateTarget "All-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C14357751F4C4F2A000B792B /* Debug */, + C14357761F4C4F2A000B792B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FAB5981A1BB5C1B100BE72C5 /* Build configuration list for PBXNativeTarget "libSDL-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FAB5981B1BB5C1B100BE72C5 /* Debug */, + FAB5981C1BB5C1B100BE72C5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FD6526990DE8FD14002AD96B /* Build configuration list for PBXNativeTarget "libSDL-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( FD6526640DE8FCCB002AD96B /* Debug */, diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj similarity index 57% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj index adc3151925..8a6ef37c5a 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj @@ -21,24 +21,55 @@ AA1EE46D176059AB0029C7A5 /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */; }; AA1EE46E176059AB0029C7A5 /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */; }; AA1EE46F176059AB0029C7A5 /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE461176059AB0029C7A5 /* SDL_test_random.c */; }; + AAF030011F9009B100B9A9FB /* SDL_test_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */; }; + AAF030021F9009B100B9A9FB /* SDL_test_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = AAF030001F9009B100B9A9FB /* SDL_test_assert.c */; }; + FA3D99011BC4E5BC002C96C8 /* SDL_test_common.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE454176059AB0029C7A5 /* SDL_test_common.c */; }; + FA3D99021BC4E5BC002C96C8 /* SDL_test_compare.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */; }; + FA3D99031BC4E5BC002C96C8 /* SDL_test_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */; }; + FA3D99041BC4E5BC002C96C8 /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE457176059AB0029C7A5 /* SDL_test_font.c */; }; + FA3D99051BC4E5BC002C96C8 /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */; }; + FA3D99061BC4E5BC002C96C8 /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */; }; + FA3D99071BC4E5BC002C96C8 /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */; }; + FA3D99081BC4E5BC002C96C8 /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */; }; + FA3D99091BC4E5BC002C96C8 /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */; }; + FA3D990A1BC4E5BC002C96C8 /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */; }; + FA3D990B1BC4E5BC002C96C8 /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */; }; + FA3D990C1BC4E5BC002C96C8 /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */; }; + FA3D990D1BC4E5BC002C96C8 /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */; }; + FA3D990E1BC4E5BC002C96C8 /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1EE461176059AB0029C7A5 /* SDL_test_random.c */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + FA3D98F61BC4E5A2002C96C8 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ AA1EE4461760589B0029C7A5 /* libSDL2test.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2test.a; sourceTree = BUILT_PRODUCTS_DIR; }; - AA1EE454176059AB0029C7A5 /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_common.c; path = ../../src/test/SDL_test_common.c; sourceTree = ""; }; - AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_compare.c; path = ../../src/test/SDL_test_compare.c; sourceTree = ""; }; - AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_crc32.c; path = ../../src/test/SDL_test_crc32.c; sourceTree = ""; }; - AA1EE457176059AB0029C7A5 /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_font.c; path = ../../src/test/SDL_test_font.c; sourceTree = ""; }; - AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_fuzzer.c; path = ../../src/test/SDL_test_fuzzer.c; sourceTree = ""; }; - AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_harness.c; path = ../../src/test/SDL_test_harness.c; sourceTree = ""; }; - AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlit.c; path = ../../src/test/SDL_test_imageBlit.c; sourceTree = ""; }; - AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlitBlend.c; path = ../../src/test/SDL_test_imageBlitBlend.c; sourceTree = ""; }; - AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageFace.c; path = ../../src/test/SDL_test_imageFace.c; sourceTree = ""; }; - AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitives.c; path = ../../src/test/SDL_test_imagePrimitives.c; sourceTree = ""; }; - AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitivesBlend.c; path = ../../src/test/SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; - AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_log.c; path = ../../src/test/SDL_test_log.c; sourceTree = ""; }; - AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_md5.c; path = ../../src/test/SDL_test_md5.c; sourceTree = ""; }; - AA1EE461176059AB0029C7A5 /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_random.c; path = ../../src/test/SDL_test_random.c; sourceTree = ""; }; + AA1EE454176059AB0029C7A5 /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_common.c; sourceTree = ""; }; + AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_compare.c; sourceTree = ""; }; + AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_crc32.c; sourceTree = ""; }; + AA1EE457176059AB0029C7A5 /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_font.c; sourceTree = ""; }; + AA1EE458176059AB0029C7A5 /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_fuzzer.c; sourceTree = ""; }; + AA1EE459176059AB0029C7A5 /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_harness.c; sourceTree = ""; }; + AA1EE45A176059AB0029C7A5 /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlit.c; sourceTree = ""; }; + AA1EE45B176059AB0029C7A5 /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlitBlend.c; sourceTree = ""; }; + AA1EE45C176059AB0029C7A5 /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageFace.c; sourceTree = ""; }; + AA1EE45D176059AB0029C7A5 /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitives.c; sourceTree = ""; }; + AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; + AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_log.c; sourceTree = ""; }; + AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_md5.c; sourceTree = ""; }; + AA1EE461176059AB0029C7A5 /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_random.c; sourceTree = ""; }; + AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_memory.c; sourceTree = ""; }; + AAF030001F9009B100B9A9FB /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_assert.c; sourceTree = ""; }; + FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSDL2test-TV.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,6 +80,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA3D98F51BC4E5A2002C96C8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -64,6 +102,7 @@ isa = PBXGroup; children = ( AA1EE4461760589B0029C7A5 /* libSDL2test.a */, + FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */, ); name = Products; sourceTree = ""; @@ -71,6 +110,7 @@ AA1EE453176059770029C7A5 /* Library Source */ = { isa = PBXGroup; children = ( + AAF030001F9009B100B9A9FB /* SDL_test_assert.c */, AA1EE454176059AB0029C7A5 /* SDL_test_common.c */, AA1EE455176059AB0029C7A5 /* SDL_test_compare.c */, AA1EE456176059AB0029C7A5 /* SDL_test_crc32.c */, @@ -84,9 +124,11 @@ AA1EE45E176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c */, AA1EE45F176059AB0029C7A5 /* SDL_test_log.c */, AA1EE460176059AB0029C7A5 /* SDL_test_md5.c */, + AAF02FFF1F9009B100B9A9FB /* SDL_test_memory.c */, AA1EE461176059AB0029C7A5 /* SDL_test_random.c */, ); name = "Library Source"; + path = ../../src/test; sourceTree = ""; }; /* End PBXGroup section */ @@ -119,6 +161,23 @@ productReference = AA1EE4461760589B0029C7A5 /* libSDL2test.a */; productType = "com.apple.product-type.library.static"; }; + FA3D98F71BC4E5A2002C96C8 /* SDL2test-TV */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA3D99001BC4E5A3002C96C8 /* Build configuration list for PBXNativeTarget "SDL2test-TV" */; + buildPhases = ( + FA3D98F41BC4E5A2002C96C8 /* Sources */, + FA3D98F51BC4E5A2002C96C8 /* Frameworks */, + FA3D98F61BC4E5A2002C96C8 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SDL2test-TV"; + productName = "SDL2test-TV"; + productReference = FA3D98F81BC4E5A2002C96C8 /* libSDL2test-TV.a */; + productType = "com.apple.product-type.library.static"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -127,6 +186,11 @@ attributes = { LastUpgradeCheck = 0460; ORGANIZATIONNAME = "Sam Lantinga"; + TargetAttributes = { + FA3D98F71BC4E5A2002C96C8 = { + CreatedOnToolsVersion = 7.1; + }; + }; }; buildConfigurationList = AA1EE4411760589B0029C7A5 /* Build configuration list for PBXProject "SDL2test" */; compatibilityVersion = "Xcode 3.2"; @@ -141,6 +205,7 @@ projectRoot = ""; targets = ( AA1EE4451760589B0029C7A5 /* SDL2test */, + FA3D98F71BC4E5A2002C96C8 /* SDL2test-TV */, ); }; /* End PBXProject section */ @@ -155,18 +220,41 @@ AA1EE464176059AB0029C7A5 /* SDL_test_crc32.c in Sources */, AA1EE465176059AB0029C7A5 /* SDL_test_font.c in Sources */, AA1EE466176059AB0029C7A5 /* SDL_test_fuzzer.c in Sources */, + AAF030021F9009B100B9A9FB /* SDL_test_assert.c in Sources */, AA1EE467176059AB0029C7A5 /* SDL_test_harness.c in Sources */, AA1EE468176059AB0029C7A5 /* SDL_test_imageBlit.c in Sources */, AA1EE469176059AB0029C7A5 /* SDL_test_imageBlitBlend.c in Sources */, AA1EE46A176059AB0029C7A5 /* SDL_test_imageFace.c in Sources */, AA1EE46B176059AB0029C7A5 /* SDL_test_imagePrimitives.c in Sources */, AA1EE46C176059AB0029C7A5 /* SDL_test_imagePrimitivesBlend.c in Sources */, + AAF030011F9009B100B9A9FB /* SDL_test_memory.c in Sources */, AA1EE46D176059AB0029C7A5 /* SDL_test_log.c in Sources */, AA1EE46E176059AB0029C7A5 /* SDL_test_md5.c in Sources */, AA1EE46F176059AB0029C7A5 /* SDL_test_random.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; + FA3D98F41BC4E5A2002C96C8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA3D99011BC4E5BC002C96C8 /* SDL_test_common.c in Sources */, + FA3D99021BC4E5BC002C96C8 /* SDL_test_compare.c in Sources */, + FA3D99031BC4E5BC002C96C8 /* SDL_test_crc32.c in Sources */, + FA3D99041BC4E5BC002C96C8 /* SDL_test_font.c in Sources */, + FA3D99051BC4E5BC002C96C8 /* SDL_test_fuzzer.c in Sources */, + FA3D99061BC4E5BC002C96C8 /* SDL_test_harness.c in Sources */, + FA3D99071BC4E5BC002C96C8 /* SDL_test_imageBlit.c in Sources */, + FA3D99081BC4E5BC002C96C8 /* SDL_test_imageBlitBlend.c in Sources */, + FA3D99091BC4E5BC002C96C8 /* SDL_test_imageFace.c in Sources */, + FA3D990A1BC4E5BC002C96C8 /* SDL_test_imagePrimitives.c in Sources */, + FA3D990B1BC4E5BC002C96C8 /* SDL_test_imagePrimitivesBlend.c in Sources */, + FA3D990C1BC4E5BC002C96C8 /* SDL_test_log.c in Sources */, + FA3D990D1BC4E5BC002C96C8 /* SDL_test_md5.c in Sources */, + FA3D990E1BC4E5BC002C96C8 /* SDL_test_random.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -195,6 +283,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../../include; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -220,6 +309,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../../include; MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = iphoneos; }; @@ -229,7 +319,7 @@ isa = XCBuildConfiguration; buildSettings = { EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ../../include; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -238,11 +328,64 @@ isa = XCBuildConfiguration; buildSettings = { EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ../../include; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; + FA3D98FE1BC4E5A3002C96C8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + FA3D98FF1BC4E5A3002C96C8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + COPY_PHASE_STRIP = NO; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -264,6 +407,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FA3D99001BC4E5A3002C96C8 /* Build configuration list for PBXNativeTarget "SDL2test-TV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA3D98FE1BC4E5A3002C96C8 /* Debug */, + FA3D98FF1BC4E5A3002C96C8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = AA1EE43E1760589B0029C7A5 /* Project object */; diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Default.png b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Default.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Default.png rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Default.png diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Icon.png b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Icon.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Icon.png rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Icon.png diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Info.plist b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Info.plist similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/Info.plist rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/Info.plist diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/main.c b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/main.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/main.c rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/main.c index 8dc00706f3..52fd9a49a9 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Template/SDL iOS Application/main.c +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Template/SDL iOS Application/main.c @@ -5,6 +5,8 @@ */ #include "SDL.h" +#include +#include #include #define SCREEN_WIDTH 320 @@ -20,6 +22,7 @@ void render(SDL_Renderer *renderer) { + SDL_Rect rect; Uint8 r, g, b; /* Clear the screen */ @@ -27,7 +30,6 @@ render(SDL_Renderer *renderer) SDL_RenderClear(renderer); /* Come up with a random rectangle */ - SDL_Rect rect; rect.w = randomInt(64, 128); rect.h = randomInt(64, 128); rect.x = randomInt(0, SCREEN_WIDTH); diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/Info.plist b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/Info.plist similarity index 94% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Test/Info.plist rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Test/Info.plist index c0f1179d35..cd3c096dab 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/Info.plist +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/Info.plist @@ -22,7 +22,5 @@ ???? CFBundleVersion 1.0 - NSMainNibFile - diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/README b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/README similarity index 63% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Test/README rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Test/README index b16ff7c0f9..b8d9ed3b41 100644 --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/README +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/README @@ -1,22 +1,11 @@ TestiPhoneOS.xcodeproj contains targets to compile many of the SDL test programs for iPhone OS. Most of these test programs work fine, with the following exceptions: -testalpha: - Program crashes. Problem appears to effect Mac OS X as well. - testthread: SIGTERM kills the process immediately without executing the 'kill' function. The posix standard says this shouldn't happen. Apple seems intent on having iPhone apps exit promptly when the user requests it, so maybe that's why(?) testlock: Locks appear to work, but there doesn't appear to be a simple way to send the process SIGINT. -testpalette: - "SDL error: blitting boat: Blit combination not supported." Happens on Mac OS X as well. - testsprite2: SDL_CreateTextureFromSurface requests an ARGB pixel format, but iPhone's SDL video driver only supports ABGR. -testwin: - Behaves as it does under Mac OS X ... not sure if that is correctly or not. - -threadwin: - Works if -threaded is not on. Otherwise it doesn't work, but this is true under Mac OS X as well. diff --git a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 77% rename from 3rdparty/sdl2-2.0.4/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj index 6b13cad139..978833d0ea --- a/3rdparty/sdl2-2.0.4/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj @@ -36,6 +36,22 @@ 56ED0508118A8FE400A56AA6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; 56ED0509118A8FE400A56AA6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; 56ED0511118A904200A56AA6 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED0510118A904200A56AA6 /* testpower.c */; }; + AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; + AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; + AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; + AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; + AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; + AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; + AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; }; + AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; }; + AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; + AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; + AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; + AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; }; + AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; }; + AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */; }; + AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */; }; AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; @@ -43,6 +59,9 @@ AA1EE47617605B9E0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; AA1EE47717605BAB0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; AA1EE47817605BF60029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; }; + AA2F57AA1FDB544800832AD7 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + AA2F57AB1FDB5A0900832AD7 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; + AA2F57AC1FDB5AB600832AD7 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2F57A91FDB544800832AD7 /* Metal.framework */; }; AAE7DEDC14CBB1E100DF1A0E /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; }; AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; AAE7DEE214CBB1E100DF1A0E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; @@ -65,7 +84,19 @@ AAE7DFAC14CBB54E00DF1A0E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; AAE7DFAD14CBB54E00DF1A0E /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; AAE7DFB514CBB5F700DF1A0E /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */; }; - FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; settings = {ASSET_TAGS = (); }; }; + FA0EF22E1BAF4654000E07A6 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A74E0E2D0F1600EA573E /* testjoystick.c */; }; + FA3D99481BC4E6AD002C96C8 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; + FA3D994A1BC4E6AD002C96C8 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; + FA3D994B1BC4E6AD002C96C8 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; + FA3D994C1BC4E6AD002C96C8 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; }; + FA3D994D1BC4E6AD002C96C8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; }; + FA3D994E1BC4E6AD002C96C8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; + FA3D994F1BC4E6AD002C96C8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; + FA3D99501BC4E6AD002C96C8 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; + FA3D99521BC4E70C002C96C8 /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */; }; + FA3D99531BC4E70E002C96C8 /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2281BAF4487000E07A6 /* axis.bmp */; }; + FA3D99541BC4E70F002C96C8 /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2291BAF4487000E07A6 /* button.bmp */; }; + FA3D99551BC4E712002C96C8 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; }; FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; @@ -112,6 +143,58 @@ FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; FA8B4BE0196766F400F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; + FAA8CEE41BDF06D600D3BD45 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA3D992B1BC4E619002C96C8 /* libSDL2.a */; }; + FABA34771D8B4EAD00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34831D8B575200915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34841D8B575200915323 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; + FABA34851D8B575200915323 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; + FABA34861D8B575200915323 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; + FABA34871D8B575200915323 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; + FABA34881D8B575200915323 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; + FABA34891D8B575200915323 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; }; + FABA348A1D8B575200915323 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; }; + FABA348B1D8B575200915323 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; + FABA348C1D8B575200915323 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; + FABA348D1D8B575200915323 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; + FABA34941D8B578200915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; + FABA34951D8B578600915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; + FABA34981D8B582100915323 /* sample.wav in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAE20E2D33C600EA573E /* sample.wav */; }; + FABA349A1D8B582100915323 /* loopwave.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A78B0E2D0F3D00EA573E /* loopwave.c */; }; + FABA349C1D8B582100915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA349D1D8B582100915323 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; + FABA349E1D8B582100915323 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; + FABA349F1D8B582100915323 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; }; + FABA34A01D8B582100915323 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; + FABA34A11D8B582100915323 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; + FABA34A21D8B582100915323 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; }; + FABA34A31D8B582100915323 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; }; + FABA34A41D8B582100915323 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; + FABA34A51D8B582100915323 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; + FABA34A61D8B582100915323 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; + FABA34AE1D8B58B200915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34AF1D8B59F800915323 /* testaudiocapture.c in Sources */ = {isa = PBXBuildFile; fileRef = FABA34931D8B578200915323 /* testaudiocapture.c */; }; + FABA34B01D8B5B6400915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B11D8B5B6C00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B21D8B5B7300915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B31D8B5B7800915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B41D8B5B7C00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B51D8B5B8400915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B61D8B5B8900915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B71D8B5B8D00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B81D8B5B9200915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34B91D8B5B9600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BA1D8B5B9B00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BB1D8B5BA100915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BC1D8B5BA600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BD1D8B5BAB00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BE1D8B5BB000915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34BF1D8B5BB500915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C01D8B5BBA00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C11D8B5BBE00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C21D8B5BC200915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C31D8B5BC600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C41D8B5BCB00915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; + FABA34C51D8B5BD000915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; }; FAE0E9821BAF9B230098DFA4 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; }; FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; }; FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; }; @@ -123,10 +206,10 @@ FAE0E98D1BAF9B230098DFA4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; }; FAE0E98E1BAF9B230098DFA4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; FAE0E98F1BAF9B230098DFA4 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; - FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */; settings = {ASSET_TAGS = (); }; }; - FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */; settings = {ASSET_TAGS = (); }; }; - FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2291BAF4487000E07A6 /* button.bmp */; settings = {ASSET_TAGS = (); }; }; - FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2281BAF4487000E07A6 /* axis.bmp */; settings = {ASSET_TAGS = (); }; }; + FAE0E9951BAF9B510098DFA4 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */; }; + FAE0E9961BAF9B650098DFA4 /* controllermap.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */; }; + FAE0E9971BAF9B6A0098DFA4 /* button.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2291BAF4487000E07A6 /* button.bmp */; }; + FAE0E9981BAF9B6E0098DFA4 /* axis.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FA0EF2281BAF4487000E07A6 /* axis.bmp */; }; FDA8A79C0E2D0F9300EA573E /* testwm2.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA8A75F0E2D0F1600EA573E /* testwm2.c */; }; FDA8A89F0E2D111A00EA573E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; FDA8A8A00E2D111A00EA573E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; }; @@ -304,6 +387,27 @@ remoteGlobalIDString = AA1EE4461760589B0029C7A5; remoteInfo = SDL2test; }; + FA3D992A1BC4E619002C96C8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FAB598141BB5C1B100BE72C5; + remoteInfo = "libSDL-tv"; + }; + FA3D992E1BC4E619002C96C8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AA1EE44D176059220029C7A5 /* SDL2test.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA3D98F81BC4E5A2002C96C8; + remoteInfo = "SDL2test-TV"; + }; + FAA8CEE51BDF06DC00D3BD45 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FAB598131BB5C1B100BE72C5; + remoteInfo = "libSDL-tv"; + }; FD1B48B70E3131CA007AB34E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */; @@ -315,42 +419,52 @@ /* Begin PBXFileReference section */ 046CEF8613254F23007AD51D /* testgesture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgesture.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 046CEF8913254F63007AD51D /* testgesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = SOURCE_ROOT; }; + 046CEF8913254F63007AD51D /* testgesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgesture.c; sourceTree = ""; }; 047A63ED13285C3200CD7973 /* checkkeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = checkkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 047A63F013285CD100CD7973 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; }; + 047A63F013285CD100CD7973 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = checkkeys.c; sourceTree = ""; }; 1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; + 56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testpower.c; sourceTree = ""; }; + AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testyuv.app; sourceTree = BUILT_PRODUCTS_DIR; }; + AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = testyuv.bmp; sourceTree = ""; }; + AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testyuv.c; sourceTree = ""; }; + AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testyuv_cvt.c; sourceTree = ""; }; AA1EE44D176059220029C7A5 /* SDL2test.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL2test.xcodeproj; path = ../SDLtest/SDL2test.xcodeproj; sourceTree = ""; }; + AA2F57A91FDB544800832AD7 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; AAE7DEEC14CBB1E100DF1A0E /* testscale.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testscale.app; sourceTree = BUILT_PRODUCTS_DIR; }; - AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = ""; }; + AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testscale.c; sourceTree = ""; }; AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; }; - AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = ""; }; - FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = ""; }; - FA0EF2281BAF4487000E07A6 /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = ""; }; - FA0EF2291BAF4487000E07A6 /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = ""; }; - FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = ""; }; + AAE7DFB414CBB5F700DF1A0E /* testrendertarget.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testrendertarget.c; sourceTree = ""; }; + FA0EF2221BAF43DE000E07A6 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamecontroller.c; sourceTree = ""; }; + FA0EF2281BAF4487000E07A6 /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = axis.bmp; sourceTree = ""; }; + FA0EF2291BAF4487000E07A6 /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = ""; }; + FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap.bmp; sourceTree = ""; }; + FA3D99341BC4E644002C96C8 /* testgamecontroller-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "testgamecontroller-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; }; FA684F7A1BAF1A4400DCFD1A /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + FABA34761D8B4EAD00915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + FABA34911D8B575200915323 /* testaudiocapture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testaudiocapture.app; sourceTree = BUILT_PRODUCTS_DIR; }; + FABA34931D8B578200915323 /* testaudiocapture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testaudiocapture.c; sourceTree = ""; }; + FABA34AA1D8B582100915323 /* loopwav-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "loopwav-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; }; FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; }; FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; - FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; }; - FDA8A7470E2D0F1600EA573E /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; }; - FDA8A7480E2D0F1600EA573E /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testfile.c; path = ../../test/testfile.c; sourceTree = SOURCE_ROOT; }; - FDA8A74C0E2D0F1600EA573E /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testthread.c; path = ../../test/testthread.c; sourceTree = SOURCE_ROOT; }; - FDA8A74D0E2D0F1600EA573E /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testiconv.c; path = ../../test/testiconv.c; sourceTree = SOURCE_ROOT; }; - FDA8A74E0E2D0F1600EA573E /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testjoystick.c; path = ../../test/testjoystick.c; sourceTree = SOURCE_ROOT; }; - FDA8A74F0E2D0F1600EA573E /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testkeys.c; path = ../../test/testkeys.c; sourceTree = SOURCE_ROOT; }; - FDA8A7510E2D0F1600EA573E /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testlock.c; path = ../../test/testlock.c; sourceTree = SOURCE_ROOT; }; - FDA8A7540E2D0F1600EA573E /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testoverlay2.c; path = ../../test/testoverlay2.c; sourceTree = SOURCE_ROOT; }; - FDA8A7560E2D0F1600EA573E /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testplatform.c; path = ../../test/testplatform.c; sourceTree = SOURCE_ROOT; }; - FDA8A7570E2D0F1600EA573E /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsem.c; path = ../../test/testsem.c; sourceTree = SOURCE_ROOT; }; - FDA8A7590E2D0F1600EA573E /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsprite2.c; path = ../../test/testsprite2.c; sourceTree = SOURCE_ROOT; }; - FDA8A75A0E2D0F1600EA573E /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testtimer.c; path = ../../test/testtimer.c; sourceTree = SOURCE_ROOT; }; - FDA8A75B0E2D0F1600EA573E /* testver.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testver.c; path = ../../test/testver.c; sourceTree = SOURCE_ROOT; }; - FDA8A75F0E2D0F1600EA573E /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testwm2.c; path = ../../test/testwm2.c; sourceTree = SOURCE_ROOT; }; - FDA8A7610E2D0F1600EA573E /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = torturethread.c; path = ../../test/torturethread.c; sourceTree = SOURCE_ROOT; }; - FDA8A78B0E2D0F3D00EA573E /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; }; + FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testaudioinfo.c; sourceTree = ""; }; + FDA8A7470E2D0F1600EA573E /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testerror.c; sourceTree = ""; }; + FDA8A7480E2D0F1600EA573E /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testfile.c; sourceTree = ""; }; + FDA8A74C0E2D0F1600EA573E /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testthread.c; sourceTree = ""; }; + FDA8A74D0E2D0F1600EA573E /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testiconv.c; sourceTree = ""; }; + FDA8A74E0E2D0F1600EA573E /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testjoystick.c; sourceTree = ""; }; + FDA8A74F0E2D0F1600EA573E /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testkeys.c; sourceTree = ""; }; + FDA8A7510E2D0F1600EA573E /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testlock.c; sourceTree = ""; }; + FDA8A7540E2D0F1600EA573E /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testoverlay2.c; sourceTree = ""; }; + FDA8A7560E2D0F1600EA573E /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testplatform.c; sourceTree = ""; }; + FDA8A7570E2D0F1600EA573E /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testsem.c; sourceTree = ""; }; + FDA8A7590E2D0F1600EA573E /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testsprite2.c; sourceTree = ""; }; + FDA8A75A0E2D0F1600EA573E /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testtimer.c; sourceTree = ""; }; + FDA8A75B0E2D0F1600EA573E /* testver.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testver.c; sourceTree = ""; }; + FDA8A75F0E2D0F1600EA573E /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testwm2.c; sourceTree = ""; }; + FDA8A7610E2D0F1600EA573E /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = torturethread.c; sourceTree = ""; }; + FDA8A78B0E2D0F3D00EA573E /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loopwave.c; sourceTree = ""; }; FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; FDA8A8990E2D111A00EA573E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; @@ -359,21 +473,21 @@ FDA8A89D0E2D111A00EA573E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; FDA8AABB0E2D330F00EA573E /* loopwav.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = loopwav.app; sourceTree = BUILT_PRODUCTS_DIR; }; - FDA8AAD90E2D33B000EA573E /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = ../../test/icon.bmp; sourceTree = SOURCE_ROOT; }; - FDA8AADA0E2D33BA00EA573E /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = moose.dat; path = ../../test/moose.dat; sourceTree = SOURCE_ROOT; }; - FDA8AADB0E2D33BA00EA573E /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = picture.xbm; path = ../../test/picture.xbm; sourceTree = SOURCE_ROOT; }; - FDA8AADE0E2D33C100EA573E /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = sample.bmp; path = ../../test/sample.bmp; sourceTree = SOURCE_ROOT; }; - FDA8AAE20E2D33C600EA573E /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = sample.wav; path = ../../test/sample.wav; sourceTree = SOURCE_ROOT; }; + FDA8AAD90E2D33B000EA573E /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = icon.bmp; sourceTree = ""; }; + FDA8AADA0E2D33BA00EA573E /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; path = moose.dat; sourceTree = ""; }; + FDA8AADB0E2D33BA00EA573E /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = picture.xbm; sourceTree = ""; }; + FDA8AADE0E2D33C100EA573E /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = sample.bmp; sourceTree = ""; }; + FDA8AAE20E2D33C600EA573E /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = sample.wav; sourceTree = ""; }; FDAAC3CD0E2D47E6001DB1D8 /* testaudioinfo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testaudioinfo.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDAAC59B0E2D5429001DB1D8 /* testerror.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testerror.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDAAC5C90E2D55B5001DB1D8 /* testfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDAAC6260E2D5914001DB1D8 /* testgles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgles.app; sourceTree = BUILT_PRODUCTS_DIR; }; - FDAAC6290E2D5960001DB1D8 /* testgles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgles.c; path = ../../test/testgles.c; sourceTree = SOURCE_ROOT; }; + FDAAC6290E2D5960001DB1D8 /* testgles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgles.c; sourceTree = ""; }; FDC430000F0D866D009C87E1 /* torturethread.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = torturethread.app; sourceTree = BUILT_PRODUCTS_DIR; }; - FDC430090F0D86BF009C87E1 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdraw2.c; path = ../../test/testdraw2.c; sourceTree = SOURCE_ROOT; }; + FDC430090F0D86BF009C87E1 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testdraw2.c; sourceTree = ""; }; FDD2C10A0E2E4F4B00B7A85F /* testthread.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testthread.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDD2C1810E2E52C000B7A85F /* testiconv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testiconv.app; sourceTree = BUILT_PRODUCTS_DIR; }; - FDD2C18A0E2E52FE00B7A85F /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = utf8.txt; path = ../../test/utf8.txt; sourceTree = SOURCE_ROOT; }; + FDD2C18A0E2E52FE00B7A85F /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = utf8.txt; sourceTree = ""; }; FDD2C1A50E2E534F00B7A85F /* testjoystick.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testjoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDD2C45E0E2E773800B7A85F /* testkeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDD2C47C0E2E77D700B7A85F /* testlock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testlock.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -390,6 +504,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B51D8B5B8400915323 /* AVFoundation.framework in Frameworks */, 046CEF7B13254F23007AD51D /* libSDL2.a in Frameworks */, FA684F841BAF1A5C00DCFD1A /* GameController.framework in Frameworks */, FA8B4BD1196766C900F8EB7C /* CoreMotion.framework in Frameworks */, @@ -407,6 +522,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B01D8B5B6400915323 /* AVFoundation.framework in Frameworks */, AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */, 047A63E213285C3200CD7973 /* libSDL2.a in Frameworks */, FA684F7B1BAF1A4400DCFD1A /* GameController.framework in Frameworks */, @@ -425,6 +541,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34C41D8B5BCB00915323 /* AVFoundation.framework in Frameworks */, AA1EE47817605BF60029C7A5 /* libSDL2test.a in Frameworks */, FDBDE5810E313465006BAC0B /* libSDL2.a in Frameworks */, FA684F931BAF1A8A00DCFD1A /* GameController.framework in Frameworks */, @@ -443,6 +560,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34BC1D8B5BA600915323 /* AVFoundation.framework in Frameworks */, 56ED0502118A8FE400A56AA6 /* libSDL2.a in Frameworks */, FA684F8B1BAF1A7100DCFD1A /* GameController.framework in Frameworks */, FA8B4BD8196766DD00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -456,10 +574,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AA13B3161FB8AEBC00D9FEE6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */, + AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */, + AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */, + AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */, + AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */, + AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */, + AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */, + AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */, + AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */, + AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */, + AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */, + AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; AAE7DEE014CBB1E100DF1A0E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34BE1D8B5BB000915323 /* AVFoundation.framework in Frameworks */, AA1EE47617605B9E0029C7A5 /* libSDL2test.a in Frameworks */, AAE7DEE114CBB1E100DF1A0E /* libSDL2.a in Frameworks */, FA684F8D1BAF1A7800DCFD1A /* GameController.framework in Frameworks */, @@ -478,6 +616,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + AA2F57AA1FDB544800832AD7 /* Metal.framework in Frameworks */, + FABA34BD1D8B5BAB00915323 /* AVFoundation.framework in Frameworks */, AA1EE47517605B930029C7A5 /* libSDL2test.a in Frameworks */, AAE7DFA614CBB54E00DF1A0E /* libSDL2.a in Frameworks */, FA684F8C1BAF1A7400DCFD1A /* GameController.framework in Frameworks */, @@ -492,10 +632,63 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA3D99311BC4E644002C96C8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FAA8CEE41BDF06D600D3BD45 /* libSDL2.a in Frameworks */, + FA3D99481BC4E6AD002C96C8 /* GameController.framework in Frameworks */, + FA3D994A1BC4E6AD002C96C8 /* AudioToolbox.framework in Frameworks */, + FA3D994B1BC4E6AD002C96C8 /* QuartzCore.framework in Frameworks */, + FA3D994C1BC4E6AD002C96C8 /* OpenGLES.framework in Frameworks */, + FA3D994D1BC4E6AD002C96C8 /* CoreGraphics.framework in Frameworks */, + FA3D994E1BC4E6AD002C96C8 /* UIKit.framework in Frameworks */, + FA3D994F1BC4E6AD002C96C8 /* Foundation.framework in Frameworks */, + FA3D99501BC4E6AD002C96C8 /* CoreAudio.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA34821D8B575200915323 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA34831D8B575200915323 /* AVFoundation.framework in Frameworks */, + FABA34841D8B575200915323 /* libSDL2.a in Frameworks */, + FABA34851D8B575200915323 /* GameController.framework in Frameworks */, + FABA34861D8B575200915323 /* CoreMotion.framework in Frameworks */, + FABA34871D8B575200915323 /* AudioToolbox.framework in Frameworks */, + FABA34881D8B575200915323 /* QuartzCore.framework in Frameworks */, + FABA34891D8B575200915323 /* OpenGLES.framework in Frameworks */, + FABA348A1D8B575200915323 /* CoreGraphics.framework in Frameworks */, + FABA348B1D8B575200915323 /* UIKit.framework in Frameworks */, + FABA348C1D8B575200915323 /* Foundation.framework in Frameworks */, + FABA348D1D8B575200915323 /* CoreAudio.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA349B1D8B582100915323 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA349C1D8B582100915323 /* AVFoundation.framework in Frameworks */, + FABA349D1D8B582100915323 /* libSDL2.a in Frameworks */, + FABA349E1D8B582100915323 /* GameController.framework in Frameworks */, + FABA349F1D8B582100915323 /* CoreMotion.framework in Frameworks */, + FABA34A01D8B582100915323 /* AudioToolbox.framework in Frameworks */, + FABA34A11D8B582100915323 /* QuartzCore.framework in Frameworks */, + FABA34A21D8B582100915323 /* OpenGLES.framework in Frameworks */, + FABA34A31D8B582100915323 /* CoreGraphics.framework in Frameworks */, + FABA34A41D8B582100915323 /* UIKit.framework in Frameworks */, + FABA34A51D8B582100915323 /* Foundation.framework in Frameworks */, + FABA34A61D8B582100915323 /* CoreAudio.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FAE0E9851BAF9B230098DFA4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34AE1D8B58B200915323 /* AVFoundation.framework in Frameworks */, FAE0E9861BAF9B230098DFA4 /* libSDL2.a in Frameworks */, FAE0E9871BAF9B230098DFA4 /* GameController.framework in Frameworks */, FAE0E9881BAF9B230098DFA4 /* CoreMotion.framework in Frameworks */, @@ -513,6 +706,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34771D8B4EAD00915323 /* AVFoundation.framework in Frameworks */, FDBDE5850E313495006BAC0B /* libSDL2.a in Frameworks */, FA684F7F1BAF1A4D00DCFD1A /* GameController.framework in Frameworks */, FA8B4BC9196766BC00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -530,6 +724,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B11D8B5B6C00915323 /* AVFoundation.framework in Frameworks */, FDBDE58C0E3134F3006BAC0B /* libSDL2.a in Frameworks */, FA684F801BAF1A5000DCFD1A /* GameController.framework in Frameworks */, FA8B4BCD196766BF00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -547,6 +742,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B31D8B5B7800915323 /* AVFoundation.framework in Frameworks */, FDBDE59B0E31356A006BAC0B /* libSDL2.a in Frameworks */, FA684F821BAF1A5700DCFD1A /* GameController.framework in Frameworks */, FA8B4BCF196766C400F8EB7C /* CoreMotion.framework in Frameworks */, @@ -564,6 +760,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B41D8B5B7C00915323 /* AVFoundation.framework in Frameworks */, FDBDE59F0E31358D006BAC0B /* libSDL2.a in Frameworks */, FA684F831BAF1A5A00DCFD1A /* GameController.framework in Frameworks */, FA8B4BD0196766C600F8EB7C /* CoreMotion.framework in Frameworks */, @@ -581,6 +778,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B61D8B5B8900915323 /* AVFoundation.framework in Frameworks */, AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */, FDBDE57C0E313445006BAC0B /* libSDL2.a in Frameworks */, FA684F851BAF1A6000DCFD1A /* GameController.framework in Frameworks */, @@ -599,6 +797,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + AA2F57AB1FDB5A0900832AD7 /* Metal.framework in Frameworks */, + FABA34B21D8B5B7300915323 /* AVFoundation.framework in Frameworks */, AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */, FDC42FF40F0D866D009C87E1 /* libSDL2.a in Frameworks */, FA684F811BAF1A5300DCFD1A /* GameController.framework in Frameworks */, @@ -617,6 +817,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34C11D8B5BBE00915323 /* AVFoundation.framework in Frameworks */, FDBDE5A90E3135C0006BAC0B /* libSDL2.a in Frameworks */, FA684F901BAF1A8100DCFD1A /* GameController.framework in Frameworks */, FA8B4BDD196766EB00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -634,6 +835,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B71D8B5B8D00915323 /* AVFoundation.framework in Frameworks */, FDBDE5AE0E3135E6006BAC0B /* libSDL2.a in Frameworks */, FA684F861BAF1A6200DCFD1A /* GameController.framework in Frameworks */, FA8B4BD3196766CE00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -651,6 +853,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B81D8B5B9200915323 /* AVFoundation.framework in Frameworks */, FDBDE5B60E3135FE006BAC0B /* libSDL2.a in Frameworks */, FA684F871BAF1A6500DCFD1A /* GameController.framework in Frameworks */, FA8B4BD4196766D100F8EB7C /* CoreMotion.framework in Frameworks */, @@ -668,6 +871,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34B91D8B5B9600915323 /* AVFoundation.framework in Frameworks */, FDBDE5BC0E31364D006BAC0B /* libSDL2.a in Frameworks */, FA684F881BAF1A6800DCFD1A /* GameController.framework in Frameworks */, FA8B4BD5196766D400F8EB7C /* CoreMotion.framework in Frameworks */, @@ -685,6 +889,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34BA1D8B5B9B00915323 /* AVFoundation.framework in Frameworks */, FDBDE5C20E313663006BAC0B /* libSDL2.a in Frameworks */, FA684F891BAF1A6A00DCFD1A /* GameController.framework in Frameworks */, FA8B4BD6196766D700F8EB7C /* CoreMotion.framework in Frameworks */, @@ -702,6 +907,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34BB1D8B5BA100915323 /* AVFoundation.framework in Frameworks */, FDBDE5C60E3136F1006BAC0B /* libSDL2.a in Frameworks */, FA684F8A1BAF1A6D00DCFD1A /* GameController.framework in Frameworks */, FA8B4BD7196766DA00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -719,6 +925,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34BF1D8B5BB500915323 /* AVFoundation.framework in Frameworks */, FDBDE5C80E313702006BAC0B /* libSDL2.a in Frameworks */, FA684F8E1BAF1A7B00DCFD1A /* GameController.framework in Frameworks */, FA8B4BDB196766E500F8EB7C /* CoreMotion.framework in Frameworks */, @@ -736,6 +943,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + AA2F57AC1FDB5AB600832AD7 /* Metal.framework in Frameworks */, + FABA34C01D8B5BBA00915323 /* AVFoundation.framework in Frameworks */, AA1EE47717605BAB0029C7A5 /* libSDL2test.a in Frameworks */, FDBDE5CA0E313712006BAC0B /* libSDL2.a in Frameworks */, FA684F8F1BAF1A7E00DCFD1A /* GameController.framework in Frameworks */, @@ -754,6 +963,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34C21D8B5BC200915323 /* AVFoundation.framework in Frameworks */, FDBDE5CC0E31372B006BAC0B /* libSDL2.a in Frameworks */, FA684F911BAF1A8400DCFD1A /* GameController.framework in Frameworks */, FA8B4BDE196766EE00F8EB7C /* CoreMotion.framework in Frameworks */, @@ -771,6 +981,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34C31D8B5BC600915323 /* AVFoundation.framework in Frameworks */, FDBDE5CE0E31373E006BAC0B /* libSDL2.a in Frameworks */, FA684F921BAF1A8700DCFD1A /* GameController.framework in Frameworks */, FA8B4BDF196766F100F8EB7C /* CoreMotion.framework in Frameworks */, @@ -788,6 +999,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FABA34C51D8B5BD000915323 /* AVFoundation.framework in Frameworks */, FDBDE5D40E313789006BAC0B /* libSDL2.a in Frameworks */, FA684F941BAF1A9400DCFD1A /* GameController.framework in Frameworks */, FA8B4BE1196766F600F8EB7C /* CoreMotion.framework in Frameworks */, @@ -831,6 +1043,10 @@ AAE7DEEC14CBB1E100DF1A0E /* testscale.app */, AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */, FAE0E9931BAF9B230098DFA4 /* testgamecontroller.app */, + FA3D99341BC4E644002C96C8 /* testgamecontroller-TV.app */, + FABA34911D8B575200915323 /* testaudiocapture.app */, + FABA34AA1D8B582100915323 /* loopwav-TV.app */, + AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */, ); name = Products; sourceTree = ""; @@ -841,9 +1057,10 @@ AA1EE44D176059220029C7A5 /* SDL2test.xcodeproj */, FD1B48AC0E3131CA007AB34E /* SDL.xcodeproj */, FDA8AAD60E2D339A00EA573E /* Resources */, - FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */, + FDA8A7C30E2D10FA00EA573E /* Frameworks */, FDA8A73B0E2D0F0400EA573E /* src */, 19C28FACFE9D520D11CA2CBB /* Products */, + FABA34751D8B4EAC00915323 /* Frameworks */, ); name = CustomTemplate; sourceTree = ""; @@ -852,14 +1069,25 @@ isa = PBXGroup; children = ( AA1EE452176059230029C7A5 /* libSDL2test.a */, + FA3D992F1BC4E619002C96C8 /* libSDL2test-TV.a */, ); name = Products; sourceTree = ""; }; + FABA34751D8B4EAC00915323 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AA2F57A91FDB544800832AD7 /* Metal.framework */, + FABA34761D8B4EAD00915323 /* AVFoundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; FD1B48AD0E3131CA007AB34E /* Products */ = { isa = PBXGroup; children = ( FD1B48B80E3131CA007AB34E /* libSDL2.a */, + FA3D992B1BC4E619002C96C8 /* libSDL2.a */, ); name = Products; sourceTree = ""; @@ -869,6 +1097,7 @@ children = ( 047A63F013285CD100CD7973 /* checkkeys.c */, FDA8A78B0E2D0F3D00EA573E /* loopwave.c */, + FABA34931D8B578200915323 /* testaudiocapture.c */, FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */, FDC430090F0D86BF009C87E1 /* testdraw2.c */, FDA8A7470E2D0F1600EA573E /* testerror.c */, @@ -891,12 +1120,15 @@ FDA8A75A0E2D0F1600EA573E /* testtimer.c */, FDA8A75B0E2D0F1600EA573E /* testver.c */, FDA8A75F0E2D0F1600EA573E /* testwm2.c */, + AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */, + AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */, FDA8A7610E2D0F1600EA573E /* torturethread.c */, ); name = src; + path = ../../test; sourceTree = ""; }; - FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */ = { + FDA8A7C30E2D10FA00EA573E /* Frameworks */ = { isa = PBXGroup; children = ( FA684F7A1BAF1A4400DCFD1A /* GameController.framework */, @@ -909,7 +1141,7 @@ FDA8A89D0E2D111A00EA573E /* Foundation.framework */, FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */, ); - name = "Linked Frameworks"; + name = Frameworks; sourceTree = ""; }; FDA8AAD60E2D339A00EA573E /* Resources */ = { @@ -918,14 +1150,16 @@ FA0EF2281BAF4487000E07A6 /* axis.bmp */, FA0EF2291BAF4487000E07A6 /* button.bmp */, FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */, - FDD2C18A0E2E52FE00B7A85F /* utf8.txt */, FDA8AAD90E2D33B000EA573E /* icon.bmp */, FDA8AADA0E2D33BA00EA573E /* moose.dat */, FDA8AADB0E2D33BA00EA573E /* picture.xbm */, FDA8AADE0E2D33C100EA573E /* sample.bmp */, FDA8AAE20E2D33C600EA573E /* sample.wav */, + AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */, + FDD2C18A0E2E52FE00B7A85F /* utf8.txt */, ); name = Resources; + path = ../../test; sourceTree = ""; }; /* End PBXGroup section */ @@ -999,6 +1233,23 @@ productReference = 56ED050D118A8FE400A56AA6 /* testpower.app */; productType = "com.apple.product-type.application"; }; + AA13B3111FB8AEBC00D9FEE6 /* testyuv */ = { + isa = PBXNativeTarget; + buildConfigurationList = AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */; + buildPhases = ( + AA13B3121FB8AEBC00D9FEE6 /* Resources */, + AA13B3141FB8AEBC00D9FEE6 /* Sources */, + AA13B3161FB8AEBC00D9FEE6 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = testyuv; + productName = Test; + productReference = AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */; + productType = "com.apple.product-type.application"; + }; AAE7DEDA14CBB1E100DF1A0E /* testscale */ = { isa = PBXNativeTarget; buildConfigurationList = AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */; @@ -1033,6 +1284,58 @@ productReference = AAE7DFB114CBB54E00DF1A0E /* testrendertarget.app */; productType = "com.apple.product-type.application"; }; + FA3D99331BC4E644002C96C8 /* testgamecontroller-TV */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA3D99451BC4E645002C96C8 /* Build configuration list for PBXNativeTarget "testgamecontroller-TV" */; + buildPhases = ( + FA3D99301BC4E644002C96C8 /* Sources */, + FA3D99311BC4E644002C96C8 /* Frameworks */, + FA3D99321BC4E644002C96C8 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + FAA8CEE61BDF06DC00D3BD45 /* PBXTargetDependency */, + ); + name = "testgamecontroller-TV"; + productName = "testgamecontroller-TV"; + productReference = FA3D99341BC4E644002C96C8 /* testgamecontroller-TV.app */; + productType = "com.apple.product-type.application"; + }; + FABA347D1D8B575200915323 /* testaudiocapture */ = { + isa = PBXNativeTarget; + buildConfigurationList = FABA348E1D8B575200915323 /* Build configuration list for PBXNativeTarget "testaudiocapture" */; + buildPhases = ( + FABA347E1D8B575200915323 /* Resources */, + FABA34801D8B575200915323 /* Sources */, + FABA34821D8B575200915323 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = testaudiocapture; + productName = Test; + productReference = FABA34911D8B575200915323 /* testaudiocapture.app */; + productType = "com.apple.product-type.application"; + }; + FABA34961D8B582100915323 /* loopwav-TV */ = { + isa = PBXNativeTarget; + buildConfigurationList = FABA34A71D8B582100915323 /* Build configuration list for PBXNativeTarget "loopwav-TV" */; + buildPhases = ( + FABA34971D8B582100915323 /* Resources */, + FABA34991D8B582100915323 /* Sources */, + FABA349B1D8B582100915323 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "loopwav-TV"; + productName = Test; + productReference = FABA34AA1D8B582100915323 /* loopwav-TV.app */; + productType = "com.apple.product-type.application"; + }; FAE0E9801BAF9B230098DFA4 /* testgamecontroller */ = { isa = PBXNativeTarget; buildConfigurationList = FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */; @@ -1346,6 +1649,17 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0630; + TargetAttributes = { + AA13B3111FB8AEBC00D9FEE6 = { + DevelopmentTeam = EH385AYQ6F; + }; + FA3D99331BC4E644002C96C8 = { + CreatedOnToolsVersion = 7.1; + }; + FABA34961D8B582100915323 = { + ProvisioningStyle = Automatic; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TestiPhoneOS" */; compatibilityVersion = "Xcode 3.2"; @@ -1356,6 +1670,7 @@ Japanese, French, German, + Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -1372,12 +1687,15 @@ projectRoot = ""; targets = ( 047A63DD13285C3200CD7973 /* checkkeys */, + FABA347D1D8B575200915323 /* testaudiocapture */, FDA8AAAA0E2D330F00EA573E /* loopwav */, + FABA34961D8B582100915323 /* loopwav-TV */, FDAAC3BB0E2D47E6001DB1D8 /* testaudioinfo */, FDC42FEF0F0D866D009C87E1 /* testdraw2 */, FDAAC58A0E2D5429001DB1D8 /* testerror */, FDAAC5B80E2D55B5001DB1D8 /* testfile */, FAE0E9801BAF9B230098DFA4 /* testgamecontroller */, + FA3D99331BC4E644002C96C8 /* testgamecontroller-TV */, 046CEF7513254F23007AD51D /* testgesture */, FDAAC6150E2D5914001DB1D8 /* testgles */, FDD2C1700E2E52C000B7A85F /* testiconv */, @@ -1394,6 +1712,7 @@ FDD2C5740E2E8C7400B7A85F /* testtimer */, FDD2C5B30E2E8CFC00B7A85F /* testver */, 1D6058900D05DD3D006BFB54 /* testwm2 */, + AA13B3111FB8AEBC00D9FEE6 /* testyuv */, FDD2C6E20E2E959E00B7A85F /* torturethread */, ); }; @@ -1407,6 +1726,20 @@ remoteRef = AA1EE451176059230029C7A5 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + FA3D992B1BC4E619002C96C8 /* libSDL2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libSDL2.a; + remoteRef = FA3D992A1BC4E619002C96C8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA3D992F1BC4E619002C96C8 /* libSDL2test-TV.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSDL2test-TV.a"; + remoteRef = FA3D992E1BC4E619002C96C8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FD1B48B80E3131CA007AB34E /* libSDL2.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1429,6 +1762,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1447,6 +1781,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AA13B3121FB8AEBC00D9FEE6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; AAE7DEDB14CBB1E100DF1A0E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1465,6 +1807,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA3D99321BC4E644002C96C8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA3D99521BC4E70C002C96C8 /* controllermap.bmp in Resources */, + FA3D99541BC4E70F002C96C8 /* button.bmp in Resources */, + FA3D99531BC4E70E002C96C8 /* axis.bmp in Resources */, + FA3D99551BC4E712002C96C8 /* icon.bmp in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA347E1D8B575200915323 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA34971D8B582100915323 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA34981D8B582100915323 /* sample.wav in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FAE0E9811BAF9B230098DFA4 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1617,6 +1985,7 @@ buildActionMask = 2147483647; files = ( 047A63F113285CD100CD7973 /* checkkeys.c in Sources */, + FABA34941D8B578200915323 /* testaudiocapture.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1636,6 +2005,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + AA13B3141FB8AEBC00D9FEE6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */, + AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; AAE7DEDD14CBB1E100DF1A0E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1652,6 +2030,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FA3D99301BC4E644002C96C8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA34AF1D8B59F800915323 /* testaudiocapture.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA34801D8B575200915323 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA34951D8B578600915323 /* testaudiocapture.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FABA34991D8B582100915323 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FABA349A1D8B582100915323 /* loopwave.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; FAE0E9831BAF9B230098DFA4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1798,6 +2200,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + FAA8CEE61BDF06DC00D3BD45 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "libSDL-tv"; + targetProxy = FAA8CEE51BDF06DC00D3BD45 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ 046CEF8413254F23007AD51D /* Debug */ = { isa = XCBuildConfiguration; @@ -1863,6 +2273,24 @@ }; name = Release; }; + AA13B3241FB8AEBC00D9FEE6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = EH385AYQ6F; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + AA13B3251FB8AEBC00D9FEE6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = EH385AYQ6F; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; AAE7DEEA14CBB1E100DF1A0E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1898,9 +2326,12 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_BITCODE = NO; GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "-ObjC"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; @@ -1912,8 +2343,11 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ../../include; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_LDFLAGS = "-ObjC"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SDKROOT = iphoneos; @@ -1921,6 +2355,132 @@ }; name = Release; }; + FA3D99461BC4E645002C96C8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + FA3D99471BC4E645002C96C8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FABA348F1D8B575200915323 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + FABA34901D8B575200915323 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + FABA34A81D8B582100915323 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = arm64; + }; + name = Debug; + }; + FABA34A91D8B582100915323 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = Info.plist; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALID_ARCHS = arm64; + }; + name = Release; + }; FAE0E9911BAF9B230098DFA4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2248,6 +2808,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AA13B3241FB8AEBC00D9FEE6 /* Debug */, + AA13B3251FB8AEBC00D9FEE6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -2275,6 +2844,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FA3D99451BC4E645002C96C8 /* Build configuration list for PBXNativeTarget "testgamecontroller-TV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA3D99461BC4E645002C96C8 /* Debug */, + FA3D99471BC4E645002C96C8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FABA348E1D8B575200915323 /* Build configuration list for PBXNativeTarget "testaudiocapture" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FABA348F1D8B575200915323 /* Debug */, + FABA34901D8B575200915323 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FABA34A71D8B582100915323 /* Build configuration list for PBXNativeTarget "loopwav-TV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FABA34A81D8B582100915323 /* Debug */, + FABA34A91D8B582100915323 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; FAE0E9901BAF9B230098DFA4 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/Info-Framework.plist b/3rdparty/sdl2-2.0.9/Xcode/SDL/Info-Framework.plist similarity index 89% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/Info-Framework.plist rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/Info-Framework.plist index bccaa8afce..0b89cc42be 100644 --- a/3rdparty/sdl2-2.0.4/Xcode/SDL/Info-Framework.plist +++ b/3rdparty/sdl2-2.0.9/Xcode/SDL/Info-Framework.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - org.libsdl.SDL2 + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.4 + 2.0.9 CFBundleSignature SDLX CFBundleVersion - 2.0.4 + 2.0.9 diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 84% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 9fc2a50190..d6041be582 --- a/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -7,15 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - 007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - 007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; @@ -31,12 +25,8 @@ 0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; 043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; 043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; @@ -57,14 +47,12 @@ 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; 04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; @@ -211,14 +199,12 @@ 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; 04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD024712E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; 04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; @@ -387,6 +373,30 @@ 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; + 4D16644E1EDD6023003DE88E /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */; }; + 4D16644F1EDD6023003DE88E /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */; }; + 4D1664531EDD60AD003DE88E /* SDL_cocoametalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664501EDD60AD003DE88E /* SDL_cocoametalview.m */; }; + 4D1664541EDD60AD003DE88E /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1664511EDD60AD003DE88E /* SDL_cocoavulkan.h */; }; + 4D1664551EDD60AD003DE88E /* SDL_cocoavulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664521EDD60AD003DE88E /* SDL_cocoavulkan.m */; }; + 4D1664561EDD61DA003DE88E /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */; }; + 4D1664571EDD61F0003DE88E /* SDL_cocoametalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664501EDD60AD003DE88E /* SDL_cocoametalview.m */; }; + 4D1664581EDD61F0003DE88E /* SDL_cocoavulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664521EDD60AD003DE88E /* SDL_cocoavulkan.m */; }; + 4D1664591EDD621B003DE88E /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */; }; + 4D16645A1EDD6235003DE88E /* SDL_cocoametalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664501EDD60AD003DE88E /* SDL_cocoametalview.m */; }; + 4D16645B1EDD6235003DE88E /* SDL_cocoavulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1664521EDD60AD003DE88E /* SDL_cocoavulkan.m */; }; + 4D7517291EE2562B00820EEA /* SDL_cocoametalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517281EE2562B00820EEA /* SDL_cocoametalview.h */; }; + 56115BBB1DF72C6D00F47E1E /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */; }; + 56115BBC1DF72C6D00F47E1E /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */; }; + 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; + 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; + 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; + 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; + 564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 564624391FF821EF0074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 5646243A1FF821FF0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 5646243B1FF822100074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 5646243C1FF822170074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; }; 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; @@ -406,6 +416,72 @@ 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; + 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; + 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; + 56F9D55C1DF73B6B00C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */; }; + 56F9D55D1DF73B6C00C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */; }; + 56F9D55E1DF73B7C00C15B5D /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */; }; + 56F9D55F1DF73B7D00C15B5D /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */; }; + 5C2EF69F1FC987C6003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; }; + 5C2EF6A01FC987C6003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; }; + 5C2EF6A11FC987C6003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; }; + 5C2EF6A21FC987C6003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; }; + 5C2EF6A31FC98B38003F5197 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; }; + 5C2EF6A41FC98B39003F5197 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; }; + 5C2EF6A51FC98B6B003F5197 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; }; + 5C2EF6A61FC98B6C003F5197 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; }; + 5C2EF6A71FC98D2D003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; }; + 5C2EF6A81FC98D2D003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; }; + 5C2EF6A91FC98D2D003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; }; + 5C2EF6AA1FC98D2D003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; }; + 5C2EF6AB1FC98D2E003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; }; + 5C2EF6AC1FC98D2E003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; }; + 5C2EF6AD1FC98D2E003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; }; + 5C2EF6AE1FC98D2E003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; }; + 5C2EF6EE1FC9D0ED003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; }; + 5C2EF6EF1FC9D0ED003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; }; + 5C2EF6F01FC9D181003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; }; + 5C2EF6F11FC9D181003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; }; + 5C2EF6F21FC9D182003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; }; + 5C2EF6F31FC9D182003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; }; + 5C2EF6F71FC9EE35003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; }; + 5C2EF6F81FC9EE35003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; }; + 5C2EF6F91FC9EE35003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; }; + 5C2EF6FA1FC9EE64003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; }; + 5C2EF6FB1FC9EE64003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; }; + 5C2EF6FC1FC9EE64003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; }; + 5C2EF6FD1FC9EE65003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; }; + 5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; }; + 5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; }; + 5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; }; + A704170920F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; }; + A704170A20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; }; + A704170B20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; }; + A704171420F09AC900A82227 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */; }; + A704171520F09AC900A82227 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */; }; + A704171620F09AC900A82227 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */; }; + A704171720F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */; }; + A704171820F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */; }; + A704171920F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */; }; + A704171A20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; + A704171B20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; + A704171C20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */; }; + A704171D20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; + A704171E20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; + A704171F20F09AC900A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704171020F09AC900A82227 /* controller_type.h */; }; + A704172020F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; + A704172120F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; + A704172220F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */; }; + A704172320F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */; }; + A704172420F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */; }; + A704172520F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */; }; + A704172620F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */; }; + A704172720F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */; }; + A704172820F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */; }; + A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; @@ -521,6 +597,11 @@ AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; AA75585E1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; AA75585F1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AA8167541F5E727800518735 /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4820431F0F10B400EDC31C /* SDL_vulkan.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */; }; + AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; }; + AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; }; + AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */; }; AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -545,6 +626,20 @@ AAC07107195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; AADA5B8816CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AADC5A431FDA035D00960936 /* SDL_shaders_metal_osx.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */; }; + AADC5A441FDA035D00960936 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A421FDA035D00960936 /* SDL_render_metal.m */; }; + AADC5A451FDA047900960936 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A421FDA035D00960936 /* SDL_render_metal.m */; }; + AADC5A461FDA047B00960936 /* SDL_shaders_metal_osx.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */; }; + AADC5A471FDA047E00960936 /* SDL_shaders_metal_osx.h in Headers */ = {isa = PBXBuildFile; fileRef = AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */; }; + AADC5A481FDA048100960936 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = AADC5A421FDA035D00960936 /* SDL_render_metal.m */; }; + AADC5A491FDA05C100960936 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */; }; + AADC5A4A1FDA05C200960936 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */; }; + AADC5A4B1FDA05CF00960936 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */; }; + AADC5A4C1FDA05CF00960936 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */; }; + AADC5A4D1FDA05D300960936 /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */; }; + AADC5A4E1FDA05D400960936 /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */; }; + AADC5A4F1FDA05E600960936 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1664511EDD60AD003DE88E /* SDL_cocoavulkan.h */; }; + AADC5A501FDA05E600960936 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1664511EDD60AD003DE88E /* SDL_cocoavulkan.h */; }; BBFC088D164C6647003E6A99 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; D55A1B81179F262300625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; @@ -563,7 +658,6 @@ DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; @@ -626,7 +720,6 @@ DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - DB313FB917554B71006C0E22 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; @@ -698,7 +791,6 @@ DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; @@ -784,7 +876,6 @@ DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; DB31405817554B71006C0E22 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; @@ -802,17 +893,39 @@ DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; + F30D9C84212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; }; + F30D9C85212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; }; + F30D9C86212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; }; + F30D9C87212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; }; + F30D9C88212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; }; + F30D9C89212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; }; + F30D9C8A212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; }; + F30D9C8B212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; }; + F30D9C8C212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; }; + F30D9C90212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; }; + F30D9C91212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; }; + F30D9C92212CABDC0047DF2E /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */; }; + F30D9C93212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; }; + F30D9C94212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; }; + F30D9C95212CABDC0047DF2E /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */; }; + F30D9CCD212EB4810047DF2E /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */; }; + F30D9CCE212EB4810047DF2E /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */; }; + F30D9CCF212EB4810047DF2E /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */; }; + F30D9CD0212EB4810047DF2E /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */; }; + F30D9CD1212EB4810047DF2E /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */; }; + F30D9CD2212EB4810047DF2E /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */; }; + F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; }; FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; + FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -826,22 +939,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; - 0073179C0858DECD00B2BC32 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; - 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 0073179E0858DECD00B2BC32 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; - 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; + 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = System/Library/Frameworks/ForceFeedback.framework; sourceTree = SDKROOT; }; + 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_glfuncs.h; sourceTree = ""; }; 041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = ""; }; 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = ""; }; 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = ""; }; 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = ""; }; - 04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; }; - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; }; 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; }; 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; }; 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gl.c; sourceTree = ""; }; @@ -849,22 +957,20 @@ 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_sw.c; sourceTree = ""; }; 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11framebuffer.c; sourceTree = ""; }; 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11framebuffer.h; sourceTree = ""; }; - 0442EC5E12FE1C75004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = ../../src/SDL_hints.c; sourceTree = SOURCE_ROOT; }; - 04BAC0C71300C2160055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; }; + 0442EC5E12FE1C75004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hints.c; sourceTree = ""; }; + 04BAC0C71300C2160055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_log.c; sourceTree = ""; }; 04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = ""; }; 04BDFD7512E6671700899322 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; 04BDFD8812E6671700899322 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_diskaudio.c; sourceTree = ""; }; 04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = ""; }; 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = ""; }; 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = ""; }; - 04BDFDA012E6671700899322 /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_coreaudio.c; sourceTree = ""; }; 04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = ""; }; 04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = ""; }; 04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = ""; }; 04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = ""; }; 04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = ""; }; 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = ""; }; - 04BDFDB912E6671700899322 /* SDL_audiomem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiomem.h; sourceTree = ""; }; 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = ""; }; 04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = ""; }; 04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = ""; }; @@ -907,11 +1013,11 @@ 04BDFE3312E6671700899322 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; 04BDFE4B12E6671700899322 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syspower.c; sourceTree = ""; }; 04BDFE4E12E6671700899322 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = ""; }; - 04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5612E6671700899322 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5812E6671700899322 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = ../../src/SDL_error_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5912E6671700899322 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = ../../src/SDL_error.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5C12E6671700899322 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; + 04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_assert_c.h; sourceTree = ""; }; + 04BDFE5612E6671700899322 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_assert.c; sourceTree = ""; }; + 04BDFE5812E6671700899322 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_error_c.h; sourceTree = ""; }; + 04BDFE5912E6671700899322 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_error.c; sourceTree = ""; }; + 04BDFE5C12E6671700899322 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL.c; sourceTree = ""; }; 04BDFE5E12E6671700899322 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = ""; }; 04BDFE5F12E6671700899322 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iconv.c; sourceTree = ""; }; 04BDFE6012E6671700899322 /* SDL_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_malloc.c; sourceTree = ""; }; @@ -1018,15 +1124,46 @@ 04F7804512FB74A200FC43C0 /* SDL_drawline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawline.h; sourceTree = ""; }; 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawpoint.c; sourceTree = ""; }; 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawpoint.h; sourceTree = ""; }; + 4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan_internal.h; sourceTree = ""; }; + 4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_vulkan_utils.c; sourceTree = ""; }; + 4D1664501EDD60AD003DE88E /* SDL_cocoametalview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoametalview.m; sourceTree = ""; }; + 4D1664511EDD60AD003DE88E /* SDL_cocoavulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoavulkan.h; sourceTree = ""; }; + 4D1664521EDD60AD003DE88E /* SDL_cocoavulkan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoavulkan.m; sourceTree = ""; }; + 4D4820431F0F10B400EDC31C /* SDL_vulkan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_vulkan.h; sourceTree = ""; }; + 4D7517281EE2562B00820EEA /* SDL_cocoametalview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoametalview.h; sourceTree = ""; }; + 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dataqueue.c; sourceTree = ""; }; + 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = ""; }; + 564624351FF821B80074AC87 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 564624371FF821CB0074AC87 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = ""; }; 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dropevents.c; sourceTree = ""; }; - 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; + 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; 567E2F2017C44C35005F1892 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = ""; }; - 56A670081856545C0007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = ""; }; - 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = ""; }; - 56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = ""; }; - 56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = ""; }; - 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = ""; }; + 56A670081856545C0007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_internal.h; sourceTree = ""; }; + 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_procs.h; sourceTree = ""; }; + 56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dynapi.c; sourceTree = ""; }; + 56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi.h; sourceTree = ""; }; + 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dynapi_overrides.h; sourceTree = ""; }; + 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gles2funcs.h; sourceTree = ""; }; + 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gles2.c; sourceTree = ""; }; + 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gles2.h; sourceTree = ""; }; + 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gles2.c; sourceTree = ""; }; + 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaopengles.m; sourceTree = ""; }; + 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaopengles.h; sourceTree = ""; }; + 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_c.h; sourceTree = ""; }; + 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = ""; }; + 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = ""; }; + 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl.h; sourceTree = ""; }; + A704170820F09A9800A82227 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = ""; }; + A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = ""; }; + A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = ""; }; + A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_switch.c; sourceTree = ""; }; + A704171020F09AC900A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = ""; }; + A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = ""; }; + A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xboxone.c; sourceTree = ""; }; + A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xbox360.c; sourceTree = ""; }; + A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = ""; }; AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = ""; }; @@ -1083,6 +1220,10 @@ AA7557F71595D4D800BBD41B /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_version.h; sourceTree = ""; }; AA7557F81595D4D800BBD41B /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video.h; sourceTree = ""; }; AA7557F91595D4D800BBD41B /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL.h; sourceTree = ""; }; + AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = ""; }; + AA9A7F101FB0206300FED37F /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = ""; }; + AA9A7F131FB0209C00FED37F /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = ""; }; + AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = ""; }; AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11messagebox.c; sourceTree = ""; }; AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_messagebox.h; sourceTree = ""; }; AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamessagebox.h; sourceTree = ""; }; @@ -1093,6 +1234,8 @@ AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2platform.h; sourceTree = ""; }; AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_khrplatform.h; sourceTree = ""; }; AADA5B8616CCAB3000107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; + AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_metal_osx.h; sourceTree = ""; }; + AADC5A421FDA035D00960936 /* SDL_render_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_render_metal.m; sourceTree = ""; }; BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = ""; }; BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; BECDF66C0761BA81005FE872 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1102,10 +1245,19 @@ D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamousetap.m; sourceTree = ""; }; DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic_c.h; sourceTree = ""; }; + F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor_c.h; sourceTree = ""; }; + F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syssensor.h; sourceTree = ""; }; + F30D9C83212BC94F0047DF2E /* SDL_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sensor.c; sourceTree = ""; }; + F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummysensor.h; sourceTree = ""; }; + F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummysensor.c; sourceTree = ""; }; + F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_displayevents_c.h; sourceTree = ""; }; + F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_displayevents.c; sourceTree = ""; }; + F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = ""; }; F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; - FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; + FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1113,15 +1265,16 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, - 007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, - 007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, + 564624381FF821DA0074AC87 /* Metal.framework in Frameworks */, + 564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */, + A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */, + 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */, 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */, - 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */, + A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */, 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */, - 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */, + FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */, + 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1129,14 +1282,16 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5646243A1FF821FF0074AC87 /* Metal.framework in Frameworks */, + 564624391FF821EF0074AC87 /* QuartzCore.framework in Frameworks */, + 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */, - 007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, - 007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */, 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */, + 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */, 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */, DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */, + 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1144,14 +1299,16 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5646243C1FF822170074AC87 /* Metal.framework in Frameworks */, + 5646243B1FF822100074AC87 /* QuartzCore.framework in Frameworks */, + 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */, - DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */, - DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */, DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */, - DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */, DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */, + 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */, DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */, DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */, + 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1163,17 +1320,17 @@ children = ( AA7557C71595D4D800BBD41B /* begin_code.h */, AA7557C81595D4D800BBD41B /* close_code.h */, - AA7557F91595D4D800BBD41B /* SDL.h */, AA7557C91595D4D800BBD41B /* SDL_assert.h */, AA7557CA1595D4D800BBD41B /* SDL_atomic.h */, AA7557CB1595D4D800BBD41B /* SDL_audio.h */, AADA5B8616CCAB3000107CF7 /* SDL_bits.h */, AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */, AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */, - AA7557CF1595D4D800BBD41B /* SDL_config.h */, AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */, + AA7557CF1595D4D800BBD41B /* SDL_config.h */, AA7557D01595D4D800BBD41B /* SDL_copying.h */, AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */, + 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */, AA7557D21595D4D800BBD41B /* SDL_endian.h */, AA7557D31595D4D800BBD41B /* SDL_error.h */, AA7557D41595D4D800BBD41B /* SDL_events.h */, @@ -1192,14 +1349,14 @@ AA7557DF1595D4D800BBD41B /* SDL_mouse.h */, AA7557E01595D4D800BBD41B /* SDL_mutex.h */, AA7557E11595D4D800BBD41B /* SDL_name.h */, - AA7557E21595D4D800BBD41B /* SDL_opengl.h */, AAC070F4195606770073DCDF /* SDL_opengl_glext.h */, + AA7557E21595D4D800BBD41B /* SDL_opengl.h */, AA7557E31595D4D800BBD41B /* SDL_opengles.h */, - AA7557E41595D4D800BBD41B /* SDL_opengles2.h */, AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */, AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */, AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */, AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */, + AA7557E41595D4D800BBD41B /* SDL_opengles2.h */, AA7557E51595D4D800BBD41B /* SDL_pixels.h */, AA7557E61595D4D800BBD41B /* SDL_platform.h */, AA7557E71595D4D800BBD41B /* SDL_power.h */, @@ -1209,6 +1366,7 @@ AA7557EB1595D4D800BBD41B /* SDL_revision.h */, AA7557EC1595D4D800BBD41B /* SDL_rwops.h */, AA7557ED1595D4D800BBD41B /* SDL_scancode.h */, + F3950CD7212BC88D00F51292 /* SDL_sensor.h */, AA7557EE1595D4D800BBD41B /* SDL_shape.h */, AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */, AA7557F01595D4D800BBD41B /* SDL_surface.h */, @@ -1220,6 +1378,8 @@ AA7557F61595D4D800BBD41B /* SDL_types.h */, AA7557F71595D4D800BBD41B /* SDL_version.h */, AA7557F81595D4D800BBD41B /* SDL_video.h */, + 4D4820431F0F10B400EDC31C /* SDL_vulkan.h */, + AA7557F91595D4D800BBD41B /* SDL.h */, ); name = "Public Headers"; path = ../../include; @@ -1228,7 +1388,6 @@ 034768DDFF38A45A11DB9C8B /* Products */ = { isa = PBXGroup; children = ( - 089C1665FE841158C02AAC07 /* Resources */, BECDF66C0761BA81005FE872 /* SDL2.framework */, BECDF6B30761BA81005FE872 /* libSDL2.a */, BECDF6BE0761BA81005FE872 /* Standard DMG */, @@ -1240,18 +1399,17 @@ 041B2C9712FA0D680087D585 /* render */ = { isa = PBXGroup; children = ( + AADC5A401FDA030E00960936 /* metal */, + 5C2EF6921FC986D8003F5197 /* opengles2 */, 041B2C9A12FA0D680087D585 /* opengl */, 041B2CA012FA0D680087D585 /* software */, - 04409B8D12FA97ED00FB9AA8 /* mmx.h */, 041B2C9E12FA0D680087D585 /* SDL_render.c */, 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */, - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */, 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */, 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */, ); - name = render; - path = ../../src/render; - sourceTree = SOURCE_ROOT; + path = render; + sourceTree = ""; }; 041B2C9A12FA0D680087D585 /* opengl */ = { isa = PBXGroup; @@ -1292,9 +1450,8 @@ 04BDFD7412E6671700899322 /* SDL_atomic.c */, 04BDFD7512E6671700899322 /* SDL_spinlock.c */, ); - name = atomic; - path = ../../src/atomic; - sourceTree = SOURCE_ROOT; + path = atomic; + sourceTree = ""; }; 04BDFD7612E6671700899322 /* audio */ = { isa = PBXGroup; @@ -1307,16 +1464,14 @@ 04BDFDB612E6671700899322 /* SDL_audiocvt.c */, 04BDFDB712E6671700899322 /* SDL_audiodev.c */, 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */, - 04BDFDB912E6671700899322 /* SDL_audiomem.h */, 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */, 04BDFDBB12E6671700899322 /* SDL_mixer.c */, 04BDFDC212E6671700899322 /* SDL_sysaudio.h */, 04BDFDC312E6671700899322 /* SDL_wave.c */, 04BDFDC412E6671700899322 /* SDL_wave.h */, ); - name = audio; - path = ../../src/audio; - sourceTree = SOURCE_ROOT; + path = audio; + sourceTree = ""; }; 04BDFD8712E6671700899322 /* disk */ = { isa = PBXGroup; @@ -1339,8 +1494,8 @@ 04BDFD9F12E6671700899322 /* coreaudio */ = { isa = PBXGroup; children = ( - 04BDFDA012E6671700899322 /* SDL_coreaudio.c */, 04BDFDA112E6671700899322 /* SDL_coreaudio.h */, + FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */, ); path = coreaudio; sourceTree = ""; @@ -1350,9 +1505,8 @@ children = ( 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */, ); - name = cpuinfo; - path = ../../src/cpuinfo; - sourceTree = SOURCE_ROOT; + path = cpuinfo; + sourceTree = ""; }; 04BDFDD512E6671700899322 /* events */ = { isa = PBXGroup; @@ -1362,28 +1516,29 @@ 04BDFDD812E6671700899322 /* scancodes_darwin.h */, 04BDFDD912E6671700899322 /* scancodes_linux.h */, 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */, - 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */, 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */, + 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */, + F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */, + F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */, 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */, 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */, - 04BDFDDE12E6671700899322 /* SDL_events.c */, 04BDFDDF12E6671700899322 /* SDL_events_c.h */, - 04BDFDE012E6671700899322 /* SDL_gesture.c */, + 04BDFDDE12E6671700899322 /* SDL_events.c */, 04BDFDE112E6671700899322 /* SDL_gesture_c.h */, - 04BDFDE212E6671700899322 /* SDL_keyboard.c */, + 04BDFDE012E6671700899322 /* SDL_gesture.c */, 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */, - 04BDFDE412E6671700899322 /* SDL_mouse.c */, + 04BDFDE212E6671700899322 /* SDL_keyboard.c */, 04BDFDE512E6671700899322 /* SDL_mouse_c.h */, + 04BDFDE412E6671700899322 /* SDL_mouse.c */, 04BDFDE612E6671700899322 /* SDL_quit.c */, 04BDFDE712E6671700899322 /* SDL_sysevents.h */, - 04BDFDE812E6671700899322 /* SDL_touch.c */, 04BDFDE912E6671700899322 /* SDL_touch_c.h */, - 04BDFDEA12E6671700899322 /* SDL_windowevents.c */, + 04BDFDE812E6671700899322 /* SDL_touch.c */, 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */, + 04BDFDEA12E6671700899322 /* SDL_windowevents.c */, ); - name = events; - path = ../../src/events; - sourceTree = SOURCE_ROOT; + path = events; + sourceTree = ""; }; 04BDFDEC12E6671700899322 /* file */ = { isa = PBXGroup; @@ -1391,9 +1546,8 @@ 04BDFDED12E6671700899322 /* cocoa */, 04BDFDF012E6671700899322 /* SDL_rwops.c */, ); - name = file; - path = ../../src/file; - sourceTree = SOURCE_ROOT; + path = file; + sourceTree = ""; }; 04BDFDED12E6671700899322 /* cocoa */ = { isa = PBXGroup; @@ -1412,9 +1566,8 @@ 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */, 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */, ); - name = haptic; - path = ../../src/haptic; - sourceTree = SOURCE_ROOT; + path = haptic; + sourceTree = ""; }; 04BDFDF212E6671700899322 /* darwin */ = { isa = PBXGroup; @@ -1428,15 +1581,15 @@ 04BDFDFF12E6671700899322 /* joystick */ = { isa = PBXGroup; children = ( + A704170C20F09AA600A82227 /* hidapi */, 04BDFE0612E6671700899322 /* darwin */, 04BDFE1612E6671700899322 /* SDL_joystick.c */, 04BDFE1712E6671700899322 /* SDL_joystick_c.h */, BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */, 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */, ); - name = joystick; - path = ../../src/joystick; - sourceTree = SOURCE_ROOT; + path = joystick; + sourceTree = ""; }; 04BDFE0612E6671700899322 /* darwin */ = { isa = PBXGroup; @@ -1452,9 +1605,8 @@ children = ( 04BDFE3212E6671700899322 /* dlopen */, ); - name = loadso; - path = ../../src/loadso; - sourceTree = SOURCE_ROOT; + path = loadso; + sourceTree = ""; }; 04BDFE3212E6671700899322 /* dlopen */ = { isa = PBXGroup; @@ -1470,9 +1622,8 @@ 04BDFE4A12E6671700899322 /* macosx */, 04BDFE4E12E6671700899322 /* SDL_power.c */, ); - name = power; - path = ../../src/power; - sourceTree = SOURCE_ROOT; + path = power; + sourceTree = ""; }; 04BDFE4A12E6671700899322 /* macosx */ = { isa = PBXGroup; @@ -1492,9 +1643,8 @@ 04BDFE6212E6671700899322 /* SDL_stdlib.c */, 04BDFE6312E6671700899322 /* SDL_string.c */, ); - name = stdlib; - path = ../../src/stdlib; - sourceTree = SOURCE_ROOT; + path = stdlib; + sourceTree = ""; }; 04BDFE6412E6671800899322 /* thread */ = { isa = PBXGroup; @@ -1504,9 +1654,8 @@ 04BDFE8C12E6671800899322 /* SDL_thread.c */, 04BDFE8D12E6671800899322 /* SDL_thread_c.h */, ); - name = thread; - path = ../../src/thread; - sourceTree = SOURCE_ROOT; + path = thread; + sourceTree = ""; }; 04BDFE7D12E6671800899322 /* pthread */ = { isa = PBXGroup; @@ -1529,9 +1678,8 @@ 04BDFE9F12E6671800899322 /* SDL_timer.c */, 04BDFEA012E6671800899322 /* SDL_timer_c.h */, ); - name = timer; - path = ../../src/timer; - sourceTree = SOURCE_ROOT; + path = timer; + sourceTree = ""; }; 04BDFEA112E6671800899322 /* unix */ = { isa = PBXGroup; @@ -1547,8 +1695,7 @@ 04BDFEC112E6671800899322 /* cocoa */, 04BDFEE712E6671800899322 /* dummy */, 04BDFFB712E6671800899322 /* x11 */, - 04BDFF4E12E6671800899322 /* SDL_blit.c */, - 04BDFF4F12E6671800899322 /* SDL_blit.h */, + AA9A7F0E1FB0200B00FED37F /* yuv2rgb */, 04BDFF5012E6671800899322 /* SDL_blit_0.c */, 04BDFF5112E6671800899322 /* SDL_blit_1.c */, 04BDFF5212E6671800899322 /* SDL_blit_A.c */, @@ -1559,24 +1706,32 @@ 04BDFF5712E6671800899322 /* SDL_blit_N.c */, 04BDFF5812E6671800899322 /* SDL_blit_slow.c */, 04BDFF5912E6671800899322 /* SDL_blit_slow.h */, + 04BDFF4E12E6671800899322 /* SDL_blit.c */, + 04BDFF4F12E6671800899322 /* SDL_blit.h */, 04BDFF5A12E6671800899322 /* SDL_bmp.c */, 04BDFF5B12E6671800899322 /* SDL_clipboard.c */, + 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */, + 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */, 04BDFF6012E6671800899322 /* SDL_fillrect.c */, - 04BDFF6512E6671800899322 /* SDL_pixels.c */, 04BDFF6612E6671800899322 /* SDL_pixels_c.h */, + 04BDFF6512E6671800899322 /* SDL_pixels.c */, + 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */, 04BDFF6712E6671800899322 /* SDL_rect.c */, - 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */, 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */, - 04BDFF7112E6671800899322 /* SDL_shape.c */, + 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */, 04BDFF7212E6671800899322 /* SDL_shape_internals.h */, + 04BDFF7112E6671800899322 /* SDL_shape.c */, 04BDFF7312E6671800899322 /* SDL_stretch.c */, 04BDFF7412E6671800899322 /* SDL_surface.c */, 04BDFF7512E6671800899322 /* SDL_sysvideo.h */, 04BDFF7612E6671800899322 /* SDL_video.c */, + 4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */, + 4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */, + AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */, + AA9A7F131FB0209C00FED37F /* SDL_yuv.c */, ); - name = video; - path = ../../src/video; - sourceTree = SOURCE_ROOT; + path = video; + sourceTree = ""; }; 04BDFEC112E6671800899322 /* cocoa */ = { isa = PBXGroup; @@ -1589,6 +1744,8 @@ 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */, AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */, AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */, + 4D7517281EE2562B00820EEA /* SDL_cocoametalview.h */, + 4D1664501EDD60AD003DE88E /* SDL_cocoametalview.m */, 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */, 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */, 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */, @@ -1597,10 +1754,14 @@ D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */, 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */, 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */, + 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */, + 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */, 04BDFECE12E6671800899322 /* SDL_cocoashape.h */, 04BDFECF12E6671800899322 /* SDL_cocoashape.m */, 04BDFED012E6671800899322 /* SDL_cocoavideo.h */, 04BDFED112E6671800899322 /* SDL_cocoavideo.m */, + 4D1664511EDD60AD003DE88E /* SDL_cocoavulkan.h */, + 4D1664521EDD60AD003DE88E /* SDL_cocoavulkan.m */, 04BDFED212E6671800899322 /* SDL_cocoawindow.h */, 04BDFED312E6671800899322 /* SDL_cocoawindow.m */, ); @@ -1668,7 +1829,7 @@ 08FB77ACFE841707C02AAC07 /* Library Source */, 034768DDFF38A45A11DB9C8B /* Products */, BECDF66B0761BA81005FE872 /* Info-Framework.plist */, - BEC562FE0761C0E800A33029 /* Linked Frameworks */, + 564624341FF821B70074AC87 /* Frameworks */, ); comments = "To build Universal Binaries, we have experimented with a variety of different options.\nThe complication is that we must retain compatibility with at least 10.2. \nThe Universal Binary defaults only work for > 10.3.9\n\nSo far, we have found:\ngcc 4.0.0 with Xcode 2.1 always links against libgcc_s. gcc 4.0.1 from Xcode 2.2 fixes this problem.\n\nBut gcc 4.0 will not work with < 10.3.9 because we continue to get an undefined symbol to _fprintf$LDBL128.\nSo we must use gcc 3.3 on PPC to accomplish 10.2 support. (But 4.0 is required for i386.)\n\nSetting the deployment target to 10.4 will disable prebinding, so for PPC, we set it less than 10.4 to preserve prebinding for legacy support.\n\nSetting the PPC SDKROOT to /Developers/SDKs/MacOSX10.2.8.sdk will link to 63.0.0 libSystem.B.dylib. Leaving it at current or 10.4u links to 88.1.2. However, as long as we are using gcc 3.3, it doesn't seem to matter as testing has demonstrated both will run. We have decided not to invoke the 10.2.8 SDK because it is not a default installed component with Xcode which will probably cause most people problems. However, rather than deleting the SDKROOT_ppc entry entirely, we have mapped it to 10.4u in case we decide we need to change this setting.\n\nTo use Altivec or SSE, we needed architecture specific flags:\nOTHER_CFLAGS_ppc\nOTHER_CFLAGS_i386\nOTHER_CFLAGS=$(OTHER_CFLAGS_($CURRENT_ARCH))\n\nThe general OTHER_CFLAGS needed to be manually mapped to architecture specific options because Xcode didn't do this automatically for us.\n\n\n"; indentWidth = 4; @@ -1677,13 +1838,6 @@ tabWidth = 4; usesTabs = 0; }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - ); - name = Resources; - sourceTree = ""; - }; 08FB77ACFE841707C02AAC07 /* Library Source */ = { isa = PBXGroup; children = ( @@ -1695,10 +1849,12 @@ 567E2F1F17C44BBB005F1892 /* filesystem */, 04BDFDEC12E6671700899322 /* file */, 04BDFDF112E6671700899322 /* haptic */, + A73EBCD520F099C10043B449 /* hidapi */, 04BDFDFF12E6671700899322 /* joystick */, 04BDFE2F12E6671700899322 /* loadso */, 04BDFE4512E6671700899322 /* power */, 041B2C9712FA0D680087D585 /* render */, + F3950CDB212BC8BC00F51292 /* sensor */, 04BDFE5D12E6671700899322 /* stdlib */, 04BDFE6412E6671800899322 /* thread */, 04BDFE9512E6671800899322 /* timer */, @@ -1706,6 +1862,8 @@ 56A670081856545C0007D20F /* SDL_internal.h */, 04BDFE5512E6671700899322 /* SDL_assert_c.h */, 04BDFE5612E6671700899322 /* SDL_assert.c */, + 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */, + 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */, 04BDFE5812E6671700899322 /* SDL_error_c.h */, 04BDFE5912E6671700899322 /* SDL_error.c */, 0442EC5E12FE1C75004C9285 /* SDL_hints.c */, @@ -1713,6 +1871,24 @@ 04BDFE5C12E6671700899322 /* SDL.c */, ); name = "Library Source"; + path = ../../src; + sourceTree = ""; + }; + 564624341FF821B70074AC87 /* Frameworks */ = { + isa = PBXGroup; + children = ( + A7381E931D8B69C300B177DD /* AudioToolbox.framework */, + 007317C10858E15000B2BC32 /* Carbon.framework */, + 0073179D0858DECD00B2BC32 /* Cocoa.framework */, + A7381E951D8B69D600B177DD /* CoreAudio.framework */, + 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, + FA73671C19A540EF004122E4 /* CoreVideo.framework */, + 00CFA89C106B4BA100758660 /* ForceFeedback.framework */, + 0073179F0858DECD00B2BC32 /* IOKit.framework */, + 564624371FF821CB0074AC87 /* Metal.framework */, + 564624351FF821B80074AC87 /* QuartzCore.framework */, + ); + name = Frameworks; sourceTree = ""; }; 567E2F1F17C44BBB005F1892 /* filesystem */ = { @@ -1720,7 +1896,7 @@ children = ( 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */, ); - name = filesystem; + path = filesystem; sourceTree = ""; }; 56A6701C1856549B0007D20F /* dynapi */ = { @@ -1731,25 +1907,89 @@ 56A6701F185654B40007D20F /* SDL_dynapi.h */, 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */, ); - name = dynapi; + path = dynapi; sourceTree = ""; }; - BEC562FE0761C0E800A33029 /* Linked Frameworks */ = { + 5C2EF6921FC986D8003F5197 /* opengles2 */ = { isa = PBXGroup; children = ( - FA73671C19A540EF004122E4 /* CoreVideo.framework */, - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, - 007317C10858E15000B2BC32 /* Carbon.framework */, - 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */, - 0073179C0858DECD00B2BC32 /* AudioUnit.framework */, - 0073179D0858DECD00B2BC32 /* Cocoa.framework */, - 0073179E0858DECD00B2BC32 /* CoreAudio.framework */, - 0073179F0858DECD00B2BC32 /* IOKit.framework */, - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */, + 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */, + 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */, + 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */, + 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */, ); - name = "Linked Frameworks"; + path = opengles2; sourceTree = ""; }; + A704170720F09A6700A82227 /* mac */ = { + isa = PBXGroup; + children = ( + A704170820F09A9800A82227 /* hid.c */, + ); + path = mac; + sourceTree = ""; + }; + A704170C20F09AA600A82227 /* hidapi */ = { + isa = PBXGroup; + children = ( + A704171020F09AC900A82227 /* controller_type.h */, + A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */, + A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */, + A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */, + A704171220F09AC900A82227 /* SDL_hidapi_xboxone.c */, + A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */, + A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */, + ); + path = hidapi; + sourceTree = ""; + }; + A73EBCD520F099C10043B449 /* hidapi */ = { + isa = PBXGroup; + children = ( + A704170720F09A6700A82227 /* mac */, + ); + path = hidapi; + sourceTree = ""; + }; + AA9A7F0E1FB0200B00FED37F /* yuv2rgb */ = { + isa = PBXGroup; + children = ( + AA9A7F101FB0206300FED37F /* yuv_rgb.c */, + AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */, + ); + path = yuv2rgb; + sourceTree = ""; + }; + AADC5A401FDA030E00960936 /* metal */ = { + isa = PBXGroup; + children = ( + AADC5A421FDA035D00960936 /* SDL_render_metal.m */, + AADC5A411FDA035D00960936 /* SDL_shaders_metal_osx.h */, + ); + path = metal; + sourceTree = ""; + }; + F30D9C8D212CABB40047DF2E /* dummy */ = { + isa = PBXGroup; + children = ( + F30D9C8F212CABDB0047DF2E /* SDL_dummysensor.c */, + F30D9C8E212CABDB0047DF2E /* SDL_dummysensor.h */, + ); + path = dummy; + sourceTree = ""; + }; + F3950CDB212BC8BC00F51292 /* sensor */ = { + isa = PBXGroup; + children = ( + F30D9C8D212CABB40047DF2E /* dummy */, + F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */, + F30D9C83212BC94F0047DF2E /* SDL_sensor.c */, + F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */, + ); + name = sensor; + path = ../../src/sensor; + sourceTree = SOURCE_ROOT; + }; F59C70FC00D5CB5801000001 /* pkg-support */ = { isa = PBXGroup; children = ( @@ -1776,13 +2016,16 @@ buildActionMask = 2147483647; files = ( AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */, + AADC5A431FDA035D00960936 /* SDL_shaders_metal_osx.h in Headers */, AA7557FC1595D4D800BBD41B /* close_code.h in Headers */, AA75585E1595D4D800BBD41B /* SDL.h in Headers */, AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */, AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */, + F30D9C87212BC94F0047DF2E /* SDL_syssensor.h in Headers */, AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */, AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */, AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */, + 5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */, AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */, AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */, AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */, @@ -1799,9 +2042,12 @@ AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */, AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */, AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */, + F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */, AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */, + F30D9C84212BC94F0047DF2E /* SDL_sensor_c.h in Headers */, AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */, AA7558261595D4D800BBD41B /* SDL_log.h in Headers */, + 5C2EF6F91FC9EE35003F5197 /* SDL_egl_c.h in Headers */, AA7558281595D4D800BBD41B /* SDL_main.h in Headers */, AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */, AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */, @@ -1820,10 +2066,12 @@ AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */, AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */, AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */, + 5C2EF69F1FC987C6003F5197 /* SDL_gles2funcs.h in Headers */, AA7558401595D4D800BBD41B /* SDL_render.h in Headers */, AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */, AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */, AA7558461595D4D800BBD41B /* SDL_scancode.h in Headers */, + A704171720F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */, AA7558481595D4D800BBD41B /* SDL_shape.h in Headers */, AA75584A1595D4D800BBD41B /* SDL_stdinc.h in Headers */, AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */, @@ -1835,12 +2083,14 @@ AA7558581595D4D800BBD41B /* SDL_types.h in Headers */, AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */, AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */, + 5C2EF6A11FC987C6003F5197 /* SDL_shaders_gles2.h in Headers */, + AA8167541F5E727800518735 /* SDL_vulkan.h in Headers */, + 4D7517291EE2562B00820EEA /* SDL_cocoametalview.h in Headers */, 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */, 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */, 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */, 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */, 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */, - 04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */, 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */, 04BD003612E6671800899322 /* SDL_wave.h in Headers */, 04BD004212E6671800899322 /* blank_cursor.h in Headers */, @@ -1853,6 +2103,7 @@ 04BD004B12E6671800899322 /* SDL_events_c.h in Headers */, 04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */, 04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */, + AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */, 04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */, 04BD005312E6671800899322 /* SDL_sysevents.h in Headers */, 04BD005512E6671800899322 /* SDL_touch_c.h in Headers */, @@ -1871,14 +2122,18 @@ 04BD00CB12E6671800899322 /* SDL_thread_c.h in Headers */, 04BD00D812E6671800899322 /* SDL_timer_c.h in Headers */, 04BD00F312E6671800899322 /* SDL_cocoaclipboard.h in Headers */, + 4D1664541EDD60AD003DE88E /* SDL_cocoavulkan.h in Headers */, 04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */, 04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */, + 5C2EF6EF1FC9D0ED003F5197 /* SDL_cocoaopengles.h in Headers */, 04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */, 04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */, 04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */, 04BD00FF12E6671800899322 /* SDL_cocoashape.h in Headers */, + 56115BBC1DF72C6D00F47E1E /* SDL_dataqueue.h in Headers */, 04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */, 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */, + 5C2EF6F71FC9EE35003F5197 /* SDL_rect_c.h in Headers */, 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */, 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */, 04BD017612E6671800899322 /* SDL_blit.h in Headers */, @@ -1890,6 +2145,8 @@ 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */, 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */, 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */, + F30D9CCD212EB4810047DF2E /* SDL_displayevents_c.h in Headers */, + 4D16644E1EDD6023003DE88E /* SDL_vulkan_internal.h in Headers */, 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */, 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */, 04BD01E212E6671800899322 /* SDL_x11events.h in Headers */, @@ -1905,7 +2162,8 @@ 04BD01F712E6671800899322 /* SDL_x11video.h in Headers */, 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */, 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */, + AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */, + A704171D20F09AC900A82227 /* controller_type.h in Headers */, 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, @@ -1913,6 +2171,7 @@ 04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, 56A67027185654B40007D20F /* SDL_dynapi.h in Headers */, 04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */, + F30D9C90212CABDC0047DF2E /* SDL_dummysensor.h in Headers */, 04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */, 04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, 0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */, @@ -1942,6 +2201,7 @@ AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */, AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */, AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */, + F30D9C85212BC94F0047DF2E /* SDL_sensor_c.h in Headers */, AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */, AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */, AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */, @@ -1955,6 +2215,7 @@ AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */, AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */, AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */, + A704171E20F09AC900A82227 /* controller_type.h in Headers */, AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */, AA7558271595D4D800BBD41B /* SDL_log.h in Headers */, AA7558291595D4D800BBD41B /* SDL_main.h in Headers */, @@ -1977,13 +2238,16 @@ AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */, AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */, AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */, + 56F9D55E1DF73B7C00C15B5D /* SDL_dataqueue.h in Headers */, 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, + F30D9CCE212EB4810047DF2E /* SDL_displayevents_c.h in Headers */, AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */, AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */, AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */, AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */, AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */, AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */, + F30D9C88212BC94F0047DF2E /* SDL_syssensor.h in Headers */, AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */, AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */, AA7558591595D4D800BBD41B /* SDL_types.h in Headers */, @@ -1996,35 +2260,42 @@ 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */, 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */, AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - 04BD024712E6671800899322 /* SDL_audiomem.h in Headers */, 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */, 04BD025212E6671800899322 /* SDL_wave.h in Headers */, 04BD025D12E6671800899322 /* blank_cursor.h in Headers */, 04BD025E12E6671800899322 /* default_cursor.h in Headers */, 04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */, + AADC5A4F1FDA05E600960936 /* SDL_cocoavulkan.h in Headers */, + 5C2EF6FA1FC9EE64003F5197 /* SDL_egl_c.h in Headers */, 04BD026012E6671800899322 /* scancodes_linux.h in Headers */, 04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */, 04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */, 04BD026612E6671800899322 /* SDL_events_c.h in Headers */, 56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */, 04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */, + AADC5A4D1FDA05D300960936 /* SDL_vulkan_internal.h in Headers */, 04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */, + AADC5A491FDA05C100960936 /* yuv_rgb.h in Headers */, 04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */, 04BD026E12E6671800899322 /* SDL_sysevents.h in Headers */, 04BD027012E6671800899322 /* SDL_touch_c.h in Headers */, 04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */, 04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */, + 5C2EF6FC1FC9EE64003F5197 /* SDL_rect_c.h in Headers */, + F30D9C91212CABDC0047DF2E /* SDL_dummysensor.h in Headers */, 04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */, 04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */, 04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */, 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */, 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */, + F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */, 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */, 04BD02B812E6671800899322 /* SDL_error_c.h in Headers */, 04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */, 04BD02DC12E6671800899322 /* SDL_systhread_c.h in Headers */, 04BD02E312E6671800899322 /* SDL_systhread.h in Headers */, 04BD02E512E6671800899322 /* SDL_thread_c.h in Headers */, + A704171820F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */, 04BD02F212E6671800899322 /* SDL_timer_c.h in Headers */, 04BD030D12E6671800899322 /* SDL_cocoaclipboard.h in Headers */, 04BD030F12E6671800899322 /* SDL_cocoaevents.h in Headers */, @@ -2034,6 +2305,7 @@ 04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */, 04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */, AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, + 5C2EF6F01FC9D181003F5197 /* SDL_cocoaopengles.h in Headers */, 04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */, 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */, 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */, @@ -2043,6 +2315,7 @@ 04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */, 04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */, 04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */, + 5C2EF6A71FC98D2D003F5197 /* SDL_gles2funcs.h in Headers */, 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */, 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */, 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */, @@ -2061,13 +2334,15 @@ 04BD040F12E6671800899322 /* SDL_x11video.h in Headers */, AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, 04BD041112E6671800899322 /* SDL_x11window.h in Headers */, + AADC5A4B1FDA05CF00960936 /* SDL_yuv_c.h in Headers */, 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */, 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, 04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, + 5C2EF6AA1FC98D2D003F5197 /* SDL_shaders_gles2.h in Headers */, 04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, 04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */, 04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, + AADC5A461FDA047B00960936 /* SDL_shaders_metal_osx.h in Headers */, 04F7805B12FB74A200FC43C0 /* SDL_draw.h in Headers */, 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */, 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, @@ -2097,6 +2372,7 @@ DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */, DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */, DB313FD017554B71006C0E22 /* SDL_config.h in Headers */, + F30D9C86212BC94F0047DF2E /* SDL_sensor_c.h in Headers */, DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */, DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */, DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */, @@ -2110,6 +2386,7 @@ DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */, DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */, DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, + A704171F20F09AC900A82227 /* controller_type.h in Headers */, DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */, DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */, DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */, @@ -2132,13 +2409,16 @@ DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */, DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */, DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */, + 56F9D55F1DF73B7D00C15B5D /* SDL_dataqueue.h in Headers */, 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, + F30D9CCF212EB4810047DF2E /* SDL_displayevents_c.h in Headers */, DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */, DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */, DB313FF117554B71006C0E22 /* SDL_system.h in Headers */, DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */, AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */, DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */, + F30D9C89212BC94F0047DF2E /* SDL_syssensor.h in Headers */, DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */, DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */, DB313FF617554B71006C0E22 /* SDL_types.h in Headers */, @@ -2151,35 +2431,42 @@ DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */, DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */, AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */, DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */, DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */, DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */, DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */, DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */, + AADC5A501FDA05E600960936 /* SDL_cocoavulkan.h in Headers */, + 5C2EF6FD1FC9EE65003F5197 /* SDL_egl_c.h in Headers */, DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */, DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */, DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */, DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */, 56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */, DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */, + AADC5A4E1FDA05D400960936 /* SDL_vulkan_internal.h in Headers */, DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */, + AADC5A4A1FDA05C200960936 /* yuv_rgb.h in Headers */, DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */, DB313F8617554B71006C0E22 /* SDL_sysevents.h in Headers */, DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */, DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */, DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */, + 5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */, + F30D9C92212CABDC0047DF2E /* SDL_dummysensor.h in Headers */, DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */, DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */, DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */, DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */, DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */, + F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */, DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */, DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */, DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */, DB313F9317554B71006C0E22 /* SDL_systhread_c.h in Headers */, DB313F9417554B71006C0E22 /* SDL_systhread.h in Headers */, DB313F9517554B71006C0E22 /* SDL_thread_c.h in Headers */, + A704171920F09AC900A82227 /* SDL_hidapijoystick_c.h in Headers */, DB313F9617554B71006C0E22 /* SDL_timer_c.h in Headers */, DB313F9717554B71006C0E22 /* SDL_cocoaclipboard.h in Headers */, DB313F9817554B71006C0E22 /* SDL_cocoaevents.h in Headers */, @@ -2189,6 +2476,7 @@ DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */, DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */, AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, + 5C2EF6F21FC9D182003F5197 /* SDL_cocoaopengles.h in Headers */, DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */, DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */, DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */, @@ -2198,6 +2486,7 @@ DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */, DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */, DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */, + 5C2EF6AB1FC98D2E003F5197 /* SDL_gles2funcs.h in Headers */, DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */, DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */, DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */, @@ -2216,13 +2505,15 @@ DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */, AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */, + AADC5A4C1FDA05CF00960936 /* SDL_yuv_c.h in Headers */, DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */, - DB313FB917554B71006C0E22 /* mmx.h in Headers */, DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */, DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */, + 5C2EF6AE1FC98D2E003F5197 /* SDL_shaders_gles2.h in Headers */, DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */, DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */, DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */, + AADC5A471FDA047E00960936 /* SDL_shaders_metal_osx.h in Headers */, DB313FBF17554B71006C0E22 /* SDL_draw.h in Headers */, DB313FC017554B71006C0E22 /* SDL_drawline.h in Headers */, DB313FC117554B71006C0E22 /* SDL_drawpoint.h in Headers */, @@ -2323,15 +2614,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0630; - TargetAttributes = { - BECDF5FE0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - BECDF6BB0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - }; + LastUpgradeCheck = 1000; }; buildConfigurationList = 0073178E0858DB0500B2BC32 /* Build configuration list for PBXProject "SDL" */; compatibilityVersion = "Xcode 3.2"; @@ -2402,9 +2685,10 @@ files = ( 04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */, 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */, + 5C2EF6A21FC987C6003F5197 /* SDL_shaders_gles2.c in Sources */, + 56115BBB1DF72C6D00F47E1E /* SDL_dataqueue.c in Sources */, 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */, 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */, 04BD002612E6671800899322 /* SDL_audio.c in Sources */, 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */, 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */, @@ -2414,6 +2698,7 @@ 04BD004112E6671800899322 /* SDL_cpuinfo.c in Sources */, 04BD004812E6671800899322 /* SDL_clipboardevents.c in Sources */, 04BD004A12E6671800899322 /* SDL_events.c in Sources */, + A704172620F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */, 04BD004C12E6671800899322 /* SDL_gesture.c in Sources */, 04BD004E12E6671800899322 /* SDL_keyboard.c in Sources */, 04BD005012E6671800899322 /* SDL_mouse.c in Sources */, @@ -2424,12 +2709,14 @@ 04BD005A12E6671800899322 /* SDL_rwops.c in Sources */, 04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */, 04BD005F12E6671800899322 /* SDL_haptic.c in Sources */, + 4D1664551EDD60AD003DE88E /* SDL_cocoavulkan.m in Sources */, 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */, 04BD007012E6671800899322 /* SDL_joystick.c in Sources */, 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */, 04BD009412E6671800899322 /* SDL_syspower.c in Sources */, 04BD009612E6671800899322 /* SDL_power.c in Sources */, 04BD009C12E6671800899322 /* SDL_assert.c in Sources */, + 4D1664531EDD60AD003DE88E /* SDL_cocoametalview.m in Sources */, 04BD009F12E6671800899322 /* SDL_error.c in Sources */, 04BD00A212E6671800899322 /* SDL.c in Sources */, 04BD00A312E6671800899322 /* SDL_getenv.c in Sources */, @@ -2440,6 +2727,7 @@ 04BD00A812E6671800899322 /* SDL_string.c in Sources */, 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */, 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */, + FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */, 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */, 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */, 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */, @@ -2448,20 +2736,27 @@ 04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */, 04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */, 04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */, + AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */, + A704171A20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */, 04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */, + 4D16644F1EDD6023003DE88E /* SDL_vulkan_utils.c in Sources */, 04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */, 04BD00FE12E6671800899322 /* SDL_cocoaopengl.m in Sources */, 04BD010012E6671800899322 /* SDL_cocoashape.m in Sources */, 04BD010212E6671800899322 /* SDL_cocoavideo.m in Sources */, 04BD010412E6671800899322 /* SDL_cocoawindow.m in Sources */, 04BD011712E6671800899322 /* SDL_nullevents.c in Sources */, + A704172320F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */, 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */, 04BD017512E6671800899322 /* SDL_blit.c in Sources */, 04BD017712E6671800899322 /* SDL_blit_0.c in Sources */, 04BD017812E6671800899322 /* SDL_blit_1.c in Sources */, + AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */, 04BD017912E6671800899322 /* SDL_blit_A.c in Sources */, 04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */, 04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */, + A704172020F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */, + A704170920F09A9800A82227 /* hid.c in Sources */, 04BD017E12E6671800899322 /* SDL_blit_N.c in Sources */, 04BD017F12E6671800899322 /* SDL_blit_slow.c in Sources */, 04BD018112E6671800899322 /* SDL_bmp.c in Sources */, @@ -2470,6 +2765,7 @@ 04BD018C12E6671800899322 /* SDL_pixels.c in Sources */, 04BD018E12E6671800899322 /* SDL_rect.c in Sources */, 04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */, + A704171420F09AC900A82227 /* SDL_hidapijoystick.c in Sources */, 04BD019812E6671800899322 /* SDL_shape.c in Sources */, 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */, 04BD019B12E6671800899322 /* SDL_surface.c in Sources */, @@ -2477,6 +2773,7 @@ 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */, 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */, 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */, + 5C2EF6A01FC987C6003F5197 /* SDL_render_gles2.c in Sources */, 04BD01E112E6671800899322 /* SDL_x11events.c in Sources */, 04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */, 04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */, @@ -2488,20 +2785,25 @@ 04BD01F612E6671800899322 /* SDL_x11video.c in Sources */, 04BD01F812E6671800899322 /* SDL_x11window.c in Sources */, 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, 04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, 04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, + AADC5A441FDA035D00960936 /* SDL_render_metal.m in Sources */, 04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */, 04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, + F30D9C93212CABDC0047DF2E /* SDL_dummysensor.c in Sources */, + 5C2EF6F81FC9EE35003F5197 /* SDL_egl.c in Sources */, 04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */, 04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */, + F30D9CD0212EB4810047DF2E /* SDL_displayevents.c in Sources */, 0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, 0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, 0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */, 56A67024185654B40007D20F /* SDL_dynapi.c in Sources */, + F30D9C8A212BC94F0047DF2E /* SDL_sensor.c in Sources */, 04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */, + 5C2EF6EE1FC9D0ED003F5197 /* SDL_cocoaopengles.m in Sources */, 0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */, 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */, AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */, @@ -2519,20 +2821,26 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4D1664571EDD61F0003DE88E /* SDL_cocoametalview.m in Sources */, + 4D1664581EDD61F0003DE88E /* SDL_cocoavulkan.m in Sources */, + 5C2EF6A91FC98D2D003F5197 /* SDL_shaders_gles2.c in Sources */, + 4D1664561EDD61DA003DE88E /* SDL_vulkan_utils.c in Sources */, 04BD021712E6671800899322 /* SDL_atomic.c in Sources */, 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */, + 56F9D55C1DF73B6B00C15B5D /* SDL_dataqueue.c in Sources */, 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */, 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */, 04BD024212E6671800899322 /* SDL_audio.c in Sources */, 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */, 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */, 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */, 04BD024912E6671800899322 /* SDL_mixer.c in Sources */, 04BD025112E6671800899322 /* SDL_wave.c in Sources */, + A704172720F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */, 04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */, 04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */, 04BD026512E6671800899322 /* SDL_events.c in Sources */, + 5C2EF6FB1FC9EE64003F5197 /* SDL_egl.c in Sources */, AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */, 04BD026712E6671800899322 /* SDL_gesture.c in Sources */, 04BD026912E6671800899322 /* SDL_keyboard.c in Sources */, @@ -2559,6 +2867,7 @@ 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */, 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */, 04BD02C212E6671800899322 /* SDL_string.c in Sources */, + 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */, 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */, 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */, @@ -2566,19 +2875,26 @@ 04BD02E412E6671800899322 /* SDL_thread.c in Sources */, 04BD02F112E6671800899322 /* SDL_timer.c in Sources */, 04BD02F312E6671800899322 /* SDL_systimer.c in Sources */, + A704171B20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */, 04BD030E12E6671800899322 /* SDL_cocoaclipboard.m in Sources */, 04BD031012E6671800899322 /* SDL_cocoaevents.m in Sources */, 04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */, 04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */, 04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */, + 5C2EF6A31FC98B38003F5197 /* SDL_yuv.c in Sources */, + 5C2EF6F11FC9D181003F5197 /* SDL_cocoaopengles.m in Sources */, 04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */, + A704172420F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */, 04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */, 04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */, 04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */, 04BD033112E6671800899322 /* SDL_nullevents.c in Sources */, 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */, + 5C2EF6A51FC98B6B003F5197 /* yuv_rgb.c in Sources */, 04BD038F12E6671800899322 /* SDL_blit.c in Sources */, 04BD039112E6671800899322 /* SDL_blit_0.c in Sources */, + A704172120F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */, + A704170A20F09A9800A82227 /* hid.c in Sources */, 04BD039212E6671800899322 /* SDL_blit_1.c in Sources */, 04BD039312E6671800899322 /* SDL_blit_A.c in Sources */, 04BD039412E6671800899322 /* SDL_blit_auto.c in Sources */, @@ -2587,6 +2903,7 @@ 04BD039912E6671800899322 /* SDL_blit_slow.c in Sources */, 04BD039B12E6671800899322 /* SDL_bmp.c in Sources */, 04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */, + A704171520F09AC900A82227 /* SDL_hidapijoystick.c in Sources */, 04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */, 04BD03A612E6671800899322 /* SDL_pixels.c in Sources */, 04BD03A812E6671800899322 /* SDL_rect.c in Sources */, @@ -2596,6 +2913,7 @@ 04BD03B512E6671800899322 /* SDL_surface.c in Sources */, 04BD03B712E6671800899322 /* SDL_video.c in Sources */, 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */, + 5C2EF6A81FC98D2D003F5197 /* SDL_render_gles2.c in Sources */, 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */, 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */, 04BD03F912E6671800899322 /* SDL_x11events.c in Sources */, @@ -2608,17 +2926,20 @@ 04BD040C12E6671800899322 /* SDL_x11touch.c in Sources */, 04BD040E12E6671800899322 /* SDL_x11video.c in Sources */, 04BD041012E6671800899322 /* SDL_x11window.c in Sources */, + AADC5A451FDA047900960936 /* SDL_render_metal.m in Sources */, 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, + F30D9C94212CABDC0047DF2E /* SDL_dummysensor.c in Sources */, 04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, 04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, 04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */, 04F7805912FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, + F30D9CD1212EB4810047DF2E /* SDL_displayevents.c in Sources */, 04F7805C12FB74A200FC43C0 /* SDL_drawline.c in Sources */, 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, 0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */, 0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, + F30D9C8B212BC94F0047DF2E /* SDL_sensor.c in Sources */, 56A67025185654B40007D20F /* SDL_dynapi.c in Sources */, 0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, 0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */, @@ -2638,20 +2959,26 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4D16645A1EDD6235003DE88E /* SDL_cocoametalview.m in Sources */, + 4D16645B1EDD6235003DE88E /* SDL_cocoavulkan.m in Sources */, + 5C2EF6AD1FC98D2E003F5197 /* SDL_shaders_gles2.c in Sources */, + 4D1664591EDD621B003DE88E /* SDL_vulkan_utils.c in Sources */, DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */, DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */, + 56F9D55D1DF73B6C00C15B5D /* SDL_dataqueue.c in Sources */, DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */, DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */, - DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */, DB31400317554B71006C0E22 /* SDL_audio.c in Sources */, DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */, DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */, DB31400617554B71006C0E22 /* SDL_audiotypecvt.c in Sources */, DB31400717554B71006C0E22 /* SDL_mixer.c in Sources */, DB31400817554B71006C0E22 /* SDL_wave.c in Sources */, + A704172820F09AC900A82227 /* SDL_hidapi_xbox360.c in Sources */, DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */, DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */, DB31400B17554B71006C0E22 /* SDL_events.c in Sources */, + 5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */, DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */, DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */, DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */, @@ -2678,6 +3005,7 @@ DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */, DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */, DB31402617554B71006C0E22 /* SDL_string.c in Sources */, + 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */, DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */, DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */, @@ -2685,19 +3013,26 @@ DB31402B17554B71006C0E22 /* SDL_thread.c in Sources */, DB31402C17554B71006C0E22 /* SDL_timer.c in Sources */, DB31402D17554B71006C0E22 /* SDL_systimer.c in Sources */, + A704171C20F09AC900A82227 /* SDL_hidapi_switch.c in Sources */, DB31402E17554B71006C0E22 /* SDL_cocoaclipboard.m in Sources */, DB31402F17554B71006C0E22 /* SDL_cocoaevents.m in Sources */, DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */, DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */, DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */, + 5C2EF6A41FC98B39003F5197 /* SDL_yuv.c in Sources */, + 5C2EF6F31FC9D182003F5197 /* SDL_cocoaopengles.m in Sources */, DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */, + A704172520F09AC900A82227 /* SDL_hidapi_xboxone.c in Sources */, DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */, DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */, DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */, DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */, DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */, + 5C2EF6A61FC98B6C003F5197 /* yuv_rgb.c in Sources */, DB31403917554B71006C0E22 /* SDL_blit.c in Sources */, DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */, + A704172220F09AC900A82227 /* SDL_hidapi_ps4.c in Sources */, + A704170B20F09A9800A82227 /* hid.c in Sources */, DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */, DB31403C17554B71006C0E22 /* SDL_blit_A.c in Sources */, DB31403D17554B71006C0E22 /* SDL_blit_auto.c in Sources */, @@ -2706,6 +3041,7 @@ DB31404017554B71006C0E22 /* SDL_blit_slow.c in Sources */, DB31404117554B71006C0E22 /* SDL_bmp.c in Sources */, DB31404217554B71006C0E22 /* SDL_clipboard.c in Sources */, + A704171620F09AC900A82227 /* SDL_hidapijoystick.c in Sources */, DB31404317554B71006C0E22 /* SDL_fillrect.c in Sources */, DB31404417554B71006C0E22 /* SDL_pixels.c in Sources */, DB31404517554B71006C0E22 /* SDL_rect.c in Sources */, @@ -2715,6 +3051,7 @@ DB31404917554B71006C0E22 /* SDL_surface.c in Sources */, DB31404A17554B71006C0E22 /* SDL_video.c in Sources */, DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */, + 5C2EF6AC1FC98D2E003F5197 /* SDL_render_gles2.c in Sources */, DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */, DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */, DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */, @@ -2727,17 +3064,20 @@ DB31405517554B71006C0E22 /* SDL_x11touch.c in Sources */, DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */, DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */, + AADC5A481FDA048100960936 /* SDL_render_metal.m in Sources */, DB31405817554B71006C0E22 /* SDL_render.c in Sources */, - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */, DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */, + F30D9C95212CABDC0047DF2E /* SDL_dummysensor.c in Sources */, DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */, DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */, DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */, DB31405E17554B71006C0E22 /* SDL_blendpoint.c in Sources */, + F30D9CD2212EB4810047DF2E /* SDL_displayevents.c in Sources */, DB31405F17554B71006C0E22 /* SDL_drawline.c in Sources */, DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */, DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */, DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */, + F30D9C8C212BC94F0047DF2E /* SDL_sensor.c in Sources */, 56A67026185654B40007D20F /* SDL_dynapi.c in Sources */, DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */, DB31406417554B71006C0E22 /* SDL_hints.c in Sources */, @@ -2767,14 +3107,47 @@ 00CFA621106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEPLOYMENT_POSTPROCESSING = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; GCC_AUTO_VECTORIZATION = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_SYMBOLS_PRIVATE_EXTERN = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/X11R6/include, + "$(VULKAN_SDK)/include", + ../../src/video/khronos, + ../../src/hidapi/hidapi, + ); + MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = macosx; STRIP_STYLE = "non-global"; }; @@ -2783,15 +3156,20 @@ 00CFA622106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.0.0; + DYLIB_CURRENT_VERSION = 10.0.0; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; INSTALL_PATH = "@rpath"; OTHER_LDFLAGS = "-liconv"; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = framework; @@ -2801,6 +3179,7 @@ 00CFA623106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "$(GCC_PREPROCESSOR_DEFINITIONS)", @@ -2810,7 +3189,6 @@ "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; }; @@ -2819,6 +3197,7 @@ 00CFA625106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; PRODUCT_NAME = "Standard DMG"; PROVISIONING_PROFILE = ""; }; @@ -2827,12 +3206,46 @@ 00CFA627106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_ALTIVEC_EXTENSIONS = YES; GCC_AUTO_VECTORIZATION = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/X11R6/include, + "$(VULKAN_SDK)/include", + ../../src/video/khronos, + ../../src/hidapi/hidapi, + ); + MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; @@ -2842,15 +3255,20 @@ 00CFA628106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.0.0; + DYLIB_CURRENT_VERSION = 10.0.0; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; INSTALL_PATH = "@rpath"; OTHER_LDFLAGS = "-liconv"; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = framework; @@ -2860,6 +3278,7 @@ 00CFA629106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "$(GCC_PREPROCESSOR_DEFINITIONS)", @@ -2869,7 +3288,6 @@ "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; }; @@ -2878,6 +3296,7 @@ 00CFA62B106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; PRODUCT_NAME = "Standard DMG"; PROVISIONING_PROFILE = ""; }; @@ -2886,6 +3305,7 @@ DB31407517554B71006C0E22 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -2896,7 +3316,6 @@ "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; INSTALL_PATH = "@rpath"; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; @@ -2906,6 +3325,7 @@ DB31407617554B71006C0E22 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -2916,7 +3336,6 @@ "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; INSTALL_PATH = "@rpath"; PRODUCT_NAME = SDL2; SKIP_INSTALL = YES; diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/Xcode/SDL/SDL.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/SDL.info b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/SDL.info old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/SDL.info rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/SDL.info diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/License.txt b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/License.txt similarity index 93% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/License.txt rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/License.txt index 3c7724df19..c63f9970a7 100644 --- a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/License.txt +++ b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/License.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga +Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/ReadMe.txt b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/ReadMe.txt old mode 100755 new mode 100644 similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/ReadMe.txt rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/ReadMe.txt diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/SDL_DS_Store similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/resources/SDL_DS_Store rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/resources/SDL_DS_Store diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/sdl_logo.pdf b/3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/sdl_logo.pdf similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDL/pkg-support/sdl_logo.pdf rename to 3rdparty/sdl2-2.0.9/Xcode/SDL/pkg-support/sdl_logo.pdf diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/3rdparty/sdl2-2.0.9/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj old mode 100755 new mode 100644 similarity index 92% rename from 3rdparty/sdl2-2.0.4/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj rename to 3rdparty/sdl2-2.0.9/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index 59cdd631b8..8c524cc54e --- a/3rdparty/sdl2-2.0.4/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/3rdparty/sdl2-2.0.9/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -348,6 +348,54 @@ 00794EF009D23739003FC8A1 /* utf8.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6309D20839003FC8A1 /* utf8.txt */; }; 00794EF709D237DE003FC8A1 /* moose.dat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5E09D20839003FC8A1 /* moose.dat */; }; 453774A5120915E3002F0F45 /* testshape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453774A4120915E3002F0F45 /* testshape.c */; }; + 66E88E5C203B733D0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E5D203B73530004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E5E203B74490004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E5F203B74860004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E60203B74C20004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E61203B74CC0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E62203B74D50004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E63203B74DC0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E64203B74E50004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E65203B74EC0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E66203B75140004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E67203B751D0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E68203B75250004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E69203B75390004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6A203B75450004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6B203B754C0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6C203B75540004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6D203B755B0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6E203B75620004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E6F203B756A0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E70203B75710004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E71203B75780004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E72203B757F0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E73203B758C0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E74203B75AF0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E75203B75B90004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E76203B75BF0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E77203B75C70004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E78203B75CE0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E79203B75D50004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7A203B75DE0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7B203B75E40004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7C203B75EB0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7D203B75F30004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7E203B75F90004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E7F203B76000004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E80203B76060004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E81203B760D0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E82203B76140004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E83203B761D0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E84203B76230004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E85203B762D0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E86203B76340004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E87203B763B0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E88203B76420004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E89203B764A0004D44E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66E88E5B203B733C0004D44E /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 66E88E8B203B778F0004D44E /* testyuv_cvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 66E88E8A203B778F0004D44E /* testyuv_cvt.c */; }; + AAF02FFA1F90092700B9A9FB /* SDL_test_memory.c in Sources */ = {isa = PBXBuildFile; fileRef = AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */; }; BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; @@ -1086,36 +1134,36 @@ /* Begin PBXFileReference section */ 0017958C10741F7900F5D044 /* testatomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testatomic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017958F1074216E00F5D044 /* testatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testatomic.c; path = ../../test/testatomic.c; sourceTree = SOURCE_ROOT; }; + 0017958F1074216E00F5D044 /* testatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testatomic.c; sourceTree = ""; }; 001795AD107421BF00F5D044 /* testaudioinfo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testaudioinfo; sourceTree = BUILT_PRODUCTS_DIR; }; - 001795B01074222D00F5D044 /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; }; + 001795B01074222D00F5D044 /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testaudioinfo.c; sourceTree = ""; }; 0017972110742F3200F5D044 /* testgl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgl2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017972710742FB900F5D044 /* testgl2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgl2.c; path = ../../test/testgl2.c; sourceTree = SOURCE_ROOT; }; + 0017972710742FB900F5D044 /* testgl2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgl2.c; sourceTree = ""; }; 00179748107430D600F5D044 /* testhaptic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhaptic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017974E1074315700F5D044 /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhaptic.c; path = ../../test/testhaptic.c; sourceTree = SOURCE_ROOT; }; + 0017974E1074315700F5D044 /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhaptic.c; sourceTree = ""; }; 0017976E107431B300F5D044 /* testdraw2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdraw2; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797711074320D00F5D044 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdraw2.c; path = ../../test/testdraw2.c; sourceTree = SOURCE_ROOT; }; + 001797711074320D00F5D044 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testdraw2.c; sourceTree = ""; }; 0017978E107432AE00F5D044 /* testime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testime; sourceTree = BUILT_PRODUCTS_DIR; }; - 00179791107432FA00F5D044 /* testime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testime.c; path = ../../test/testime.c; sourceTree = SOURCE_ROOT; }; + 00179791107432FA00F5D044 /* testime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testime.c; sourceTree = ""; }; 001797AE1074334C00F5D044 /* testintersections */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testintersections; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797B31074339C00F5D044 /* testintersections.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testintersections.c; path = ../../test/testintersections.c; sourceTree = SOURCE_ROOT; }; + 001797B31074339C00F5D044 /* testintersections.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testintersections.c; sourceTree = ""; }; 001797D0107433C600F5D044 /* testloadso */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testloadso; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797D31074343E00F5D044 /* testloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testloadso.c; path = ../../test/testloadso.c; sourceTree = SOURCE_ROOT; }; + 001797D31074343E00F5D044 /* testloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testloadso.c; sourceTree = ""; }; 001798121074355200F5D044 /* testmultiaudio */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmultiaudio; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798151074359B00F5D044 /* testmultiaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testmultiaudio.c; path = ../../test/testmultiaudio.c; sourceTree = SOURCE_ROOT; }; - 0017985A107436ED00F5D044 /* testnative.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnative.c; path = ../../test/testnative.c; sourceTree = SOURCE_ROOT; }; - 0017985B107436ED00F5D044 /* testnative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testnative.h; path = ../../test/testnative.h; sourceTree = SOURCE_ROOT; }; - 0017985C107436ED00F5D044 /* testnativecocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = testnativecocoa.m; path = ../../test/testnativecocoa.m; sourceTree = SOURCE_ROOT; }; - 00179872107438D000F5D044 /* testnativex11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnativex11.c; path = ../../test/testnativex11.c; sourceTree = SOURCE_ROOT; }; + 001798151074359B00F5D044 /* testmultiaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testmultiaudio.c; sourceTree = ""; }; + 0017985A107436ED00F5D044 /* testnative.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testnative.c; sourceTree = ""; }; + 0017985B107436ED00F5D044 /* testnative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testnative.h; sourceTree = ""; }; + 0017985C107436ED00F5D044 /* testnativecocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = testnativecocoa.m; sourceTree = ""; }; + 00179872107438D000F5D044 /* testnativex11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testnativex11.c; sourceTree = ""; }; 001798941074392D00F5D044 /* testnative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testnative; sourceTree = BUILT_PRODUCTS_DIR; }; 001798B5107439DF00F5D044 /* testpower */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testpower; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B910743A4900F5D044 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; + 001798B910743A4900F5D044 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testpower.c; sourceTree = ""; }; 001798F210743BEC00F5D044 /* testresample */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testresample; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798F910743E9200F5D044 /* testresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testresample.c; path = ../../test/testresample.c; sourceTree = SOURCE_ROOT; }; + 001798F910743E9200F5D044 /* testresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testresample.c; sourceTree = ""; }; 0017991610743F1000F5D044 /* testsprite2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testsprite2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017991910743F5300F5D044 /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsprite2.c; path = ../../test/testsprite2.c; sourceTree = SOURCE_ROOT; }; + 0017991910743F5300F5D044 /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testsprite2.c; sourceTree = ""; }; 0017993810743FB700F5D044 /* testwm2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testwm2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017993B10743FEF00F5D044 /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testwm2.c; path = ../../test/testwm2.c; sourceTree = SOURCE_ROOT; }; + 0017993B10743FEF00F5D044 /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testwm2.c; sourceTree = ""; }; 002A863B10730545007319AE /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; 002A863C10730545007319AE /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; 002A863D10730545007319AE /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; @@ -1125,34 +1173,37 @@ 002A873910730675007319AE /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 002F33A709CA188600EBEB88 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 002F341209CA1BFF00EBEB88 /* testfile */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfile; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F341709CA1C5B00EBEB88 /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testfile.c; path = ../../test/testfile.c; sourceTree = SOURCE_ROOT; }; + 002F341709CA1C5B00EBEB88 /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testfile.c; sourceTree = ""; }; 002F343109CA1F0300EBEB88 /* testiconv */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testiconv; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F343609CA1F6F00EBEB88 /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testiconv.c; path = ../../test/testiconv.c; sourceTree = SOURCE_ROOT; }; + 002F343609CA1F6F00EBEB88 /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testiconv.c; sourceTree = ""; }; 002F344D09CA1FB300EBEB88 /* testoverlay2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testoverlay2; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F345209CA201C00EBEB88 /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testoverlay2.c; path = ../../test/testoverlay2.c; sourceTree = SOURCE_ROOT; }; + 002F345209CA201C00EBEB88 /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testoverlay2.c; sourceTree = ""; }; 002F346A09CA204F00EBEB88 /* testplatform */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testplatform; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F346F09CA20A600EBEB88 /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testplatform.c; path = ../../test/testplatform.c; sourceTree = SOURCE_ROOT; }; + 002F346F09CA20A600EBEB88 /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testplatform.c; sourceTree = ""; }; 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; - 00794E5D09D20839003FC8A1 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = ../../test/icon.bmp; sourceTree = SOURCE_ROOT; }; - 00794E5E09D20839003FC8A1 /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = moose.dat; path = ../../test/moose.dat; sourceTree = SOURCE_ROOT; }; - 00794E5F09D20839003FC8A1 /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = picture.xbm; path = ../../test/picture.xbm; sourceTree = SOURCE_ROOT; }; - 00794E6109D20839003FC8A1 /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = sample.bmp; path = ../../test/sample.bmp; sourceTree = SOURCE_ROOT; }; - 00794E6209D20839003FC8A1 /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = sample.wav; path = ../../test/sample.wav; sourceTree = SOURCE_ROOT; }; - 00794E6309D20839003FC8A1 /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = utf8.txt; path = ../../test/utf8.txt; sourceTree = SOURCE_ROOT; }; - 083E4872006D84C97F000001 /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; }; - 083E4878006D85357F000001 /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; }; - 083E487E006D86A17F000001 /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testsem.c; path = ../../test/testsem.c; sourceTree = SOURCE_ROOT; }; - 083E4880006D86A17F000001 /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testtimer.c; path = ../../test/testtimer.c; sourceTree = SOURCE_ROOT; }; - 083E4882006D86A17F000001 /* testver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testver.c; path = ../../test/testver.c; sourceTree = SOURCE_ROOT; }; - 083E4887006D86A17F000001 /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = torturethread.c; path = ../../test/torturethread.c; sourceTree = SOURCE_ROOT; }; - 092D6D10FFB30A2C7F000001 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D58FFB311A97F000001 /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testthread.c; path = ../../test/testthread.c; sourceTree = SOURCE_ROOT; }; - 092D6D62FFB312AA7F000001 /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testjoystick.c; path = ../../test/testjoystick.c; sourceTree = SOURCE_ROOT; }; - 092D6D6CFFB313437F000001 /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testkeys.c; path = ../../test/testkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D75FFB313BB7F000001 /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testlock.c; path = ../../test/testlock.c; sourceTree = SOURCE_ROOT; }; + 00794E5D09D20839003FC8A1 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = icon.bmp; sourceTree = ""; }; + 00794E5E09D20839003FC8A1 /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; path = moose.dat; sourceTree = ""; }; + 00794E5F09D20839003FC8A1 /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = picture.xbm; sourceTree = ""; }; + 00794E6109D20839003FC8A1 /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = sample.bmp; sourceTree = ""; }; + 00794E6209D20839003FC8A1 /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = sample.wav; sourceTree = ""; }; + 00794E6309D20839003FC8A1 /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = utf8.txt; sourceTree = ""; }; + 083E4872006D84C97F000001 /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = loopwave.c; sourceTree = ""; }; + 083E4878006D85357F000001 /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testerror.c; sourceTree = ""; }; + 083E487E006D86A17F000001 /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testsem.c; sourceTree = ""; }; + 083E4880006D86A17F000001 /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testtimer.c; sourceTree = ""; }; + 083E4882006D86A17F000001 /* testver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testver.c; sourceTree = ""; }; + 083E4887006D86A17F000001 /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = torturethread.c; sourceTree = ""; }; + 092D6D10FFB30A2C7F000001 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = checkkeys.c; sourceTree = ""; }; + 092D6D58FFB311A97F000001 /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testthread.c; sourceTree = ""; }; + 092D6D62FFB312AA7F000001 /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testjoystick.c; sourceTree = ""; }; + 092D6D6CFFB313437F000001 /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testkeys.c; sourceTree = ""; }; + 092D6D75FFB313BB7F000001 /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testlock.c; sourceTree = ""; }; 4537749212091504002F0F45 /* testshape */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshape; sourceTree = BUILT_PRODUCTS_DIR; }; - 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testshape.c; path = ../../test/testshape.c; sourceTree = SOURCE_ROOT; }; - BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = ""; }; + 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testshape.c; sourceTree = ""; }; + 66E88E5B203B733C0004D44E /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; + 66E88E8A203B778F0004D44E /* testyuv_cvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testyuv_cvt.c; sourceTree = ""; }; + AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_memory.c; sourceTree = ""; }; + BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamecontroller.c; sourceTree = ""; }; BBFC08CD164C6862003E6A99 /* testgamecontroller */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgamecontroller; sourceTree = BUILT_PRODUCTS_DIR; }; BEC566B60761D90300A33029 /* checkkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = checkkeys; sourceTree = BUILT_PRODUCTS_DIR; }; BEC566D10761D90300A33029 /* loopwave */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = loopwave; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1165,37 +1216,37 @@ BEC567980761D90500A33029 /* testtimer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testtimer; sourceTree = BUILT_PRODUCTS_DIR; }; BEC567B20761D90500A33029 /* testversion */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testversion; sourceTree = BUILT_PRODUCTS_DIR; }; BEC567F50761D90600A33029 /* torturethread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = torturethread; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testdrawchessboard.c; path = ../../test/testdrawchessboard.c; sourceTree = ""; }; - DB0F48D817CA51D2008798C5 /* testfilesystem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testfilesystem.c; path = ../../test/testfilesystem.c; sourceTree = ""; }; + DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testdrawchessboard.c; sourceTree = ""; }; + DB0F48D817CA51D2008798C5 /* testfilesystem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testfilesystem.c; sourceTree = ""; }; DB0F48EC17CA51E5008798C5 /* testdrawchessboard */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdrawchessboard; sourceTree = BUILT_PRODUCTS_DIR; }; DB0F490117CA5212008798C5 /* testfilesystem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfilesystem; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166CBB16A1C74100A1396C /* testgesture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = ""; }; - DB166CBC16A1C74100A1396C /* testgles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgles.c; path = ../../test/testgles.c; sourceTree = ""; }; - DB166CBD16A1C74100A1396C /* testmessage.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testmessage.c; path = ../../test/testmessage.c; sourceTree = ""; }; - DB166CBF16A1C74100A1396C /* testrelative.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrelative.c; path = ../../test/testrelative.c; sourceTree = ""; }; - DB166CC016A1C74100A1396C /* testrendercopyex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendercopyex.c; path = ../../test/testrendercopyex.c; sourceTree = ""; }; - DB166CC116A1C74100A1396C /* testrendertarget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = ""; }; - DB166CC216A1C74100A1396C /* testrumble.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrumble.c; path = ../../test/testrumble.c; sourceTree = ""; }; - DB166CC316A1C74100A1396C /* testscale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = ""; }; - DB166CC416A1C74100A1396C /* testshader.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testshader.c; path = ../../test/testshader.c; sourceTree = ""; }; - DB166CC516A1C74100A1396C /* testspriteminimal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testspriteminimal.c; path = ../../test/testspriteminimal.c; sourceTree = ""; }; - DB166CC616A1C74100A1396C /* teststreaming.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = teststreaming.c; path = ../../test/teststreaming.c; sourceTree = ""; }; + DB166CBB16A1C74100A1396C /* testgesture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testgesture.c; sourceTree = ""; }; + DB166CBC16A1C74100A1396C /* testgles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testgles.c; sourceTree = ""; }; + DB166CBD16A1C74100A1396C /* testmessage.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testmessage.c; sourceTree = ""; }; + DB166CBF16A1C74100A1396C /* testrelative.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testrelative.c; sourceTree = ""; }; + DB166CC016A1C74100A1396C /* testrendercopyex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testrendercopyex.c; sourceTree = ""; }; + DB166CC116A1C74100A1396C /* testrendertarget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testrendertarget.c; sourceTree = ""; }; + DB166CC216A1C74100A1396C /* testrumble.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testrumble.c; sourceTree = ""; }; + DB166CC316A1C74100A1396C /* testscale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testscale.c; sourceTree = ""; }; + DB166CC416A1C74100A1396C /* testshader.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testshader.c; sourceTree = ""; }; + DB166CC516A1C74100A1396C /* testspriteminimal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testspriteminimal.c; sourceTree = ""; }; + DB166CC616A1C74100A1396C /* teststreaming.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = teststreaming.c; sourceTree = ""; }; DB166D7F16A1D12400A1396C /* libSDL_test.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL_test.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166D8416A1D1A500A1396C /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_assert.c; path = ../../src/test/SDL_test_assert.c; sourceTree = ""; }; - DB166D8516A1D1A500A1396C /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_common.c; path = ../../src/test/SDL_test_common.c; sourceTree = ""; }; - DB166D8616A1D1A500A1396C /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_compare.c; path = ../../src/test/SDL_test_compare.c; sourceTree = ""; }; - DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_crc32.c; path = ../../src/test/SDL_test_crc32.c; sourceTree = ""; }; - DB166D8816A1D1A500A1396C /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_font.c; path = ../../src/test/SDL_test_font.c; sourceTree = ""; }; - DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_fuzzer.c; path = ../../src/test/SDL_test_fuzzer.c; sourceTree = ""; }; - DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_harness.c; path = ../../src/test/SDL_test_harness.c; sourceTree = ""; }; - DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlit.c; path = ../../src/test/SDL_test_imageBlit.c; sourceTree = ""; }; - DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlitBlend.c; path = ../../src/test/SDL_test_imageBlitBlend.c; sourceTree = ""; }; - DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageFace.c; path = ../../src/test/SDL_test_imageFace.c; sourceTree = ""; }; - DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitives.c; path = ../../src/test/SDL_test_imagePrimitives.c; sourceTree = ""; }; - DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitivesBlend.c; path = ../../src/test/SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; - DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_log.c; path = ../../src/test/SDL_test_log.c; sourceTree = ""; }; - DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_md5.c; path = ../../src/test/SDL_test_md5.c; sourceTree = ""; }; - DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_random.c; path = ../../src/test/SDL_test_random.c; sourceTree = ""; }; + DB166D8416A1D1A500A1396C /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_assert.c; sourceTree = ""; }; + DB166D8516A1D1A500A1396C /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_common.c; sourceTree = ""; }; + DB166D8616A1D1A500A1396C /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_compare.c; sourceTree = ""; }; + DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_crc32.c; sourceTree = ""; }; + DB166D8816A1D1A500A1396C /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_font.c; sourceTree = ""; }; + DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_fuzzer.c; sourceTree = ""; }; + DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_harness.c; sourceTree = ""; }; + DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlit.c; sourceTree = ""; }; + DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageBlitBlend.c; sourceTree = ""; }; + DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imageFace.c; sourceTree = ""; }; + DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitives.c; sourceTree = ""; }; + DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; + DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_log.c; sourceTree = ""; }; + DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_md5.c; sourceTree = ""; }; + DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_random.c; sourceTree = ""; }; DB166DBF16A1D2F600A1396C /* testgesture */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgesture; sourceTree = BUILT_PRODUCTS_DIR; }; DB166DD516A1D36A00A1396C /* testmessage */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmessage; sourceTree = BUILT_PRODUCTS_DIR; }; DB166DEE16A1D50C00A1396C /* testrelative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrelative; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1206,16 +1257,16 @@ DB166E6816A1D6F300A1396C /* testshader */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshader; sourceTree = BUILT_PRODUCTS_DIR; }; DB166E7E16A1D78400A1396C /* testspriteminimal */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testspriteminimal; sourceTree = BUILT_PRODUCTS_DIR; }; DB166E9116A1D78C00A1396C /* teststreaming */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = teststreaming; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166ECF16A1D87000A1396C /* shapes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shapes; path = ../../test/shapes; sourceTree = ""; }; + DB166ECF16A1D87000A1396C /* shapes */ = {isa = PBXFileReference; lastKnownFileType = folder; path = shapes; sourceTree = ""; }; DB445EF818184B7000B306B0 /* testdropfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdropfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB445EFA18184BB600B306B0 /* testdropfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdropfile.c; path = ../../test/testdropfile.c; sourceTree = ""; }; + DB445EFA18184BB600B306B0 /* testdropfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testdropfile.c; sourceTree = ""; }; DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhotplug; sourceTree = BUILT_PRODUCTS_DIR; }; - DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhotplug.c; path = ../../test/testhotplug.c; sourceTree = ""; }; - DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "TestDropFile-Info.plist"; sourceTree = ""; }; - DBEC54D11A1A811D005B1EAB /* controllermap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = controllermap.c; path = ../../test/controllermap.c; sourceTree = ""; }; - DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = ""; }; - DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = ""; }; - DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = ""; }; + DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhotplug.c; sourceTree = ""; }; + DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestDropFile-Info.plist"; sourceTree = SOURCE_ROOT; }; + DBEC54D11A1A811D005B1EAB /* controllermap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = controllermap.c; sourceTree = ""; }; + DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = axis.bmp; sourceTree = ""; }; + DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = ""; }; + DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap.bmp; sourceTree = ""; }; DBEC54EA1A1A81C3005B1EAB /* controllermap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = controllermap; sourceTree = BUILT_PRODUCTS_DIR; }; FA73672219A54A90004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1225,6 +1276,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E5F203B74860004D44E /* Metal.framework in Frameworks */, FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */, 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */, 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */, @@ -1242,6 +1294,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E89203B764A0004D44E /* Metal.framework in Frameworks */, FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */, 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */, 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1259,6 +1312,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E80203B76060004D44E /* Metal.framework in Frameworks */, FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */, 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */, 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */, @@ -1277,6 +1331,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7F203B76000004D44E /* Metal.framework in Frameworks */, FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */, 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */, 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */, @@ -1294,6 +1349,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E88203B76420004D44E /* Metal.framework in Frameworks */, FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */, 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */, 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */, @@ -1312,6 +1368,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7C203B75EB0004D44E /* Metal.framework in Frameworks */, FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */, 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */, 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1330,6 +1387,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7B203B75E40004D44E /* Metal.framework in Frameworks */, FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */, 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */, 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1348,6 +1406,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E78203B75CE0004D44E /* Metal.framework in Frameworks */, FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */, 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */, 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */, @@ -1365,6 +1424,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E75203B75B90004D44E /* Metal.framework in Frameworks */, FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */, 001798021074355200F5D044 /* Cocoa.framework in Frameworks */, 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */, @@ -1382,6 +1442,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E74203B75AF0004D44E /* Metal.framework in Frameworks */, FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */, 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */, 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1399,6 +1460,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E71203B75780004D44E /* Metal.framework in Frameworks */, FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */, 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */, 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1416,6 +1478,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6D203B755B0004D44E /* Metal.framework in Frameworks */, FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */, 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */, 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */, @@ -1433,6 +1496,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E67203B751D0004D44E /* Metal.framework in Frameworks */, FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */, 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */, 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */, @@ -1451,6 +1515,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E61203B74CC0004D44E /* Metal.framework in Frameworks */, FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */, 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */, 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */, @@ -1469,6 +1534,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E84203B76230004D44E /* Metal.framework in Frameworks */, FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */, 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */, 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */, @@ -1486,6 +1552,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7D203B75F30004D44E /* Metal.framework in Frameworks */, FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */, 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */, 002A866210730547007319AE /* CoreAudio.framework in Frameworks */, @@ -1503,6 +1570,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E73203B758C0004D44E /* Metal.framework in Frameworks */, FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */, 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */, 002A868010730549007319AE /* CoreAudio.framework in Frameworks */, @@ -1520,6 +1588,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E72203B757F0004D44E /* Metal.framework in Frameworks */, FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */, 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */, 002A868610730549007319AE /* CoreAudio.framework in Frameworks */, @@ -1537,6 +1606,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E68203B75250004D44E /* Metal.framework in Frameworks */, FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */, DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */, DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */, @@ -1555,6 +1625,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E82203B76140004D44E /* Metal.framework in Frameworks */, FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */, BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */, BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */, @@ -1572,6 +1643,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E5C203B733D0004D44E /* Metal.framework in Frameworks */, FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */, 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A863010730405007319AE /* libSDL2.a in Frameworks */, @@ -1589,6 +1661,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E5E203B74490004D44E /* Metal.framework in Frameworks */, FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */, 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A865310730547007319AE /* CoreAudio.framework in Frameworks */, @@ -1606,6 +1679,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E85203B762D0004D44E /* Metal.framework in Frameworks */, FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */, 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */, @@ -1623,6 +1697,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E64203B74E50004D44E /* Metal.framework in Frameworks */, FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */, 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */, @@ -1640,6 +1715,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7A203B75DE0004D44E /* Metal.framework in Frameworks */, FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */, 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867410730548007319AE /* CoreAudio.framework in Frameworks */, @@ -1657,6 +1733,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E79203B75D50004D44E /* Metal.framework in Frameworks */, FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */, 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867710730548007319AE /* CoreAudio.framework in Frameworks */, @@ -1674,6 +1751,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E77203B75C70004D44E /* Metal.framework in Frameworks */, FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */, 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */, @@ -1691,6 +1769,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6A203B75450004D44E /* Metal.framework in Frameworks */, FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */, 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A868910730549007319AE /* CoreAudio.framework in Frameworks */, @@ -1708,6 +1787,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E63203B74DC0004D44E /* Metal.framework in Frameworks */, FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */, 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */, @@ -1725,6 +1805,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E62203B74D50004D44E /* Metal.framework in Frameworks */, FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */, 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */, @@ -1742,6 +1823,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E60203B74C20004D44E /* Metal.framework in Frameworks */, FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */, 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */, 002A864110730546007319AE /* CoreAudio.framework in Frameworks */, @@ -1759,6 +1841,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E87203B763B0004D44E /* Metal.framework in Frameworks */, FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */, DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */, DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */, @@ -1776,6 +1859,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E83203B761D0004D44E /* Metal.framework in Frameworks */, FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */, DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */, DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */, @@ -1800,6 +1884,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E81203B760D0004D44E /* Metal.framework in Frameworks */, FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */, DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */, DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */, @@ -1817,6 +1902,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E76203B75BF0004D44E /* Metal.framework in Frameworks */, FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */, DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */, DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */, @@ -1834,6 +1920,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E70203B75710004D44E /* Metal.framework in Frameworks */, FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */, DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */, DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */, @@ -1852,6 +1939,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6F203B756A0004D44E /* Metal.framework in Frameworks */, FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */, DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */, DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */, @@ -1870,6 +1958,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6E203B75620004D44E /* Metal.framework in Frameworks */, FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */, DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */, DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */, @@ -1888,6 +1977,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6C203B75540004D44E /* Metal.framework in Frameworks */, FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */, DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */, DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */, @@ -1905,6 +1995,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E6B203B754C0004D44E /* Metal.framework in Frameworks */, FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */, DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */, DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */, @@ -1923,6 +2014,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E69203B75390004D44E /* Metal.framework in Frameworks */, FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */, DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */, DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */, @@ -1940,6 +2032,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E66203B75140004D44E /* Metal.framework in Frameworks */, FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */, DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */, DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */, @@ -1957,6 +2050,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E65203B74EC0004D44E /* Metal.framework in Frameworks */, FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */, DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */, DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */, @@ -1974,6 +2068,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E86203B76340004D44E /* Metal.framework in Frameworks */, FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */, DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */, DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */, @@ -1992,6 +2087,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E7E203B75F90004D44E /* Metal.framework in Frameworks */, FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */, DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */, DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */, @@ -2009,6 +2105,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 66E88E5D203B73530004D44E /* Metal.framework in Frameworks */, DBEC54DD1A1A81C3005B1EAB /* CoreVideo.framework in Frameworks */, DBEC54DE1A1A81C3005B1EAB /* Cocoa.framework in Frameworks */, DBEC54DF1A1A81C3005B1EAB /* libSDL2.a in Frameworks */, @@ -2068,6 +2165,7 @@ 00794E6309D20839003FC8A1 /* utf8.txt */, ); name = Resources; + path = ../../test; sourceTree = ""; }; 08FB7794FE84155DC02AAC07 /* SDLTest */ = { @@ -2079,6 +2177,7 @@ 002F33A209CA183B00EBEB88 /* Linked Frameworks */, 00794E4609D207B4003FC8A1 /* Resources */, 1AB674ADFE9D54B511CA2CBB /* Products */, + 66E88E56203B733C0004D44E /* Frameworks */, ); comments = "I made these tests link against our \"default\" framework which includes X11 stuff. If you didn't install the X11 headers with Xcode, you might have problems building the SDL.framework (which is a dependency). You can swap the dependencies around to get around this, or you can modify the default SDL.framework target to not include X11 stuff. (Go into its target build options and remove all the Preprocessor macros.)\n\n\n\nWe are sort of in a half-way state at the moment. Going \"all-the-way\" means we copy the SDL.framework inside the app bundle so we can run the test without the step of the user \"installing\" the framework. But there is an oversight/bug in Xcode that doesn't correctly find the location of the framework when in an embedded/nested Xcode project. We could probably try to hack this with a shell script that checks multiple directories for existence, but this is messier and more work than I prefer, so I rather just wait for Apple to fix this. In the meantime...\n\nThe \"All\" target will build the SDL framework from the Xcode project. The other targets do not have this dependency set (for flexibility reasons in case we make changes). If you have not built the framework, you will probably be unable to link. You will either need to build the framework, or you need to add \"-framework SDL\" to the link options and make sure you have the SDL.framework installed somewhere where it can be seen (like /Library/Frameworks...I think we already set this one up.) \n\nTo run though, you should have a copy of the SDL.framework in /Library/Frameworks or ~/Library/Frameworks.\n\n\n\n\ntestgl and testdyngl need -DHAVE_OPENGL\ntestgl needs to link against OpenGL.framework\n\n"; name = SDLTest; @@ -2118,6 +2217,7 @@ 0017985C107436ED00F5D044 /* testnativecocoa.m */, 00179872107438D000F5D044 /* testnativex11.c */, 002F345209CA201C00EBEB88 /* testoverlay2.c */, + 66E88E8A203B778F0004D44E /* testyuv_cvt.c */, 002F346F09CA20A600EBEB88 /* testplatform.c */, 001798B910743A4900F5D044 /* testpower.c */, DB166CBF16A1C74100A1396C /* testrelative.c */, @@ -2139,6 +2239,7 @@ 083E4887006D86A17F000001 /* torturethread.c */, ); name = Source; + path = ../../test; sourceTree = ""; }; 1AB674ADFE9D54B511CA2CBB /* Products */ = { @@ -2195,6 +2296,14 @@ name = Products; sourceTree = ""; }; + 66E88E56203B733C0004D44E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 66E88E5B203B733C0004D44E /* Metal.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; DB166D8316A1D17E00A1396C /* SDL_Test */ = { isa = PBXGroup; children = ( @@ -2212,9 +2321,11 @@ DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */, DB166D9016A1D1A500A1396C /* SDL_test_log.c */, DB166D9116A1D1A500A1396C /* SDL_test_md5.c */, + AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */, DB166D9216A1D1A500A1396C /* SDL_test_random.c */, ); name = SDL_Test; + path = ../../src/test; sourceTree = ""; }; /* End PBXGroup section */ @@ -3244,6 +3355,7 @@ buildActionMask = 2147483647; files = ( 002F345409CA202000EBEB88 /* testoverlay2.c in Sources */, + 66E88E8B203B778F0004D44E /* testyuv_cvt.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3393,6 +3505,7 @@ DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */, DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */, DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */, + AAF02FFA1F90092700B9A9FB /* SDL_test_memory.c in Sources */, DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3927,6 +4040,7 @@ 002A85B21073008E007319AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -3934,7 +4048,7 @@ ); GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Debug; }; @@ -4053,6 +4167,7 @@ 002A85D41073009D007319AE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -4060,7 +4175,7 @@ ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Release; }; diff --git a/3rdparty/sdl2-2.0.4/Xcode/SDLTest/TestDropFile-Info.plist b/3rdparty/sdl2-2.0.9/Xcode/SDLTest/TestDropFile-Info.plist similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/SDLTest/TestDropFile-Info.plist rename to 3rdparty/sdl2-2.0.9/Xcode/SDLTest/TestDropFile-Info.plist diff --git a/3rdparty/sdl2-2.0.4/Xcode/XcodeDocSet/Doxyfile b/3rdparty/sdl2-2.0.9/Xcode/XcodeDocSet/Doxyfile similarity index 100% rename from 3rdparty/sdl2-2.0.4/Xcode/XcodeDocSet/Doxyfile rename to 3rdparty/sdl2-2.0.9/Xcode/XcodeDocSet/Doxyfile diff --git a/3rdparty/sdl2-2.0.4/acinclude/ac_check_define.m4 b/3rdparty/sdl2-2.0.9/acinclude/ac_check_define.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ac_check_define.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ac_check_define.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/alsa.m4 b/3rdparty/sdl2-2.0.9/acinclude/alsa.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/alsa.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/alsa.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/ax_check_compiler_flags.m4 b/3rdparty/sdl2-2.0.9/acinclude/ax_check_compiler_flags.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ax_check_compiler_flags.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ax_check_compiler_flags.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/ax_gcc_archflag.m4 b/3rdparty/sdl2-2.0.9/acinclude/ax_gcc_archflag.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ax_gcc_archflag.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ax_gcc_archflag.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/ax_gcc_x86_cpuid.m4.htm b/3rdparty/sdl2-2.0.9/acinclude/ax_gcc_x86_cpuid.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ax_gcc_x86_cpuid.m4.htm rename to 3rdparty/sdl2-2.0.9/acinclude/ax_gcc_x86_cpuid.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/esd.m4 b/3rdparty/sdl2-2.0.9/acinclude/esd.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/esd.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/esd.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/libtool.m4 b/3rdparty/sdl2-2.0.9/acinclude/libtool.m4 similarity index 99% rename from 3rdparty/sdl2-2.0.4/acinclude/libtool.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/libtool.m4 index 0eb07c8afe..b8ba0324f0 100644 --- a/3rdparty/sdl2-2.0.4/acinclude/libtool.m4 +++ b/3rdparty/sdl2-2.0.9/acinclude/libtool.m4 @@ -1347,7 +1347,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) diff --git a/3rdparty/sdl2-2.0.4/acinclude/ltoptions.m4 b/3rdparty/sdl2-2.0.9/acinclude/ltoptions.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ltoptions.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ltoptions.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/ltsugar.m4 b/3rdparty/sdl2-2.0.9/acinclude/ltsugar.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ltsugar.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ltsugar.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/ltversion.m4 b/3rdparty/sdl2-2.0.9/acinclude/ltversion.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/ltversion.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/ltversion.m4 diff --git a/3rdparty/sdl2-2.0.4/acinclude/lt~obsolete.m4 b/3rdparty/sdl2-2.0.9/acinclude/lt~obsolete.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/acinclude/lt~obsolete.m4 rename to 3rdparty/sdl2-2.0.9/acinclude/lt~obsolete.m4 diff --git a/3rdparty/sdl2-2.0.9/android-project/app/build.gradle b/3rdparty/sdl2-2.0.9/android-project/app/build.gradle new file mode 100644 index 0000000000..3900943557 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/build.gradle @@ -0,0 +1,63 @@ +def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY'); +def buildAsApplication = !buildAsLibrary +if (buildAsApplication) { + apply plugin: 'com.android.application' +} +else { + apply plugin: 'com.android.library' +} + +android { + compileSdkVersion 26 + defaultConfig { + if (buildAsApplication) { + applicationId "org.libsdl.app" + } + minSdkVersion 14 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + externalNativeBuild { + ndkBuild { + arguments "APP_PLATFORM=android-14" + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + } + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { + sourceSets.main { + jniLibs.srcDir 'libs' + } + externalNativeBuild { + ndkBuild { + path 'jni/Android.mk' + } + } + + } + lintOptions { + abortOnError false + } + + if (buildAsLibrary) { + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith(".aar")) { + def fileName = "org.libsdl.app.aar"; + output.outputFile = new File(outputFile.parent, fileName); + } + } + } + } +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') +} diff --git a/3rdparty/sdl2-2.0.4/android-project/jni/Android.mk b/3rdparty/sdl2-2.0.9/android-project/app/jni/Android.mk similarity index 100% rename from 3rdparty/sdl2-2.0.4/android-project/jni/Android.mk rename to 3rdparty/sdl2-2.0.9/android-project/app/jni/Android.mk diff --git a/3rdparty/sdl2-2.0.9/android-project/app/jni/Application.mk b/3rdparty/sdl2-2.0.9/android-project/app/jni/Application.mk new file mode 100644 index 0000000000..15b2a73cab --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/jni/Application.mk @@ -0,0 +1,10 @@ + +# Uncomment this if you're using STL in your project +# You can find more information here: +# https://developer.android.com/ndk/guides/cpp-support +# APP_STL := c++_shared + +APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 + +# Min runtime API level +APP_PLATFORM=android-14 diff --git a/3rdparty/sdl2-2.0.4/android-project/jni/src/Android.mk b/3rdparty/sdl2-2.0.9/android-project/app/jni/src/Android.mk similarity index 77% rename from 3rdparty/sdl2-2.0.4/android-project/jni/src/Android.mk rename to 3rdparty/sdl2-2.0.9/android-project/app/jni/src/Android.mk index 943a8cdbe2..1adcb6e9aa 100644 --- a/3rdparty/sdl2-2.0.4/android-project/jni/src/Android.mk +++ b/3rdparty/sdl2-2.0.9/android-project/app/jni/src/Android.mk @@ -9,8 +9,7 @@ SDL_PATH := ../SDL LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include # Add your application source files here... -LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \ - YourSourceHere.c +LOCAL_SRC_FILES := YourSourceHere.c LOCAL_SHARED_LIBRARIES := SDL2 diff --git a/3rdparty/sdl2-2.0.4/android-project/proguard-project.txt b/3rdparty/sdl2-2.0.9/android-project/app/proguard-rules.pro similarity index 62% rename from 3rdparty/sdl2-2.0.4/android-project/proguard-project.txt rename to 3rdparty/sdl2-2.0.9/android-project/app/proguard-rules.pro index f2fe1559a2..eaf0e916cd 100644 --- a/3rdparty/sdl2-2.0.4/android-project/proguard-project.txt +++ b/3rdparty/sdl2-2.0.9/android-project/app/proguard-rules.pro @@ -1,11 +1,8 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. +# in [sdk]/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/AndroidManifest.xml b/3rdparty/sdl2-2.0.9/android-project/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..25730cf39a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/AndroidManifest.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDevice.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDevice.java new file mode 100644 index 0000000000..aa358d1fc3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDevice.java @@ -0,0 +1,19 @@ +package org.libsdl.app; + +interface HIDDevice +{ + public int getId(); + public int getVendorId(); + public int getProductId(); + public String getSerialNumber(); + public int getVersion(); + public String getManufacturerName(); + public String getProductName(); + public boolean open(); + public int sendFeatureReport(byte[] report); + public int sendOutputReport(byte[] report); + public boolean getFeatureReport(byte[] report); + public void setFrozen(boolean frozen); + public void close(); + public void shutdown(); +} diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java new file mode 100644 index 0000000000..4cf114a299 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java @@ -0,0 +1,642 @@ +package org.libsdl.app; + +import android.content.Context; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothGatt; +import android.bluetooth.BluetoothGattCallback; +import android.bluetooth.BluetoothGattCharacteristic; +import android.bluetooth.BluetoothGattDescriptor; +import android.bluetooth.BluetoothManager; +import android.bluetooth.BluetoothProfile; +import android.bluetooth.BluetoothGattService; +import android.os.Handler; +import android.os.Looper; +import android.util.Log; + +//import com.android.internal.util.HexDump; + +import java.lang.Runnable; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.UUID; + +class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDevice { + + private static final String TAG = "hidapi"; + private HIDDeviceManager mManager; + private BluetoothDevice mDevice; + private int mDeviceId; + private BluetoothGatt mGatt; + private boolean mIsRegistered = false; + private boolean mIsConnected = false; + private boolean mIsChromebook = false; + private boolean mIsReconnecting = false; + private boolean mFrozen = false; + private LinkedList mOperations; + GattOperation mCurrentOperation = null; + private Handler mHandler; + + private static final int TRANSPORT_AUTO = 0; + private static final int TRANSPORT_BREDR = 1; + private static final int TRANSPORT_LE = 2; + + private static final int CHROMEBOOK_CONNECTION_CHECK_INTERVAL = 10000; + + static public final UUID steamControllerService = UUID.fromString("100F6C32-1735-4313-B402-38567131E5F3"); + static public final UUID inputCharacteristic = UUID.fromString("100F6C33-1735-4313-B402-38567131E5F3"); + static public final UUID reportCharacteristic = UUID.fromString("100F6C34-1735-4313-B402-38567131E5F3"); + static private final byte[] enterValveMode = new byte[] { (byte)0xC0, (byte)0x87, 0x03, 0x08, 0x07, 0x00 }; + + static class GattOperation { + private enum Operation { + CHR_READ, + CHR_WRITE, + ENABLE_NOTIFICATION + } + + Operation mOp; + UUID mUuid; + byte[] mValue; + BluetoothGatt mGatt; + boolean mResult = true; + + private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid) { + mGatt = gatt; + mOp = operation; + mUuid = uuid; + } + + private GattOperation(BluetoothGatt gatt, GattOperation.Operation operation, UUID uuid, byte[] value) { + mGatt = gatt; + mOp = operation; + mUuid = uuid; + mValue = value; + } + + public void run() { + // This is executed in main thread + BluetoothGattCharacteristic chr; + + switch (mOp) { + case CHR_READ: + chr = getCharacteristic(mUuid); + //Log.v(TAG, "Reading characteristic " + chr.getUuid()); + if (!mGatt.readCharacteristic(chr)) { + Log.e(TAG, "Unable to read characteristic " + mUuid.toString()); + mResult = false; + break; + } + mResult = true; + break; + case CHR_WRITE: + chr = getCharacteristic(mUuid); + //Log.v(TAG, "Writing characteristic " + chr.getUuid() + " value=" + HexDump.toHexString(value)); + chr.setValue(mValue); + if (!mGatt.writeCharacteristic(chr)) { + Log.e(TAG, "Unable to write characteristic " + mUuid.toString()); + mResult = false; + break; + } + mResult = true; + break; + case ENABLE_NOTIFICATION: + chr = getCharacteristic(mUuid); + //Log.v(TAG, "Writing descriptor of " + chr.getUuid()); + if (chr != null) { + BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")); + if (cccd != null) { + int properties = chr.getProperties(); + byte[] value; + if ((properties & BluetoothGattCharacteristic.PROPERTY_NOTIFY) == BluetoothGattCharacteristic.PROPERTY_NOTIFY) { + value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE; + } else if ((properties & BluetoothGattCharacteristic.PROPERTY_INDICATE) == BluetoothGattCharacteristic.PROPERTY_INDICATE) { + value = BluetoothGattDescriptor.ENABLE_INDICATION_VALUE; + } else { + Log.e(TAG, "Unable to start notifications on input characteristic"); + mResult = false; + return; + } + + mGatt.setCharacteristicNotification(chr, true); + cccd.setValue(value); + if (!mGatt.writeDescriptor(cccd)) { + Log.e(TAG, "Unable to write descriptor " + mUuid.toString()); + mResult = false; + return; + } + mResult = true; + } + } + } + } + + public boolean finish() { + return mResult; + } + + private BluetoothGattCharacteristic getCharacteristic(UUID uuid) { + BluetoothGattService valveService = mGatt.getService(steamControllerService); + if (valveService == null) + return null; + return valveService.getCharacteristic(uuid); + } + + static public GattOperation readCharacteristic(BluetoothGatt gatt, UUID uuid) { + return new GattOperation(gatt, Operation.CHR_READ, uuid); + } + + static public GattOperation writeCharacteristic(BluetoothGatt gatt, UUID uuid, byte[] value) { + return new GattOperation(gatt, Operation.CHR_WRITE, uuid, value); + } + + static public GattOperation enableNotification(BluetoothGatt gatt, UUID uuid) { + return new GattOperation(gatt, Operation.ENABLE_NOTIFICATION, uuid); + } + } + + public HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice device) { + mManager = manager; + mDevice = device; + mDeviceId = mManager.getDeviceIDForIdentifier(getIdentifier()); + mIsRegistered = false; + mIsChromebook = mManager.getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); + mOperations = new LinkedList(); + mHandler = new Handler(Looper.getMainLooper()); + + mGatt = connectGatt(); + final HIDDeviceBLESteamController finalThis = this; + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + finalThis.checkConnectionForChromebookIssue(); + } + }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL); + } + + public String getIdentifier() { + return String.format("SteamController.%s", mDevice.getAddress()); + } + + public BluetoothGatt getGatt() { + return mGatt; + } + + // Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead + // of TRANSPORT_LE. Let's force ourselves to connect low energy. + private BluetoothGatt connectGatt(boolean managed) { + try { + Method m = mDevice.getClass().getDeclaredMethod("connectGatt", Context.class, boolean.class, BluetoothGattCallback.class, int.class); + return (BluetoothGatt) m.invoke(mDevice, mManager.getContext(), managed, this, TRANSPORT_LE); + } catch (Exception e) { + return mDevice.connectGatt(mManager.getContext(), managed, this); + } + } + + private BluetoothGatt connectGatt() { + return connectGatt(false); + } + + protected int getConnectionState() { + + Context context = mManager.getContext(); + if (context == null) { + // We are lacking any context to get our Bluetooth information. We'll just assume disconnected. + return BluetoothProfile.STATE_DISCONNECTED; + } + + BluetoothManager btManager = (BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE); + if (btManager == null) { + // This device doesn't support Bluetooth. We should never be here, because how did + // we instantiate a device to start with? + return BluetoothProfile.STATE_DISCONNECTED; + } + + return btManager.getConnectionState(mDevice, BluetoothProfile.GATT); + } + + public void reconnect() { + + if (getConnectionState() != BluetoothProfile.STATE_CONNECTED) { + mGatt.disconnect(); + mGatt = connectGatt(); + } + + } + + protected void checkConnectionForChromebookIssue() { + if (!mIsChromebook) { + // We only do this on Chromebooks, because otherwise it's really annoying to just attempt + // over and over. + return; + } + + int connectionState = getConnectionState(); + + switch (connectionState) { + case BluetoothProfile.STATE_CONNECTED: + if (!mIsConnected) { + // We are in the Bad Chromebook Place. We can force a disconnect + // to try to recover. + Log.v(TAG, "Chromebook: We are in a very bad state; the controller shows as connected in the underlying Bluetooth layer, but we never received a callback. Forcing a reconnect."); + mIsReconnecting = true; + mGatt.disconnect(); + mGatt = connectGatt(false); + break; + } + else if (!isRegistered()) { + if (mGatt.getServices().size() > 0) { + Log.v(TAG, "Chromebook: We are connected to a controller, but never got our registration. Trying to recover."); + probeService(this); + } + else { + Log.v(TAG, "Chromebook: We are connected to a controller, but never discovered services. Trying to recover."); + mIsReconnecting = true; + mGatt.disconnect(); + mGatt = connectGatt(false); + break; + } + } + else { + Log.v(TAG, "Chromebook: We are connected, and registered. Everything's good!"); + return; + } + break; + + case BluetoothProfile.STATE_DISCONNECTED: + Log.v(TAG, "Chromebook: We have either been disconnected, or the Chromebook BtGatt.ContextMap bug has bitten us. Attempting a disconnect/reconnect, but we may not be able to recover."); + + mIsReconnecting = true; + mGatt.disconnect(); + mGatt = connectGatt(false); + break; + + case BluetoothProfile.STATE_CONNECTING: + Log.v(TAG, "Chromebook: We're still trying to connect. Waiting a bit longer."); + break; + } + + final HIDDeviceBLESteamController finalThis = this; + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + finalThis.checkConnectionForChromebookIssue(); + } + }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL); + } + + private boolean isRegistered() { + return mIsRegistered; + } + + private void setRegistered() { + mIsRegistered = true; + } + + private boolean probeService(HIDDeviceBLESteamController controller) { + + if (isRegistered()) { + return true; + } + + if (!mIsConnected) { + return false; + } + + Log.v(TAG, "probeService controller=" + controller); + + for (BluetoothGattService service : mGatt.getServices()) { + if (service.getUuid().equals(steamControllerService)) { + Log.v(TAG, "Found Valve steam controller service " + service.getUuid()); + + for (BluetoothGattCharacteristic chr : service.getCharacteristics()) { + if (chr.getUuid().equals(inputCharacteristic)) { + Log.v(TAG, "Found input characteristic"); + // Start notifications + BluetoothGattDescriptor cccd = chr.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")); + if (cccd != null) { + enableNotification(chr.getUuid()); + } + } + } + return true; + } + } + + if ((mGatt.getServices().size() == 0) && mIsChromebook && !mIsReconnecting) { + Log.e(TAG, "Chromebook: Discovered services were empty; this almost certainly means the BtGatt.ContextMap bug has bitten us."); + mIsConnected = false; + mIsReconnecting = true; + mGatt.disconnect(); + mGatt = connectGatt(false); + } + + return false; + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + private void finishCurrentGattOperation() { + GattOperation op = null; + synchronized (mOperations) { + if (mCurrentOperation != null) { + op = mCurrentOperation; + mCurrentOperation = null; + } + } + if (op != null) { + boolean result = op.finish(); // TODO: Maybe in main thread as well? + + // Our operation failed, let's add it back to the beginning of our queue. + if (!result) { + mOperations.addFirst(op); + } + } + executeNextGattOperation(); + } + + private void executeNextGattOperation() { + synchronized (mOperations) { + if (mCurrentOperation != null) + return; + + if (mOperations.isEmpty()) + return; + + mCurrentOperation = mOperations.removeFirst(); + } + + // Run in main thread + mHandler.post(new Runnable() { + @Override + public void run() { + synchronized (mOperations) { + if (mCurrentOperation == null) { + Log.e(TAG, "Current operation null in executor?"); + return; + } + + mCurrentOperation.run(); + // now wait for the GATT callback and when it comes, finish this operation + } + } + }); + } + + private void queueGattOperation(GattOperation op) { + synchronized (mOperations) { + mOperations.add(op); + } + executeNextGattOperation(); + } + + private void enableNotification(UUID chrUuid) { + GattOperation op = HIDDeviceBLESteamController.GattOperation.enableNotification(mGatt, chrUuid); + queueGattOperation(op); + } + + public void writeCharacteristic(UUID uuid, byte[] value) { + GattOperation op = HIDDeviceBLESteamController.GattOperation.writeCharacteristic(mGatt, uuid, value); + queueGattOperation(op); + } + + public void readCharacteristic(UUID uuid) { + GattOperation op = HIDDeviceBLESteamController.GattOperation.readCharacteristic(mGatt, uuid); + queueGattOperation(op); + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////// BluetoothGattCallback overridden methods + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + public void onConnectionStateChange(BluetoothGatt g, int status, int newState) { + //Log.v(TAG, "onConnectionStateChange status=" + status + " newState=" + newState); + mIsReconnecting = false; + if (newState == 2) { + mIsConnected = true; + // Run directly, without GattOperation + if (!isRegistered()) { + mHandler.post(new Runnable() { + @Override + public void run() { + mGatt.discoverServices(); + } + }); + } + } + else if (newState == 0) { + mIsConnected = false; + } + + // Disconnection is handled in SteamLink using the ACTION_ACL_DISCONNECTED Intent. + } + + public void onServicesDiscovered(BluetoothGatt gatt, int status) { + //Log.v(TAG, "onServicesDiscovered status=" + status); + if (status == 0) { + if (gatt.getServices().size() == 0) { + Log.v(TAG, "onServicesDiscovered returned zero services; something has gone horribly wrong down in Android's Bluetooth stack."); + mIsReconnecting = true; + mIsConnected = false; + gatt.disconnect(); + mGatt = connectGatt(false); + } + else { + probeService(this); + } + } + } + + public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + //Log.v(TAG, "onCharacteristicRead status=" + status + " uuid=" + characteristic.getUuid()); + + if (characteristic.getUuid().equals(reportCharacteristic) && !mFrozen) { + mManager.HIDDeviceFeatureReport(getId(), characteristic.getValue()); + } + + finishCurrentGattOperation(); + } + + public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + //Log.v(TAG, "onCharacteristicWrite status=" + status + " uuid=" + characteristic.getUuid()); + + if (characteristic.getUuid().equals(reportCharacteristic)) { + // Only register controller with the native side once it has been fully configured + if (!isRegistered()) { + Log.v(TAG, "Registering Steam Controller with ID: " + getId()); + mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0); + setRegistered(); + } + } + + finishCurrentGattOperation(); + } + + public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { + // Enable this for verbose logging of controller input reports + //Log.v(TAG, "onCharacteristicChanged uuid=" + characteristic.getUuid() + " data=" + HexDump.dumpHexString(characteristic.getValue())); + + if (characteristic.getUuid().equals(inputCharacteristic) && !mFrozen) { + mManager.HIDDeviceInputReport(getId(), characteristic.getValue()); + } + } + + public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { + //Log.v(TAG, "onDescriptorRead status=" + status); + } + + public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { + BluetoothGattCharacteristic chr = descriptor.getCharacteristic(); + //Log.v(TAG, "onDescriptorWrite status=" + status + " uuid=" + chr.getUuid() + " descriptor=" + descriptor.getUuid()); + + if (chr.getUuid().equals(inputCharacteristic)) { + boolean hasWrittenInputDescriptor = true; + BluetoothGattCharacteristic reportChr = chr.getService().getCharacteristic(reportCharacteristic); + if (reportChr != null) { + Log.v(TAG, "Writing report characteristic to enter valve mode"); + reportChr.setValue(enterValveMode); + gatt.writeCharacteristic(reportChr); + } + } + + finishCurrentGattOperation(); + } + + public void onReliableWriteCompleted(BluetoothGatt gatt, int status) { + //Log.v(TAG, "onReliableWriteCompleted status=" + status); + } + + public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { + //Log.v(TAG, "onReadRemoteRssi status=" + status); + } + + public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { + //Log.v(TAG, "onMtuChanged status=" + status); + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + //////// Public API + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public int getId() { + return mDeviceId; + } + + @Override + public int getVendorId() { + // Valve Corporation + final int VALVE_USB_VID = 0x28DE; + return VALVE_USB_VID; + } + + @Override + public int getProductId() { + // We don't have an easy way to query from the Bluetooth device, but we know what it is + final int D0G_BLE2_PID = 0x1106; + return D0G_BLE2_PID; + } + + @Override + public String getSerialNumber() { + // This will be read later via feature report by Steam + return "12345"; + } + + @Override + public int getVersion() { + return 0; + } + + @Override + public String getManufacturerName() { + return "Valve Corporation"; + } + + @Override + public String getProductName() { + return "Steam Controller"; + } + + @Override + public boolean open() { + return true; + } + + @Override + public int sendFeatureReport(byte[] report) { + if (!isRegistered()) { + Log.e(TAG, "Attempted sendFeatureReport before Steam Controller is registered!"); + if (mIsConnected) { + probeService(this); + } + return -1; + } + + // We need to skip the first byte, as that doesn't go over the air + byte[] actual_report = Arrays.copyOfRange(report, 1, report.length - 1); + //Log.v(TAG, "sendFeatureReport " + HexDump.dumpHexString(actual_report)); + writeCharacteristic(reportCharacteristic, actual_report); + return report.length; + } + + @Override + public int sendOutputReport(byte[] report) { + if (!isRegistered()) { + Log.e(TAG, "Attempted sendOutputReport before Steam Controller is registered!"); + if (mIsConnected) { + probeService(this); + } + return -1; + } + + //Log.v(TAG, "sendFeatureReport " + HexDump.dumpHexString(report)); + writeCharacteristic(reportCharacteristic, report); + return report.length; + } + + @Override + public boolean getFeatureReport(byte[] report) { + if (!isRegistered()) { + Log.e(TAG, "Attempted getFeatureReport before Steam Controller is registered!"); + if (mIsConnected) { + probeService(this); + } + return false; + } + + //Log.v(TAG, "getFeatureReport"); + readCharacteristic(reportCharacteristic); + return true; + } + + @Override + public void close() { + } + + @Override + public void setFrozen(boolean frozen) { + mFrozen = frozen; + } + + @Override + public void shutdown() { + close(); + + BluetoothGatt g = mGatt; + if (g != null) { + g.disconnect(); + g.close(); + mGatt = null; + } + mManager = null; + mIsRegistered = false; + mIsConnected = false; + mOperations.clear(); + } + +} + diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java new file mode 100644 index 0000000000..db9400f6d6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java @@ -0,0 +1,682 @@ +package org.libsdl.app; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.PendingIntent; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothManager; +import android.bluetooth.BluetoothProfile; +import android.util.Log; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.hardware.usb.*; +import android.os.Handler; +import android.os.Looper; + +import java.util.HashMap; +import java.util.ArrayList; +import java.util.List; + +public class HIDDeviceManager { + private static final String TAG = "hidapi"; + private static final String ACTION_USB_PERMISSION = "org.libsdl.app.USB_PERMISSION"; + + private static HIDDeviceManager sManager; + private static int sManagerRefCount = 0; + + public static HIDDeviceManager acquire(Context context) { + if (sManagerRefCount == 0) { + sManager = new HIDDeviceManager(context); + } + ++sManagerRefCount; + return sManager; + } + + public static void release(HIDDeviceManager manager) { + if (manager == sManager) { + --sManagerRefCount; + if (sManagerRefCount == 0) { + sManager.close(); + sManager = null; + } + } + } + + private Context mContext; + private HashMap mDevicesById = new HashMap(); + private HashMap mUSBDevices = new HashMap(); + private HashMap mBluetoothDevices = new HashMap(); + private int mNextDeviceId = 0; + private SharedPreferences mSharedPreferences = null; + private boolean mIsChromebook = false; + private UsbManager mUsbManager; + private Handler mHandler; + private BluetoothManager mBluetoothManager; + private List mLastBluetoothDevices; + + private final BroadcastReceiver mUsbBroadcast = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (action.equals(UsbManager.ACTION_USB_DEVICE_ATTACHED)) { + UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); + handleUsbDeviceAttached(usbDevice); + } else if (action.equals(UsbManager.ACTION_USB_DEVICE_DETACHED)) { + UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); + handleUsbDeviceDetached(usbDevice); + } else if (action.equals(HIDDeviceManager.ACTION_USB_PERMISSION)) { + UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); + handleUsbDevicePermission(usbDevice, intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)); + } + } + }; + + private final BroadcastReceiver mBluetoothBroadcast = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + // Bluetooth device was connected. If it was a Steam Controller, handle it + if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) { + BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); + Log.d(TAG, "Bluetooth device connected: " + device); + + if (isSteamController(device)) { + connectBluetoothDevice(device); + } + } + + // Bluetooth device was disconnected, remove from controller manager (if any) + if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) { + BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); + Log.d(TAG, "Bluetooth device disconnected: " + device); + + disconnectBluetoothDevice(device); + } + } + }; + + private HIDDeviceManager(final Context context) { + mContext = context; + + // Make sure we have the HIDAPI library loaded with the native functions + try { + SDL.loadLibrary("hidapi"); + } catch (Throwable e) { + Log.w(TAG, "Couldn't load hidapi: " + e.toString()); + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setCancelable(false); + builder.setTitle("SDL HIDAPI Error"); + builder.setMessage("Please report the following error to the SDL maintainers: " + e.getMessage()); + builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + try { + // If our context is an activity, exit rather than crashing when we can't + // call our native functions. + Activity activity = (Activity)context; + + activity.finish(); + } + catch (ClassCastException cce) { + // Context wasn't an activity, there's nothing we can do. Give up and return. + } + } + }); + builder.show(); + + return; + } + + HIDDeviceRegisterCallback(); + + mSharedPreferences = mContext.getSharedPreferences("hidapi", Context.MODE_PRIVATE); + mIsChromebook = mContext.getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); + +// if (shouldClear) { +// SharedPreferences.Editor spedit = mSharedPreferences.edit(); +// spedit.clear(); +// spedit.commit(); +// } +// else + { + mNextDeviceId = mSharedPreferences.getInt("next_device_id", 0); + } + + initializeUSB(); + initializeBluetooth(); + } + + public Context getContext() { + return mContext; + } + + public int getDeviceIDForIdentifier(String identifier) { + SharedPreferences.Editor spedit = mSharedPreferences.edit(); + + int result = mSharedPreferences.getInt(identifier, 0); + if (result == 0) { + result = mNextDeviceId++; + spedit.putInt("next_device_id", mNextDeviceId); + } + + spedit.putInt(identifier, result); + spedit.commit(); + return result; + } + + private void initializeUSB() { + mUsbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE); + + /* + // Logging + for (UsbDevice device : mUsbManager.getDeviceList().values()) { + Log.i(TAG,"Path: " + device.getDeviceName()); + Log.i(TAG,"Manufacturer: " + device.getManufacturerName()); + Log.i(TAG,"Product: " + device.getProductName()); + Log.i(TAG,"ID: " + device.getDeviceId()); + Log.i(TAG,"Class: " + device.getDeviceClass()); + Log.i(TAG,"Protocol: " + device.getDeviceProtocol()); + Log.i(TAG,"Vendor ID " + device.getVendorId()); + Log.i(TAG,"Product ID: " + device.getProductId()); + Log.i(TAG,"Interface count: " + device.getInterfaceCount()); + Log.i(TAG,"---------------------------------------"); + + // Get interface details + for (int index = 0; index < device.getInterfaceCount(); index++) { + UsbInterface mUsbInterface = device.getInterface(index); + Log.i(TAG," ***** *****"); + Log.i(TAG," Interface index: " + index); + Log.i(TAG," Interface ID: " + mUsbInterface.getId()); + Log.i(TAG," Interface class: " + mUsbInterface.getInterfaceClass()); + Log.i(TAG," Interface subclass: " + mUsbInterface.getInterfaceSubclass()); + Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol()); + Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount()); + + // Get endpoint details + for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++) + { + UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi); + Log.i(TAG," ++++ ++++ ++++"); + Log.i(TAG," Endpoint index: " + epi); + Log.i(TAG," Attributes: " + mEndpoint.getAttributes()); + Log.i(TAG," Direction: " + mEndpoint.getDirection()); + Log.i(TAG," Number: " + mEndpoint.getEndpointNumber()); + Log.i(TAG," Interval: " + mEndpoint.getInterval()); + Log.i(TAG," Packet size: " + mEndpoint.getMaxPacketSize()); + Log.i(TAG," Type: " + mEndpoint.getType()); + } + } + } + Log.i(TAG," No more devices connected."); + */ + + // Register for USB broadcasts and permission completions + IntentFilter filter = new IntentFilter(); + filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED); + filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); + filter.addAction(HIDDeviceManager.ACTION_USB_PERMISSION); + mContext.registerReceiver(mUsbBroadcast, filter); + + for (UsbDevice usbDevice : mUsbManager.getDeviceList().values()) { + handleUsbDeviceAttached(usbDevice); + } + } + + UsbManager getUSBManager() { + return mUsbManager; + } + + private void shutdownUSB() { + try { + mContext.unregisterReceiver(mUsbBroadcast); + } catch (Exception e) { + // We may not have registered, that's okay + } + } + + private boolean isHIDDeviceUSB(UsbDevice usbDevice) { + for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); ++interface_number) { + if (isHIDDeviceInterface(usbDevice, interface_number)) { + return true; + } + } + return false; + } + + private boolean isHIDDeviceInterface(UsbDevice usbDevice, int interface_number) { + UsbInterface usbInterface = usbDevice.getInterface(interface_number); + if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_HID) { + return true; + } + if (interface_number == 0) { + if (isXbox360Controller(usbDevice, usbInterface) || isXboxOneController(usbDevice, usbInterface)) { + return true; + } + } + return false; + } + + private boolean isXbox360Controller(UsbDevice usbDevice, UsbInterface usbInterface) { + final int XB360_IFACE_SUBCLASS = 93; + final int XB360_IFACE_PROTOCOL = 1; // Wired only + final int[] SUPPORTED_VENDORS = { + 0x0079, // GPD Win 2 + 0x044f, // Thrustmaster + 0x045e, // Microsoft + 0x046d, // Logitech + 0x056e, // Elecom + 0x06a3, // Saitek + 0x0738, // Mad Catz + 0x07ff, // Mad Catz + 0x0e6f, // Unknown + 0x0f0d, // Hori + 0x11c9, // Nacon + 0x12ab, // Unknown + 0x1430, // RedOctane + 0x146b, // BigBen + 0x1532, // Razer Sabertooth + 0x15e4, // Numark + 0x162e, // Joytech + 0x1689, // Razer Onza + 0x1bad, // Harmonix + 0x24c6, // PowerA + }; + + if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC && + usbInterface.getInterfaceSubclass() == XB360_IFACE_SUBCLASS && + usbInterface.getInterfaceProtocol() == XB360_IFACE_PROTOCOL) { + int vendor_id = usbDevice.getVendorId(); + for (int supportedVid : SUPPORTED_VENDORS) { + if (vendor_id == supportedVid) { + return true; + } + } + } + return false; + } + + private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterface) { + final int XB1_IFACE_SUBCLASS = 71; + final int XB1_IFACE_PROTOCOL = 208; + final int[] SUPPORTED_VENDORS = { + 0x045e, // Microsoft + 0x0738, // Mad Catz + 0x0e6f, // Unknown + 0x0f0d, // Hori + 0x1532, // Razer Wildcat + 0x24c6, // PowerA + }; + + if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC && + usbInterface.getInterfaceSubclass() == XB1_IFACE_SUBCLASS && + usbInterface.getInterfaceProtocol() == XB1_IFACE_PROTOCOL) { + int vendor_id = usbDevice.getVendorId(); + for (int supportedVid : SUPPORTED_VENDORS) { + if (vendor_id == supportedVid) { + return true; + } + } + } + return false; + } + + private void handleUsbDeviceAttached(UsbDevice usbDevice) { + if (isHIDDeviceUSB(usbDevice)) { + connectHIDDeviceUSB(usbDevice); + } + } + + private void handleUsbDeviceDetached(UsbDevice usbDevice) { + HIDDeviceUSB device = mUSBDevices.get(usbDevice); + if (device == null) + return; + + int id = device.getId(); + mUSBDevices.remove(usbDevice); + mDevicesById.remove(id); + device.shutdown(); + HIDDeviceDisconnected(id); + } + + private void handleUsbDevicePermission(UsbDevice usbDevice, boolean permission_granted) { + HIDDeviceUSB device = mUSBDevices.get(usbDevice); + if (device == null) + return; + + boolean opened = false; + if (permission_granted) { + opened = device.open(); + } + HIDDeviceOpenResult(device.getId(), opened); + } + + private void connectHIDDeviceUSB(UsbDevice usbDevice) { + synchronized (this) { + for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); interface_number++) { + if (isHIDDeviceInterface(usbDevice, interface_number)) { + HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_number); + int id = device.getId(); + mUSBDevices.put(usbDevice, device); + mDevicesById.put(id, device); + HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), interface_number); + break; + } + } + } + } + + private void initializeBluetooth() { + Log.d(TAG, "Initializing Bluetooth"); + + if (mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) { + Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH"); + return; + } + + // Find bonded bluetooth controllers and create SteamControllers for them + mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE); + if (mBluetoothManager == null) { + // This device doesn't support Bluetooth. + return; + } + + BluetoothAdapter btAdapter = mBluetoothManager.getAdapter(); + if (btAdapter == null) { + // This device has Bluetooth support in the codebase, but has no available adapters. + return; + } + + // Get our bonded devices. + for (BluetoothDevice device : btAdapter.getBondedDevices()) { + + Log.d(TAG, "Bluetooth device available: " + device); + if (isSteamController(device)) { + connectBluetoothDevice(device); + } + + } + + // NOTE: These don't work on Chromebooks, to my undying dismay. + IntentFilter filter = new IntentFilter(); + filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); + filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); + mContext.registerReceiver(mBluetoothBroadcast, filter); + + if (mIsChromebook) { + mHandler = new Handler(Looper.getMainLooper()); + mLastBluetoothDevices = new ArrayList<>(); + + // final HIDDeviceManager finalThis = this; + // mHandler.postDelayed(new Runnable() { + // @Override + // public void run() { + // finalThis.chromebookConnectionHandler(); + // } + // }, 5000); + } + } + + private void shutdownBluetooth() { + try { + mContext.unregisterReceiver(mBluetoothBroadcast); + } catch (Exception e) { + // We may not have registered, that's okay + } + } + + // Chromebooks do not pass along ACTION_ACL_CONNECTED / ACTION_ACL_DISCONNECTED properly. + // This function provides a sort of dummy version of that, watching for changes in the + // connected devices and attempting to add controllers as things change. + public void chromebookConnectionHandler() { + if (!mIsChromebook) { + return; + } + + ArrayList disconnected = new ArrayList<>(); + ArrayList connected = new ArrayList<>(); + + List currentConnected = mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT); + + for (BluetoothDevice bluetoothDevice : currentConnected) { + if (!mLastBluetoothDevices.contains(bluetoothDevice)) { + connected.add(bluetoothDevice); + } + } + for (BluetoothDevice bluetoothDevice : mLastBluetoothDevices) { + if (!currentConnected.contains(bluetoothDevice)) { + disconnected.add(bluetoothDevice); + } + } + + mLastBluetoothDevices = currentConnected; + + for (BluetoothDevice bluetoothDevice : disconnected) { + disconnectBluetoothDevice(bluetoothDevice); + } + for (BluetoothDevice bluetoothDevice : connected) { + connectBluetoothDevice(bluetoothDevice); + } + + final HIDDeviceManager finalThis = this; + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + finalThis.chromebookConnectionHandler(); + } + }, 10000); + } + + public boolean connectBluetoothDevice(BluetoothDevice bluetoothDevice) { + Log.v(TAG, "connectBluetoothDevice device=" + bluetoothDevice); + synchronized (this) { + if (mBluetoothDevices.containsKey(bluetoothDevice)) { + Log.v(TAG, "Steam controller with address " + bluetoothDevice + " already exists, attempting reconnect"); + + HIDDeviceBLESteamController device = mBluetoothDevices.get(bluetoothDevice); + device.reconnect(); + + return false; + } + HIDDeviceBLESteamController device = new HIDDeviceBLESteamController(this, bluetoothDevice); + int id = device.getId(); + mBluetoothDevices.put(bluetoothDevice, device); + mDevicesById.put(id, device); + + // The Steam Controller will mark itself connected once initialization is complete + } + return true; + } + + public void disconnectBluetoothDevice(BluetoothDevice bluetoothDevice) { + synchronized (this) { + HIDDeviceBLESteamController device = mBluetoothDevices.get(bluetoothDevice); + if (device == null) + return; + + int id = device.getId(); + mBluetoothDevices.remove(bluetoothDevice); + mDevicesById.remove(id); + device.shutdown(); + HIDDeviceDisconnected(id); + } + } + + public boolean isSteamController(BluetoothDevice bluetoothDevice) { + // Sanity check. If you pass in a null device, by definition it is never a Steam Controller. + if (bluetoothDevice == null) { + return false; + } + + // If the device has no local name, we really don't want to try an equality check against it. + if (bluetoothDevice.getName() == null) { + return false; + } + + return bluetoothDevice.getName().equals("SteamController") && ((bluetoothDevice.getType() & BluetoothDevice.DEVICE_TYPE_LE) != 0); + } + + private void close() { + shutdownUSB(); + shutdownBluetooth(); + synchronized (this) { + for (HIDDevice device : mDevicesById.values()) { + device.shutdown(); + } + mDevicesById.clear(); + mBluetoothDevices.clear(); + HIDDeviceReleaseCallback(); + } + } + + public void setFrozen(boolean frozen) { + synchronized (this) { + for (HIDDevice device : mDevicesById.values()) { + device.setFrozen(frozen); + } + } + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + private HIDDevice getDevice(int id) { + synchronized (this) { + HIDDevice result = mDevicesById.get(id); + if (result == null) { + Log.v(TAG, "No device for id: " + id); + Log.v(TAG, "Available devices: " + mDevicesById.keySet()); + } + return result; + } + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////// JNI interface functions + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + public boolean openDevice(int deviceID) { + // Look to see if this is a USB device and we have permission to access it + for (HIDDeviceUSB device : mUSBDevices.values()) { + if (deviceID == device.getId()) { + UsbDevice usbDevice = device.getDevice(); + if (!mUsbManager.hasPermission(usbDevice)) { + HIDDeviceOpenPending(deviceID); + try { + mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0)); + } catch (Exception e) { + Log.v(TAG, "Couldn't request permission for USB device " + usbDevice); + HIDDeviceOpenResult(deviceID, false); + } + return false; + } + break; + } + } + + try { + Log.v(TAG, "openDevice deviceID=" + deviceID); + HIDDevice device; + device = getDevice(deviceID); + if (device == null) { + HIDDeviceDisconnected(deviceID); + return false; + } + + return device.open(); + } catch (Exception e) { + Log.e(TAG, "Got exception: " + Log.getStackTraceString(e)); + } + return false; + } + + public int sendOutputReport(int deviceID, byte[] report) { + try { + Log.v(TAG, "sendOutputReport deviceID=" + deviceID + " length=" + report.length); + HIDDevice device; + device = getDevice(deviceID); + if (device == null) { + HIDDeviceDisconnected(deviceID); + return -1; + } + + return device.sendOutputReport(report); + } catch (Exception e) { + Log.e(TAG, "Got exception: " + Log.getStackTraceString(e)); + } + return -1; + } + + public int sendFeatureReport(int deviceID, byte[] report) { + try { + Log.v(TAG, "sendFeatureReport deviceID=" + deviceID + " length=" + report.length); + HIDDevice device; + device = getDevice(deviceID); + if (device == null) { + HIDDeviceDisconnected(deviceID); + return -1; + } + + return device.sendFeatureReport(report); + } catch (Exception e) { + Log.e(TAG, "Got exception: " + Log.getStackTraceString(e)); + } + return -1; + } + + public boolean getFeatureReport(int deviceID, byte[] report) { + try { + Log.v(TAG, "getFeatureReport deviceID=" + deviceID); + HIDDevice device; + device = getDevice(deviceID); + if (device == null) { + HIDDeviceDisconnected(deviceID); + return false; + } + + return device.getFeatureReport(report); + } catch (Exception e) { + Log.e(TAG, "Got exception: " + Log.getStackTraceString(e)); + } + return false; + } + + public void closeDevice(int deviceID) { + try { + Log.v(TAG, "closeDevice deviceID=" + deviceID); + HIDDevice device; + device = getDevice(deviceID); + if (device == null) { + HIDDeviceDisconnected(deviceID); + return; + } + + device.close(); + } catch (Exception e) { + Log.e(TAG, "Got exception: " + Log.getStackTraceString(e)); + } + } + + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////// Native methods + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + private native void HIDDeviceRegisterCallback(); + private native void HIDDeviceReleaseCallback(); + + native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number); + native void HIDDeviceOpenPending(int deviceID); + native void HIDDeviceOpenResult(int deviceID, boolean opened); + native void HIDDeviceDisconnected(int deviceID); + + native void HIDDeviceInputReport(int deviceID, byte[] report); + native void HIDDeviceFeatureReport(int deviceID, byte[] report); +} diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java new file mode 100644 index 0000000000..c9fc58ece2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java @@ -0,0 +1,307 @@ +package org.libsdl.app; + +import android.hardware.usb.*; +import android.os.Build; +import android.util.Log; +import java.util.Arrays; + +class HIDDeviceUSB implements HIDDevice { + + private static final String TAG = "hidapi"; + + protected HIDDeviceManager mManager; + protected UsbDevice mDevice; + protected int mInterface; + protected int mDeviceId; + protected UsbDeviceConnection mConnection; + protected UsbEndpoint mInputEndpoint; + protected UsbEndpoint mOutputEndpoint; + protected InputThread mInputThread; + protected boolean mRunning; + protected boolean mFrozen; + + public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_number) { + mManager = manager; + mDevice = usbDevice; + mInterface = interface_number; + mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier()); + mRunning = false; + } + + public String getIdentifier() { + return String.format("%s/%x/%x", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId()); + } + + @Override + public int getId() { + return mDeviceId; + } + + @Override + public int getVendorId() { + return mDevice.getVendorId(); + } + + @Override + public int getProductId() { + return mDevice.getProductId(); + } + + @Override + public String getSerialNumber() { + String result = null; + if (Build.VERSION.SDK_INT >= 21) { + result = mDevice.getSerialNumber(); + } + if (result == null) { + result = ""; + } + return result; + } + + @Override + public int getVersion() { + return 0; + } + + @Override + public String getManufacturerName() { + String result = null; + if (Build.VERSION.SDK_INT >= 21) { + result = mDevice.getManufacturerName(); + } + if (result == null) { + result = String.format("%x", getVendorId()); + } + return result; + } + + @Override + public String getProductName() { + String result = null; + if (Build.VERSION.SDK_INT >= 21) { + result = mDevice.getProductName(); + } + if (result == null) { + result = String.format("%x", getProductId()); + } + return result; + } + + public UsbDevice getDevice() { + return mDevice; + } + + public String getDeviceName() { + return getManufacturerName() + " " + getProductName() + "(0x" + String.format("%x", getVendorId()) + "/0x" + String.format("%x", getProductId()) + ")"; + } + + @Override + public boolean open() { + mConnection = mManager.getUSBManager().openDevice(mDevice); + if (mConnection == null) { + Log.w(TAG, "Unable to open USB device " + getDeviceName()); + return false; + } + + // Force claim all interfaces + for (int i = 0; i < mDevice.getInterfaceCount(); i++) { + UsbInterface iface = mDevice.getInterface(i); + + if (!mConnection.claimInterface(iface, true)) { + Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName()); + close(); + return false; + } + } + + // Find the endpoints + UsbInterface iface = mDevice.getInterface(mInterface); + for (int j = 0; j < iface.getEndpointCount(); j++) { + UsbEndpoint endpt = iface.getEndpoint(j); + switch (endpt.getDirection()) { + case UsbConstants.USB_DIR_IN: + if (mInputEndpoint == null) { + mInputEndpoint = endpt; + } + break; + case UsbConstants.USB_DIR_OUT: + if (mOutputEndpoint == null) { + mOutputEndpoint = endpt; + } + break; + } + } + + // Make sure the required endpoints were present + if (mInputEndpoint == null || mOutputEndpoint == null) { + Log.w(TAG, "Missing required endpoint on USB device " + getDeviceName()); + close(); + return false; + } + + // Start listening for input + mRunning = true; + mInputThread = new InputThread(); + mInputThread.start(); + + return true; + } + + @Override + public int sendFeatureReport(byte[] report) { + int res = -1; + int offset = 0; + int length = report.length; + boolean skipped_report_id = false; + byte report_number = report[0]; + + if (report_number == 0x0) { + ++offset; + --length; + skipped_report_id = true; + } + + res = mConnection.controlTransfer( + UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_OUT, + 0x09/*HID set_report*/, + (3/*HID feature*/ << 8) | report_number, + 0, + report, offset, length, + 1000/*timeout millis*/); + + if (res < 0) { + Log.w(TAG, "sendFeatureReport() returned " + res + " on device " + getDeviceName()); + return -1; + } + + if (skipped_report_id) { + ++length; + } + return length; + } + + @Override + public int sendOutputReport(byte[] report) { + int r = mConnection.bulkTransfer(mOutputEndpoint, report, report.length, 1000); + if (r != report.length) { + Log.w(TAG, "sendOutputReport() returned " + r + " on device " + getDeviceName()); + } + return r; + } + + @Override + public boolean getFeatureReport(byte[] report) { + int res = -1; + int offset = 0; + int length = report.length; + boolean skipped_report_id = false; + byte report_number = report[0]; + + if (report_number == 0x0) { + /* Offset the return buffer by 1, so that the report ID + will remain in byte 0. */ + ++offset; + --length; + skipped_report_id = true; + } + + res = mConnection.controlTransfer( + UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_IN, + 0x01/*HID get_report*/, + (3/*HID feature*/ << 8) | report_number, + 0, + report, offset, length, + 1000/*timeout millis*/); + + if (res < 0) { + Log.w(TAG, "getFeatureReport() returned " + res + " on device " + getDeviceName()); + return false; + } + + if (skipped_report_id) { + ++res; + ++length; + } + + byte[] data; + if (res == length) { + data = report; + } else { + data = Arrays.copyOfRange(report, 0, res); + } + mManager.HIDDeviceFeatureReport(mDeviceId, data); + + return true; + } + + @Override + public void close() { + mRunning = false; + if (mInputThread != null) { + while (mInputThread.isAlive()) { + mInputThread.interrupt(); + try { + mInputThread.join(); + } catch (InterruptedException e) { + // Keep trying until we're done + } + } + mInputThread = null; + } + if (mConnection != null) { + for (int i = 0; i < mDevice.getInterfaceCount(); i++) { + UsbInterface iface = mDevice.getInterface(i); + mConnection.releaseInterface(iface); + } + mConnection.close(); + mConnection = null; + } + } + + @Override + public void shutdown() { + close(); + mManager = null; + } + + @Override + public void setFrozen(boolean frozen) { + mFrozen = frozen; + } + + protected class InputThread extends Thread { + @Override + public void run() { + int packetSize = mInputEndpoint.getMaxPacketSize(); + byte[] packet = new byte[packetSize]; + while (mRunning) { + int r; + try + { + r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000); + } + catch (Exception e) + { + Log.v(TAG, "Exception in UsbDeviceConnection bulktransfer: " + e); + break; + } + if (r < 0) { + // Could be a timeout or an I/O error + } + if (r > 0) { + byte[] data; + if (r == packetSize) { + data = packet; + } else { + data = Arrays.copyOfRange(packet, 0, r); + } + + if (!mFrozen) { + mManager.HIDDeviceInputReport(mDeviceId, data); + } + } + } + } + } +} diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDL.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDL.java new file mode 100644 index 0000000000..fb7f7319a8 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDL.java @@ -0,0 +1,84 @@ +package org.libsdl.app; + +import android.content.Context; + +import java.lang.reflect.*; + +/** + SDL library initialization +*/ +public class SDL { + + // This function should be called first and sets up the native code + // so it can call into the Java classes + public static void setupJNI() { + SDLActivity.nativeSetupJNI(); + SDLAudioManager.nativeSetupJNI(); + SDLControllerManager.nativeSetupJNI(); + } + + // This function should be called each time the activity is started + public static void initialize() { + setContext(null); + + SDLActivity.initialize(); + SDLAudioManager.initialize(); + SDLControllerManager.initialize(); + } + + // This function stores the current activity (SDL or not) + public static void setContext(Context context) { + mContext = context; + } + + public static Context getContext() { + return mContext; + } + + public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException { + + if (libraryName == null) { + throw new NullPointerException("No library name provided."); + } + + try { + // Let's see if we have ReLinker available in the project. This is necessary for + // some projects that have huge numbers of local libraries bundled, and thus may + // trip a bug in Android's native library loader which ReLinker works around. (If + // loadLibrary works properly, ReLinker will simply use the normal Android method + // internally.) + // + // To use ReLinker, just add it as a dependency. For more information, see + // https://github.com/KeepSafe/ReLinker for ReLinker's repository. + // + Class relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker"); + Class relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener"); + Class contextClass = mContext.getClassLoader().loadClass("android.content.Context"); + Class stringClass = mContext.getClassLoader().loadClass("java.lang.String"); + + // Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if + // they've changed during updates. + Method forceMethod = relinkClass.getDeclaredMethod("force"); + Object relinkInstance = forceMethod.invoke(null); + Class relinkInstanceClass = relinkInstance.getClass(); + + // Actually load the library! + Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass); + loadMethod.invoke(relinkInstance, mContext, libraryName, null, null); + } + catch (final Throwable e) { + // Fall back + try { + System.loadLibrary(libraryName); + } + catch (final UnsatisfiedLinkError ule) { + throw ule; + } + catch (final SecurityException se) { + throw se; + } + } + } + + protected static Context mContext; +} diff --git a/3rdparty/sdl2-2.0.4/android-project/src/org/libsdl/app/SDLActivity.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java similarity index 50% rename from 3rdparty/sdl2-2.0.4/android-project/src/org/libsdl/app/SDLActivity.java rename to 3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 0a2e5d87e3..311b2f1df4 100644 --- a/3rdparty/sdl2-2.0.4/android-project/src/org/libsdl/app/SDLActivity.java +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -2,42 +2,74 @@ import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; +import java.util.Hashtable; import java.lang.reflect.Method; +import java.lang.Math; import android.app.*; import android.content.*; +import android.content.res.Configuration; import android.text.InputType; import android.view.*; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import android.widget.AbsoluteLayout; +import android.widget.RelativeLayout; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import android.os.*; +import android.util.DisplayMetrics; import android.util.Log; import android.util.SparseArray; import android.graphics.*; import android.graphics.drawable.Drawable; -import android.media.*; import android.hardware.*; import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ApplicationInfo; /** SDL Activity */ -public class SDLActivity extends Activity { +public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; - // Keep track of the paused state - public static boolean mIsPaused, mIsSurfaceReady, mHasFocus; + public static boolean mIsResumedCalled, mIsSurfaceReady, mHasFocus; + + // Cursor types + private static final int SDL_SYSTEM_CURSOR_NONE = -1; + private static final int SDL_SYSTEM_CURSOR_ARROW = 0; + private static final int SDL_SYSTEM_CURSOR_IBEAM = 1; + private static final int SDL_SYSTEM_CURSOR_WAIT = 2; + private static final int SDL_SYSTEM_CURSOR_CROSSHAIR = 3; + private static final int SDL_SYSTEM_CURSOR_WAITARROW = 4; + private static final int SDL_SYSTEM_CURSOR_SIZENWSE = 5; + private static final int SDL_SYSTEM_CURSOR_SIZENESW = 6; + private static final int SDL_SYSTEM_CURSOR_SIZEWE = 7; + private static final int SDL_SYSTEM_CURSOR_SIZENS = 8; + private static final int SDL_SYSTEM_CURSOR_SIZEALL = 9; + private static final int SDL_SYSTEM_CURSOR_NO = 10; + private static final int SDL_SYSTEM_CURSOR_HAND = 11; + + protected static final int SDL_ORIENTATION_UNKNOWN = 0; + protected static final int SDL_ORIENTATION_LANDSCAPE = 1; + protected static final int SDL_ORIENTATION_LANDSCAPE_FLIPPED = 2; + protected static final int SDL_ORIENTATION_PORTRAIT = 3; + protected static final int SDL_ORIENTATION_PORTRAIT_FLIPPED = 4; + + protected static int mCurrentOrientation; + + // Handle the state of the native layer + public enum NativeState { + INIT, RESUMED, PAUSED + } + + public static NativeState mNextNativeState; + public static NativeState mCurrentNativeState; + public static boolean mExitCalledFromJava; /** If shared libraries (e.g. SDL or the native application) could not be loaded. */ @@ -51,14 +83,54 @@ public class SDLActivity extends Activity { protected static SDLActivity mSingleton; protected static SDLSurface mSurface; protected static View mTextEdit; + protected static boolean mScreenKeyboardShown; protected static ViewGroup mLayout; - protected static SDLJoystickHandler mJoystickHandler; + protected static SDLClipboardHandler mClipboardHandler; + protected static Hashtable mCursors; + protected static int mLastCursorID; + protected static SDLGenericMotionListener_API12 mMotionListener; + protected static HIDDeviceManager mHIDDeviceManager; // This is what SDL runs in. It invokes SDL_main(), eventually protected static Thread mSDLThread; - // Audio - protected static AudioTrack mAudioTrack; + protected static SDLGenericMotionListener_API12 getMotionListener() { + if (mMotionListener == null) { + if (Build.VERSION.SDK_INT >= 26) { + mMotionListener = new SDLGenericMotionListener_API26(); + } else + if (Build.VERSION.SDK_INT >= 24) { + mMotionListener = new SDLGenericMotionListener_API24(); + } else { + mMotionListener = new SDLGenericMotionListener_API12(); + } + } + + return mMotionListener; + } + + /** + * This method returns the name of the shared object with the application entry point + * It can be overridden by derived classes. + */ + protected String getMainSharedObject() { + String library; + String[] libraries = SDLActivity.mSingleton.getLibraries(); + if (libraries.length > 0) { + library = "lib" + libraries[libraries.length - 1] + ".so"; + } else { + library = "libmain.so"; + } + return getContext().getApplicationInfo().nativeLibraryDir + "/" + library; + } + + /** + * This method returns the name of the application entry point + * It can be overridden by derived classes. + */ + protected String getMainFunction() { + return "SDL_main"; + } /** * This method is called by SDL before loading the native shared libraries. @@ -82,7 +154,7 @@ protected String[] getLibraries() { // Load the .so public void loadLibraries() { for (String lib : getLibraries()) { - System.loadLibrary(lib); + SDL.loadLibrary(lib); } } @@ -103,28 +175,27 @@ public static void initialize() { mSurface = null; mTextEdit = null; mLayout = null; - mJoystickHandler = null; + mClipboardHandler = null; + mCursors = new Hashtable(); + mLastCursorID = 0; mSDLThread = null; - mAudioTrack = null; mExitCalledFromJava = false; mBrokenLibraries = false; - mIsPaused = false; + mIsResumedCalled = false; mIsSurfaceReady = false; mHasFocus = true; + mNextNativeState = NativeState.INIT; + mCurrentNativeState = NativeState.INIT; } // Setup @Override protected void onCreate(Bundle savedInstanceState) { - Log.v(TAG, "Device: " + android.os.Build.DEVICE); - Log.v(TAG, "Model: " + android.os.Build.MODEL); - Log.v(TAG, "onCreate(): " + mSingleton); + Log.v(TAG, "Device: " + Build.DEVICE); + Log.v(TAG, "Model: " + Build.MODEL); + Log.v(TAG, "onCreate()"); super.onCreate(savedInstanceState); - SDLActivity.initialize(); - // So we can call stuff from static callbacks - mSingleton = this; - // Load shared libraries String errorMsgBrokenLib = ""; try { @@ -141,6 +212,7 @@ protected void onCreate(Bundle savedInstanceState) { if (mBrokenLibraries) { + mSingleton = this; AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); dlgAlert.setMessage("An error occurred while trying to start the application. Please try again and/or reinstall." + System.getProperty("line.separator") @@ -161,24 +233,43 @@ public void onClick(DialogInterface dialog,int id) { return; } - // Set up the surface - mSurface = new SDLSurface(getApplication()); + // Set up JNI + SDL.setupJNI(); - if(Build.VERSION.SDK_INT >= 12) { - mJoystickHandler = new SDLJoystickHandler_API12(); - } - else { - mJoystickHandler = new SDLJoystickHandler(); + // Initialize state + SDL.initialize(); + + // So we can call stuff from static callbacks + mSingleton = this; + SDL.setContext(this); + + if (Build.VERSION.SDK_INT >= 11) { + mClipboardHandler = new SDLClipboardHandler_API11(); + } else { + /* Before API 11, no clipboard notification (eg no SDL_CLIPBOARDUPDATE) */ + mClipboardHandler = new SDLClipboardHandler_Old(); } - mLayout = new AbsoluteLayout(this); + mHIDDeviceManager = HIDDeviceManager.acquire(this); + + // Set up the surface + mSurface = new SDLSurface(getApplication()); + + mLayout = new RelativeLayout(this); mLayout.addView(mSurface); + // Get our current screen orientation and pass it down. + mCurrentOrientation = SDLActivity.getCurrentOrientation(); + SDLActivity.onNativeOrientationChanged(mCurrentOrientation); + setContentView(mLayout); - + + setWindowStyle(false); + + getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(this); + // Get filename from "Open with" of another application Intent intent = getIntent(); - if (intent != null && intent.getData() != null) { String filename = intent.getData().getPath(); if (filename != null) { @@ -193,26 +284,64 @@ public void onClick(DialogInterface dialog,int id) { protected void onPause() { Log.v(TAG, "onPause()"); super.onPause(); + mNextNativeState = NativeState.PAUSED; + mIsResumedCalled = false; if (SDLActivity.mBrokenLibraries) { return; } - SDLActivity.handlePause(); + if (mHIDDeviceManager != null) { + mHIDDeviceManager.setFrozen(true); + } + + SDLActivity.handleNativeState(); } @Override protected void onResume() { Log.v(TAG, "onResume()"); super.onResume(); + mNextNativeState = NativeState.RESUMED; + mIsResumedCalled = true; if (SDLActivity.mBrokenLibraries) { return; } - SDLActivity.handleResume(); + if (mHIDDeviceManager != null) { + mHIDDeviceManager.setFrozen(false); + } + + SDLActivity.handleNativeState(); } + public static int getCurrentOrientation() { + final Context context = SDLActivity.getContext(); + final Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); + + int result = SDL_ORIENTATION_UNKNOWN; + + switch (display.getRotation()) { + case Surface.ROTATION_0: + result = SDL_ORIENTATION_PORTRAIT; + break; + + case Surface.ROTATION_90: + result = SDL_ORIENTATION_LANDSCAPE; + break; + + case Surface.ROTATION_180: + result = SDL_ORIENTATION_PORTRAIT_FLIPPED; + break; + + case Surface.ROTATION_270: + result = SDL_ORIENTATION_LANDSCAPE_FLIPPED; + break; + } + + return result; + } @Override public void onWindowFocusChanged(boolean hasFocus) { @@ -225,8 +354,13 @@ public void onWindowFocusChanged(boolean hasFocus) { SDLActivity.mHasFocus = hasFocus; if (hasFocus) { - SDLActivity.handleResume(); + mNextNativeState = NativeState.RESUMED; + SDLActivity.getMotionListener().reclaimRelativeMouseModeIfNeeded(); + } else { + mNextNativeState = NativeState.PAUSED; } + + SDLActivity.handleNativeState(); } @Override @@ -245,6 +379,11 @@ public void onLowMemory() { protected void onDestroy() { Log.v(TAG, "onDestroy()"); + if (mHIDDeviceManager != null) { + HIDDeviceManager.release(mHIDDeviceManager); + mHIDDeviceManager = null; + } + if (SDLActivity.mBrokenLibraries) { super.onDestroy(); // Reset everything in case the user re opens the app @@ -252,6 +391,9 @@ protected void onDestroy() { return; } + mNextNativeState = NativeState.PAUSED; + SDLActivity.handleNativeState(); + // Send a quit message to the application SDLActivity.mExitCalledFromJava = true; SDLActivity.nativeQuit(); @@ -269,10 +411,48 @@ protected void onDestroy() { } super.onDestroy(); + // Reset everything in case the user re opens the app SDLActivity.initialize(); } + @Override + public void onBackPressed() { + // Check if we want to block the back button in case of mouse right click. + // + // If we do, the normal hardware back button will no longer work and people have to use home, + // but the mouse right click will work. + // + String trapBack = SDLActivity.nativeGetHint("SDL_ANDROID_TRAP_BACK_BUTTON"); + if ((trapBack != null) && trapBack.equals("1")) { + // Exit and let the mouse handler handle this button (if appropriate) + return; + } + + // Default system back button behavior. + super.onBackPressed(); + } + + // Called by JNI from SDL. + public static void manualBackButton() { + mSingleton.pressBackButton(); + } + + // Used to get us onto the activity's main thread + public void pressBackButton() { + runOnUiThread(new Runnable() { + @Override + public void run() { + SDLActivity.this.superOnBackPressed(); + } + }); + } + + // Used to access the system back behavior. + public void superOnBackPressed() { + super.onBackPressed(); + } + @Override public boolean dispatchKeyEvent(KeyEvent event) { @@ -285,53 +465,77 @@ public boolean dispatchKeyEvent(KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_CAMERA || - keyCode == 168 || /* API 11: KeyEvent.KEYCODE_ZOOM_IN */ - keyCode == 169 /* API 11: KeyEvent.KEYCODE_ZOOM_OUT */ + keyCode == KeyEvent.KEYCODE_ZOOM_IN || /* API 11 */ + keyCode == KeyEvent.KEYCODE_ZOOM_OUT /* API 11 */ ) { return false; } return super.dispatchKeyEvent(event); } - /** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed - * is the first to be called, mIsSurfaceReady should still be set - * to 'true' during the call to onPause (in a usual scenario). - */ - public static void handlePause() { - if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) { - SDLActivity.mIsPaused = true; - SDLActivity.nativePause(); - mSurface.handlePause(); + /* Transition to next state */ + public static void handleNativeState() { + + if (mNextNativeState == mCurrentNativeState) { + // Already in same state, discard. + return; } - } - /** Called by onResume or surfaceCreated. An actual resume should be done only when the surface is ready. - * Note: Some Android variants may send multiple surfaceChanged events, so we don't need to resume - * every time we get one of those events, only if it comes after surfaceDestroyed - */ - public static void handleResume() { - if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) { - SDLActivity.mIsPaused = false; - SDLActivity.nativeResume(); - mSurface.handleResume(); + // Try a transition to init state + if (mNextNativeState == NativeState.INIT) { + + mCurrentNativeState = mNextNativeState; + return; + } + + // Try a transition to paused state + if (mNextNativeState == NativeState.PAUSED) { + nativePause(); + if (mSurface != null) + mSurface.handlePause(); + mCurrentNativeState = mNextNativeState; + return; + } + + // Try a transition to resumed state + if (mNextNativeState == NativeState.RESUMED) { + if (mIsSurfaceReady && mHasFocus && mIsResumedCalled) { + if (mSDLThread == null) { + // This is the entry point to the C app. + // Start up the C app thread and enable sensor input for the first time + // FIXME: Why aren't we enabling sensor input at start? + + mSDLThread = new Thread(new SDLMain(), "SDLThread"); + mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true); + mSDLThread.start(); + } + + nativeResume(); + mSurface.handleResume(); + mCurrentNativeState = mNextNativeState; + } } } /* The native thread has finished */ public static void handleNativeExit() { SDLActivity.mSDLThread = null; - mSingleton.finish(); + if (mSingleton != null) { + mSingleton.finish(); + } } // Messages from the SDLMain thread static final int COMMAND_CHANGE_TITLE = 1; - static final int COMMAND_UNUSED = 2; + static final int COMMAND_CHANGE_WINDOW_STYLE = 2; static final int COMMAND_TEXTEDIT_HIDE = 3; static final int COMMAND_SET_KEEP_SCREEN_ON = 5; protected static final int COMMAND_USER = 0x8000; + protected static boolean mFullscreenModeActive; + /** * This method is called by SDL if SDL did not handle a message itself. * This happens if a received message contains an unsupported command. @@ -352,7 +556,7 @@ protected boolean onUnhandledMessage(int command, Object param) { protected static class SDLCommandHandler extends Handler { @Override public void handleMessage(Message msg) { - Context context = getContext(); + Context context = SDL.getContext(); if (context == null) { Log.e(TAG, "error handling message, getContext() returned null"); return; @@ -365,22 +569,60 @@ public void handleMessage(Message msg) { Log.e(TAG, "error handling message, getContext() returned no Activity"); } break; + case COMMAND_CHANGE_WINDOW_STYLE: + if (Build.VERSION.SDK_INT < 19) { + // This version of Android doesn't support the immersive fullscreen mode + break; + } + if (context instanceof Activity) { + Window window = ((Activity) context).getWindow(); + if (window != null) { + if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { + int flags = View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE; + window.getDecorView().setSystemUiVisibility(flags); + window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + SDLActivity.mFullscreenModeActive = true; + } else { + int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE; + window.getDecorView().setSystemUiVisibility(flags); + window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + SDLActivity.mFullscreenModeActive = false; + } + } + } else { + Log.e(TAG, "error handling message, getContext() returned no Activity"); + } + break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { - mTextEdit.setVisibility(View.GONE); + // Note: On some devices setting view to GONE creates a flicker in landscape. + // Setting the View's sizes to 0 is similar to GONE but without the flicker. + // The sizes will be set to useful values when the keyboard is shown again. + mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0)); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); + + mScreenKeyboardShown = false; } break; case COMMAND_SET_KEEP_SCREEN_ON: { - Window window = ((Activity) context).getWindow(); - if (window != null) { - if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { - window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } else { - window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + if (context instanceof Activity) { + Window window = ((Activity) context).getWindow(); + if (window != null) { + if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } else { + window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } } } break; @@ -401,38 +643,86 @@ boolean sendCommand(int command, Object data) { Message msg = commandHandler.obtainMessage(); msg.arg1 = command; msg.obj = data; - return commandHandler.sendMessage(msg); + boolean result = commandHandler.sendMessage(msg); + + if ((Build.VERSION.SDK_INT >= 19) && (command == COMMAND_CHANGE_WINDOW_STYLE)) { + // Ensure we don't return until the resize has actually happened, + // or 500ms have passed. + + boolean bShouldWait = false; + + if (data instanceof Integer) { + // Let's figure out if we're already laid out fullscreen or not. + Display display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); + android.util.DisplayMetrics realMetrics = new android.util.DisplayMetrics(); + display.getRealMetrics( realMetrics ); + + boolean bFullscreenLayout = ((realMetrics.widthPixels == mSurface.getWidth()) && + (realMetrics.heightPixels == mSurface.getHeight())); + + if (((Integer)data).intValue() == 1) { + // If we aren't laid out fullscreen or actively in fullscreen mode already, we're going + // to change size and should wait for surfaceChanged() before we return, so the size + // is right back in native code. If we're already laid out fullscreen, though, we're + // not going to change size even if we change decor modes, so we shouldn't wait for + // surfaceChanged() -- which may not even happen -- and should return immediately. + bShouldWait = !bFullscreenLayout; + } + else { + // If we're laid out fullscreen (even if the status bar and nav bar are present), + // or are actively in fullscreen, we're going to change size and should wait for + // surfaceChanged before we return, so the size is right back in native code. + bShouldWait = bFullscreenLayout; + } + } + + if (bShouldWait) { + // We'll wait for the surfaceChanged() method, which will notify us + // when called. That way, we know our current size is really the + // size we need, instead of grabbing a size that's still got + // the navigation and/or status bars before they're hidden. + // + // We'll wait for up to half a second, because some devices + // take a surprisingly long time for the surface resize, but + // then we'll just give up and return. + // + synchronized(SDLActivity.getContext()) { + try { + SDLActivity.getContext().wait(500); + } + catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + } + } + + return result; } // C functions we call - public static native int nativeInit(Object arguments); + public static native int nativeSetupJNI(); + public static native int nativeRunMain(String library, String function, Object arguments); public static native void nativeLowMemory(); public static native void nativeQuit(); public static native void nativePause(); public static native void nativeResume(); public static native void onNativeDropFile(String filename); - public static native void onNativeResize(int x, int y, int format, float rate); - public static native int onNativePadDown(int device_id, int keycode); - public static native int onNativePadUp(int device_id, int keycode); - public static native void onNativeJoy(int device_id, int axis, - float value); - public static native void onNativeHat(int device_id, int hat_id, - int x, int y); + public static native void onNativeResize(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate); public static native void onNativeKeyDown(int keycode); public static native void onNativeKeyUp(int keycode); public static native void onNativeKeyboardFocusLost(); - public static native void onNativeMouse(int button, int action, float x, float y); + public static native void onNativeMouse(int button, int action, float x, float y, boolean relative); public static native void onNativeTouch(int touchDevId, int pointerFingerId, int action, float x, float y, float p); public static native void onNativeAccel(float x, float y, float z); + public static native void onNativeClipboardChanged(); public static native void onNativeSurfaceChanged(); public static native void onNativeSurfaceDestroyed(); - public static native int nativeAddJoystick(int device_id, String name, - int is_accelerometer, int nbuttons, - int naxes, int nhats, int nballs); - public static native int nativeRemoveJoystick(int device_id); public static native String nativeGetHint(String name); + public static native void nativeSetenv(String name, String value); + public static native void onNativeOrientationChanged(int orientation); /** * This method is called by SDL using JNI. @@ -442,10 +732,127 @@ public static boolean setActivityTitle(String title) { return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); } + /** + * This method is called by SDL using JNI. + */ + public static void setWindowStyle(boolean fullscreen) { + // Called from SDLMain() thread and can't directly affect the view + mSingleton.sendCommand(COMMAND_CHANGE_WINDOW_STYLE, fullscreen ? 1 : 0); + } + + /** + * This method is called by SDL using JNI. + * This is a static method for JNI convenience, it calls a non-static method + * so that is can be overridden + */ + public static void setOrientation(int w, int h, boolean resizable, String hint) + { + if (mSingleton != null) { + mSingleton.setOrientationBis(w, h, resizable, hint); + } + } + + /** + * This can be overridden + */ + public void setOrientationBis(int w, int h, boolean resizable, String hint) + { + int orientation = -1; + + if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; + } else if (hint.contains("LandscapeRight")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + } else if (hint.contains("LandscapeLeft")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + } else if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; + } else if (hint.contains("Portrait")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + } else if (hint.contains("PortraitUpsideDown")) { + orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + } + + /* no valid hint */ + if (orientation == -1) { + if (resizable) { + /* no fixed orientation */ + } else { + if (w > h) { + orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; + } else { + orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; + } + } + } + + Log.v("SDL", "setOrientation() orientation=" + orientation + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint); + if (orientation != -1) { + mSingleton.setRequestedOrientation(orientation); + } + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean isScreenKeyboardShown() + { + if (mTextEdit == null) { + return false; + } + + if (!mScreenKeyboardShown) { + return false; + } + + InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + return imm.isAcceptingText(); + + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean supportsRelativeMouse() + { + // ChromeOS doesn't provide relative mouse motion via the Android 7 APIs + if (isChromebook()) { + return false; + } + + // DeX mode in Samsung Experience 9.0 and earlier doesn't support relative mice properly under + // Android 7 APIs, and simply returns no data under Android 8 APIs. + // + // This is fixed in Samsung Experience 9.5, which corresponds to Android 8.1.0, and + // thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result, + // we should stick to relative mode. + // + if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) { + return false; + } + + return SDLActivity.getMotionListener().supportsRelativeMouse(); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean setRelativeMouseEnabled(boolean enabled) + { + if (enabled && !supportsRelativeMouse()) { + return false; + } + + return SDLActivity.getMotionListener().setRelativeMouseEnabled(enabled); + } + /** * This method is called by SDL using JNI. */ public static boolean sendMessage(int command, int param) { + if (mSingleton == null) { + return false; + } return mSingleton.sendCommand(command, Integer.valueOf(param)); } @@ -453,36 +860,105 @@ public static boolean sendMessage(int command, int param) { * This method is called by SDL using JNI. */ public static Context getContext() { - return mSingleton; + return SDL.getContext(); } /** * This method is called by SDL using JNI. - * @return result of getSystemService(name) but executed on UI thread. */ - public Object getSystemServiceFromUiThread(final String name) { - final Object lock = new Object(); - final Object[] results = new Object[2]; // array for writable variables - synchronized (lock) { - runOnUiThread(new Runnable() { - @Override - public void run() { - synchronized (lock) { - results[0] = getSystemService(name); - results[1] = Boolean.TRUE; - lock.notify(); - } - } - }); - if (results[1] == null) { - try { - lock.wait(); - } catch (InterruptedException ex) { - ex.printStackTrace(); + public static boolean isAndroidTV() { + UiModeManager uiModeManager = (UiModeManager) getContext().getSystemService(UI_MODE_SERVICE); + if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { + return true; + } + if (Build.MANUFACTURER.equals("MINIX") && Build.MODEL.equals("NEO-U1")) { + return true; + } + if (Build.MANUFACTURER.equals("Amlogic") && Build.MODEL.equals("X96-W")) { + return true; + } + return false; + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean isTablet() { + DisplayMetrics metrics = new DisplayMetrics(); + Activity activity = (Activity)getContext(); + activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); + + double dWidthInches = metrics.widthPixels / (double)metrics.xdpi; + double dHeightInches = metrics.heightPixels / (double)metrics.ydpi; + + double dDiagonal = Math.sqrt((dWidthInches * dWidthInches) + (dHeightInches * dHeightInches)); + + // If our diagonal size is seven inches or greater, we consider ourselves a tablet. + return (dDiagonal >= 7.0); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean isChromebook() { + return getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management"); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean isDeXMode() { + if (Build.VERSION.SDK_INT < 24) { + return false; + } + try { + final Configuration config = getContext().getResources().getConfiguration(); + final Class configClass = config.getClass(); + return configClass.getField("SEM_DESKTOP_MODE_ENABLED").getInt(configClass) + == configClass.getField("semDesktopModeEnabled").getInt(config); + } catch(Exception ignored) { + return false; + } + } + + /** + * This method is called by SDL using JNI. + */ + public static DisplayMetrics getDisplayDPI() { + return getContext().getResources().getDisplayMetrics(); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean getManifestEnvironmentVariables() { + try { + ApplicationInfo applicationInfo = getContext().getPackageManager().getApplicationInfo(getContext().getPackageName(), PackageManager.GET_META_DATA); + Bundle bundle = applicationInfo.metaData; + if (bundle == null) { + return false; + } + String prefix = "SDL_ENV."; + final int trimLength = prefix.length(); + for (String key : bundle.keySet()) { + if (key.startsWith(prefix)) { + String name = key.substring(trimLength); + String value = bundle.get(key).toString(); + nativeSetenv(name, value); } } + /* environment variables set! */ + return true; + } catch (Exception e) { + Log.v("SDL", "exception " + e.toString()); } - return results[0]; + return false; + } + + // This method is called by SDLControllerManager's API 26 Generic Motion Handler. + public static View getContentView() + { + return mSingleton.mLayout; } static class ShowTextInputTask implements Runnable { @@ -504,11 +980,12 @@ public ShowTextInputTask(int x, int y, int w, int h) { @Override public void run() { - AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams( - w, h + HEIGHT_PADDING, x, y); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING); + params.leftMargin = x; + params.topMargin = y; if (mTextEdit == null) { - mTextEdit = new DummyEdit(getContext()); + mTextEdit = new DummyEdit(SDL.getContext()); mLayout.addView(mTextEdit, params); } else { @@ -518,8 +995,10 @@ public void run() { mTextEdit.setVisibility(View.VISIBLE); mTextEdit.requestFocus(); - InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); + + mScreenKeyboardShown = true; } } @@ -531,102 +1010,26 @@ public static boolean showTextInput(int x, int y, int w, int h) { return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h)); } - /** - * This method is called by SDL using JNI. - */ - public static Surface getNativeSurface() { - return SDLActivity.mSurface.getNativeSurface(); - } - - // Audio - - /** - * This method is called by SDL using JNI. - */ - public static int audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { - int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO; - int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; - int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); - - Log.v(TAG, "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - // Let the user pick a larger buffer if they really want -- but ye - // gods they probably shouldn't, the minimums are horrifyingly high - // latency already - desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize); - - if (mAudioTrack == null) { - mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, - channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); - - // Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid - // Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java - // Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState() - - if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) { - Log.e(TAG, "Failed during initialization of Audio Track"); - mAudioTrack = null; - return -1; - } - - mAudioTrack.play(); - } - - Log.v(TAG, "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - return 0; - } - - /** - * This method is called by SDL using JNI. - */ - public static void audioWriteShortBuffer(short[] buffer) { - for (int i = 0; i < buffer.length; ) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch(InterruptedException e) { - // Nom nom - } - } else { - Log.w(TAG, "SDL audio: error return from write(short)"); - return; - } + public static boolean isTextInputEvent(KeyEvent event) { + + // Key pressed with Ctrl should be sent as SDL_KEYDOWN/SDL_KEYUP and not SDL_TEXTINPUT + if (Build.VERSION.SDK_INT >= 11) { + if (event.isCtrlPressed()) { + return false; + } } - } - /** - * This method is called by SDL using JNI. - */ - public static void audioWriteByteBuffer(byte[] buffer) { - for (int i = 0; i < buffer.length; ) { - int result = mAudioTrack.write(buffer, i, buffer.length - i); - if (result > 0) { - i += result; - } else if (result == 0) { - try { - Thread.sleep(1); - } catch(InterruptedException e) { - // Nom nom - } - } else { - Log.w(TAG, "SDL audio: error return from write(byte)"); - return; - } - } + return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE; } /** * This method is called by SDL using JNI. */ - public static void audioQuit() { - if (mAudioTrack != null) { - mAudioTrack.stop(); - mAudioTrack = null; + public static Surface getNativeSurface() { + if (SDLActivity.mSurface == null) { + return null; } + return SDLActivity.mSurface.getNativeSurface(); } // Input @@ -648,43 +1051,20 @@ public static int[] inputGetInputDeviceIds(int sources) { return Arrays.copyOf(filtered, used); } - // Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance - public static boolean handleJoystickMotionEvent(MotionEvent event) { - return mJoystickHandler.handleMotionEvent(event); - } - - /** - * This method is called by SDL using JNI. - */ - public static void pollInputDevices() { - if (SDLActivity.mSDLThread != null) { - mJoystickHandler.pollInputDevices(); - } - } - // APK expansion files support /** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */ - private Object expansionFile; + private static Object expansionFile; /** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */ - private Method expansionFileMethod; - - /** - * This method was called by SDL using JNI. - * @deprecated because of an incorrect name - */ - @Deprecated - public InputStream openAPKExtensionInputStream(String fileName) throws IOException { - return openAPKExpansionInputStream(fileName); - } + private static Method expansionFileMethod; /** * This method is called by SDL using JNI. * @return an InputStream on success or null if no expansion file was used. * @throws IOException on errors. Message is set for the SDL error message. */ - public InputStream openAPKExpansionInputStream(String fileName) throws IOException { + public static InputStream openAPKExpansionInputStream(String fileName) throws IOException { // Get a ZipResourceFile representing a merger of both the main and patch files if (expansionFile == null) { String mainHint = nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"); @@ -711,7 +1091,7 @@ public InputStream openAPKExpansionInputStream(String fileName) throws IOExcepti // not a part of Android SDK we access it using reflection expansionFile = Class.forName("com.android.vending.expansion.zipfile.APKExpansionSupport") .getMethod("getAPKExpansionZipFile", Context.class, int.class, int.class) - .invoke(null, this, mainVersion, patchVersion); + .invoke(null, SDL.getContext(), mainVersion, patchVersion); expansionFileMethod = expansionFile.getClass() .getMethod("getInputStream", String.class); @@ -890,7 +1270,7 @@ public void onClick(View v) { mapping.put(KeyEvent.KEYCODE_ENTER, button); } if ((buttonFlags[i] & 0x00000002) != 0) { - mapping.put(111, button); /* API 11: KeyEvent.KEYCODE_ESCAPE */ + mapping.put(KeyEvent.KEYCODE_ESCAPE, button); /* API 11 */ } } button.setText(buttonTexts[i]); @@ -945,18 +1325,164 @@ public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) { return dialog; } + + private final Runnable rehideSystemUi = new Runnable() { + @Override + public void run() { + int flags = View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE; + + SDLActivity.this.getWindow().getDecorView().setSystemUiVisibility(flags); + } + }; + + public void onSystemUiVisibilityChange(int visibility) { + if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) { + + Handler handler = getWindow().getDecorView().getHandler(); + if (handler != null) { + handler.removeCallbacks(rehideSystemUi); // Prevent a hide loop. + handler.postDelayed(rehideSystemUi, 2000); + } + + } + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean clipboardHasText() { + return mClipboardHandler.clipboardHasText(); + } + + /** + * This method is called by SDL using JNI. + */ + public static String clipboardGetText() { + return mClipboardHandler.clipboardGetText(); + } + + /** + * This method is called by SDL using JNI. + */ + public static void clipboardSetText(String string) { + mClipboardHandler.clipboardSetText(string); + } + + /** + * This method is called by SDL using JNI. + */ + public static int createCustomCursor(int[] colors, int width, int height, int hotSpotX, int hotSpotY) { + Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888); + ++mLastCursorID; + // This requires API 24, so use reflection to implement this + try { + Class PointerIconClass = Class.forName("android.view.PointerIcon"); + Class[] arg_types = new Class[] { Bitmap.class, float.class, float.class }; + Method create = PointerIconClass.getMethod("create", arg_types); + mCursors.put(mLastCursorID, create.invoke(null, bitmap, hotSpotX, hotSpotY)); + } catch (Exception e) { + return 0; + } + return mLastCursorID; + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean setCustomCursor(int cursorID) { + // This requires API 24, so use reflection to implement this + try { + Class PointerIconClass = Class.forName("android.view.PointerIcon"); + Method setPointerIcon = SDLSurface.class.getMethod("setPointerIcon", PointerIconClass); + setPointerIcon.invoke(mSurface, mCursors.get(cursorID)); + } catch (Exception e) { + return false; + } + return true; + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean setSystemCursor(int cursorID) { + int cursor_type = 0; //PointerIcon.TYPE_NULL; + switch (cursorID) { + case SDL_SYSTEM_CURSOR_ARROW: + cursor_type = 1000; //PointerIcon.TYPE_ARROW; + break; + case SDL_SYSTEM_CURSOR_IBEAM: + cursor_type = 1008; //PointerIcon.TYPE_TEXT; + break; + case SDL_SYSTEM_CURSOR_WAIT: + cursor_type = 1004; //PointerIcon.TYPE_WAIT; + break; + case SDL_SYSTEM_CURSOR_CROSSHAIR: + cursor_type = 1007; //PointerIcon.TYPE_CROSSHAIR; + break; + case SDL_SYSTEM_CURSOR_WAITARROW: + cursor_type = 1004; //PointerIcon.TYPE_WAIT; + break; + case SDL_SYSTEM_CURSOR_SIZENWSE: + cursor_type = 1017; //PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; + break; + case SDL_SYSTEM_CURSOR_SIZENESW: + cursor_type = 1016; //PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; + break; + case SDL_SYSTEM_CURSOR_SIZEWE: + cursor_type = 1014; //PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; + break; + case SDL_SYSTEM_CURSOR_SIZENS: + cursor_type = 1015; //PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; + break; + case SDL_SYSTEM_CURSOR_SIZEALL: + cursor_type = 1020; //PointerIcon.TYPE_GRAB; + break; + case SDL_SYSTEM_CURSOR_NO: + cursor_type = 1012; //PointerIcon.TYPE_NO_DROP; + break; + case SDL_SYSTEM_CURSOR_HAND: + cursor_type = 1002; //PointerIcon.TYPE_HAND; + break; + } + // This requires API 24, so use reflection to implement this + try { + Class PointerIconClass = Class.forName("android.view.PointerIcon"); + Class[] arg_types = new Class[] { Context.class, int.class }; + Method getSystemIcon = PointerIconClass.getMethod("getSystemIcon", arg_types); + Method setPointerIcon = SDLSurface.class.getMethod("setPointerIcon", PointerIconClass); + setPointerIcon.invoke(mSurface, getSystemIcon.invoke(null, SDL.getContext(), cursor_type)); + } catch (Exception e) { + return false; + } + return true; + } } /** - Simple nativeInit() runnable + Simple runnable to start the SDL application */ class SDLMain implements Runnable { @Override public void run() { // Runs SDL_main() - SDLActivity.nativeInit(SDLActivity.mSingleton.getArguments()); + String library = SDLActivity.mSingleton.getMainSharedObject(); + String function = SDLActivity.mSingleton.getMainFunction(); + String[] arguments = SDLActivity.mSingleton.getArguments(); + + Log.v("SDL", "Running main function " + function + " from library " + library); + SDLActivity.nativeRunMain(library, function, arguments); - //Log.v("SDL", "SDL thread terminated"); + Log.v("SDL", "Finished main function"); + + // Native thread has finished, let's finish the Activity + if (!SDLActivity.mExitCalledFromJava) { + SDLActivity.handleNativeExit(); + } } } @@ -991,8 +1517,8 @@ public SDLSurface(Context context) { mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); - if(Build.VERSION.SDK_INT >= 12) { - setOnGenericMotionListener(new SDLGenericMotionListener_API12()); + if (Build.VERSION.SDK_INT >= 12) { + setOnGenericMotionListener(SDLActivity.getMotionListener()); } // Some arbitrary defaults to avoid a potential division by zero @@ -1028,8 +1554,11 @@ public void surfaceCreated(SurfaceHolder holder) { @Override public void surfaceDestroyed(SurfaceHolder holder) { Log.v("SDL", "surfaceDestroyed()"); - // Call this *before* setting mIsSurfaceReady to 'false' - SDLActivity.handlePause(); + + // Transition to pause, if needed + SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED; + SDLActivity.handleNativeState(); + SDLActivity.mIsSurfaceReady = false; SDLActivity.onNativeSurfaceDestroyed(); } @@ -1040,6 +1569,10 @@ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.v("SDL", "surfaceChanged()"); + if (SDLActivity.mSingleton == null) { + return; + } + int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default switch (format) { case PixelFormat.A_8: @@ -1087,10 +1620,28 @@ public void surfaceChanged(SurfaceHolder holder, mWidth = width; mHeight = height; - SDLActivity.onNativeResize(width, height, sdlFormat, mDisplay.getRefreshRate()); + int nDeviceWidth = width; + int nDeviceHeight = height; + try + { + if (Build.VERSION.SDK_INT >= 17) { + android.util.DisplayMetrics realMetrics = new android.util.DisplayMetrics(); + mDisplay.getRealMetrics( realMetrics ); + nDeviceWidth = realMetrics.widthPixels; + nDeviceHeight = realMetrics.heightPixels; + } + } + catch ( java.lang.Throwable throwable ) {} + + synchronized(SDLActivity.getContext()) { + // In case we're waiting on a size change after going fullscreen, send a notification. + SDLActivity.getContext().notifyAll(); + } + Log.v("SDL", "Window size: " + width + "x" + height); + Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight); + SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); - boolean skip = false; int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation(); @@ -1098,12 +1649,12 @@ public void surfaceChanged(SurfaceHolder holder, { // Accept any } - else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) + else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) { if (mWidth > mHeight) { skip = true; } - } else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { + } else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) { if (mWidth < mHeight) { skip = true; } @@ -1113,7 +1664,7 @@ else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) if (skip) { double min = Math.min(mWidth, mHeight); double max = Math.max(mWidth, mHeight); - + if (max / min < 1.20) { Log.v("SDL", "Don't skip on such aspect-ratio. Could be a square resolution."); skip = false; @@ -1122,70 +1673,48 @@ else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) if (skip) { Log.v("SDL", "Skip .. Surface is not ready."); + SDLActivity.mIsSurfaceReady = false; return; } - - // Set mIsSurfaceReady to 'true' *before* making a call to handleResume + /* Surface is ready */ SDLActivity.mIsSurfaceReady = true; - SDLActivity.onNativeSurfaceChanged(); - - if (SDLActivity.mSDLThread == null) { - // This is the entry point to the C app. - // Start up the C app thread and enable sensor input for the first time - - final Thread sdlThread = new Thread(new SDLMain(), "SDLThread"); - enableSensor(Sensor.TYPE_ACCELEROMETER, true); - sdlThread.start(); - - // Set up a listener thread to catch when the native thread ends - SDLActivity.mSDLThread = new Thread(new Runnable(){ - @Override - public void run(){ - try { - sdlThread.join(); - } - catch(Exception e){} - finally{ - // Native thread has finished - if (! SDLActivity.mExitCalledFromJava) { - SDLActivity.handleNativeExit(); - } - } - } - }, "SDLThreadListener"); - SDLActivity.mSDLThread.start(); - } + /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ + SDLActivity.onNativeSurfaceChanged(); - if (SDLActivity.mHasFocus) { - SDLActivity.handleResume(); - } + SDLActivity.handleNativeState(); } // Key events @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // Dispatch the different events depending on where they come from - // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD - // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD - - if ( (event.getSource() & InputDevice.SOURCE_GAMEPAD) != 0 || - (event.getSource() & InputDevice.SOURCE_DPAD) != 0 ) { + // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD + // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD + // + // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and + // SOURCE_JOYSTICK, while its key events arrive from the keyboard source + // So, retrieve the device itself and check all of its sources + if (SDLControllerManager.isDeviceSDLJoystick(event.getDeviceId())) { + // Note that we process events with specific key codes here if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) { + if (SDLControllerManager.onNativePadDown(event.getDeviceId(), keyCode) == 0) { return true; } } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (SDLActivity.onNativePadUp(event.getDeviceId(), keyCode) == 0) { + if (SDLControllerManager.onNativePadUp(event.getDeviceId(), keyCode) == 0) { return true; } } } - if( (event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) { + if ((event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) { if (event.getAction() == KeyEvent.ACTION_DOWN) { //Log.v("SDL", "key down: " + keyCode); + if (SDLActivity.isTextInputEvent(event)) { + SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); + } SDLActivity.onNativeKeyDown(keyCode); return true; } @@ -1196,6 +1725,20 @@ else if (event.getAction() == KeyEvent.ACTION_UP) { } } + if ((event.getSource() & InputDevice.SOURCE_MOUSE) != 0) { + // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses + // they are ignored here because sending them as mouse input to SDL is messy + if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { + switch (event.getAction()) { + case KeyEvent.ACTION_DOWN: + case KeyEvent.ACTION_UP: + // mark the event as handled or it will be handled by system + // handling KEYCODE_BACK by system will call onBackPressed() + return true; + } + } + } + return false; } @@ -1212,9 +1755,10 @@ public boolean onTouch(View v, MotionEvent event) { float x,y,p; // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. - if (event.getSource() == InputDevice.SOURCE_MOUSE && SDLActivity.mSeparateMouseAndTouch) { + // 12290 = Samsung DeX mode desktop mouse + if ((event.getSource() == InputDevice.SOURCE_MOUSE || event.getSource() == 12290) && SDLActivity.mSeparateMouseAndTouch) { if (Build.VERSION.SDK_INT < 14) { - mouseButton = 1; // For Android==12 all mouse buttons are the left button + mouseButton = 1; // all mouse buttons are the left button } else { try { mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); @@ -1222,7 +1766,14 @@ public boolean onTouch(View v, MotionEvent event) { mouseButton = 1; // oh well. } } - SDLActivity.onNativeMouse(mouseButton, action, event.getX(0), event.getY(0)); + + // We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values + // if we are. We'll leverage our existing mouse motion listener + SDLGenericMotionListener_API12 motionListener = SDLActivity.getMotionListener(); + x = motionListener.getEventX(event); + y = motionListener.getEventY(event); + + SDLActivity.onNativeMouse(mouseButton, action, x, y, motionListener.inRelativeMode()); } else { switch(action) { case MotionEvent.ACTION_MOVE: @@ -1307,30 +1858,90 @@ public void onAccuracyChanged(Sensor sensor, int accuracy) { @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { + + // Since we may have an orientation set, we won't receive onConfigurationChanged events. + // We thus should check here. + int newOrientation = SDLActivity.SDL_ORIENTATION_UNKNOWN; + float x, y; switch (mDisplay.getRotation()) { case Surface.ROTATION_90: x = -event.values[1]; y = event.values[0]; + newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE; break; case Surface.ROTATION_270: x = event.values[1]; y = -event.values[0]; + newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE_FLIPPED; break; case Surface.ROTATION_180: x = -event.values[1]; y = -event.values[0]; + newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT_FLIPPED; break; default: x = event.values[0]; y = event.values[1]; + newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT; break; } + + if (newOrientation != SDLActivity.mCurrentOrientation) { + SDLActivity.mCurrentOrientation = newOrientation; + SDLActivity.onNativeOrientationChanged(newOrientation); + } + SDLActivity.onNativeAccel(-x / SensorManager.GRAVITY_EARTH, y / SensorManager.GRAVITY_EARTH, - event.values[2] / SensorManager.GRAVITY_EARTH - 1); + event.values[2] / SensorManager.GRAVITY_EARTH); + + } } + + // Captured pointer events for API 26. + public boolean onCapturedPointerEvent(MotionEvent event) + { + int action = event.getActionMasked(); + + float x, y; + switch (action) { + case MotionEvent.ACTION_SCROLL: + x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); + y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + case MotionEvent.ACTION_HOVER_MOVE: + case MotionEvent.ACTION_MOVE: + x = event.getX(0); + y = event.getY(0); + SDLActivity.onNativeMouse(0, action, x, y, true); + return true; + + case MotionEvent.ACTION_BUTTON_PRESS: + case MotionEvent.ACTION_BUTTON_RELEASE: + + // Change our action value to what SDL's code expects. + if (action == MotionEvent.ACTION_BUTTON_PRESS) { + action = MotionEvent.ACTION_DOWN; + } + else if (action == MotionEvent.ACTION_BUTTON_RELEASE) { + action = MotionEvent.ACTION_UP; + } + + x = event.getX(0); + y = event.getY(0); + int button = event.getButtonState(); + + SDLActivity.onNativeMouse(button, action, x, y, true); + return true; + } + + return false; + } + } /* This is a fake invisible editor view that receives the input and defines the @@ -1353,23 +1964,20 @@ public boolean onCheckIsTextEditor() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { - - // This handles the hardware keyboard input - if (event.isPrintingKey()) { - if (event.getAction() == KeyEvent.ACTION_DOWN) { + /* + * This handles the hardware keyboard input + */ + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (SDLActivity.isTextInputEvent(event)) { ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); + return true; } - return true; - } - - if (event.getAction() == KeyEvent.ACTION_DOWN) { SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { SDLActivity.onNativeKeyUp(keyCode); return true; } - return false; } @@ -1379,7 +1987,7 @@ public boolean onKeyPreIme (int keyCode, KeyEvent event) { // As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event // FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639 // FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is showing or not - // FIXME: A more effective solution would be to change our Layout from AbsoluteLayout to Relative or Linear + // FIXME: A more effective solution would be to assume our Layout to be RelativeLayout or LinearLayout // FIXME: And determine the keyboard presence doing this: http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android // FIXME: An even more effective way would be if Android provided this out of the box, but where would the fun be in that :) if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { @@ -1396,7 +2004,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI - | 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */; + | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; } @@ -1411,30 +2019,43 @@ public SDLInputConnection(View targetView, boolean fullEditor) { @Override public boolean sendKeyEvent(KeyEvent event) { + /* + * This used to handle the keycodes from soft keyboard (and IME-translated input from hardkeyboard) + * However, as of Ice Cream Sandwich and later, almost all soft keyboard doesn't generate key presses + * and so we need to generate them ourselves in commitText. To avoid duplicates on the handful of keys + * that still do, we empty this out. + */ /* - * This handles the keycodes from soft keyboard (and IME-translated - * input from hardkeyboard) + * Return DOES still generate a key event, however. So rather than using it as the 'click a button' key + * as we do with physical keyboards, let's just use it to hide the keyboard. */ - int keyCode = event.getKeyCode(); - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (event.isPrintingKey()) { - commitText(String.valueOf((char) event.getUnicodeChar()), 1); - } - SDLActivity.onNativeKeyDown(keyCode); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativeKeyUp(keyCode); - return true; + if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { + String imeHide = SDLActivity.nativeGetHint("SDL_RETURN_KEY_HIDES_IME"); + if ((imeHide != null) && imeHide.equals("1")) { + Context c = SDL.getContext(); + if (c instanceof SDLActivity) { + SDLActivity activity = (SDLActivity)c; + activity.sendCommand(SDLActivity.COMMAND_TEXTEDIT_HIDE, null); + return true; + } + } } + + return super.sendKeyEvent(event); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - nativeCommitText(text.toString(), newCursorPosition); + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + nativeGenerateScancodeForUnichar(c); + } + + SDLInputConnection.nativeCommitText(text.toString(), newCursorPosition); return super.commitText(text, newCursorPosition); } @@ -1447,215 +2068,107 @@ public boolean setComposingText(CharSequence text, int newCursorPosition) { return super.setComposingText(text, newCursorPosition); } - public native void nativeCommitText(String text, int newCursorPosition); + public static native void nativeCommitText(String text, int newCursorPosition); + + public native void nativeGenerateScancodeForUnichar(char c); public native void nativeSetComposingText(String text, int newCursorPosition); @Override public boolean deleteSurroundingText(int beforeLength, int afterLength) { // Workaround to capture backspace key. Ref: http://stackoverflow.com/questions/14560344/android-backspace-in-webview-baseinputconnection - if (beforeLength == 1 && afterLength == 0) { - // backspace - return super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)) - && super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); + // and https://bugzilla.libsdl.org/show_bug.cgi?id=2265 + if (beforeLength > 0 && afterLength == 0) { + boolean ret = true; + // backspace(s) + while (beforeLength-- > 0) { + boolean ret_key = sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)) + && sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); + ret = ret && ret_key; + } + return ret; } return super.deleteSurroundingText(beforeLength, afterLength); } } -/* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */ -class SDLJoystickHandler { +interface SDLClipboardHandler { - /** - * Handles given MotionEvent. - * @param event the event to be handled. - * @return if given event was processed. - */ - public boolean handleMotionEvent(MotionEvent event) { - return false; - } + public boolean clipboardHasText(); + public String clipboardGetText(); + public void clipboardSetText(String string); - /** - * Handles adding and removing of input devices. - */ - public void pollInputDevices() { - } } -/* Actual joystick functionality available for API >= 12 devices */ -class SDLJoystickHandler_API12 extends SDLJoystickHandler { - - static class SDLJoystick { - public int device_id; - public String name; - public ArrayList axes; - public ArrayList hats; - } - static class RangeComparator implements Comparator { - @Override - public int compare(InputDevice.MotionRange arg0, InputDevice.MotionRange arg1) { - return arg0.getAxis() - arg1.getAxis(); - } - } - private ArrayList mJoysticks; +class SDLClipboardHandler_API11 implements + SDLClipboardHandler, + android.content.ClipboardManager.OnPrimaryClipChangedListener { - public SDLJoystickHandler_API12() { + protected android.content.ClipboardManager mClipMgr; - mJoysticks = new ArrayList(); + SDLClipboardHandler_API11() { + mClipMgr = (android.content.ClipboardManager) SDL.getContext().getSystemService(Context.CLIPBOARD_SERVICE); + mClipMgr.addPrimaryClipChangedListener(this); } @Override - public void pollInputDevices() { - int[] deviceIds = InputDevice.getDeviceIds(); - // It helps processing the device ids in reverse order - // For example, in the case of the XBox 360 wireless dongle, - // so the first controller seen by SDL matches what the receiver - // considers to be the first controller - - for(int i=deviceIds.length-1; i>-1; i--) { - SDLJoystick joystick = getJoystick(deviceIds[i]); - if (joystick == null) { - joystick = new SDLJoystick(); - InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]); - - if ( - (joystickDevice.getSources() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 - || - (joystickDevice.getSources() & InputDevice.SOURCE_CLASS_BUTTON) != 0 - ) - { - joystick.device_id = deviceIds[i]; - joystick.name = joystickDevice.getName(); - joystick.axes = new ArrayList(); - joystick.hats = new ArrayList(); - - List ranges = joystickDevice.getMotionRanges(); - Collections.sort(ranges, new RangeComparator()); - for (InputDevice.MotionRange range : ranges ) { - if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 ) { - if (range.getAxis() == MotionEvent.AXIS_HAT_X || - range.getAxis() == MotionEvent.AXIS_HAT_Y) { - joystick.hats.add(range); - } - else { - joystick.axes.add(range); - } - } - } - - mJoysticks.add(joystick); - SDLActivity.nativeAddJoystick(joystick.device_id, joystick.name, 0, -1, - joystick.axes.size(), joystick.hats.size()/2, 0); - } - } - } - - /* Check removed devices */ - ArrayList removedDevices = new ArrayList(); - for(int i=0; i < mJoysticks.size(); i++) { - int device_id = mJoysticks.get(i).device_id; - int j; - for (j=0; j < deviceIds.length; j++) { - if (device_id == deviceIds[j]) break; - } - if (j == deviceIds.length) { - removedDevices.add(Integer.valueOf(device_id)); - } - } - - for(int i=0; i < removedDevices.size(); i++) { - int device_id = removedDevices.get(i).intValue(); - SDLActivity.nativeRemoveJoystick(device_id); - for (int j=0; j < mJoysticks.size(); j++) { - if (mJoysticks.get(j).device_id == device_id) { - mJoysticks.remove(j); - break; - } - } - } + public boolean clipboardHasText() { + return mClipMgr.hasText(); } - protected SDLJoystick getJoystick(int device_id) { - for(int i=0; i < mJoysticks.size(); i++) { - if (mJoysticks.get(i).device_id == device_id) { - return mJoysticks.get(i); - } + @Override + public String clipboardGetText() { + CharSequence text; + text = mClipMgr.getText(); + if (text != null) { + return text.toString(); } return null; } @Override - public boolean handleMotionEvent(MotionEvent event) { - if ( (event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) { - int actionPointerIndex = event.getActionIndex(); - int action = event.getActionMasked(); - switch(action) { - case MotionEvent.ACTION_MOVE: - SDLJoystick joystick = getJoystick(event.getDeviceId()); - if ( joystick != null ) { - for (int i = 0; i < joystick.axes.size(); i++) { - InputDevice.MotionRange range = joystick.axes.get(i); - /* Normalize the value to -1...1 */ - float value = ( event.getAxisValue( range.getAxis(), actionPointerIndex) - range.getMin() ) / range.getRange() * 2.0f - 1.0f; - SDLActivity.onNativeJoy(joystick.device_id, i, value ); - } - for (int i = 0; i < joystick.hats.size(); i+=2) { - int hatX = Math.round(event.getAxisValue( joystick.hats.get(i).getAxis(), actionPointerIndex ) ); - int hatY = Math.round(event.getAxisValue( joystick.hats.get(i+1).getAxis(), actionPointerIndex ) ); - SDLActivity.onNativeHat(joystick.device_id, i/2, hatX, hatY ); - } - } - break; - default: - break; - } - } - return true; + public void clipboardSetText(String string) { + mClipMgr.removePrimaryClipChangedListener(this); + mClipMgr.setText(string); + mClipMgr.addPrimaryClipChangedListener(this); } -} - -class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { - // Generic Motion (mouse hover, joystick...) events go here + @Override - public boolean onGenericMotion(View v, MotionEvent event) { - float x, y; - int action; - - switch ( event.getSource() ) { - case InputDevice.SOURCE_JOYSTICK: - case InputDevice.SOURCE_GAMEPAD: - case InputDevice.SOURCE_DPAD: - SDLActivity.handleJoystickMotionEvent(event); - return true; - - case InputDevice.SOURCE_MOUSE: - action = event.getActionMasked(); - switch (action) { - case MotionEvent.ACTION_SCROLL: - x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); - y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); - SDLActivity.onNativeMouse(0, action, x, y); - return true; + public void onPrimaryClipChanged() { + SDLActivity.onNativeClipboardChanged(); + } - case MotionEvent.ACTION_HOVER_MOVE: - x = event.getX(0); - y = event.getY(0); +} - SDLActivity.onNativeMouse(0, action, x, y); - return true; +class SDLClipboardHandler_Old implements + SDLClipboardHandler { + + protected android.text.ClipboardManager mClipMgrOld; + + SDLClipboardHandler_Old() { + mClipMgrOld = (android.text.ClipboardManager) SDL.getContext().getSystemService(Context.CLIPBOARD_SERVICE); + } - default: - break; - } - break; + @Override + public boolean clipboardHasText() { + return mClipMgrOld.hasText(); + } - default: - break; - } + @Override + public String clipboardGetText() { + CharSequence text; + text = mClipMgrOld.getText(); + if (text != null) { + return text.toString(); + } + return null; + } - // Event was not managed - return false; + @Override + public void clipboardSetText(String string) { + mClipMgrOld.setText(string); } } + diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java new file mode 100644 index 0000000000..bed0eb5c3c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java @@ -0,0 +1,368 @@ +package org.libsdl.app; + +import android.media.*; +import android.os.Build; +import android.util.Log; + +public class SDLAudioManager +{ + protected static final String TAG = "SDLAudio"; + + protected static AudioTrack mAudioTrack; + protected static AudioRecord mAudioRecord; + + public static void initialize() { + mAudioTrack = null; + mAudioRecord = null; + } + + // Audio + + protected static String getAudioFormatString(int audioFormat) { + switch (audioFormat) { + case AudioFormat.ENCODING_PCM_8BIT: + return "8-bit"; + case AudioFormat.ENCODING_PCM_16BIT: + return "16-bit"; + case AudioFormat.ENCODING_PCM_FLOAT: + return "float"; + default: + return Integer.toString(audioFormat); + } + } + + protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { + int channelConfig; + int sampleSize; + int frameSize; + + Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz"); + + /* On older devices let's use known good settings */ + if (Build.VERSION.SDK_INT < 21) { + if (desiredChannels > 2) { + desiredChannels = 2; + } + if (sampleRate < 8000) { + sampleRate = 8000; + } else if (sampleRate > 48000) { + sampleRate = 48000; + } + } + + if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) { + int minSDKVersion = (isCapture ? 23 : 21); + if (Build.VERSION.SDK_INT < minSDKVersion) { + audioFormat = AudioFormat.ENCODING_PCM_16BIT; + } + } + switch (audioFormat) + { + case AudioFormat.ENCODING_PCM_8BIT: + sampleSize = 1; + break; + case AudioFormat.ENCODING_PCM_16BIT: + sampleSize = 2; + break; + case AudioFormat.ENCODING_PCM_FLOAT: + sampleSize = 4; + break; + default: + Log.v(TAG, "Requested format " + audioFormat + ", getting ENCODING_PCM_16BIT"); + audioFormat = AudioFormat.ENCODING_PCM_16BIT; + sampleSize = 2; + break; + } + + if (isCapture) { + switch (desiredChannels) { + case 1: + channelConfig = AudioFormat.CHANNEL_IN_MONO; + break; + case 2: + channelConfig = AudioFormat.CHANNEL_IN_STEREO; + break; + default: + Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); + desiredChannels = 2; + channelConfig = AudioFormat.CHANNEL_IN_STEREO; + break; + } + } else { + switch (desiredChannels) { + case 1: + channelConfig = AudioFormat.CHANNEL_OUT_MONO; + break; + case 2: + channelConfig = AudioFormat.CHANNEL_OUT_STEREO; + break; + case 3: + channelConfig = AudioFormat.CHANNEL_OUT_STEREO | AudioFormat.CHANNEL_OUT_FRONT_CENTER; + break; + case 4: + channelConfig = AudioFormat.CHANNEL_OUT_QUAD; + break; + case 5: + channelConfig = AudioFormat.CHANNEL_OUT_QUAD | AudioFormat.CHANNEL_OUT_FRONT_CENTER; + break; + case 6: + channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; + break; + case 7: + channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER; + break; + case 8: + if (Build.VERSION.SDK_INT >= 23) { + channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; + } else { + Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround"); + desiredChannels = 6; + channelConfig = AudioFormat.CHANNEL_OUT_5POINT1; + } + break; + default: + Log.v(TAG, "Requested " + desiredChannels + " channels, getting stereo"); + desiredChannels = 2; + channelConfig = AudioFormat.CHANNEL_OUT_STEREO; + break; + } + +/* + Log.v(TAG, "Speaker configuration (and order of channels):"); + + if ((channelConfig & 0x00000004) != 0) { + Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT"); + } + if ((channelConfig & 0x00000008) != 0) { + Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT"); + } + if ((channelConfig & 0x00000010) != 0) { + Log.v(TAG, " CHANNEL_OUT_FRONT_CENTER"); + } + if ((channelConfig & 0x00000020) != 0) { + Log.v(TAG, " CHANNEL_OUT_LOW_FREQUENCY"); + } + if ((channelConfig & 0x00000040) != 0) { + Log.v(TAG, " CHANNEL_OUT_BACK_LEFT"); + } + if ((channelConfig & 0x00000080) != 0) { + Log.v(TAG, " CHANNEL_OUT_BACK_RIGHT"); + } + if ((channelConfig & 0x00000100) != 0) { + Log.v(TAG, " CHANNEL_OUT_FRONT_LEFT_OF_CENTER"); + } + if ((channelConfig & 0x00000200) != 0) { + Log.v(TAG, " CHANNEL_OUT_FRONT_RIGHT_OF_CENTER"); + } + if ((channelConfig & 0x00000400) != 0) { + Log.v(TAG, " CHANNEL_OUT_BACK_CENTER"); + } + if ((channelConfig & 0x00000800) != 0) { + Log.v(TAG, " CHANNEL_OUT_SIDE_LEFT"); + } + if ((channelConfig & 0x00001000) != 0) { + Log.v(TAG, " CHANNEL_OUT_SIDE_RIGHT"); + } +*/ + } + frameSize = (sampleSize * desiredChannels); + + // Let the user pick a larger buffer if they really want -- but ye + // gods they probably shouldn't, the minimums are horrifyingly high + // latency already + int minBufferSize; + if (isCapture) { + minBufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat); + } else { + minBufferSize = AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat); + } + desiredFrames = Math.max(desiredFrames, (minBufferSize + frameSize - 1) / frameSize); + + int[] results = new int[4]; + + if (isCapture) { + if (mAudioRecord == null) { + mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, + channelConfig, audioFormat, desiredFrames * frameSize); + + // see notes about AudioTrack state in audioOpen(), above. Probably also applies here. + if (mAudioRecord.getState() != AudioRecord.STATE_INITIALIZED) { + Log.e(TAG, "Failed during initialization of AudioRecord"); + mAudioRecord.release(); + mAudioRecord = null; + return null; + } + + mAudioRecord.startRecording(); + } + + results[0] = mAudioRecord.getSampleRate(); + results[1] = mAudioRecord.getAudioFormat(); + results[2] = mAudioRecord.getChannelCount(); + results[3] = desiredFrames; + + } else { + if (mAudioTrack == null) { + mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); + + // Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid + // Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java + // Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState() + if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) { + /* Try again, with safer values */ + + Log.e(TAG, "Failed during initialization of Audio Track"); + mAudioTrack.release(); + mAudioTrack = null; + return null; + } + + mAudioTrack.play(); + } + + results[0] = mAudioTrack.getSampleRate(); + results[1] = mAudioTrack.getAudioFormat(); + results[2] = mAudioTrack.getChannelCount(); + results[3] = desiredFrames; + } + + Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", got " + results[3] + " frames of " + results[2] + " channel " + getAudioFormatString(results[1]) + " audio at " + results[0] + " Hz"); + + return results; + } + + /** + * This method is called by SDL using JNI. + */ + public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { + return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames); + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioWriteFloatBuffer(float[] buffer) { + if (mAudioTrack == null) { + Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); + return; + } + + for (int i = 0; i < buffer.length;) { + int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING); + if (result > 0) { + i += result; + } else if (result == 0) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + // Nom nom + } + } else { + Log.w(TAG, "SDL audio: error return from write(float)"); + return; + } + } + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioWriteShortBuffer(short[] buffer) { + if (mAudioTrack == null) { + Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); + return; + } + + for (int i = 0; i < buffer.length;) { + int result = mAudioTrack.write(buffer, i, buffer.length - i); + if (result > 0) { + i += result; + } else if (result == 0) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + // Nom nom + } + } else { + Log.w(TAG, "SDL audio: error return from write(short)"); + return; + } + } + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioWriteByteBuffer(byte[] buffer) { + if (mAudioTrack == null) { + Log.e(TAG, "Attempted to make audio call with uninitialized audio!"); + return; + } + + for (int i = 0; i < buffer.length; ) { + int result = mAudioTrack.write(buffer, i, buffer.length - i); + if (result > 0) { + i += result; + } else if (result == 0) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + // Nom nom + } + } else { + Log.w(TAG, "SDL audio: error return from write(byte)"); + return; + } + } + } + + /** + * This method is called by SDL using JNI. + */ + public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) { + return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames); + } + + /** This method is called by SDL using JNI. */ + public static int captureReadFloatBuffer(float[] buffer, boolean blocking) { + return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); + } + + /** This method is called by SDL using JNI. */ + public static int captureReadShortBuffer(short[] buffer, boolean blocking) { + if (Build.VERSION.SDK_INT < 23) { + return mAudioRecord.read(buffer, 0, buffer.length); + } else { + return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); + } + } + + /** This method is called by SDL using JNI. */ + public static int captureReadByteBuffer(byte[] buffer, boolean blocking) { + if (Build.VERSION.SDK_INT < 23) { + return mAudioRecord.read(buffer, 0, buffer.length); + } else { + return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); + } + } + + /** This method is called by SDL using JNI. */ + public static void audioClose() { + if (mAudioTrack != null) { + mAudioTrack.stop(); + mAudioTrack.release(); + mAudioTrack = null; + } + } + + /** This method is called by SDL using JNI. */ + public static void captureClose() { + if (mAudioRecord != null) { + mAudioRecord.stop(); + mAudioRecord.release(); + mAudioRecord = null; + } + } + + public static native int nativeSetupJNI(); +} diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java new file mode 100644 index 0000000000..6c5623d27d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -0,0 +1,846 @@ +package org.libsdl.app; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import android.content.Context; +import android.os.*; +import android.view.*; +import android.util.Log; + + +public class SDLControllerManager +{ + + public static native int nativeSetupJNI(); + + public static native int nativeAddJoystick(int device_id, String name, String desc, + int vendor_id, int product_id, + boolean is_accelerometer, int button_mask, + int naxes, int nhats, int nballs); + public static native int nativeRemoveJoystick(int device_id); + public static native int nativeAddHaptic(int device_id, String name); + public static native int nativeRemoveHaptic(int device_id); + public static native int onNativePadDown(int device_id, int keycode); + public static native int onNativePadUp(int device_id, int keycode); + public static native void onNativeJoy(int device_id, int axis, + float value); + public static native void onNativeHat(int device_id, int hat_id, + int x, int y); + + protected static SDLJoystickHandler mJoystickHandler; + protected static SDLHapticHandler mHapticHandler; + + private static final String TAG = "SDLControllerManager"; + + public static void initialize() { + if (mJoystickHandler == null) { + if (Build.VERSION.SDK_INT >= 19) { + mJoystickHandler = new SDLJoystickHandler_API19(); + } else if (Build.VERSION.SDK_INT >= 16) { + mJoystickHandler = new SDLJoystickHandler_API16(); + } else if (Build.VERSION.SDK_INT >= 12) { + mJoystickHandler = new SDLJoystickHandler_API12(); + } else { + mJoystickHandler = new SDLJoystickHandler(); + } + } + + if (mHapticHandler == null) { + if (Build.VERSION.SDK_INT >= 26) { + mHapticHandler = new SDLHapticHandler_API26(); + } else { + mHapticHandler = new SDLHapticHandler(); + } + } + } + + // Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance + public static boolean handleJoystickMotionEvent(MotionEvent event) { + return mJoystickHandler.handleMotionEvent(event); + } + + /** + * This method is called by SDL using JNI. + */ + public static void pollInputDevices() { + mJoystickHandler.pollInputDevices(); + } + + /** + * This method is called by SDL using JNI. + */ + public static void pollHapticDevices() { + mHapticHandler.pollHapticDevices(); + } + + /** + * This method is called by SDL using JNI. + */ + public static void hapticRun(int device_id, float intensity, int length) { + mHapticHandler.run(device_id, intensity, length); + } + + /** + * This method is called by SDL using JNI. + */ + public static void hapticStop(int device_id) + { + mHapticHandler.stop(device_id); + } + + // Check if a given device is considered a possible SDL joystick + public static boolean isDeviceSDLJoystick(int deviceId) { + InputDevice device = InputDevice.getDevice(deviceId); + // We cannot use InputDevice.isVirtual before API 16, so let's accept + // only nonnegative device ids (VIRTUAL_KEYBOARD equals -1) + if ((device == null) || (deviceId < 0)) { + return false; + } + int sources = device.getSources(); + + /* This is called for every button press, so let's not spam the logs */ + /** + if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) { + Log.v(TAG, "Input device " + device.getName() + " is a joystick."); + } + if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) { + Log.v(TAG, "Input device " + device.getName() + " is a dpad."); + } + if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) { + Log.v(TAG, "Input device " + device.getName() + " is a gamepad."); + } + **/ + + return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) || + ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) || + ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) + ); + } + +} + +/* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */ +class SDLJoystickHandler { + + /** + * Handles given MotionEvent. + * @param event the event to be handled. + * @return if given event was processed. + */ + public boolean handleMotionEvent(MotionEvent event) { + return false; + } + + /** + * Handles adding and removing of input devices. + */ + public void pollInputDevices() { + } +} + +/* Actual joystick functionality available for API >= 12 devices */ +class SDLJoystickHandler_API12 extends SDLJoystickHandler { + + static class SDLJoystick { + public int device_id; + public String name; + public String desc; + public ArrayList axes; + public ArrayList hats; + } + static class RangeComparator implements Comparator { + @Override + public int compare(InputDevice.MotionRange arg0, InputDevice.MotionRange arg1) { + // Some controllers, like the Moga Pro 2, return AXIS_GAS (22) for right trigger and AXIS_BRAKE (23) for left trigger - swap them so they're sorted in the right order for SDL + int arg0Axis = arg0.getAxis(); + int arg1Axis = arg1.getAxis(); + if (arg0Axis == MotionEvent.AXIS_GAS) { + arg0Axis = MotionEvent.AXIS_BRAKE; + } else if (arg0Axis == MotionEvent.AXIS_BRAKE) { + arg0Axis = MotionEvent.AXIS_GAS; + } + if (arg1Axis == MotionEvent.AXIS_GAS) { + arg1Axis = MotionEvent.AXIS_BRAKE; + } else if (arg1Axis == MotionEvent.AXIS_BRAKE) { + arg1Axis = MotionEvent.AXIS_GAS; + } + + return arg0Axis - arg1Axis; + } + } + + private ArrayList mJoysticks; + + public SDLJoystickHandler_API12() { + + mJoysticks = new ArrayList(); + } + + @Override + public void pollInputDevices() { + int[] deviceIds = InputDevice.getDeviceIds(); + for(int i=0; i < deviceIds.length; ++i) { + SDLJoystick joystick = getJoystick(deviceIds[i]); + if (joystick == null) { + joystick = new SDLJoystick(); + InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]); + if (SDLControllerManager.isDeviceSDLJoystick(deviceIds[i])) { + joystick.device_id = deviceIds[i]; + joystick.name = joystickDevice.getName(); + joystick.desc = getJoystickDescriptor(joystickDevice); + joystick.axes = new ArrayList(); + joystick.hats = new ArrayList(); + + List ranges = joystickDevice.getMotionRanges(); + Collections.sort(ranges, new RangeComparator()); + for (InputDevice.MotionRange range : ranges ) { + if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + if (range.getAxis() == MotionEvent.AXIS_HAT_X || + range.getAxis() == MotionEvent.AXIS_HAT_Y) { + joystick.hats.add(range); + } + else { + joystick.axes.add(range); + } + } + } + + mJoysticks.add(joystick); + SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc, getVendorId(joystickDevice), getProductId(joystickDevice), false, getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0); + } + } + } + + /* Check removed devices */ + ArrayList removedDevices = new ArrayList(); + for(int i=0; i < mJoysticks.size(); i++) { + int device_id = mJoysticks.get(i).device_id; + int j; + for (j=0; j < deviceIds.length; j++) { + if (device_id == deviceIds[j]) break; + } + if (j == deviceIds.length) { + removedDevices.add(Integer.valueOf(device_id)); + } + } + + for(int i=0; i < removedDevices.size(); i++) { + int device_id = removedDevices.get(i).intValue(); + SDLControllerManager.nativeRemoveJoystick(device_id); + for (int j=0; j < mJoysticks.size(); j++) { + if (mJoysticks.get(j).device_id == device_id) { + mJoysticks.remove(j); + break; + } + } + } + } + + protected SDLJoystick getJoystick(int device_id) { + for(int i=0; i < mJoysticks.size(); i++) { + if (mJoysticks.get(i).device_id == device_id) { + return mJoysticks.get(i); + } + } + return null; + } + + @Override + public boolean handleMotionEvent(MotionEvent event) { + if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) { + int actionPointerIndex = event.getActionIndex(); + int action = event.getActionMasked(); + switch(action) { + case MotionEvent.ACTION_MOVE: + SDLJoystick joystick = getJoystick(event.getDeviceId()); + if ( joystick != null ) { + for (int i = 0; i < joystick.axes.size(); i++) { + InputDevice.MotionRange range = joystick.axes.get(i); + /* Normalize the value to -1...1 */ + float value = ( event.getAxisValue( range.getAxis(), actionPointerIndex) - range.getMin() ) / range.getRange() * 2.0f - 1.0f; + SDLControllerManager.onNativeJoy(joystick.device_id, i, value ); + } + for (int i = 0; i < joystick.hats.size(); i+=2) { + int hatX = Math.round(event.getAxisValue( joystick.hats.get(i).getAxis(), actionPointerIndex ) ); + int hatY = Math.round(event.getAxisValue( joystick.hats.get(i+1).getAxis(), actionPointerIndex ) ); + SDLControllerManager.onNativeHat(joystick.device_id, i/2, hatX, hatY ); + } + } + break; + default: + break; + } + } + return true; + } + + public String getJoystickDescriptor(InputDevice joystickDevice) { + return joystickDevice.getName(); + } + public int getProductId(InputDevice joystickDevice) { + return 0; + } + public int getVendorId(InputDevice joystickDevice) { + return 0; + } + public int getButtonMask(InputDevice joystickDevice) { + return -1; + } +} + +class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 { + + @Override + public String getJoystickDescriptor(InputDevice joystickDevice) { + String desc = joystickDevice.getDescriptor(); + + if (desc != null && !desc.isEmpty()) { + return desc; + } + + return super.getJoystickDescriptor(joystickDevice); + } +} + +class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { + + @Override + public int getProductId(InputDevice joystickDevice) { + return joystickDevice.getProductId(); + } + + @Override + public int getVendorId(InputDevice joystickDevice) { + return joystickDevice.getVendorId(); + } + + @Override + public int getButtonMask(InputDevice joystickDevice) { + int button_mask = 0; + int[] keys = new int[] { + KeyEvent.KEYCODE_BUTTON_A, + KeyEvent.KEYCODE_BUTTON_B, + KeyEvent.KEYCODE_BUTTON_X, + KeyEvent.KEYCODE_BUTTON_Y, + KeyEvent.KEYCODE_BACK, + KeyEvent.KEYCODE_BUTTON_MODE, + KeyEvent.KEYCODE_BUTTON_START, + KeyEvent.KEYCODE_BUTTON_THUMBL, + KeyEvent.KEYCODE_BUTTON_THUMBR, + KeyEvent.KEYCODE_BUTTON_L1, + KeyEvent.KEYCODE_BUTTON_R1, + KeyEvent.KEYCODE_DPAD_UP, + KeyEvent.KEYCODE_DPAD_DOWN, + KeyEvent.KEYCODE_DPAD_LEFT, + KeyEvent.KEYCODE_DPAD_RIGHT, + KeyEvent.KEYCODE_BUTTON_SELECT, + KeyEvent.KEYCODE_DPAD_CENTER, + + // These don't map into any SDL controller buttons directly + KeyEvent.KEYCODE_BUTTON_L2, + KeyEvent.KEYCODE_BUTTON_R2, + KeyEvent.KEYCODE_BUTTON_C, + KeyEvent.KEYCODE_BUTTON_Z, + KeyEvent.KEYCODE_BUTTON_1, + KeyEvent.KEYCODE_BUTTON_2, + KeyEvent.KEYCODE_BUTTON_3, + KeyEvent.KEYCODE_BUTTON_4, + KeyEvent.KEYCODE_BUTTON_5, + KeyEvent.KEYCODE_BUTTON_6, + KeyEvent.KEYCODE_BUTTON_7, + KeyEvent.KEYCODE_BUTTON_8, + KeyEvent.KEYCODE_BUTTON_9, + KeyEvent.KEYCODE_BUTTON_10, + KeyEvent.KEYCODE_BUTTON_11, + KeyEvent.KEYCODE_BUTTON_12, + KeyEvent.KEYCODE_BUTTON_13, + KeyEvent.KEYCODE_BUTTON_14, + KeyEvent.KEYCODE_BUTTON_15, + KeyEvent.KEYCODE_BUTTON_16, + }; + int[] masks = new int[] { + (1 << 0), // A -> A + (1 << 1), // B -> B + (1 << 2), // X -> X + (1 << 3), // Y -> Y + (1 << 4), // BACK -> BACK + (1 << 5), // MODE -> GUIDE + (1 << 6), // START -> START + (1 << 7), // THUMBL -> LEFTSTICK + (1 << 8), // THUMBR -> RIGHTSTICK + (1 << 9), // L1 -> LEFTSHOULDER + (1 << 10), // R1 -> RIGHTSHOULDER + (1 << 11), // DPAD_UP -> DPAD_UP + (1 << 12), // DPAD_DOWN -> DPAD_DOWN + (1 << 13), // DPAD_LEFT -> DPAD_LEFT + (1 << 14), // DPAD_RIGHT -> DPAD_RIGHT + (1 << 4), // SELECT -> BACK + (1 << 0), // DPAD_CENTER -> A + (1 << 15), // L2 -> ?? + (1 << 16), // R2 -> ?? + (1 << 17), // C -> ?? + (1 << 18), // Z -> ?? + (1 << 20), // 1 -> ?? + (1 << 21), // 2 -> ?? + (1 << 22), // 3 -> ?? + (1 << 23), // 4 -> ?? + (1 << 24), // 5 -> ?? + (1 << 25), // 6 -> ?? + (1 << 26), // 7 -> ?? + (1 << 27), // 8 -> ?? + (1 << 28), // 9 -> ?? + (1 << 29), // 10 -> ?? + (1 << 30), // 11 -> ?? + (1 << 31), // 12 -> ?? + // We're out of room... + 0xFFFFFFFF, // 13 -> ?? + 0xFFFFFFFF, // 14 -> ?? + 0xFFFFFFFF, // 15 -> ?? + 0xFFFFFFFF, // 16 -> ?? + }; + boolean[] has_keys = joystickDevice.hasKeys(keys); + for (int i = 0; i < keys.length; ++i) { + if (has_keys[i]) { + button_mask |= masks[i]; + } + } + return button_mask; + } +} + +class SDLHapticHandler_API26 extends SDLHapticHandler { + @Override + public void run(int device_id, float intensity, int length) { + SDLHaptic haptic = getHaptic(device_id); + if (haptic != null) { + Log.d("SDL", "Rtest: Vibe with intensity " + intensity + " for " + length); + if (intensity == 0.0f) { + stop(device_id); + return; + } + + int vibeValue = Math.round(intensity * 255); + + if (vibeValue > 255) { + vibeValue = 255; + } + if (vibeValue < 1) { + stop(device_id); + return; + } + try { + haptic.vib.vibrate(VibrationEffect.createOneShot(length, vibeValue)); + } + catch (Exception e) { + // Fall back to the generic method, which uses DEFAULT_AMPLITUDE, but works even if + // something went horribly wrong with the Android 8.0 APIs. + haptic.vib.vibrate(length); + } + } + } +} + +class SDLHapticHandler { + + class SDLHaptic { + public int device_id; + public String name; + public Vibrator vib; + } + + private ArrayList mHaptics; + + public SDLHapticHandler() { + mHaptics = new ArrayList(); + } + + public void run(int device_id, float intensity, int length) { + SDLHaptic haptic = getHaptic(device_id); + if (haptic != null) { + haptic.vib.vibrate(length); + } + } + + public void stop(int device_id) { + SDLHaptic haptic = getHaptic(device_id); + if (haptic != null) { + haptic.vib.cancel(); + } + } + + public void pollHapticDevices() { + + final int deviceId_VIBRATOR_SERVICE = 999999; + boolean hasVibratorService = false; + + int[] deviceIds = InputDevice.getDeviceIds(); + // It helps processing the device ids in reverse order + // For example, in the case of the XBox 360 wireless dongle, + // so the first controller seen by SDL matches what the receiver + // considers to be the first controller + + if (Build.VERSION.SDK_INT >= 16) + { + for (int i = deviceIds.length - 1; i > -1; i--) { + SDLHaptic haptic = getHaptic(deviceIds[i]); + if (haptic == null) { + InputDevice device = InputDevice.getDevice(deviceIds[i]); + Vibrator vib = device.getVibrator(); + if (vib.hasVibrator()) { + haptic = new SDLHaptic(); + haptic.device_id = deviceIds[i]; + haptic.name = device.getName(); + haptic.vib = vib; + mHaptics.add(haptic); + SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name); + } + } + } + } + + /* Check VIBRATOR_SERVICE */ + Vibrator vib = (Vibrator) SDL.getContext().getSystemService(Context.VIBRATOR_SERVICE); + if (vib != null) { + if (Build.VERSION.SDK_INT >= 11) { + hasVibratorService = vib.hasVibrator(); + } else { + hasVibratorService = true; + } + + if (hasVibratorService) { + SDLHaptic haptic = getHaptic(deviceId_VIBRATOR_SERVICE); + if (haptic == null) { + haptic = new SDLHaptic(); + haptic.device_id = deviceId_VIBRATOR_SERVICE; + haptic.name = "VIBRATOR_SERVICE"; + haptic.vib = vib; + mHaptics.add(haptic); + SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name); + } + } + } + + /* Check removed devices */ + ArrayList removedDevices = new ArrayList(); + for(int i=0; i < mHaptics.size(); i++) { + int device_id = mHaptics.get(i).device_id; + int j; + for (j=0; j < deviceIds.length; j++) { + if (device_id == deviceIds[j]) break; + } + + if (device_id == deviceId_VIBRATOR_SERVICE && hasVibratorService) { + // don't remove the vibrator if it is still present + } else if (j == deviceIds.length) { + removedDevices.add(device_id); + } + } + + for(int i=0; i < removedDevices.size(); i++) { + int device_id = removedDevices.get(i); + SDLControllerManager.nativeRemoveHaptic(device_id); + for (int j=0; j < mHaptics.size(); j++) { + if (mHaptics.get(j).device_id == device_id) { + mHaptics.remove(j); + break; + } + } + } + } + + protected SDLHaptic getHaptic(int device_id) { + for(int i=0; i < mHaptics.size(); i++) { + if (mHaptics.get(i).device_id == device_id) { + return mHaptics.get(i); + } + } + return null; + } +} + +class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { + // Generic Motion (mouse hover, joystick...) events go here + @Override + public boolean onGenericMotion(View v, MotionEvent event) { + float x, y; + int action; + + switch ( event.getSource() ) { + case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: + return SDLControllerManager.handleJoystickMotionEvent(event); + + case InputDevice.SOURCE_MOUSE: + if (!SDLActivity.mSeparateMouseAndTouch) { + break; + } + action = event.getActionMasked(); + switch (action) { + case MotionEvent.ACTION_SCROLL: + x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); + y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + case MotionEvent.ACTION_HOVER_MOVE: + x = event.getX(0); + y = event.getY(0); + + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + default: + break; + } + break; + + default: + break; + } + + // Event was not managed + return false; + } + + public boolean supportsRelativeMouse() { + return false; + } + + public boolean inRelativeMode() { + return false; + } + + public boolean setRelativeMouseEnabled(boolean enabled) { + return false; + } + + public void reclaimRelativeMouseModeIfNeeded() + { + + } + + public float getEventX(MotionEvent event) { + return event.getX(0); + } + + public float getEventY(MotionEvent event) { + return event.getY(0); + } + +} + +class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 { + // Generic Motion (mouse hover, joystick...) events go here + + private boolean mRelativeModeEnabled; + + @Override + public boolean onGenericMotion(View v, MotionEvent event) { + float x, y; + int action; + + switch ( event.getSource() ) { + case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: + return SDLControllerManager.handleJoystickMotionEvent(event); + + case InputDevice.SOURCE_MOUSE: + if (!SDLActivity.mSeparateMouseAndTouch) { + break; + } + action = event.getActionMasked(); + switch (action) { + case MotionEvent.ACTION_SCROLL: + x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); + y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + case MotionEvent.ACTION_HOVER_MOVE: + if (mRelativeModeEnabled) { + x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); + y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); + } + else { + x = event.getX(0); + y = event.getY(0); + } + + SDLActivity.onNativeMouse(0, action, x, y, mRelativeModeEnabled); + return true; + + default: + break; + } + break; + + default: + break; + } + + // Event was not managed + return false; + } + + @Override + public boolean supportsRelativeMouse() { + return true; + } + + @Override + public boolean inRelativeMode() { + return mRelativeModeEnabled; + } + + @Override + public boolean setRelativeMouseEnabled(boolean enabled) { + mRelativeModeEnabled = enabled; + return true; + } + + @Override + public float getEventX(MotionEvent event) { + if (mRelativeModeEnabled) { + return event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); + } + else { + return event.getX(0); + } + } + + @Override + public float getEventY(MotionEvent event) { + if (mRelativeModeEnabled) { + return event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); + } + else { + return event.getY(0); + } + } +} + + +class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { + // Generic Motion (mouse hover, joystick...) events go here + private boolean mRelativeModeEnabled; + + @Override + public boolean onGenericMotion(View v, MotionEvent event) { + float x, y; + int action; + + switch ( event.getSource() ) { + case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: + return SDLControllerManager.handleJoystickMotionEvent(event); + + case InputDevice.SOURCE_MOUSE: + case 12290: // DeX desktop mouse cursor is a separate non-standard input type. + if (!SDLActivity.mSeparateMouseAndTouch) { + break; + } + + action = event.getActionMasked(); + switch (action) { + case MotionEvent.ACTION_SCROLL: + x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); + y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + case MotionEvent.ACTION_HOVER_MOVE: + x = event.getX(0); + y = event.getY(0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + default: + break; + } + break; + + case InputDevice.SOURCE_MOUSE_RELATIVE: + if (!SDLActivity.mSeparateMouseAndTouch) { + break; + } + action = event.getActionMasked(); + switch (action) { + case MotionEvent.ACTION_SCROLL: + x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); + y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); + SDLActivity.onNativeMouse(0, action, x, y, false); + return true; + + case MotionEvent.ACTION_HOVER_MOVE: + x = event.getX(0); + y = event.getY(0); + SDLActivity.onNativeMouse(0, action, x, y, true); + return true; + + default: + break; + } + break; + + default: + break; + } + + // Event was not managed + return false; + } + + @Override + public boolean supportsRelativeMouse() { + return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)); + } + + @Override + public boolean inRelativeMode() { + return mRelativeModeEnabled; + } + + @Override + public boolean setRelativeMouseEnabled(boolean enabled) { + if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) { + if (enabled) { + SDLActivity.getContentView().requestPointerCapture(); + } + else { + SDLActivity.getContentView().releasePointerCapture(); + } + mRelativeModeEnabled = enabled; + return true; + } + else + { + return false; + } + } + + @Override + public void reclaimRelativeMouseModeIfNeeded() + { + if (mRelativeModeEnabled && !SDLActivity.isDeXMode()) { + SDLActivity.getContentView().requestPointerCapture(); + } + } + + @Override + public float getEventX(MotionEvent event) { + // Relative mouse in capture mode will only have relative for X/Y + return event.getX(0); + } + + @Override + public float getEventY(MotionEvent event) { + // Relative mouse in capture mode will only have relative for X/Y + return event.getY(0); + } +} \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/android-project/res/drawable-hdpi/ic_launcher.png b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/android-project/res/drawable-hdpi/ic_launcher.png rename to 3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/3rdparty/sdl2-2.0.4/android-project/res/drawable-mdpi/ic_launcher.png b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/android-project/res/drawable-mdpi/ic_launcher.png rename to 3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/3rdparty/sdl2-2.0.4/android-project/res/drawable-xhdpi/ic_launcher.png b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/android-project/res/drawable-xhdpi/ic_launcher.png rename to 3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/3rdparty/sdl2-2.0.4/android-project/res/drawable-xxhdpi/ic_launcher.png b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from 3rdparty/sdl2-2.0.4/android-project/res/drawable-xxhdpi/ic_launcher.png rename to 3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..959c384b08 Binary files /dev/null and b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/colors.xml b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000..3ab3e9cbce --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/strings.xml b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000..ab79533060 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Game + diff --git a/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/styles.xml b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..ff6c9d2c0f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/3rdparty/sdl2-2.0.9/android-project/build.gradle b/3rdparty/sdl2-2.0.9/android-project/build.gradle new file mode 100644 index 0000000000..f6f90b25b1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.2.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + google() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/3rdparty/sdl2-2.0.9/android-project/gradle.properties b/3rdparty/sdl2-2.0.9/android-project/gradle.properties new file mode 100644 index 0000000000..aac7c9b461 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.jar b/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..13372aef5e Binary files /dev/null and b/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.jar differ diff --git a/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.properties b/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..f9b3be2f9f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Oct 23 13:51:26 PDT 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/3rdparty/sdl2-2.0.9/android-project/gradlew b/3rdparty/sdl2-2.0.9/android-project/gradlew new file mode 100755 index 0000000000..9d82f78915 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/3rdparty/sdl2-2.0.9/android-project/gradlew.bat b/3rdparty/sdl2-2.0.9/android-project/gradlew.bat new file mode 100644 index 0000000000..aec99730b4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/3rdparty/sdl2-2.0.9/android-project/settings.gradle b/3rdparty/sdl2-2.0.9/android-project/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/android-project/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/3rdparty/sdl2-2.0.4/autogen.sh b/3rdparty/sdl2-2.0.9/autogen.sh similarity index 88% rename from 3rdparty/sdl2-2.0.4/autogen.sh rename to 3rdparty/sdl2-2.0.9/autogen.sh index 649d7b31e9..9edfb8a7d9 100755 --- a/3rdparty/sdl2-2.0.4/autogen.sh +++ b/3rdparty/sdl2-2.0.9/autogen.sh @@ -3,6 +3,10 @@ echo "Generating build information using autoconf" echo "This may take a while ..." +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. +cd "$srcdir" + # Regenerate configuration files cat acinclude/* >aclocal.m4 found=false diff --git a/3rdparty/sdl2-2.0.9/build-scripts/androidbuild.sh b/3rdparty/sdl2-2.0.9/build-scripts/androidbuild.sh new file mode 100755 index 0000000000..8145781824 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/androidbuild.sh @@ -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" diff --git a/3rdparty/sdl2-2.0.9/build-scripts/androidbuildlibs.sh b/3rdparty/sdl2-2.0.9/build-scripts/androidbuildlibs.sh new file mode 100755 index 0000000000..934becc684 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/androidbuildlibs.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# 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= - specify alternate destination for installable +# modules. +# +# Note that SDLmain is not an installable module (.so) so libSDLmain.a +# can be found in $obj/local/ along with the unstripped libSDL.so. +# + + +# Android.mk is in srcdir +srcdir=`dirname $0`/.. +srcdir=`cd $srcdir && pwd` +cd $srcdir + + +# +# Create the build directories +# + +build=build +buildandroid=$build/android +obj= +lib= +ndk_args= + +# Allow an external caller to specify locations. +for arg in $* +do + if [ "${arg:0:8}" == "NDK_OUT=" ]; then + obj=${arg#NDK_OUT=} + elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then + lib=${arg#NDK_LIBS_OUT=} + else + ndk_args="$ndk_args $arg" + fi +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="armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-14 \ + APP_MODULES="SDL2 SDL2_main" \ + $ndk_args diff --git a/3rdparty/sdl2-2.0.4/build-scripts/checker-buildbot.sh b/3rdparty/sdl2-2.0.9/build-scripts/checker-buildbot.sh similarity index 66% rename from 3rdparty/sdl2-2.0.4/build-scripts/checker-buildbot.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/checker-buildbot.sh index 682e7fbbb8..cc16a50a2f 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/checker-buildbot.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/checker-buildbot.sh @@ -11,7 +11,7 @@ FINALDIR="$1" -CHECKERDIR="/usr/local/checker-276" +CHECKERDIR="/usr/local/checker-279" if [ ! -d "$CHECKERDIR" ]; then echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2 CHECKERDIR="/usr/share/clang/scan-build" @@ -46,6 +46,10 @@ fi echo "\$MAKE is '$MAKE'" +# Unset $MAKE so submakes don't use it. +MAKECOMMAND="$MAKE" +unset MAKE + set -x set -e @@ -60,17 +64,23 @@ fi mkdir checker-buildbot cd checker-buildbot +# We turn off deprecated declarations, because we don't care about these warnings during static analysis. +# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found" + # You might want to do this for CMake-backed builds instead... -PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug .. +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" .. # ...or run configure without the scan-build wrapper... -#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure - -# ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X). -#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure +#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled rm -rf analysis -PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND + +if [ `ls -A analysis |wc -l` == 0 ] ; then + mkdir analysis/zarro + echo 'Zarro boogsStatic analysis: no issues to report.' >analysis/zarro/index.html +fi + mv analysis/* ../analysis rmdir analysis # Make sure this is empty. cd .. diff --git a/3rdparty/sdl2-2.0.4/build-scripts/config.guess b/3rdparty/sdl2-2.0.9/build-scripts/config.guess old mode 100644 new mode 100755 similarity index 80% rename from 3rdparty/sdl2-2.0.4/build-scripts/config.guess rename to 3rdparty/sdl2-2.0.9/build-scripts/config.guess index 68c1be32a4..a744844274 --- a/3rdparty/sdl2-2.0.4/build-scripts/config.guess +++ b/3rdparty/sdl2-2.0.9/build-scripts/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-14' +timestamp='2017-08-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-08-14' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -182,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -192,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -208,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -220,6 +256,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -236,42 +278,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -306,7 +348,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -344,16 +386,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -378,7 +420,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -564,8 +606,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -602,13 +645,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -647,11 +690,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -664,12 +707,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -774,14 +817,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -797,10 +840,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -811,7 +855,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -859,21 +903,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -886,64 +930,60 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - case `sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - BCM2708) MANUFACTURER=raspberry;; - BCM2709) MANUFACTURER=raspberry;; - *) MANUFACTURER=unknown;; - esac if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -962,54 +1002,69 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1085,7 +1140,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1234,6 +1289,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1242,24 +1300,43 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1268,15 +1345,18 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; @@ -1290,7 +1370,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1332,7 +1412,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1343,171 +1423,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; -esac - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi +esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/3rdparty/sdl2-2.0.4/build-scripts/config.sub b/3rdparty/sdl2-2.0.9/build-scripts/config.sub old mode 100644 new mode 100755 similarity index 90% rename from 3rdparty/sdl2-2.0.4/build-scripts/config.sub rename to 3rdparty/sdl2-2.0.9/build-scripts/config.sub index 53273f2bbf..dcf41330c8 --- a/3rdparty/sdl2-2.0.4/build-scripts/config.sub +++ b/3rdparty/sdl2-2.0.9/build-scripts/config.sub @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-18' +timestamp='2017-04-02' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . @@ -26,11 +20,12 @@ timestamp='2012-08-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -38,7 +33,7 @@ timestamp='2012-08-18' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -58,8 +53,7 @@ timestamp='2012-08-18' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -73,9 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -124,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -156,7 +148,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,21 +251,25 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -287,26 +283,30 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -314,6 +314,8 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,7 +330,10 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -383,26 +388,29 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -416,28 +424,34 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -445,6 +459,8 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -521,6 +537,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -641,6 +660,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -782,6 +809,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -801,7 +831,7 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; mingw64) @@ -809,7 +839,7 @@ case $basic_machine in os=-mingw64 ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -837,6 +867,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -845,7 +879,7 @@ case $basic_machine in basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -933,6 +967,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1017,7 +1054,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1027,7 +1064,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1040,7 +1077,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1224,6 +1265,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1367,29 +1411,30 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1437,6 +1482,9 @@ case $os in -os400*) os=-os400 ;; + -cegcc*) + os=-cegcc + ;; -wince*) os=-wince ;; @@ -1519,9 +1567,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1534,6 +1579,8 @@ case $os in -pnacl*) os=-pnacl ;; + -ios) + ;; -emscripten*) ;; -none) @@ -1576,6 +1623,9 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; @@ -1628,6 +1678,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/3rdparty/sdl2-2.0.9/build-scripts/config.sub.patch b/3rdparty/sdl2-2.0.9/build-scripts/config.sub.patch new file mode 100644 index 0000000000..8c09e0046c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/config.sub.patch @@ -0,0 +1,72 @@ +--- config.sub.orig 2017-09-09 08:01:02.139023205 -0700 ++++ config.sub 2017-09-09 07:59:35.798264474 -0700 +@@ -364,6 +364,19 @@ + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; ++ nacl64*) ++ basic_machine=x86_64-pc ++ os=-nacl ++ ;; ++ nacl*) ++ basic_machine=i686-pc ++ os=-nacl ++ ;; ++ pnacl*) ++ # le32-unknown-pnacl comes from http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +@@ -877,6 +890,10 @@ + basic_machine=le32-unknown + os=-nacl + ;; ++ pnacl) ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -1429,6 +1446,12 @@ + ;; + esac + ;; ++ -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl ++ ;; + -nto-qnx*) + ;; + -nto*) +@@ -1459,6 +1482,9 @@ + -os400*) + os=-os400 + ;; ++ -cegcc*) ++ os=-cegcc ++ ;; + -wince*) + os=-wince + ;; +@@ -1548,9 +1574,15 @@ + os=-dicos + ;; + -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl + ;; + -ios) + ;; ++ -emscripten*) ++ ;; + -none) + ;; + *) diff --git a/3rdparty/sdl2-2.0.4/build-scripts/emscripten-buildbot.sh b/3rdparty/sdl2-2.0.9/build-scripts/emscripten-buildbot.sh similarity index 79% rename from 3rdparty/sdl2-2.0.4/build-scripts/emscripten-buildbot.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/emscripten-buildbot.sh index db5fb81840..65b43e83ea 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/emscripten-buildbot.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/emscripten-buildbot.sh @@ -1,9 +1,13 @@ #!/bin/bash -SDKDIR="/emsdk_portable" +if [ -z "$SDKDIR" ]; then + SDKDIR="/emsdk_portable" +fi + ENVSCRIPT="$SDKDIR/emsdk_env.sh" if [ ! -f "$ENVSCRIPT" ]; then echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2 + echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2 exit 1 fi @@ -51,13 +55,14 @@ mkdir buildbot pushd buildbot echo "Configuring..." -emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" +emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? echo "Building..." -emmake $MAKE +emmake $MAKE || exit $? echo "Moving things around..." -emmake $MAKE install +emmake $MAKE install || exit $? + # Fix up a few things to a real install path perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config mkdir -p ./usr diff --git a/3rdparty/sdl2-2.0.4/build-scripts/g++-fat.sh b/3rdparty/sdl2-2.0.9/build-scripts/g++-fat.sh similarity index 93% rename from 3rdparty/sdl2-2.0.4/build-scripts/g++-fat.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/g++-fat.sh index 29b04302fa..0dbe990394 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/g++-fat.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/g++-fat.sh @@ -6,11 +6,11 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 32-bit compiler flags (10.5 runtime compatibility) -GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \ +# Intel 32-bit compiler flags (10.6 runtime compatibility) +GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \ -I/usr/local/include" -GCC_LINK_X86="-mmacosx-version-min=10.5" +GCC_LINK_X86="-mmacosx-version-min=10.6" # Intel 64-bit compiler flags (10.6 runtime compatibility) GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \ diff --git a/3rdparty/sdl2-2.0.4/build-scripts/gcc-fat.sh b/3rdparty/sdl2-2.0.9/build-scripts/gcc-fat.sh similarity index 91% rename from 3rdparty/sdl2-2.0.4/build-scripts/gcc-fat.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/gcc-fat.sh index e556c1dd13..65f759d4ab 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/gcc-fat.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/gcc-fat.sh @@ -6,15 +6,15 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 32-bit compiler flags (10.5 runtime compatibility) -GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \ +# Intel 32-bit compiler flags (10.6 runtime compatibility) +GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \ -I/usr/local/include" -GCC_LINK_X86="-mmacosx-version-min=10.5" +GCC_LINK_X86="-mmacosx-version-min=10.6" # Intel 64-bit compiler flags (10.6 runtime compatibility) GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \ -I/usr/local/include" GCC_LINK_X64="-mmacosx-version-min=10.6" diff --git a/3rdparty/sdl2-2.0.9/build-scripts/install-sh b/3rdparty/sdl2-2.0.9/build-scripts/install-sh new file mode 100755 index 0000000000..377bb8687f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/install-sh @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/3rdparty/sdl2-2.0.9/build-scripts/iosbuild.sh b/3rdparty/sdl2-2.0.9/build-scripts/iosbuild.sh new file mode 100755 index 0000000000..bb0e6319c5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/iosbuild.sh @@ -0,0 +1,188 @@ +#!/bin/sh +# +# Build a fat binary for iOS + +# Number of CPUs (for make -j) +NCPU=`sysctl -n hw.ncpu` +if test x$NJOB = x; then + NJOB=$NCPU +fi + +SRC_DIR=$(cd `dirname $0`/..; pwd) +if [ "$PWD" = "$SRC_DIR" ]; then + PREFIX=$SRC_DIR/ios-build + mkdir $PREFIX +else + PREFIX=$PWD +fi + +BUILD_I386_IOSSIM=YES +BUILD_X86_64_IOSSIM=YES + +BUILD_IOS_ARMV7=YES +BUILD_IOS_ARMV7S=YES +BUILD_IOS_ARM64=YES + +# 13.4.0 - Mavericks +# 14.0.0 - Yosemite +# 15.0.0 - El Capitan +DARWIN=darwin15.0.0 + +XCODEDIR=`xcode-select --print-path` +IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` +MIN_SDK_VERSION=6.0 + +IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path` +IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` + +IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path` +IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path` + +# Uncomment if you want to see more information about each invocation +# of clang as the builds proceed. +# CLANG_VERBOSE="--verbose" + +CC=clang +CXX=clang + +SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function" + +CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fobjc-arc" + +echo "PREFIX ..................... ${PREFIX}" +echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}" +echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}" +echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}" +echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}" +echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}" +echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}" +echo "DARWIN ..................... ${DARWIN}" +echo "XCODEDIR ................... ${XCODEDIR}" +echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}" +echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}" +echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}" +echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}" +echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}" +echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}" +echo "CC ......................... ${CC}" +echo "CFLAGS ..................... ${CFLAGS}" +echo "CXX ........................ ${CXX}" +echo "CXXFLAGS ................... ${CXXFLAGS}" +echo "LDFLAGS .................... ${LDFLAGS}" + +################################################################### +# This section contains the build commands for each of the +# architectures that will be included in the universal binaries. +################################################################### + +echo "$(tput setaf 2)" +echo "###########################" +echo "# i386 for iPhone Simulator" +echo "###########################" +echo "$(tput sgr0)" + +if [ "${BUILD_I386_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=i386-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j10 || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "#############################" +echo "# x86_64 for iPhone Simulator" +echo "#############################" +echo "$(tput sgr0)" + +if [ "${BUILD_X86_64_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=x86_64-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "##################" +echo "# armv7 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "###################" +echo "# armv7s for iPhone" +echo "###################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7S}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7s-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "##################" +echo "# arm64 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARM64}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=arm-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "###################################################################" +echo "# Create Universal Libraries and Finalize the packaging" +echo "###################################################################" +echo "$(tput sgr0)" + +( + cd ${PREFIX}/platform + mkdir -p universal + lipo x86_64-sim/lib/libSDL2.a i386-sim/lib/libSDL2.a arm64-ios/lib/libSDL2.a armv7s-ios/lib/libSDL2.a armv7-ios/lib/libSDL2.a -create -output universal/libSDL2.a +) + +( + cd ${PREFIX} + mkdir -p lib + cp -r platform/universal/* lib + #rm -rf platform + lipo -info lib/libSDL2.a +) + +echo Done! diff --git a/3rdparty/sdl2-2.0.4/build-scripts/ltmain.sh b/3rdparty/sdl2-2.0.9/build-scripts/ltmain.sh similarity index 99% rename from 3rdparty/sdl2-2.0.4/build-scripts/ltmain.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/ltmain.sh index 63ae69dc6f..3cbc4a7766 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/ltmain.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/ltmain.sh @@ -189,7 +189,7 @@ func_basename () # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. -# value retuned in "$func_basename_result" +# value returned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. @@ -3276,7 +3276,7 @@ extern \"C\" { /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) @@ -4394,7 +4394,7 @@ EOF { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then + have already dealt with, above (including dump-script), then report an error. Otherwise, targets might begin to believe they are allowed to use options in the LTWRAPPER_OPTION_PREFIX namespace. The first time any user complains about this, we'll @@ -7404,8 +7404,11 @@ func_mode_link () # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + #xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + #verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # make the compatibility version match the Xcode project files, i.e. 1.0 + xlcverstring="${wl}-compatibility_version 1.0 ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version 1.0 -current_version $minor_current.$revision" ;; freebsd-aout) diff --git a/3rdparty/sdl2-2.0.9/build-scripts/mkinstalldirs b/3rdparty/sdl2-2.0.9/build-scripts/mkinstalldirs new file mode 100755 index 0000000000..55d537f872 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/mkinstalldirs @@ -0,0 +1,162 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2009-04-28.21; # UTC + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +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 ." + +# 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 "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 + +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 + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr= + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp=$pathcomp/ + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/3rdparty/sdl2-2.0.4/build-scripts/nacl-buildbot.sh b/3rdparty/sdl2-2.0.9/build-scripts/nacl-buildbot.sh similarity index 83% rename from 3rdparty/sdl2-2.0.4/build-scripts/nacl-buildbot.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/nacl-buildbot.sh index a72333bb78..73aae9eaf4 100755 --- a/3rdparty/sdl2-2.0.4/build-scripts/nacl-buildbot.sh +++ b/3rdparty/sdl2-2.0.9/build-scripts/nacl-buildbot.sh @@ -3,7 +3,11 @@ # This is the script buildbot.libsdl.org uses to cross-compile SDL2 from # amd64 Linux to NaCl. -export NACL_SDK_ROOT="/nacl_sdk/pepper_35" +# PLEASE NOTE that we have reports that SDL built with pepper_49 (current +# stable release as of November 10th, 2016) is broken. Please retest +# when something newer becomes stable and then decide if this was SDL's +# bug or NaCl's bug. --ryan. +export NACL_SDK_ROOT="/nacl_sdk/pepper_47" TARBALL="$1" if [ -z $1 ]; then diff --git a/3rdparty/sdl2-2.0.4/build-scripts/naclbuild.sh b/3rdparty/sdl2-2.0.9/build-scripts/naclbuild.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/build-scripts/naclbuild.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/naclbuild.sh diff --git a/3rdparty/sdl2-2.0.4/build-scripts/raspberrypi-buildbot.sh b/3rdparty/sdl2-2.0.9/build-scripts/raspberrypi-buildbot.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/build-scripts/raspberrypi-buildbot.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/raspberrypi-buildbot.sh diff --git a/3rdparty/sdl2-2.0.9/build-scripts/showrev.sh b/3rdparty/sdl2-2.0.9/build-scripts/showrev.sh new file mode 100755 index 0000000000..517992d9cd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/showrev.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# +# Print the current source revision, if available + +hg parents --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1) diff --git a/3rdparty/sdl2-2.0.4/build-scripts/strip_fPIC.sh b/3rdparty/sdl2-2.0.9/build-scripts/strip_fPIC.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/build-scripts/strip_fPIC.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/strip_fPIC.sh diff --git a/3rdparty/sdl2-2.0.9/build-scripts/update-copyright.sh b/3rdparty/sdl2-2.0.9/build-scripts/update-copyright.sh new file mode 100755 index 0000000000..5955b09fa0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/build-scripts/update-copyright.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +find . -type f -exec grep -Il "Copyright" {} \; \ +| grep -v \.hg \ +| while read file; \ +do \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ +done diff --git a/3rdparty/sdl2-2.0.4/build-scripts/updaterev.sh b/3rdparty/sdl2-2.0.9/build-scripts/updaterev.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/build-scripts/updaterev.sh rename to 3rdparty/sdl2-2.0.9/build-scripts/updaterev.sh diff --git a/3rdparty/sdl2-2.0.4/build-scripts/windows-buildbot-zipper.bat b/3rdparty/sdl2-2.0.9/build-scripts/windows-buildbot-zipper.bat similarity index 61% rename from 3rdparty/sdl2-2.0.4/build-scripts/windows-buildbot-zipper.bat rename to 3rdparty/sdl2-2.0.9/build-scripts/windows-buildbot-zipper.bat index 5a1e40a2e7..a6f516974b 100644 --- a/3rdparty/sdl2-2.0.4/build-scripts/windows-buildbot-zipper.bat +++ b/3rdparty/sdl2-2.0.9/build-scripts/windows-buildbot-zipper.bat @@ -3,11 +3,16 @@ rem just a helper batch file for collecting up files and zipping them. rem usage: windows-buildbot-zipper.bat rem must be run from root of SDL source tree. -IF EXIST VisualC\Win32\Release GOTO okaydir +IF EXIST VisualC\Win32\Release GOTO okaywin32dir echo Please run from root of source tree after doing a Release build. GOTO done -:okaydir +:okaywin32dir +IF EXIST VisualC\x64\Release GOTO okaydirs +echo Please run from root of source tree after doing a Release build. +GOTO done + +:okaydirs erase /q /f /s zipper IF EXIST zipper GOTO zippermade mkdir zipper @@ -18,10 +23,14 @@ cd SDL mkdir include mkdir lib mkdir lib\win32 +mkdir lib\win64 copy ..\..\include\*.h include\ copy ..\..\VisualC\Win32\Release\SDL2.dll lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2.lib lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2main.lib lib\win32\ +copy ..\..\VisualC\x64\Release\SDL2.dll lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2.lib lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2main.lib lib\win64\ cd .. zip -9r ..\%1 SDL cd .. diff --git a/3rdparty/sdl2-2.0.4/build-scripts/winrtbuild.bat b/3rdparty/sdl2-2.0.9/build-scripts/winrtbuild.bat similarity index 100% rename from 3rdparty/sdl2-2.0.4/build-scripts/winrtbuild.bat rename to 3rdparty/sdl2-2.0.9/build-scripts/winrtbuild.bat diff --git a/3rdparty/sdl2-2.0.4/build-scripts/winrtbuild.ps1 b/3rdparty/sdl2-2.0.9/build-scripts/winrtbuild.ps1 similarity index 89% rename from 3rdparty/sdl2-2.0.4/build-scripts/winrtbuild.ps1 rename to 3rdparty/sdl2-2.0.9/build-scripts/winrtbuild.ps1 index 31ac504b3f..0d7a24e7bb 100644 --- a/3rdparty/sdl2-2.0.4/build-scripts/winrtbuild.ps1 +++ b/3rdparty/sdl2-2.0.9/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.4" +$SDLVersion = "2.0.9" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. @@ -211,18 +211,26 @@ function Build-SDL-WinRT-Variant $DidAnyDLLBuildFail = $false $DidAnyNugetBuildFail = $false +# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs. +# My assumption is that no one will miss this, but send patches otherwise! --ryan. # Build for Windows Phone 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows Phone 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true } if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } +# +# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig . +# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus +# Microsoft hasn't supported Windows 8.0 development for a few years now. +# The commented-out lines below may still work on some systems, though. +# +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true } diff --git a/3rdparty/sdl2-2.0.4/cmake/macros.cmake b/3rdparty/sdl2-2.0.9/cmake/macros.cmake similarity index 100% rename from 3rdparty/sdl2-2.0.4/cmake/macros.cmake rename to 3rdparty/sdl2-2.0.9/cmake/macros.cmake diff --git a/3rdparty/sdl2-2.0.4/cmake/sdlchecks.cmake b/3rdparty/sdl2-2.0.9/cmake/sdlchecks.cmake similarity index 82% rename from 3rdparty/sdl2-2.0.4/cmake/sdlchecks.cmake rename to 3rdparty/sdl2-2.0.9/cmake/sdlchecks.cmake index 7ff0985fdb..4a2c3ed578 100644 --- a/3rdparty/sdl2-2.0.4/cmake/sdlchecks.cmake +++ b/3rdparty/sdl2-2.0.9/cmake/sdlchecks.cmake @@ -105,7 +105,9 @@ macro(CheckALSA) if(ALSA) CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H) if(HAVE_ASOUNDLIB_H) - CHECK_LIBRARY_EXISTS(asound snd_pcm_open "" HAVE_LIBASOUND) + CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND) + endif() + if(HAVE_LIBASOUND) set(HAVE_ALSA TRUE) file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES}) @@ -156,6 +158,36 @@ macro(CheckPulseAudio) endif() endmacro() +# Requires: +# - PkgCheckModules +# Optional: +# - JACK_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckJACK) + if(JACK) + pkg_check_modules(PKG_JACK jack) + if(PKG_JACK_FOUND) + set(HAVE_JACK TRUE) + file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) + set(SDL_AUDIO_DRIVER_JACK 1) + list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) + if(JACK_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") + else() + FindLibraryAndSONAME("jack") + set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") + set(HAVE_JACK_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS ${PKG_JACK_LDFLAGS}) + endif() + set(HAVE_SDL_AUDIO TRUE) + endif() + endif() +endmacro() + # Requires: # - PkgCheckModules # Optional: @@ -313,6 +345,31 @@ macro(CheckFusionSound) endif() endmacro() +# Requires: +# - LIBSAMPLERATE +# Optional: +# - LIBSAMPLERATE_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckLibSampleRate) + if(LIBSAMPLERATE) + check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) + if(HAVE_LIBSAMPLERATE_H) + set(HAVE_LIBSAMPLERATE TRUE) + if(LIBSAMPLERATE_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + else() + FindLibraryAndSONAME("samplerate") + set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") + set(HAVE_LIBSAMPLERATE_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS -lsamplerate) + endif() + endif() + endif() +endmacro() + # Requires: # - n/a # Optional: @@ -324,9 +381,21 @@ macro(CheckX11) FindLibraryAndSONAME("${_LIB}") endforeach() - find_path(X_INCLUDEDIR X11/Xlib.h) + find_path(X_INCLUDEDIR X11/Xlib.h + /usr/pkg/xorg/include + /usr/X11R6/include + /usr/X11R7/include + /usr/local/include/X11 + /usr/include/X11 + /usr/openwin/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include + /opt/X11/include + ) + if(X_INCLUDEDIR) - set(X_CFLAGS "-I${X_INCLUDEDIR}") + list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}") + list(APPEND CMAKE_REQUIRED_INCLUDES "${X_INCLUDEDIR}") endif() check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H) @@ -363,7 +432,7 @@ macro(CheckX11) endif() if(NOT HAVE_SHMAT) add_definitions(-DNO_SHARED_MEMORY) - set(X_CFLAGS "${X_CFLAGS} -DNO_SHARED_MEMORY") + list(APPEND EXTRA_CFLAGS "-DNO_SHARED_MEMORY") endif() endif() @@ -382,8 +451,6 @@ macro(CheckX11) endif() endif() - set(SDL_CFLAGS "${SDL_CFLAGS} ${X_CFLAGS}") - set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB}) check_c_source_compiles(" #include @@ -506,7 +573,7 @@ endmacro() macro(CheckMir) if(VIDEO_MIR) find_library(MIR_LIB mirclient mircommon egl) - pkg_check_modules(MIR_TOOLKIT mirclient mircommon) + pkg_check_modules(MIR_TOOLKIT mirclient>=0.26 mircommon) pkg_check_modules(EGL egl) pkg_check_modules(XKB xkbcommon) @@ -518,7 +585,7 @@ macro(CheckMir) set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES}) set(SDL_VIDEO_DRIVER_MIR 1) - list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS}) + list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CFLAGS} ${XKB_CFLAGS}) if(MIR_SHARED) if(NOT HAVE_DLOPEN) @@ -537,6 +604,27 @@ macro(CheckMir) endif() endmacro() +macro(WaylandProtocolGen _SCANNER _XML _PROTL) + set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c") + set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h") + + add_custom_command( + OUTPUT "${_WAYLAND_PROT_H_CODE}" + DEPENDS "${_XML}" + COMMAND "${_SCANNER}" + ARGS client-header "${_XML}" "${_WAYLAND_PROT_H_CODE}" + ) + + add_custom_command( + OUTPUT "${_WAYLAND_PROT_C_CODE}" + DEPENDS "${_WAYLAND_PROT_H_CODE}" + COMMAND "${_SCANNER}" + ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}" + ) + + set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}") +endmacro() + # Requires: # - EGL # - PkgCheckModules @@ -545,7 +633,22 @@ endmacro() # - HAVE_DLOPEN opt macro(CheckWayland) if(VIDEO_WAYLAND) - pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon) + pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon) + + if(WAYLAND_FOUND) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + RESULT_VARIABLE WAYLAND_SCANNER_RC + OUTPUT_VARIABLE WAYLAND_SCANNER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT WAYLAND_SCANNER_RC EQUAL 0) + set(WAYLAND_FOUND FALSE) + endif() + endif() + if(WAYLAND_FOUND) link_directories( ${WAYLAND_LIBRARY_DIRS} @@ -559,6 +662,16 @@ macro(CheckWayland) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES}) + # We have to generate some protocol interface code for some unstable Wayland features. + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") + include_directories("${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") + + file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml") + foreach(_XML ${WAYLAND_PROTOCOLS_XML}) + string(REGEX REPLACE "\\.xml$" "" _PROTL "${_XML}") + WaylandProtocolGen("${WAYLAND_SCANNER}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") + endforeach() + if(VIDEO_WAYLAND_QT_TOUCH) set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1) endif() @@ -679,7 +792,6 @@ macro(CheckOpenGLX11) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL_GLX 1) set(SDL_VIDEO_RENDER_OGL 1) - list(APPEND EXTRA_LIBS GL) endif() endif() endmacro() @@ -726,7 +838,10 @@ endmacro() # PTHREAD_LIBS macro(CheckPTHREAD) if(PTHREADS) - if(LINUX) + if(ANDROID) + # the android libc provides built-in support for pthreads, so no + # additional linking or compile flags are necessary + elseif(LINUX) set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_LDFLAGS "-pthread") elseif(BSDI) @@ -767,7 +882,8 @@ macro(CheckPTHREAD) endif() # Run some tests - set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}") if(CMAKE_CROSSCOMPILING) set(HAVE_PTHREADS 1) else() @@ -800,7 +916,7 @@ macro(CheckPTHREAD) #include int main(int argc, char **argv) { pthread_mutexattr_t attr; - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); return 0; }" HAVE_RECURSIVE_MUTEXES_NP) if(HAVE_RECURSIVE_MUTEXES_NP) @@ -829,7 +945,6 @@ macro(CheckPTHREAD) int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H) check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP) check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP) - set(CMAKE_REQUIRED_FLAGS) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c @@ -846,6 +961,7 @@ macro(CheckPTHREAD) endif() set(HAVE_SDL_THREADS TRUE) endif() + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") endif() endmacro() @@ -883,7 +999,8 @@ macro(CheckUSBHID) endif() endif() - set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${USB_CFLAGS}") set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}") check_c_source_compiles(" #include @@ -984,7 +1101,7 @@ macro(CheckUSBHID) set(HAVE_SDL_JOYSTICK TRUE) set(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") endif() endmacro() @@ -992,18 +1109,23 @@ endmacro() # - n/a macro(CheckRPI) if(VIDEO_RPI) - set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) - set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) - set(VIDEO_RPI_LIBS bcm_host ) + pkg_check_modules(VIDEO_RPI bcm_host brcmegl) + if (NOT VIDEO_RPI_FOUND) + set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) + set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) + set(VIDEO_RPI_LIBRARIES bcm_host ) + set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib") + endif() listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") - set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") - set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") + set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}") check_c_source_compiles(" #include int main(int argc, char **argv) {}" HAVE_VIDEO_RPI) - set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_LIBRARIES) if(SDL_VIDEO AND HAVE_VIDEO_RPI) @@ -1011,8 +1133,52 @@ macro(CheckRPI) set(SDL_VIDEO_DRIVER_RPI 1) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES}) - list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS}) + list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") + list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS}) endif(SDL_VIDEO AND HAVE_VIDEO_RPI) endif(VIDEO_RPI) endmacro(CheckRPI) + +# Requires: +# - EGL +# - PkgCheckModules +# Optional: +# - KMSDRM_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckKMSDRM) + if(VIDEO_KMSDRM) + pkg_check_modules(KMSDRM libdrm gbm egl) + if(KMSDRM_FOUND) + link_directories( + ${KMSDRM_LIBRARY_DIRS} + ) + include_directories( + ${KMSDRM_INCLUDE_DIRS} + ) + set(HAVE_VIDEO_KMSDRM TRUE) + set(HAVE_SDL_VIDEO TRUE) + + file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) + + list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) + + set(SDL_VIDEO_DRIVER_KMSDRM 1) + + if(KMSDRM_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") + else() + FindLibraryAndSONAME(drm) + FindLibraryAndSONAME(gbm) + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") + set(HAVE_KMSDRM_SHARED TRUE) + endif() + else() + set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) + endif() + endif() + endif() +endmacro() diff --git a/3rdparty/sdl2-2.0.4/cmake_uninstall.cmake.in b/3rdparty/sdl2-2.0.9/cmake_uninstall.cmake.in similarity index 67% rename from 3rdparty/sdl2-2.0.4/cmake_uninstall.cmake.in rename to 3rdparty/sdl2-2.0.9/cmake_uninstall.cmake.in index e3a5a4be9f..1761561b3b 100644 --- a/3rdparty/sdl2-2.0.4/cmake_uninstall.cmake.in +++ b/3rdparty/sdl2-2.0.9/cmake_uninstall.cmake.in @@ -1,8 +1,8 @@ -if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") -file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") foreach (file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") diff --git a/3rdparty/sdl2-2.0.4/configure b/3rdparty/sdl2-2.0.9/configure similarity index 94% rename from 3rdparty/sdl2-2.0.4/configure rename to 3rdparty/sdl2-2.0.9/configure index a41f025954..aee0cb6ecd 100755 --- a/3rdparty/sdl2-2.0.4/configure +++ b/3rdparty/sdl2-2.0.9/configure @@ -630,6 +630,7 @@ ac_includes_default="\ #endif" ac_subst_vars='LTLIBOBJS +WAYLAND_SCANNER EXTRA_LDFLAGS BUILD_LDFLAGS EXTRA_CFLAGS @@ -637,6 +638,8 @@ BUILD_CFLAGS SDLTEST_OBJECTS SDLMAIN_OBJECTS VERSION_OBJECTS +GEN_OBJECTS +GEN_HEADERS OBJECTS INCLUDE ac_aux_dir @@ -655,10 +658,10 @@ X_PRE_LIBS X_CFLAGS XMKMF ARTSCONFIG -PKG_CONFIG ESD_LIBS ESD_CFLAGS ESD_CONFIG +PKG_CONFIG ALSA_LIBS ALSA_CFLAGS POW_LIB @@ -782,6 +785,7 @@ enable_render enable_events enable_joystick enable_haptic +enable_sensor enable_power enable_filesystem enable_threads @@ -795,6 +799,7 @@ enable_mmx enable_3dnow enable_sse enable_sse2 +enable_sse3 enable_altivec enable_oss enable_alsa @@ -802,6 +807,8 @@ with_alsa_prefix with_alsa_inc_prefix enable_alsatest enable_alsa_shared +enable_jack +enable_jack_shared enable_esd with_esd_prefix with_esd_exec_prefix @@ -815,13 +822,18 @@ enable_nas enable_nas_shared enable_sndio enable_sndio_shared +enable_fusionsound +enable_fusionsound_shared enable_diskaudio enable_dummyaudio +enable_libsamplerate +enable_libsamplerate_shared enable_video_wayland enable_video_wayland_qt_touch enable_wayland_shared enable_video_mir enable_mir_shared +enable_video_rpi enable_video_x11 with_x enable_x11_shared @@ -835,23 +847,29 @@ enable_video_x11_xshape enable_video_x11_vm enable_video_vivante enable_video_cocoa +enable_render_metal enable_video_directfb enable_directfb_shared -enable_fusionsound -enable_fusionsound_shared +enable_video_kmsdrm +enable_kmsdrm_shared enable_video_dummy enable_video_opengl enable_video_opengles enable_video_opengles1 enable_video_opengles2 +enable_video_vulkan enable_libudev enable_dbus +enable_ime enable_ibus +enable_fcitx enable_input_tslib enable_pthreads enable_pthread_sem enable_directx +enable_wasapi enable_sdl_dlopen +enable_hidapi enable_clock_gettime enable_rpath enable_render_d3d @@ -1506,6 +1524,7 @@ Optional Features: --enable-joystick Enable the joystick subsystem [[default=yes]] --enable-haptic Enable the haptic (force feedback) subsystem [[default=yes]] + --enable-sensor Enable the sensor subsystem [[default=yes]] --enable-power Enable the power subsystem [[default=yes]] --enable-filesystem Enable the filesystem subsystem [[default=yes]] --enable-threads Enable the threading subsystem [[default=yes]] @@ -1516,16 +1535,19 @@ Optional Features: --enable-cpuinfo Enable the cpuinfo subsystem [[default=yes]] --enable-assembly Enable assembly routines [[default=yes]] --enable-ssemath Allow GCC to use SSE floating point math - [[default=no]] + [[default=maybe]] --enable-mmx use MMX assembly routines [[default=yes]] --enable-3dnow use 3DNow! assembly routines [[default=yes]] --enable-sse use SSE assembly routines [[default=yes]] - --enable-sse2 use SSE2 assembly routines [[default=no]] + --enable-sse2 use SSE2 assembly routines [[default=maybe]] + --enable-sse3 use SSE3 assembly routines [[default=maybe]] --enable-altivec use Altivec assembly routines [[default=yes]] --enable-oss support the OSS audio API [[default=maybe]] --enable-alsa support the ALSA audio API [[default=yes]] --disable-alsatest Do not try to compile and run a test Alsa program --enable-alsa-shared dynamically load ALSA audio support [[default=yes]] + --enable-jack use JACK audio [[default=yes]] + --enable-jack-shared dynamically load JACK audio support [[default=yes]] --enable-esd support the Enlightened Sound Daemon [[default=yes]] --disable-esdtest Do not try to compile and run a test ESD program --enable-esd-shared dynamically load ESD audio support [[default=yes]] @@ -1539,15 +1561,24 @@ Optional Features: --enable-nas-shared dynamically load NAS audio support [[default=yes]] --enable-sndio support the sndio audio API [[default=yes]] --enable-sndio-shared dynamically load sndio audio support [[default=yes]] + --enable-fusionsound use FusionSound audio driver [[default=no]] + --enable-fusionsound-shared + dynamically load fusionsound audio support + [[default=yes]] --enable-diskaudio support the disk writer audio driver [[default=yes]] --enable-dummyaudio support the dummy audio driver [[default=yes]] + --enable-libsamplerate use libsamplerate for audio rate conversion + [[default=yes]] + --enable-libsamplerate-shared + dynamically load libsamplerate [[default=yes]] --enable-video-wayland use Wayland video driver [[default=yes]] --enable-video-wayland-qt-touch QtWayland server support for Wayland video driver [[default=yes]] --enable-wayland-shared dynamically load Wayland support [[default=maybe]] - --enable-video-mir use Mir video driver [[default=yes]] + --enable-video-mir use Mir video driver [[default=no]] --enable-mir-shared dynamically load Mir support [[default=maybe]] + --enable-video-rpi use Raspberry Pi video driver [[default=yes]] --enable-video-x11 use X11 video driver [[default=yes]] --enable-x11-shared dynamically load X11 support [[default=maybe]] --enable-video-x11-xcursor @@ -1568,13 +1599,12 @@ Optional Features: --enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]] --enable-video-vivante use Vivante EGL video driver [[default=yes]] --enable-video-cocoa use Cocoa video driver [[default=yes]] + --enable-render-metal enable the Metal render driver [[default=yes]] --enable-video-directfb use DirectFB video driver [[default=no]] --enable-directfb-shared dynamically load directfb support [[default=yes]] - --enable-fusionsound use FusionSound audio driver [[default=no]] - --enable-fusionsound-shared - dynamically load fusionsound audio support - [[default=yes]] + --enable-video-kmsdrm use KMSDRM video driver [[default=no]] + --enable-kmsdrm-shared dynamically load kmsdrm support [[default=yes]] --enable-video-dummy use dummy video driver [[default=yes]] --enable-video-opengl include OpenGL support [[default=yes]] --enable-video-opengles include OpenGL ES support [[default=yes]] @@ -1582,16 +1612,22 @@ Optional Features: include OpenGL ES 1.1 support [[default=yes]] --enable-video-opengles2 include OpenGL ES 2.0 support [[default=yes]] + --enable-video-vulkan include Vulkan support [[default=yes]] --enable-libudev enable libudev support [[default=yes]] --enable-dbus enable D-Bus support [[default=yes]] + --enable-ime enable IME support [[default=yes]] --enable-ibus enable IBus support [[default=yes]] + --enable-fcitx enable fcitx support [[default=yes]] --enable-input-tslib use the Touchscreen library for input [[default=yes]] --enable-pthreads use POSIX threads for multi-threading [[default=yes]] --enable-pthread-sem use pthread semaphores [[default=yes]] --enable-directx use DirectX for Windows audio/video [[default=yes]] + --enable-wasapi use the Windows WASAPI audio driver [[default=yes]] --enable-sdl-dlopen use dlopen for shared object loading [[default=yes]] + --enable-hidapi use HIDAPI for low level joystick drivers + [[default=no]] --enable-clock_gettime use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]] --enable-rpath use an rpath when linking SDL [[default=yes]] @@ -2683,9 +2719,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=4 +SDL_MICRO_VERSION=9 SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=4 +SDL_BINARY_AGE=9 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -5970,7 +6006,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -15649,7 +15688,7 @@ case "$host" in ;; esac -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -15720,10 +15759,17 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2 $BASE_LDFLAGS" -CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" -CFLAGS="$CFLAGS $EXTRA_CFLAGS" -LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" +SDL_LIBS="-lSDL2" +if test "x$BASE_LDFLAGS" != x; then + SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" +fi +if test "x$EXTRA_CFLAGS" != x; then + CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" + CFLAGS="$CFLAGS $EXTRA_CFLAGS" +fi +if test "x$EXTRA_LDFLAGS" != x; then + LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" +fi base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'` @@ -16141,7 +16187,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi - for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h + for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -16605,7 +16651,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname + for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16658,7 +16704,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then : LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" fi - for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf + for ac_func in acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16726,10 +16772,24 @@ done ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : - $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h + +$as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h + +fi + + + for ac_header in libunwind.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUNWIND_H 1 +_ACEOF fi +done + fi @@ -16826,10 +16886,12 @@ SOURCES="$SOURCES $srcdir/src/power/*.c" #SOURCES="$SOURCES $srcdir/src/filesystem/*.c" SOURCES="$SOURCES $srcdir/src/render/*.c" SOURCES="$SOURCES $srcdir/src/render/*/*.c" +SOURCES="$SOURCES $srcdir/src/sensor/*.c" SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" # Check whether --enable-atomic was given. @@ -16930,6 +16992,20 @@ $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} haptic" fi +# Check whether --enable-sensor was given. +if test "${enable_sensor+set}" = set; then : + enableval=$enable_sensor; +else + enable_sensor=yes +fi + +if test x$enable_sensor != xyes; then + +$as_echo "#define SDL_SENSOR_DISABLED 1" >>confdefs.h + +else + SUMMARY_modules="${SUMMARY_modules} sensor" +fi # Check whether --enable-power was given. if test "${enable_power+set}" = set; then : enableval=$enable_power; @@ -17065,7 +17141,7 @@ else fi if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -17292,6 +17368,77 @@ $as_echo "$have_gcc_sse2" >&6; } fi fi + # Check whether --enable-sse3 was given. +if test "${enable_sse3+set}" = set; then : + enableval=$enable_sse3; +else + enable_sse3=$default_ssemath +fi + + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 +$as_echo_n "checking for GCC -msse3 option... " >&6; } + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_sse3=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 +$as_echo "$have_gcc_sse3" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + ac_fn_c_check_header_mongrel "$LINENO" "immintrin.h" "ac_cv_header_immintrin_h" "$ac_includes_default" +if test "x$ac_cv_header_immintrin_h" = xyes; then : + have_immintrin_h_hdr=yes +else + have_immintrin_h_hdr=no +fi + + + if test x$have_immintrin_h_hdr = xyes; then + +$as_echo "#define HAVE_IMMINTRIN_H 1" >>confdefs.h + + fi + # Check whether --enable-altivec was given. if test "${enable_altivec+set}" = set; then : enableval=$enable_altivec; @@ -17601,7 +17748,7 @@ LIBS="$ALSA_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 $as_echo "$ALSA_LIBS" >&6; } -min_alsa_version=0.9.0 +min_alsa_version=1.0.11 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 $as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; } no_alsa="" @@ -17794,6 +17941,119 @@ _ACEOF fi } +CheckJACK() +{ + # Check whether --enable-jack was given. +if test "${enable_jack+set}" = set; then : + enableval=$enable_jack; +else + enable_jack=yes +fi + + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK $JACK_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for JACK $JACK_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_jack" >&5 +$as_echo "$audio_jack" >&6; } + + if test x$audio_jack = xyes; then + # Check whether --enable-jack-shared was given. +if test "${enable_jack_shared+set}" = set; then : + enableval=$enable_jack_shared; +else + enable_jack_shared=yes +fi + + jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + + +$as_echo "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_JACK_DYNAMIC "$jack_lib" +_ACEOF + + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + CheckESD() { # Check whether --enable-esd was given. @@ -18137,7 +18397,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support" >&5 $as_echo_n "checking for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support... " >&6; } if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple` audio_pulseaudio=yes @@ -18537,57 +18797,220 @@ $as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h fi } -CheckDiskAudio() +CheckFusionSound() { - # Check whether --enable-diskaudio was given. -if test "${enable_diskaudio+set}" = set; then : - enableval=$enable_diskaudio; + # Check whether --enable-fusionsound was given. +if test "${enable_fusionsound+set}" = set; then : + enableval=$enable_fusionsound; else - enable_diskaudio=yes + enable_fusionsound=no fi - if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no -$as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h + FUSIONSOUND_REQUIRED_VERSION=1.1.1 - SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" - SUMMARY_audio="${SUMMARY_audio} disk" - fi -} + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -CheckDummyAudio() -{ - # Check whether --enable-dummyaudio was given. -if test "${enable_dummyaudio+set}" = set; then : - enableval=$enable_dummyaudio; + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else - enable_dummyaudio=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 +$as_echo "$fusionsound" >&6; } - SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" - SUMMARY_audio="${SUMMARY_audio} dummy" - fi -} + if test x$fusionsound = xyes; then -CheckVisibilityHidden() -{ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 -$as_echo_n "checking for GCC -fvisibility=hidden option... " >&6; } - have_gcc_fvisibility=no +$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h - visibility_CFLAGS="-fvisibility=hidden" - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - #if !defined(__GNUC__) || __GNUC__ < 4 - #error SDL only uses visibility attributes in GCC 4 or newer - #endif + # Check whether --enable-fusionsound-shared was given. +if test "${enable_fusionsound_shared+set}" = set; then : + enableval=$enable_fusionsound_shared; +else + enable_fusionsound_shared=yes +fi + + fusionsound_shared=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 +$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +_ACEOF + + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 +$as_echo "$fusionsound_shared" >&6; } + + have_audio=yes + fi + fi +} + +CheckDiskAudio() +{ + # Check whether --enable-diskaudio was given. +if test "${enable_diskaudio+set}" = set; then : + enableval=$enable_diskaudio; +else + enable_diskaudio=yes +fi + + if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" + SUMMARY_audio="${SUMMARY_audio} disk" + fi +} + +CheckDummyAudio() +{ + # Check whether --enable-dummyaudio was given. +if test "${enable_dummyaudio+set}" = set; then : + enableval=$enable_dummyaudio; +else + enable_dummyaudio=yes +fi + + if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" + SUMMARY_audio="${SUMMARY_audio} dummy" + fi +} + +CheckLibSampleRate() +{ + # Check whether --enable-libsamplerate was given. +if test "${enable_libsamplerate+set}" = set; then : + enableval=$enable_libsamplerate; +else + enable_libsamplerate=yes +fi + + if test x$enable_libsamplerate = xyes; then + ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" +if test "x$ac_cv_header_samplerate_h" = xyes; then : + have_samplerate_h_hdr=yes +else + have_samplerate_h_hdr=no +fi + + + if test x$have_samplerate_h_hdr = xyes; then + +$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h + + + # Check whether --enable-libsamplerate-shared was given. +if test "${enable_libsamplerate_shared+set}" = set; then : + enableval=$enable_libsamplerate_shared; +else + enable_libsamplerate_shared=yes +fi + + + samplerate_lib=`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib" +_ACEOF + + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + +CheckVisibilityHidden() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 +$as_echo_n "checking for GCC -fvisibility=hidden option... " >&6; } + have_gcc_fvisibility=no + + visibility_CFLAGS="-fvisibility=hidden" + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if !defined(__GNUC__) || __GNUC__ < 4 + #error SDL only uses visibility attributes in GCC 4 or newer + #endif int main () @@ -18650,6 +19073,43 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; } fi } +CheckDeclarationAfterStatement() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 +$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_declaration_after_statement=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 +$as_echo "$have_gcc_declaration_after_statement" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + CheckWarnAll() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 @@ -18767,9 +19227,10 @@ $as_echo_n "checking for Wayland support... " >&6; } if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` video_wayland=yes fi fi @@ -18785,8 +19246,10 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi - SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" + + WAYLAND_SOURCES="$srcdir/src/video/wayland/*.c" + SOURCES="$SOURCES $WAYLAND_SOURCES" + EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" # Check whether --enable-wayland-shared was given. if test "${enable_wayland_shared+set}" = set; then : enableval=$enable_wayland_shared; @@ -18863,7 +19326,7 @@ CheckMir() if test "${enable_video_mir+set}" = set; then : enableval=$enable_video_mir; else - enable_video_mir=yes + enable_video_mir=no fi @@ -18928,7 +19391,7 @@ int main () { - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirWindowAttrib attrib = mir_window_attrib_state ; return 0; @@ -19023,9 +19486,11 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h - $as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h + + +$as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h $as_echo "#define HAVE_POW 1" >>confdefs.h @@ -19053,10 +19518,121 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext } -CheckX11() +CheckRPI() +{ + # Check whether --enable-video-rpi was given. +if test "${enable_video_rpi+set}" = set; then : + enableval=$enable_video_rpi; +else + enable_video_rpi=yes +fi + + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5 +$as_echo_n "checking for Raspberry Pi... " >&6; } + have_video_rpi=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main () { + bcm_host_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_video_rpi=yes + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 +$as_echo "$have_video_rpi" >&6; } + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + +$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} +CheckX11() +{ # Check whether --enable-video-x11 was given. if test "${enable_video_x11+set}" = set; then : enableval=$enable_video_x11; @@ -19892,7 +20468,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_const_param_XextAddDisplay=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h fi @@ -19906,7 +20483,7 @@ $as_echo_n "checking for XGenericEvent... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include + #include int main () @@ -19926,7 +20503,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_XGenericEvent=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h fi @@ -20249,13 +20827,13 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5 $as_echo_n "checking for xinput2 multitouch... " >&6; } - have_xinput2_multitouch=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + have_xinput2_multitouch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include - #include + #include + #include + #include int main () @@ -20270,14 +20848,14 @@ XITouchClassInfo *t; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - have_xinput2_multitouch=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h + have_xinput2_multitouch=yes + $as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h - SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" + SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 $as_echo "$have_xinput2_multitouch" >&6; } fi # Check whether --enable-video-x11-xrandr was given. @@ -20712,32 +21290,89 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h fi } -CheckDirectFB() +CheckMETAL() { - # Check whether --enable-video-directfb was given. -if test "${enable_video_directfb+set}" = set; then : - enableval=$enable_video_directfb; + # Check whether --enable-render-metal was given. +if test "${enable_render_metal+set}" = set; then : + enableval=$enable_render_metal; else - enable_video_directfb=no + enable_render_metal=yes fi - if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then - video_directfb=no + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 +$as_echo_n "checking for Metal framework... " >&6; } + have_metal=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - DIRECTFB_REQUIRED_VERSION=1.0.0 - for ac_prog in directfb-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DIRECTFBCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $DIRECTFBCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_DIRECTFBCONFIG="$DIRECTFBCONFIG" # Let the user override the test with a path. - ;; + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_metal=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 +$as_echo "$have_metal" >&6; } + if test x$have_metal = xyes; then + +$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + +CheckDirectFB() +{ + # Check whether --enable-video-directfb was given. +if test "${enable_video_directfb+set}" = set; then : + enableval=$enable_video_directfb; +else + enable_video_directfb=no +fi + + if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then + video_directfb=no + + DIRECTFB_REQUIRED_VERSION=1.0.0 + for ac_prog in directfb-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DIRECTFBCONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DIRECTFBCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_DIRECTFBCONFIG="$DIRECTFBCONFIG" # Let the user override the test with a path. + ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="$prefix/bin:$PATH" @@ -20875,7 +21510,7 @@ $as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for directfb dynamic loading support" >&5 $as_echo_n "checking for directfb dynamic loading support... " >&6; } directfb_shared=no - directfb_lib=`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"` + directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"` # | sed 's/.*\/\(.*\)/\1/; q'`] { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"directfb $directfb_lib\"" >&5 $as_echo "$as_me: WARNING: \"directfb $directfb_lib\"" >&2;} @@ -20906,19 +21541,23 @@ $as_echo "$directfb_shared" >&6; } fi } -CheckFusionSound() +CheckKMSDRM() { - # Check whether --enable-fusionsound was given. -if test "${enable_fusionsound+set}" = set; then : - enableval=$enable_fusionsound; + # Check whether --enable-video-kmsdrm was given. +if test "${enable_video_kmsdrm+set}" = set; then : + enableval=$enable_video_kmsdrm; else - enable_fusionsound=no + enable_video_kmsdrm=no fi - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 @@ -20961,57 +21600,86 @@ $as_echo "no" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 -$as_echo "$fusionsound" >&6; } - - if test x$fusionsound = xyes; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi -$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libdrm_avail" >&5 +$as_echo "$libdrm_avail" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgbm_avail" >&5 +$as_echo "$libgbm_avail" >&6; } - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - # Check whether --enable-fusionsound-shared was given. -if test "${enable_fusionsound_shared+set}" = set; then : - enableval=$enable_fusionsound_shared; + if test x$video_kmsdrm = xyes; then + # Check whether --enable-kmsdrm-shared was given. +if test "${enable_kmsdrm_shared+set}" = set; then : + enableval=$enable_kmsdrm_shared; else - enable_fusionsound_shared=yes + enable_kmsdrm_shared=yes fi - fusionsound_shared=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then + + +$as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 +$as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } + kmsdrm_shared=no + drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"` + gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"` + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" _ACEOF - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -$as_echo "$fusionsound_shared" >&6; } - have_audio=yes +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "$gbm_lib" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_KMSDRM_SHARED "TRUE" +_ACEOF + + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +$as_echo "$kmsdrm_shared" >&6; } + have_video=yes + fi + fi fi fi } @@ -21035,6 +21703,32 @@ $as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h fi } +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + # Check whether --enable-video-opengl was given. if test "${enable_video_opengl+set}" = set; then : enableval=$enable_video_opengl; @@ -21353,6 +22047,24 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h fi } +CheckMacGLES() +{ + if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then + video_opengl_egl=yes + +$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h + + video_opengles_v2=yes + +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} opengl_es2" + fi +} + CheckEmscriptenGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then @@ -21425,6 +22137,97 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h fi } +# Check whether --enable-video-vulkan was given. +if test "${enable_video_vulkan+set}" = set; then : + enableval=$enable_video_vulkan; +else + enable_video_vulkan=yes +fi + + +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 +$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} + fi + fi + if test x$enable_video_vulkan = xyes; then + +$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + CheckInputEvents() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 @@ -21525,6 +22328,16 @@ fi $as_echo "#define HAVE_LIBUDEV_H 1" >>confdefs.h + + udev_lib=`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_UDEV_DYNAMIC "$udev_lib" +_ACEOF + + fi fi fi } @@ -21604,6 +22417,23 @@ $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h fi } +CheckIME() +{ + # Check whether --enable-ime was given. +if test "${enable_ime+set}" = set; then : + enableval=$enable_ime; +else + enable_ime=yes +fi + + if test x$enable_ime = xyes; then + +$as_echo "#define SDL_USE_IME 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" + fi +} + CheckIBus() { # Check whether --enable-ibus was given. @@ -21677,7 +22507,11 @@ fi CFLAGS="$save_CFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_dbus != xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 +$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;} + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 $as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no @@ -21697,6 +22531,90 @@ $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h fi } +CheckFcitx() +{ + # Check whether --enable-fcitx was given. +if test "${enable_fcitx+set}" = set; then : + enableval=$enable_fcitx; +else + enable_fcitx=yes +fi + + if test x$enable_fcitx = xyes; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno; then + FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` + CFLAGS="$CFLAGS $FCITX_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default" +if test "x$ac_cv_header_fcitx_frontend_h" = xyes; then : + have_fcitx_frontend_h_hdr=yes +else + have_fcitx_frontend_h_hdr=no +fi + + + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;} + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;} + have_fcitx_frontend_h_hdr=no + else + +$as_echo "#define HAVE_FCITX_FRONTEND_H 1" >>confdefs.h + + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" + fi + fi + fi + fi +} + CheckTslib() { # Check whether --enable-input-tslib was given. @@ -21759,7 +22677,7 @@ else fi case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -21819,6 +22737,10 @@ fi pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -21992,7 +22914,8 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_sem_timedwait=yes - $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h + +$as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi @@ -22236,18 +23159,50 @@ if test "x$ac_cv_header_dxgi_h" = xyes; then : fi - ac_fn_c_check_header_mongrel "$LINENO" "xaudio2.h" "ac_cv_header_xaudio2_h" "$ac_includes_default" -if test "x$ac_cv_header_xaudio2_h" = xyes; then : - have_xaudio2=yes -fi - - ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" if test "x$ac_cv_header_xinput_h" = xyes; then : have_xinput=yes fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_GAMEPAD_EX x1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_gamepadex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_STATE_EX s1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_stateex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_ddraw = xyes; then @@ -22273,6 +23228,16 @@ $as_echo "#define HAVE_DXGI_H 1" >>confdefs.h $as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h + fi + if test x$have_xinput_gamepadex = xyes; then + +$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h + + fi + if test x$have_xinput_stateex = xyes; then + +$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h + fi SUMMARY_video="${SUMMARY_video} directx" @@ -22286,6 +23251,45 @@ $as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h ;; esac fi + + ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then : + have_wasapi=yes +fi + + + if test x$have_wasapi = xyes; then + $as_echo "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h + + fi + ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" +if test "x$ac_cv_header_audioclient_h" = xyes; then : + +else + have_wasapi=no +fi + + + if test x$have_wasapi = xyes; then + $as_echo "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h + + fi + + ac_fn_c_check_header_mongrel "$LINENO" "endpointvolume.h" "ac_cv_header_endpointvolume_h" "$ac_includes_default" +if test "x$ac_cv_header_endpointvolume_h" = xyes; then : + $as_echo "#define HAVE_ENDPOINTVOLUME_H 1" >>confdefs.h + +fi + + + + # Check whether --enable-wasapi was given. +if test "${enable_wasapi+set}" = set; then : + enableval=$enable_wasapi; +else + enable_wasapi=yes +fi + } CheckDLOPEN() @@ -22764,6 +23768,93 @@ $as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h esac } +CheckHIDAPI() +{ + # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, + # so we'll just use libusb when it's available. + # + # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default. + # Check whether --enable-hidapi was given. +if test "${enable_hidapi+set}" = set; then : + enableval=$enable_hidapi; +else + enable_hidapi=no +fi + + if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then + hidapi_support=no + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno; then + LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0` + LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0` + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" +if test "x$ac_cv_header_libusb_h" = xyes; then : + have_libusb_h=yes +fi + + + CFLAGS="$save_CFLAGS" + fi + if test x$have_libusb_h = xyes; then + hidapi_support=yes + +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h + + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi support" >&5 +$as_echo_n "checking for hidapi support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 +$as_echo "$hidapi_support" >&6; } + fi +} + CheckClockGettime() { # Check whether --enable-clock_gettime was given. @@ -22894,26 +23985,12 @@ fi } +CheckWarnAll + case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -22921,6 +23998,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -22938,21 +24016,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -22960,8 +24023,12 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -22969,20 +24036,28 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev CheckDBus + CheckIME CheckIBus + CheckFcitx case $ARCH in linux) CheckInputEvents @@ -22991,11 +24066,13 @@ case "$host" in esac CheckTslib CheckUSBHID + CheckHIDAPI CheckPTHREAD CheckClockGettime CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -23004,13 +24081,15 @@ case "$host" in $as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. -$as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) @@ -23018,6 +24097,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -23028,6 +24108,9 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -23038,6 +24121,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) @@ -23045,23 +24129,43 @@ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) + case $ARCH in + linux) + if test x$use_input_events = xyes; then $as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + +$as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac + fi + # Set up files for the sensor library + if test x$enable_sensor = xyes; then + case $ARCH in + android) + +$as_echo "#define SDL_SENSOR_ANDROID 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/sensor/android/*.c" + have_sensor=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -23115,8 +24219,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -23129,12 +24235,14 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -23177,11 +24285,12 @@ $as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then + if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_XAUDIO2 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + SUMMARY_audio="${SUMMARY_audio} wasapi" + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -23204,7 +24313,13 @@ $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h fi + +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes fi if test x$enable_haptic = xyes; then @@ -23268,7 +24383,7 @@ $as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h else LIBUUID=-luuid fi - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc" # The Windows platform requires special setup VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" @@ -23330,6 +24445,7 @@ fi CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -23340,6 +24456,7 @@ fi $as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -23358,14 +24475,6 @@ $as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -$as_echo "#define SDL_LOADSO_HAIKU 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then @@ -23385,30 +24494,61 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + as_ac_File=`$as_echo "ac_cv_file_"/boot/system/lib/libstdc++.r4.so"" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/boot/system/lib/libstdc++.r4.so\"" >&5 +$as_echo_n "checking for \"/boot/system/lib/libstdc++.r4.so\"... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r ""/boot/system/lib/libstdc++.r4.so""; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4" +else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++" +fi + ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + +$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + +$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -23419,6 +24559,9 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h #fi # Set up files for the power library if test x$enable_power = xyes; then + +$as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -23427,28 +24570,55 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + +$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + +$as_echo "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -23461,14 +24631,18 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL + CheckMacGLES CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library @@ -23476,7 +24650,8 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi @@ -23485,7 +24660,13 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h + +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes fi # Set up files for the haptic library @@ -23494,8 +24675,8 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h $as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" - have_haptic=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + have_haptic=yes fi # Set up files for the power library if test x$enable_power = xyes; then @@ -23525,16 +24706,17 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" - # If audio is used, add the AudioUnit framework - if test x$enable_audio = xyes; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" fi ;; *-nacl|*-pnacl) @@ -23547,7 +24729,8 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then - $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -23581,6 +24764,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23630,14 +24814,12 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ;; esac -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" @@ -23645,11 +24827,19 @@ fi if test x$have_haptic != xyes; then if test x$enable_haptic = xyes; then -$as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c" fi +if test x$have_sensor != xyes; then + if test x$enable_sensor = xyes; then + +$as_echo "#define SDL_SENSOR_DUMMY 1" >>confdefs.h + + fi + SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c" +fi if test x$have_threads != xyes; then if test x$enable_threads = xyes; then @@ -23687,6 +24877,30 @@ if test x$SDLMAIN_SOURCES = x; then fi SDLTEST_SOURCES="$srcdir/src/test/*.c" +if test x$video_wayland = xyes; then + WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done` + WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done` + WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done` + GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES" + GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS" + + WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\ + echo ;\ + echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\ + echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\ + echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\ + echo ;\ + echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\ + echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\ + echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\ + echo ;\ + echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\ + echo " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\ + done ;\ + echo ;\ + for s in $WAYLAND_SOURCES ; do echo -n "\$s:" ; for p in $WAYLAND_PROTOCOLS ; do echo -n " \\$(gen)/\$p-client-protocol.h" ; done ; echo ; done ; echo` +fi + OBJECTS=`echo $SOURCES` DEPENDS=`echo $SOURCES | tr ' ' '\n'` for EXT in asm cc m c S; do @@ -23696,6 +24910,8 @@ for EXT in asm cc m c S; do \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` done +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` + VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'` @@ -23705,16 +24921,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.rc,\ SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -23722,6 +24938,36 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\ if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 +$as_echo_n "checking for linker option --enable-new-dtags... " >&6; } + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 +$as_echo "$have_enable_new_dtags" >&6; } fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -23767,6 +25013,9 @@ fi + + + cat >Makefile.rules <<__EOF__ # Build rules for objects @@ -23778,6 +25027,7 @@ $DEPENDS $VERSION_DEPENDS $SDLMAIN_DEPENDS $SDLTEST_DEPENDS +$WAYLAND_PROTOCOLS_DEPENDS __EOF__ ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc" @@ -23800,20 +25050,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" +else + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using dbus : NO\n" +fi +if test x$enable_ime = xyes; then + SUMMARY="${SUMMARY}Using ime : YES\n" +else + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" +else + SUMMARY="${SUMMARY}Using ibus : NO\n" +fi +if test x$have_fcitx_frontend_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi ac_config_commands="$ac_config_commands summary" diff --git a/3rdparty/sdl2-2.0.4/configure.in b/3rdparty/sdl2-2.0.9/configure.in similarity index 79% rename from 3rdparty/sdl2-2.0.4/configure.in rename to 3rdparty/sdl2-2.0.9/configure.in index f585d01af4..ae866ff0c5 100644 --- a/3rdparty/sdl2-2.0.4/configure.in +++ b/3rdparty/sdl2-2.0.9/configure.in @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=4 +SDL_MICRO_VERSION=9 SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=4 +SDL_BINARY_AGE=9 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -68,7 +68,7 @@ case "$host" in esac dnl Set up the compiler and linker flags -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -123,10 +123,17 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2 $BASE_LDFLAGS" -CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" -CFLAGS="$CFLAGS $EXTRA_CFLAGS" -LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" +SDL_LIBS="-lSDL2" +if test "x$BASE_LDFLAGS" != x; then + SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" +fi +if test "x$EXTRA_CFLAGS" != x; then + CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" + CFLAGS="$CFLAGS $EXTRA_CFLAGS" +fi +if test "x$EXTRA_LDFLAGS" != x; then + LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" +fi dnl set this to use on systems that use lib64 instead of lib base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'` @@ -234,7 +241,7 @@ if test x$enable_libc = xyes; then dnl Check for C library headers AC_HEADER_STDC - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -268,15 +275,18 @@ if test x$enable_libc = xyes; then AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) - AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) AC_CHECK_FUNCS(iconv) - AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include ]) + AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) + + dnl Check for additional non-standard headers + AC_CHECK_HEADERS(libunwind.h) fi dnl AC_CHECK_SIZEOF(void*) @@ -336,10 +346,12 @@ SOURCES="$SOURCES $srcdir/src/power/*.c" #SOURCES="$SOURCES $srcdir/src/filesystem/*.c" SOURCES="$SOURCES $srcdir/src/render/*.c" SOURCES="$SOURCES $srcdir/src/render/*/*.c" +SOURCES="$SOURCES $srcdir/src/sensor/*.c" SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" dnl Enable/disable various subsystems of the SDL library @@ -399,6 +411,14 @@ if test x$enable_haptic != xyes; then else SUMMARY_modules="${SUMMARY_modules} haptic" fi +AC_ARG_ENABLE(sensor, +AC_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]), + , enable_sensor=yes) +if test x$enable_sensor != xyes; then + AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} sensor" +fi AC_ARG_ENABLE(power, AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]), , enable_power=yes) @@ -479,10 +499,10 @@ if test x$enable_assembly = xyes; then ;; esac AC_ARG_ENABLE(ssemath, -AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]), +AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), , enable_ssemath=$default_ssemath) if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -593,7 +613,7 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), fi AC_ARG_ENABLE(sse2, -AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), +AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), , enable_sse2=$default_ssemath) if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" @@ -629,6 +649,50 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), fi fi + AC_ARG_ENABLE(sse3, +AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), + , enable_sse3=$default_ssemath) + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + AC_MSG_CHECKING(for GCC -msse3 option) + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse3=yes + ]) + AC_MSG_RESULT($have_gcc_sse3) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + AC_CHECK_HEADER(immintrin.h, + have_immintrin_h_hdr=yes, + have_immintrin_h_hdr=no) + if test x$have_immintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ]) + fi + AC_ARG_ENABLE(altivec, AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), , enable_altivec=yes) @@ -770,7 +834,7 @@ CheckALSA() AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), , enable_alsa=yes) if test x$enable_audio = xyes -a x$enable_alsa = xyes; then - AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no) + AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no) # Restore all flags from before the ALSA detection runs CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" @@ -802,6 +866,63 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de fi } +dnl Find JACK Audio +CheckJACK() +{ + AC_ARG_ENABLE(jack, +AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), + , enable_jack=yes) + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + AC_MSG_RESULT($audio_jack) + + if test x$audio_jack = xyes; then + AC_ARG_ENABLE(jack-shared, +AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), + , enable_jack_shared=yes) + jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + dnl Find the ESD includes and libraries CheckESD() { @@ -851,7 +972,7 @@ AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), AC_PATH_PROG(PKG_CONFIG, pkg-config, no) AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support) if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple` audio_pulseaudio=yes @@ -1049,6 +1170,58 @@ AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[ fi } +dnl Find FusionSound +CheckFusionSound() +{ + AC_ARG_ENABLE(fusionsound, +AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), + , enable_fusionsound=no) + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + AC_MSG_RESULT($fusionsound) + + if test x$fusionsound = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + AC_ARG_ENABLE(fusionsound-shared, +AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), + , enable_fusionsound_shared=yes) + fusionsound_shared=no + AC_MSG_CHECKING(for FusionSound dynamic loading support) + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + AC_MSG_RESULT($fusionsound_shared) + + have_audio=yes + fi + fi +} + dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { @@ -1075,6 +1248,40 @@ AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default= fi } +dnl See if libsamplerate is available +CheckLibSampleRate() +{ + AC_ARG_ENABLE(libsamplerate, +AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), + , enable_libsamplerate=yes) + if test x$enable_libsamplerate = xyes; then + AC_CHECK_HEADER(samplerate.h, + have_samplerate_h_hdr=yes, + have_samplerate_h_hdr=no) + if test x$have_samplerate_h_hdr = xyes; then + AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ]) + + AC_ARG_ENABLE(libsamplerate-shared, +AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), + , enable_libsamplerate_shared=yes) + + samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ]) + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1124,6 +1331,30 @@ CheckStackBoundary() fi } +dnl See if GCC's -Wdeclaration-after-statement is supported. +dnl This lets us catch things that would fail on a C89 compiler when using +dnl a modern GCC. +CheckDeclarationAfterStatement() +{ + AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option) + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_declaration_after_statement=yes + ]) + AC_MSG_RESULT($have_gcc_declaration_after_statement) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + dnl See if GCC's -Wall is supported. CheckWarnAll() { @@ -1177,9 +1408,10 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` video_wayland=yes fi fi @@ -1190,8 +1422,10 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for if test x$enable_video_wayland_qt_touch = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) fi - SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" + + WAYLAND_SOURCES="$srcdir/src/video/wayland/*.c" + SOURCES="$SOURCES $WAYLAND_SOURCES" + EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" AC_ARG_ENABLE(wayland-shared, AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), , enable_wayland_shared=maybe) @@ -1247,8 +1481,8 @@ dnl Check for Mir CheckMir() { AC_ARG_ENABLE(video-mir, -AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), - ,enable_video_mir=yes) +AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]), + ,enable_video_mir=no) if test x$enable_video = xyes -a x$enable_video_mir = xyes; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) @@ -1260,12 +1494,12 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon` save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $MIR_CFLAGS" - - dnl This will disable Mir on Ubuntu < 14.04 + + dnl This will disable Mir if >= v0.26 is not available AC_TRY_COMPILE([ #include ],[ - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirWindowAttrib attrib = mir_window_attrib_state ],[ video_mir=yes ]) @@ -1326,8 +1560,8 @@ CheckNativeClient() #endif ],[ ],[ - AC_DEFINE(SDL_VIDEO_DRIVER_NACL) - AC_DEFINE(SDL_AUDIO_DRIVER_NACL) + AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ]) + AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ]) AC_DEFINE(HAVE_POW, 1, [ ]) AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) @@ -1344,11 +1578,60 @@ CheckNativeClient() } -dnl Find the X11 include and library directories -CheckX11() +CheckRPI() { + AC_ARG_ENABLE(video-rpi, +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), + , enable_video_rpi=yes) + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + AC_MSG_CHECKING(for Raspberry Pi) + have_video_rpi=no + AC_TRY_LINK([ + #include + ],[ + bcm_host_init(); + ],[ + have_video_rpi=yes + ],[ + ]) + AC_MSG_RESULT($have_video_rpi) + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + +dnl Find the X11 include and library directories +CheckX11() +{ AC_ARG_ENABLE(video-x11, AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), , enable_video_x11=yes) @@ -1466,7 +1749,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma ],[ ],[ have_const_param_XextAddDisplay=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ]) ]) AC_MSG_RESULT($have_const_param_XextAddDisplay) @@ -1474,7 +1757,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma AC_MSG_CHECKING([for XGenericEvent]) have_XGenericEvent=no AC_TRY_COMPILE([ - #include + #include ],[ Display *display; XEvent event; @@ -1484,7 +1767,7 @@ XGetEventData(display, cookie); XFreeEventData(display, cookie); ],[ have_XGenericEvent=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ]) ]) AC_MSG_RESULT($have_XGenericEvent) @@ -1588,20 +1871,20 @@ AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for man SUMMARY_video_x11="${SUMMARY_video_x11} xinput2" AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ]) AC_MSG_CHECKING(for xinput2 multitouch) - have_xinput2_multitouch=no - AC_TRY_COMPILE([ - #include - #include - #include - ],[ + have_xinput2_multitouch=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ int event_type = XI_TouchBegin; XITouchClassInfo *t; - ],[ - have_xinput2_multitouch=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH) - SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" - ]) - AC_MSG_RESULT($have_xinput2_multitouch) + ],[ + have_xinput2_multitouch=yes + AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, []) + SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" + ]) + AC_MSG_RESULT($have_xinput2_multitouch) fi AC_ARG_ENABLE(video-x11-xrandr, AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), @@ -1773,7 +2056,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" - dnl work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Cocoa framework) have_cocoa=no @@ -1794,6 +2077,42 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) fi } +CheckMETAL() +{ + AC_ARG_ENABLE(render-metal, +AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), + , enable_render_metal=yes) + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Metal framework) + have_metal=no + AC_TRY_COMPILE([ + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + ],[ + ],[ + have_metal=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($have_metal) + if test x$have_metal = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + dnl Find DirectFB CheckDirectFB() { @@ -1850,7 +2169,7 @@ AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[ AC_MSG_CHECKING(for directfb dynamic loading support) directfb_shared=no - directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`] + directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`] # | sed 's/.*\/\(.*\)/\1/; q'`] AC_MSG_WARN("directfb $directfb_lib") if test x$have_loadso != xyes && \ @@ -1874,54 +2193,77 @@ AC_MSG_WARN("directfb $directfb_lib") fi } -dnl Find FusionSound -CheckFusionSound() +dnl Find KMSDRM +CheckKMSDRM() { - AC_ARG_ENABLE(fusionsound, -AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), - , enable_fusionsound=no) - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no + AC_ARG_ENABLE(video-kmsdrm, +AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), + , enable_video_kmsdrm=no) - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - AC_MSG_RESULT($fusionsound) - - if test x$fusionsound = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - AC_ARG_ENABLE(fusionsound-shared, -AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), - , enable_fusionsound_shared=yes) - fusionsound_shared=no - AC_MSG_CHECKING(for FusionSound dynamic loading support) - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi + + AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libdrm_avail) + AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libgbm_avail) + + if test x$video_kmsdrm = xyes; then + AC_ARG_ENABLE(kmsdrm-shared, +AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), + , enable_kmsdrm_shared=yes) + + AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + AC_MSG_CHECKING(for kmsdrm dynamic loading support) + kmsdrm_shared=no + drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] + gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) + AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + AC_MSG_RESULT($kmsdrm_shared) + have_video=yes + fi fi - AC_MSG_RESULT($fusionsound_shared) - - have_audio=yes fi fi } @@ -1940,6 +2282,30 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]) fi } +dnl Set up the QNX video driver if enabled +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +dnl Set up the QNX audio driver if enabled +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + dnl Check to see if OpenGL support is desired AC_ARG_ENABLE(video-opengl, AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), @@ -2110,6 +2476,19 @@ CheckMacGL() fi } +dnl Check for MacOS OpenGLES +CheckMacGLES() +{ + if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then + video_opengl_egl=yes + AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ]) + video_opengles_v2=yes + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) + SUMMARY_video="${SUMMARY_video} opengl_es2" + fi +} + CheckEmscriptenGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then @@ -2144,6 +2523,61 @@ CheckEmscriptenGLES() fi } +dnl Check to see if Vulkan support is desired +AC_ARG_ENABLE(video-vulkan, +AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), + , enable_video_vulkan=yes) + +dnl Find Vulkan Header +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + AC_TRY_COMPILE([ + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_TRY_COMPILE([ + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + AC_MSG_WARN([Vulkan does not work on this configuration.]) + fi + fi + if test x$enable_video_vulkan = xyes; then + AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ]) + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { @@ -2201,6 +2635,12 @@ AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), have_libudev_h_hdr=no) if test x$have_libudev_h_hdr = xyes; then AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ]) + + udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ]) + fi fi fi } @@ -2230,6 +2670,18 @@ AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]), fi } +dnl See if the platform wanna IME support. +CheckIME() +{ + AC_ARG_ENABLE(ime, +AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]), + , enable_ime=yes) + if test x$enable_ime = xyes; then + AC_DEFINE(SDL_USE_IME, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" + fi +} + dnl See if the platform has libibus IME support. CheckIBus() { @@ -2250,7 +2702,10 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), have_inotify_inotify_h_hdr=no) CFLAGS="$save_CFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_dbus != xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then AC_MSG_WARN([DBus support is required for IBus.]) have_ibus_ibus_h_hdr=no elif test x$have_inotify_inotify_h_hdr != xyes; then @@ -2266,6 +2721,38 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), fi } +dnl See if the platform has fcitx IME support. +CheckFcitx() +{ + AC_ARG_ENABLE(fcitx, +AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]), + , enable_fcitx=yes) + if test x$enable_fcitx = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` + CFLAGS="$CFLAGS $FCITX_CFLAGS" + AC_CHECK_HEADER(fcitx/frontend.h, + have_fcitx_frontend_h_hdr=yes, + have_fcitx_frontend_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + else + AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" + fi + fi + fi + fi +} + dnl See if we can use the Touchscreen input library CheckTslib() { @@ -2302,7 +2789,7 @@ AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[def AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), , enable_pthread_sem=yes) case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -2362,6 +2849,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -2451,7 +2942,7 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) sem_timedwait(NULL, NULL); ],[ have_sem_timedwait=yes - AC_DEFINE(HAVE_SEM_TIMEDWAIT) + AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ]) ]) AC_MSG_RESULT($have_sem_timedwait) fi @@ -2560,8 +3051,17 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) AC_CHECK_HEADER(dxgi.h, have_dxgi=yes) - AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes) AC_CHECK_HEADER(xinput.h, have_xinput=yes) + AC_TRY_COMPILE([ +#include +#include +XINPUT_GAMEPAD_EX x1; + ],[],[have_xinput_gamepadex=yes]) + AC_TRY_COMPILE([ +#include +#include +XINPUT_STATE_EX s1; + ],[],[have_xinput_stateex=yes]) if test x$have_ddraw = xyes; then AC_DEFINE(HAVE_DDRAW_H, 1, [ ]) @@ -2578,6 +3078,12 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul if test x$have_xinput = xyes; then AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) fi + if test x$have_xinput_gamepadex = xyes; then + AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) + fi + if test x$have_xinput_stateex = xyes; then + AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) + fi SUMMARY_video="${SUMMARY_video} directx" SUMMARY_audio="${SUMMARY_audio} directx" @@ -2590,6 +3096,21 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul ;; esac fi + + AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes) + if test x$have_wasapi = xyes; then + AC_DEFINE(HAVE_MMDEVICEAPI_H,1,[]) + fi + AC_CHECK_HEADER(audioclient.h,,have_wasapi=no) + if test x$have_wasapi = xyes; then + AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[]) + fi + + AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[])) + + AC_ARG_ENABLE(wasapi, +AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]), + , enable_wasapi=yes) } dnl Check for the dlfcn.h interface for dynamically loading objects @@ -2763,6 +3284,41 @@ CheckUSBHID() esac } +dnl Check for HIDAPI joystick drivers +CheckHIDAPI() +{ + # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, + # so we'll just use libusb when it's available. + # + # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default. + AC_ARG_ENABLE(hidapi, +AC_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]), + , enable_hidapi=no) + if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then + hidapi_support=no + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0` + LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0` + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS" + AC_CHECK_HEADER(libusb.h, have_libusb_h=yes) + CFLAGS="$save_CFLAGS" + fi + if test x$have_libusb_h = xyes; then + hidapi_support=yes + AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS" + fi + AC_MSG_CHECKING(for hidapi support) + AC_MSG_RESULT($hidapi_support) + fi +} + dnl Check for clock_gettime() CheckClockGettime() { @@ -2801,27 +3357,14 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]] , enable_rpath=yes) } +dnl Do this on all platforms, before everything else (other things might want to override it). +CheckWarnAll + dnl Set up the configuration based on the host platform! case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -2829,6 +3372,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -2846,21 +3390,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -2868,8 +3397,12 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -2877,20 +3410,28 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev CheckDBus + CheckIME CheckIBus + CheckFcitx case $ARCH in linux) CheckInputEvents @@ -2899,27 +3440,32 @@ case "$host" in esac CheckTslib CheckUSBHID + CheckHIDAPI CheckPTHREAD CheckClockGettime CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in sysv5|solaris|hpux) AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. - AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -2928,6 +3474,9 @@ case "$host" in SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -2936,26 +3485,43 @@ case "$host" in linux) AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) - AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + case $ARCH in + linux) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac + fi + # Set up files for the sensor library + if test x$enable_sensor = xyes; then + case $ARCH in + android) + AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/sensor/android/*.c" + have_sensor=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -2999,8 +3565,10 @@ case "$host" in fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -3013,12 +3581,14 @@ case "$host" in ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -3047,9 +3617,10 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ]) + SUMMARY_audio="${SUMMARY_audio} wasapi" + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -3066,7 +3637,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) fi + AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes fi if test x$enable_haptic = xyes; then @@ -3116,7 +3691,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau else LIBUUID=-luuid fi - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc" # The Windows platform requires special setup VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" @@ -3146,6 +3721,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -3154,6 +3730,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -3168,12 +3745,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then AC_DEFINE(SDL_POWER_HAIKU, 1, [ ]) @@ -3189,30 +3760,35 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++") ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -3223,6 +3799,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau #fi # Set up files for the power library if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_UIKIT, 1, [ ]) SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -3231,28 +3808,41 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -3265,35 +3855,44 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL + CheckMacGLES CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ]) + AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" + SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" have_joystick=yes fi # Set up files for the haptic library if test x$enable_haptic = xyes; then AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ]) SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" - have_haptic=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + have_haptic=yes fi # Set up files for the power library if test x$enable_power = xyes; then @@ -3317,16 +3916,17 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" - # If audio is used, add the AudioUnit framework - if test x$enable_audio = xyes; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" fi ;; *-nacl|*-pnacl) @@ -3339,7 +3939,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the timer library if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_UNIX) + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi @@ -3366,6 +3966,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3407,23 +4008,26 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ;; esac -dnl Do this on all platforms, after everything else. -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then if test x$enable_joystick = xyes; then - AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ]) + AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" fi if test x$have_haptic != xyes; then if test x$enable_haptic = xyes; then - AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ]) + AC_DEFINE(SDL_HAPTIC_DUMMY, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c" fi +if test x$have_sensor != xyes; then + if test x$enable_sensor = xyes; then + AC_DEFINE(SDL_SENSOR_DUMMY, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c" +fi if test x$have_threads != xyes; then if test x$enable_threads = xyes; then AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) @@ -3453,6 +4057,30 @@ if test x$SDLMAIN_SOURCES = x; then fi SDLTEST_SOURCES="$srcdir/src/test/*.c" +if test x$video_wayland = xyes; then + WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done` + WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done` + WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done` + GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES" + GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS" + + WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\ + echo ;\ + echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\ + echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\ + echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\ + echo ;\ + echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\ + echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\ + echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\ + echo ;\ + echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\ + echo " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\ + done ;\ + echo ;\ + for s in $WAYLAND_SOURCES ; do echo -n "\$s:" ; for p in $WAYLAND_PROTOCOLS ; do echo -n " \\$(gen)/\$p-client-protocol.h" ; done ; echo ; done ; echo` +fi + OBJECTS=`echo $SOURCES` DEPENDS=`echo $SOURCES | tr ' ' '\n'` for EXT in asm cc m c S; do @@ -3462,6 +4090,8 @@ for EXT in asm cc m c S; do \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` done +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` + VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` @@ -3471,16 +4101,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -3488,6 +4118,19 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + AC_MSG_CHECKING(for linker option --enable-new-dtags) + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + AC_TRY_LINK([ + ],[ + ],[ + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + ]) + LDFLAGS="$save_LDFLAGS" + AC_MSG_RESULT($have_enable_new_dtags) fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -3526,6 +4169,8 @@ dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir) AC_SUBST(INCLUDE) AC_SUBST(OBJECTS) +AC_SUBST(GEN_HEADERS) +AC_SUBST(GEN_OBJECTS) AC_SUBST(VERSION_OBJECTS) AC_SUBST(SDLMAIN_OBJECTS) AC_SUBST(SDLTEST_OBJECTS) @@ -3534,6 +4179,7 @@ AC_SUBST(EXTRA_CFLAGS) AC_SUBST(BUILD_LDFLAGS) AC_SUBST(EXTRA_LDFLAGS) AC_SUBST(WINDRES) +AC_SUBST(WAYLAND_SCANNER) cat >Makefile.rules <<__EOF__ @@ -3546,6 +4192,7 @@ $DEPENDS $VERSION_DEPENDS $SDLMAIN_DEPENDS $SDLTEST_DEPENDS +$WAYLAND_PROTOCOLS_DEPENDS __EOF__ AC_CONFIG_FILES([ @@ -3568,20 +4215,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" +else + SUMMARY="${SUMMARY}Using dbus : NO\n" +fi +if test x$enable_ime = xyes; then + SUMMARY="${SUMMARY}Using ime : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" +else + SUMMARY="${SUMMARY}Using ibus : NO\n" +fi +if test x$have_fcitx_frontend_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"]) diff --git a/3rdparty/sdl2-2.0.4/debian/changelog b/3rdparty/sdl2-2.0.9/debian/changelog similarity index 76% rename from 3rdparty/sdl2-2.0.4/debian/changelog rename to 3rdparty/sdl2-2.0.9/debian/changelog index 84d1b878be..ba4cf4a3eb 100644 --- a/3rdparty/sdl2-2.0.4/debian/changelog +++ b/3rdparty/sdl2-2.0.9/debian/changelog @@ -1,3 +1,39 @@ +libsdl2 (2.0.9) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.9 + + -- Sam Lantinga Wed, 26 Sep 2018 10:02:21 -0800 + +libsdl2 (2.0.8) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.8 + + -- Sam Lantinga Sat, 4 Nov 2017 21:21:53 -0800 + +libsdl2 (2.0.7) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.7 + + -- Sam Lantinga Thu, 12 Oct 2017 08:01:16 -0800 + +libsdl2 (2.0.6) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.6 + + -- Sam Lantinga Sat, 9 Sep 2017 07:29:36 -0800 + +libsdl2 (2.0.5) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.5 + + -- Sam Lantinga Mon, 28 Nov 2016 07:32:52 -0800 + +libsdl2 (2.0.4) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.4 + + -- Sam Lantinga Thu, 07 Jan 2016 11:02:39 -0800 + libsdl2 (2.0.3) UNRELEASED; urgency=low * Updated SDL to version 2.0.3 diff --git a/3rdparty/sdl2-2.0.4/debian/compat b/3rdparty/sdl2-2.0.9/debian/compat similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/compat rename to 3rdparty/sdl2-2.0.9/debian/compat diff --git a/3rdparty/sdl2-2.0.4/debian/control b/3rdparty/sdl2-2.0.9/debian/control similarity index 98% rename from 3rdparty/sdl2-2.0.4/debian/control rename to 3rdparty/sdl2-2.0.9/debian/control index e61995df42..a3411335ae 100644 --- a/3rdparty/sdl2-2.0.4/debian/control +++ b/3rdparty/sdl2-2.0.9/debian/control @@ -11,6 +11,7 @@ Standards-Version: 3.9.3 Build-Depends: debhelper (>= 9), dh-autoreconf, dpkg-dev (>= 1.16.1~), + fcitx-libs-dev [linux-any], libasound2-dev [linux-any], libgl1-mesa-dev, libpulse-dev, @@ -26,7 +27,6 @@ Build-Depends: debhelper (>= 9), libxinerama-dev, libxrandr-dev, libxss-dev, - libxt-dev, libxxf86vm-dev Homepage: http://www.libsdl.org/ diff --git a/3rdparty/sdl2-2.0.4/debian/copyright b/3rdparty/sdl2-2.0.9/debian/copyright similarity index 96% rename from 3rdparty/sdl2-2.0.4/debian/copyright rename to 3rdparty/sdl2-2.0.9/debian/copyright index 8ce26d1c58..4ccbf0fbd2 100644 --- a/3rdparty/sdl2-2.0.4/debian/copyright +++ b/3rdparty/sdl2-2.0.9/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2016 Sam Lantinga +Copyright: 2018 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -31,12 +31,8 @@ Copyright: 1995 Erik Corry 1995 Brown University License: BrownUn_UnCalifornia_ErikCorry -Files: src/stdlib/SDL_qsort.c -Copyright: 1998 Gareth McCaughan -License: Gareth_McCaughan - Files: src/test/SDL_test_md5.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -50,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -173,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -270,13 +266,6 @@ License: BrownUn_UnCalifornia_ErikCorry * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -License: Gareth_McCaughan - You may use it in anything you like; you may make money - out of it; you may distribute it in object form or as - part of an executable without including source code; - you don't have to credit me. (But it would be nice if - you did.) - License: Johnson_M._Hart Permission is granted for any and all use providing that this copyright is properly acknowledged. diff --git a/3rdparty/sdl2-2.0.4/debian/docs b/3rdparty/sdl2-2.0.9/debian/docs similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/docs rename to 3rdparty/sdl2-2.0.9/debian/docs diff --git a/3rdparty/sdl2-2.0.4/debian/libsdl2-dev.install b/3rdparty/sdl2-2.0.9/debian/libsdl2-dev.install similarity index 50% rename from 3rdparty/sdl2-2.0.4/debian/libsdl2-dev.install rename to 3rdparty/sdl2-2.0.9/debian/libsdl2-dev.install index 7f99ff427c..a1f02d8cd7 100644 --- a/3rdparty/sdl2-2.0.4/debian/libsdl2-dev.install +++ b/3rdparty/sdl2-2.0.9/debian/libsdl2-dev.install @@ -1,8 +1,8 @@ usr/bin/sdl2-config usr/include/SDL2 -usr/lib/*/libSDL2*.so -usr/lib/*/libSDL2.a -usr/lib/*/libSDL2main.a -usr/lib/*/libSDL2_test.a +usr/lib/*/*.a +usr/lib/*/*.la +usr/lib/*/*.so usr/lib/*/pkgconfig/sdl2.pc +usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/share/aclocal/sdl2.m4 diff --git a/3rdparty/sdl2-2.0.4/debian/libsdl2-dev.manpages b/3rdparty/sdl2-2.0.9/debian/libsdl2-dev.manpages similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/libsdl2-dev.manpages rename to 3rdparty/sdl2-2.0.9/debian/libsdl2-dev.manpages diff --git a/3rdparty/sdl2-2.0.4/debian/libsdl2.install b/3rdparty/sdl2-2.0.9/debian/libsdl2.install similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/libsdl2.install rename to 3rdparty/sdl2-2.0.9/debian/libsdl2.install diff --git a/3rdparty/sdl2-2.0.4/debian/rules b/3rdparty/sdl2-2.0.9/debian/rules similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/rules rename to 3rdparty/sdl2-2.0.9/debian/rules diff --git a/3rdparty/sdl2-2.0.4/debian/sdl2-config.1 b/3rdparty/sdl2-2.0.9/debian/sdl2-config.1 similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/sdl2-config.1 rename to 3rdparty/sdl2-2.0.9/debian/sdl2-config.1 diff --git a/3rdparty/sdl2-2.0.4/debian/source/format b/3rdparty/sdl2-2.0.9/debian/source/format similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/source/format rename to 3rdparty/sdl2-2.0.9/debian/source/format diff --git a/3rdparty/sdl2-2.0.4/debian/watch b/3rdparty/sdl2-2.0.9/debian/watch similarity index 100% rename from 3rdparty/sdl2-2.0.4/debian/watch rename to 3rdparty/sdl2-2.0.9/debian/watch diff --git a/3rdparty/sdl2-2.0.4/docs/README-android.md b/3rdparty/sdl2-2.0.9/docs/README-android.md similarity index 68% rename from 3rdparty/sdl2-2.0.4/docs/README-android.md rename to 3rdparty/sdl2-2.0.9/docs/README-android.md index a4b38210fe..0aa90e70b6 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-android.md +++ b/3rdparty/sdl2-2.0.9/docs/README-android.md @@ -1,16 +1,27 @@ -Android +Android ================================================================================ -Requirements: +Matt Styles wrote a tutorial on building SDL for Android with Visual Studio: +http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html -Android SDK (version 12 or later) -http://developer.android.com/sdk/index.html +The rest of this README covers the Android gradle style build process. -Android NDK r7 or later -http://developer.android.com/tools/sdk/ndk/index.html +If you are using the older ant build process, it is no longer officially +supported, but you can use the "android-project-ant" directory as a template. + + +================================================================================ + Requirements +================================================================================ + +Android SDK (version 26 or later) +https://developer.android.com/sdk/index.html + +Android NDK r15c or later +https://developer.android.com/tools/sdk/ndk/index.html + +Minimum API level supported by SDL: 14 (Android 4.0.1) -Minimum API level supported by SDL: 10 (Android 2.3.3) -Joystick support is available for API level >=12 devices. ================================================================================ How the port works @@ -24,15 +35,12 @@ Joystick support is available for API level >=12 devices. - This eventually produces a standard Android .apk package The Android Java code implements an "Activity" and can be found in: -android-project/src/org/libsdl/app/SDLActivity.java +android-project/app/src/main/java/org/libsdl/app/SDLActivity.java The Java code loads your game code, the SDL shared library, and dispatches to native functions implemented in the SDL library: src/core/android/SDL_android.c -Your project must include some glue code that starts your main() routine: -src/main/android/SDL_android_main.c - ================================================================================ Building an app @@ -67,71 +75,30 @@ For more complex projects, follow these instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. -2. Move or symlink this SDL directory into the /jni directory -3. Edit /jni/src/Android.mk to include your source files -4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source - -If you want to use the Eclipse IDE, skip to the Eclipse section below. +2. Move or symlink this SDL directory into the "/app/jni" directory +3. Edit "/app/jni/src/Android.mk" to include your source files -5. Create /local.properties and use that to point to the Android SDK directory, by writing a line with the following form: +4a. If you want to use Android Studio, simply open your directory and start building. - sdk.dir=PATH_TO_ANDROID_SDK - -6. Run 'ant debug' in android/project. This compiles the .java and eventually - creates a .apk with the native code embedded -7. 'ant debug install' will push the apk to the device or emulator (if connected) +4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device Here's an explanation of the files in the Android project, so you can customize them: - android-project/ - AndroidManifest.xml - package manifest. Among others, it contains the class name - of the main Activity and the package name of the application. - build.properties - empty - build.xml - build description file, used by ant. The actual application name - is specified here. - default.properties - holds the target ABI for the application, android-10 and up - project.properties - holds the target ABI for the application, android-10 and up - local.properties - holds the SDK path, you should change this to the path to your SDK + android-project/app + build.gradle - build info including the application version and SDK + src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application. jni/ - directory holding native code - jni/Android.mk - Android makefile that can call recursively the Android.mk files - in all subdirectories + jni/Application.mk - Application JNI settings, including target platform and STL library + jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories jni/SDL/ - (symlink to) directory holding the SDL library files jni/SDL/Android.mk - Android makefile for creating the SDL shared library jni/src/ - directory holding your C/C++ source - jni/src/Android.mk - Android makefile that you should customize to include your - source code and any library references - res/ - directory holding resources for your application - res/drawable-* - directories holding icons for different phone hardware. Could be - one dir called "drawable". - res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout. - We don't need it because we use the SDL video output. - res/values/strings.xml - strings used in your application, including the application name - shown on the phone. - src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding - to SDL. Be very careful changing this, as the SDL library relies - on this implementation. - - -================================================================================ - Build an app with static linking of libSDL -================================================================================ - -This build uses the Android NDK module system. - -Instructions: -1. Copy the android-project directory wherever you want to keep your projects - and rename it to the name of your project. -2. Rename /jni/src/Android_static.mk to /jni/src/Android.mk - (overwrite the existing one) -3. Edit /jni/src/Android.mk to include your source files -4. create and export an environment variable named NDK_MODULE_PATH that points - to the parent directory of this SDL directory. e.g.: - - export NDK_MODULE_PATH="$PWD"/.. - -5. Edit /src/org/libsdl/app/SDLActivity.java and remove the call to - System.loadLibrary("SDL2"). -6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source + jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references + src/main/assets/ - directory holding asset files for your application + src/main/res/ - directory holding resources for your application + src/main/res/mipmap-* - directories holding icons for different phone hardware + src/main/res/values/strings.xml - strings used in your application, including the application name + src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application. ================================================================================ @@ -164,25 +131,23 @@ Here's an example of a minimal class file: Then replace "SDLActivity" in AndroidManifest.xml with the name of your class, .e.g. "MyGame" + ================================================================================ Customizing your application icon ================================================================================ Conceptually changing your icon is just replacing the "ic_launcher.png" files in -the drawable directories under the res directory. There are four directories for -different screen sizes. These can be replaced with one dir called "drawable", -containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72. +the drawable directories under the res directory. There are several directories +for different screen sizes. -You may need to change the name of your icon in AndroidManifest.xml to match -this icon filename. ================================================================================ Loading assets ================================================================================ -Any files you put in the "assets" directory of your android-project directory -will get bundled into the application package and you can load them using the -standard functions in SDL_rwops.h. +Any files you put in the "app/src/main/assets" directory of your project +directory will get bundled into the application package and you can load +them using the standard functions in SDL_rwops.h. There are also a few Android specific functions that allow you to get other useful paths for saving and loading data: @@ -204,6 +169,7 @@ disable this behaviour, see for example: http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/ + ================================================================================ Pause / Resume behaviour ================================================================================ @@ -224,12 +190,13 @@ a specific message, (which is not yet implemented!) and restore your textures manually or quit the app (which is actually the kind of behaviour you'll see under iOS, if the OS can not restore your GL context it will just kill your app) + ================================================================================ Threads and the Java VM ================================================================================ For a quick tour on how Linux native threads interoperate with the Java VM, take -a look here: http://developer.android.com/guide/practices/jni.html +a look here: https://developer.android.com/guide/practices/jni.html If you want to use threads in your SDL app, it's strongly recommended that you do so by creating them using SDL functions. This way, the required attach/detach @@ -239,6 +206,7 @@ Android_JNI_SetupThread() before doing anything else otherwise SDL will attach your thread automatically anyway (when you make an SDL call), but it'll never detach it. + ================================================================================ Using STL ================================================================================ @@ -246,34 +214,10 @@ detach it. You can use STL in your project by creating an Application.mk file in the jni folder and adding the following line: - APP_STL := stlport_static - -For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation. - -================================================================================ - Additional documentation -================================================================================ - -The documentation in the NDK docs directory is very helpful in understanding the -build process and how to work with native code on the Android platform. - -The best place to start is with docs/OVERVIEW.TXT - - -================================================================================ - Using Eclipse -================================================================================ - -First make sure that you've installed Eclipse and the Android extensions as described here: - http://developer.android.com/tools/sdk/eclipse-adt.html + APP_STL := c++_shared -Once you've copied the SDL android project and customized it, you can create an Eclipse project from it: - * File -> New -> Other - * Select the Android -> Android Project wizard and click Next - * Enter the name you'd like your project to have - * Select "Create project from existing source" and browse for your project directory - * Make sure the Build Target is set to Android 3.1 (API 12) - * Click Finish +For more information go here: + https://developer.android.com/ndk/guides/cpp-support ================================================================================ @@ -281,20 +225,18 @@ Once you've copied the SDL android project and customized it, you can create an ================================================================================ There are some good tips and tricks for getting the most out of the -emulator here: http://developer.android.com/tools/devices/emulator.html +emulator here: https://developer.android.com/tools/devices/emulator.html Especially useful is the info on setting up OpenGL ES 2.0 emulation. Notice that this software emulator is incredibly slow and needs a lot of disk space. Using a real device works better. + ================================================================================ Troubleshooting ================================================================================ -You can create and run an emulator from the Eclipse IDE: - * Window -> Android SDK and AVD Manager - You can see if adb can see any devices with the following command: adb devices @@ -331,7 +273,10 @@ You can see the complete command line that ndk-build is using by passing V=1 on ndk-build V=1 -If your application crashes in native code, you can use addr2line to convert the +If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace: + https://developer.android.com/ndk/guides/ndk-stack + +If you want to go through the process manually, you can use addr2line to convert the addresses in the stack trace to lines in your code. For example, if your crash looks like this: @@ -419,23 +364,30 @@ When you're done instrumenting with valgrind, you can disable the wrapper: adb shell setprop wrap.org.libsdl.app "" + ================================================================================ - Why is API level 10 the minimum required? + Graphics debugging ================================================================================ -API level 10 is the minimum required level at runtime (that is, on the device) -because SDL requires some functionality for running not -available on older devices. Since the incorporation of joystick support into SDL, -the minimum SDK required to *build* SDL is version 12. Devices running API levels -10-11 are still supported, only with the joystick functionality disabled. +If you are developing on a compatible Tegra-based tablet, NVidia provides +Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL +and GLES libraries, you must follow their instructions for installing the +interposer library on a rooted device. The non-rooted instructions are not +compatible with applications that use SDL2 for video. + +The Tegra Graphics Debugger is available from NVidia here: +https://developer.nvidia.com/tegra-graphics-debugger + + +================================================================================ + Why is API level 14 the minimum required? +================================================================================ + +The latest NDK toolchain doesn't support targeting earlier than API level 14. +As of this writing, according to https://developer.android.com/about/dashboards/index.html +about 99% of the Android devices accessing Google Play support API level 14 or +higher (October 2017). -Support for native OpenGL ES and ES2 applications was introduced in the NDK for -API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which -has since then been obsoleted, with the recommendation to developers to bump the -required API level to 10. -As of this writing, according to http://developer.android.com/about/dashboards/index.html -about 90% of the Android devices accessing Google Play support API level 10 or -higher (March 2013). ================================================================================ A note regarding the use of the "dirty rectangles" rendering technique @@ -455,6 +407,7 @@ screen each frame. Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html + ================================================================================ Known issues ================================================================================ diff --git a/3rdparty/sdl2-2.0.4/docs/README-cmake.md b/3rdparty/sdl2-2.0.9/docs/README-cmake.md similarity index 96% rename from 3rdparty/sdl2-2.0.4/docs/README-cmake.md rename to 3rdparty/sdl2-2.0.9/docs/README-cmake.md index 5b440c5468..2ce11d7a01 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-cmake.md +++ b/3rdparty/sdl2-2.0.9/docs/README-cmake.md @@ -1,6 +1,6 @@ -CMake +CMake ================================================================================ -(www.cmake.org) +(www.cmake.org) SDL's build system was traditionally based on autotools. Over time, this approach has suffered from several issues across the different supported diff --git a/3rdparty/sdl2-2.0.4/docs/README-directfb.md b/3rdparty/sdl2-2.0.9/docs/README-directfb.md similarity index 95% rename from 3rdparty/sdl2-2.0.4/docs/README-directfb.md rename to 3rdparty/sdl2-2.0.9/docs/README-directfb.md index 7df8bb864a..eeac42806c 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-directfb.md +++ b/3rdparty/sdl2-2.0.9/docs/README-directfb.md @@ -1,5 +1,5 @@ DirectFB -======== +======== Supports: diff --git a/3rdparty/sdl2-2.0.4/docs/README-dynapi.md b/3rdparty/sdl2-2.0.9/docs/README-dynapi.md similarity index 97% rename from 3rdparty/sdl2-2.0.4/docs/README-dynapi.md rename to 3rdparty/sdl2-2.0.9/docs/README-dynapi.md index bfaecb3449..40b44db809 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-dynapi.md +++ b/3rdparty/sdl2-2.0.9/docs/README-dynapi.md @@ -1,130 +1,130 @@ -Dynamic API -================================================================================ -Originally posted by Ryan at: - https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U - -Background: - -- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, - but developers are shipping their own SDL2 with individual Steam games. - These games might stop getting updates, but a newer SDL2 might be needed later. - Certainly we'll always be fixing bugs in SDL, even if a new video target isn't - ever needed, and these fixes won't make it to a game shipping its own SDL. -- Even if we replace the SDL2 in those games with a compatible one, that is to - say, edit a developer's Steam depot (yuck!), there are developers that are - statically linking SDL2 that we can't do this for. We can't even force the - dynamic loader to ignore their SDL2 in this case, of course. -- If you don't ship an SDL2 with the game in some form, people that disabled the - Steam Runtime, or just tried to run the game from the command line instead of - Steam might find themselves unable to run the game, due to a missing dependency. -- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target - generic Linux boxes that may or may not have SDL2 installed, you have to ship - the library or risk a total failure to launch. So now, you might have to have - a non-Steam build plus a Steam build (that is, one with and one without SDL2 - included), which is inconvenient if you could have had one universal build - that works everywhere. -- We like the zlib license, but the biggest complaint from the open source - community about the license change is the static linking. The LGPL forced this - as a legal, not technical issue, but zlib doesn't care. Even those that aren't - concerned about the GNU freedoms found themselves solving the same problems: - swapping in a newer SDL to an older game often times can save the day. - Static linking stops this dead. - -So here's what we did: - -SDL now has, internally, a table of function pointers. So, this is what SDL_Init -now looks like: - - UInt32 SDL_Init(Uint32 flags) - { - return jump_table.SDL_Init(flags); - } - -Except that is all done with a bunch of macro magic so we don't have to maintain -every one of these. - -What is jump_table.SDL_init()? Eventually, that's a function pointer of the real -SDL_Init() that you've been calling all this time. But at startup, it looks more -like this: - - Uint32 SDL_Init_DEFAULT(Uint32 flags) - { - SDL_InitDynamicAPI(); - return jump_table.SDL_Init(flags); - } - -SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function -pointers, which means that this _DEFAULT function never gets called again. -First call to any SDL function sets the whole thing up. - -So you might be asking, what was the value in that? Isn't this what the operating -system's dynamic loader was supposed to do for us? Yes, but now we've got this -level of indirection, we can do things like this: - - export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 - ./MyGameThatIsStaticallyLinkedToSDL2 - -And now, this game that is staticallly linked to SDL, can still be overridden -with a newer, or better, SDL. The statically linked one will only be used as -far as calling into the jump table in this case. But in cases where no override -is desired, the statically linked version will provide its own jump table, -and everyone is happy. - -So now: -- Developers can statically link SDL, and users can still replace it. - (We'd still rather you ship a shared library, though!) -- Developers can ship an SDL with their game, Valve can override it for, say, - new features on SteamOS, or distros can override it for their own needs, - but it'll also just work in the default case. -- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), - and it'll do the right thing. -- End users (and Valve) can update a game's SDL in almost any case, - to keep abandoned games running on newer platforms. -- Everyone develops with SDL exactly as they have been doing all along. - Same headers, same ABI. Just get the latest version to enable this magic. - - -A little more about SDL_InitDynamicAPI(): - -Internally, InitAPI does some locking to make sure everything waits until a -single thread initializes everything (although even SDL_CreateThread() goes -through here before spinning a thread, too), and then decides if it should use -an external SDL library. If not, it sets up the jump table using the current -SDL's function pointers (which might be statically linked into a program, or in -a shared library of its own). If so, it loads that library and looks for and -calls a single function: - - SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); - -That function takes a version number (more on that in a moment), the address of -the jump table, and the size, in bytes, of the table. -Now, we've got policy here: this table's layout never changes; new stuff gets -added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all -the needed functions if tablesize <= sizeof its own jump table. If tablesize is -bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but -if it's smaller, we know we can provide the entire API that the caller needs. - -The version variable is a failsafe switch. -Right now it's always 1. This number changes when there are major API changes -(so we know if the tablesize might be smaller, or entries in it have changed). -Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not -inconceivable to have a small dispatch library that only supplies this one -function and loads different, otherwise-incompatible SDL libraries and has the -right one initialize the jump table based on the version. For something that -must generically catch lots of different versions of SDL over time, like the -Steam Client, this isn't a bad option. - -Finally, I'm sure some people are reading this and thinking, -"I don't want that overhead in my project!" -To which I would point out that the extra function call through the jump table -probably wouldn't even show up in a profile, but lucky you: this can all be -disabled. You can build SDL without this if you absolutely must, but we would -encourage you not to do that. However, on heavily locked down platforms like -iOS, or maybe when debugging, it makes sense to disable it. The way this is -designed in SDL, you just have to change one #define, and the entire system -vaporizes out, and SDL functions exactly like it always did. Most of it is -macro magic, so the system is contained to one C file and a few headers. -However, this is on by default and you have to edit a header file to turn it -off. Our hopes is that if we make it easy to disable, but not too easy, -everyone will ultimately be able to get what they want, but we've gently -nudged everyone towards what we think is the best solution. +Dynamic API +================================================================================ +Originally posted by Ryan at: + https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U + +Background: + +- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, + but developers are shipping their own SDL2 with individual Steam games. + These games might stop getting updates, but a newer SDL2 might be needed later. + Certainly we'll always be fixing bugs in SDL, even if a new video target isn't + ever needed, and these fixes won't make it to a game shipping its own SDL. +- Even if we replace the SDL2 in those games with a compatible one, that is to + say, edit a developer's Steam depot (yuck!), there are developers that are + statically linking SDL2 that we can't do this for. We can't even force the + dynamic loader to ignore their SDL2 in this case, of course. +- If you don't ship an SDL2 with the game in some form, people that disabled the + Steam Runtime, or just tried to run the game from the command line instead of + Steam might find themselves unable to run the game, due to a missing dependency. +- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target + generic Linux boxes that may or may not have SDL2 installed, you have to ship + the library or risk a total failure to launch. So now, you might have to have + a non-Steam build plus a Steam build (that is, one with and one without SDL2 + included), which is inconvenient if you could have had one universal build + that works everywhere. +- We like the zlib license, but the biggest complaint from the open source + community about the license change is the static linking. The LGPL forced this + as a legal, not technical issue, but zlib doesn't care. Even those that aren't + concerned about the GNU freedoms found themselves solving the same problems: + swapping in a newer SDL to an older game often times can save the day. + Static linking stops this dead. + +So here's what we did: + +SDL now has, internally, a table of function pointers. So, this is what SDL_Init +now looks like: + + UInt32 SDL_Init(Uint32 flags) + { + return jump_table.SDL_Init(flags); + } + +Except that is all done with a bunch of macro magic so we don't have to maintain +every one of these. + +What is jump_table.SDL_init()? Eventually, that's a function pointer of the real +SDL_Init() that you've been calling all this time. But at startup, it looks more +like this: + + Uint32 SDL_Init_DEFAULT(Uint32 flags) + { + SDL_InitDynamicAPI(); + return jump_table.SDL_Init(flags); + } + +SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function +pointers, which means that this _DEFAULT function never gets called again. +First call to any SDL function sets the whole thing up. + +So you might be asking, what was the value in that? Isn't this what the operating +system's dynamic loader was supposed to do for us? Yes, but now we've got this +level of indirection, we can do things like this: + + export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 + ./MyGameThatIsStaticallyLinkedToSDL2 + +And now, this game that is statically linked to SDL, can still be overridden +with a newer, or better, SDL. The statically linked one will only be used as +far as calling into the jump table in this case. But in cases where no override +is desired, the statically linked version will provide its own jump table, +and everyone is happy. + +So now: +- Developers can statically link SDL, and users can still replace it. + (We'd still rather you ship a shared library, though!) +- Developers can ship an SDL with their game, Valve can override it for, say, + new features on SteamOS, or distros can override it for their own needs, + but it'll also just work in the default case. +- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), + and it'll do the right thing. +- End users (and Valve) can update a game's SDL in almost any case, + to keep abandoned games running on newer platforms. +- Everyone develops with SDL exactly as they have been doing all along. + Same headers, same ABI. Just get the latest version to enable this magic. + + +A little more about SDL_InitDynamicAPI(): + +Internally, InitAPI does some locking to make sure everything waits until a +single thread initializes everything (although even SDL_CreateThread() goes +through here before spinning a thread, too), and then decides if it should use +an external SDL library. If not, it sets up the jump table using the current +SDL's function pointers (which might be statically linked into a program, or in +a shared library of its own). If so, it loads that library and looks for and +calls a single function: + + SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); + +That function takes a version number (more on that in a moment), the address of +the jump table, and the size, in bytes, of the table. +Now, we've got policy here: this table's layout never changes; new stuff gets +added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all +the needed functions if tablesize <= sizeof its own jump table. If tablesize is +bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but +if it's smaller, we know we can provide the entire API that the caller needs. + +The version variable is a failsafe switch. +Right now it's always 1. This number changes when there are major API changes +(so we know if the tablesize might be smaller, or entries in it have changed). +Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not +inconceivable to have a small dispatch library that only supplies this one +function and loads different, otherwise-incompatible SDL libraries and has the +right one initialize the jump table based on the version. For something that +must generically catch lots of different versions of SDL over time, like the +Steam Client, this isn't a bad option. + +Finally, I'm sure some people are reading this and thinking, +"I don't want that overhead in my project!" +To which I would point out that the extra function call through the jump table +probably wouldn't even show up in a profile, but lucky you: this can all be +disabled. You can build SDL without this if you absolutely must, but we would +encourage you not to do that. However, on heavily locked down platforms like +iOS, or maybe when debugging, it makes sense to disable it. The way this is +designed in SDL, you just have to change one #define, and the entire system +vaporizes out, and SDL functions exactly like it always did. Most of it is +macro magic, so the system is contained to one C file and a few headers. +However, this is on by default and you have to edit a header file to turn it +off. Our hopes is that if we make it easy to disable, but not too easy, +everyone will ultimately be able to get what they want, but we've gently +nudged everyone towards what we think is the best solution. diff --git a/3rdparty/sdl2-2.0.4/docs/README-emscripten.md b/3rdparty/sdl2-2.0.9/docs/README-emscripten.md similarity index 85% rename from 3rdparty/sdl2-2.0.4/docs/README-emscripten.md rename to 3rdparty/sdl2-2.0.9/docs/README-emscripten.md index 62012db72c..b535cc60a1 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-emscripten.md +++ b/3rdparty/sdl2-2.0.9/docs/README-emscripten.md @@ -1,37 +1,35 @@ -Emscripten -================================================================================ - -Build: - - $ mkdir build - $ cd build - $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2" - $ emmake make - -Or with cmake: - - $ mkdir build - $ cd build - $ emcmake cmake .. - $ emmake make - -To build one of the tests: - - $ cd test/ - $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html - -Uses GLES2 renderer or software - -tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html - -Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): - -SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): - - $ EMCONFIGURE_JS=1 emconfigure ../configure - build as usual... - -SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): - - $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx - build as usual... +Emscripten +================================================================================ + +Build: + + $ mkdir build + $ cd build + $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2" + $ emmake make + +Or with cmake: + + $ mkdir build + $ cd build + $ emcmake cmake .. + $ emmake make + +To build one of the tests: + + $ cd test/ + $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html + +Uses GLES2 renderer or software + +Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): + +SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): + + $ EMCONFIGURE_JS=1 emconfigure ../configure + build as usual... + +SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): + + $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx + build as usual... diff --git a/3rdparty/sdl2-2.0.4/docs/README-gesture.md b/3rdparty/sdl2-2.0.9/docs/README-gesture.md similarity index 100% rename from 3rdparty/sdl2-2.0.4/docs/README-gesture.md rename to 3rdparty/sdl2-2.0.9/docs/README-gesture.md diff --git a/3rdparty/sdl2-2.0.4/docs/README-hg.md b/3rdparty/sdl2-2.0.9/docs/README-hg.md similarity index 75% rename from 3rdparty/sdl2-2.0.4/docs/README-hg.md rename to 3rdparty/sdl2-2.0.9/docs/README-hg.md index 6e18bab0ad..5f3d25922e 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-hg.md +++ b/3rdparty/sdl2-2.0.9/docs/README-hg.md @@ -1,19 +1,16 @@ -Mercurial -========= - +Mercurial +========= + The latest development version of SDL is available via Mercurial. Mercurial allows you to get up-to-the-minute fixes and enhancements; as a developer works on a source tree, you can use "hg" to mirror that source tree instead of waiting for an official release. Please look -at the Mercurial website ( http://mercurial.selenic.com/ ) for more +at the Mercurial website ( https://www.mercurial-scm.org/ ) for more information on using hg, where you can also download software for Mac OS X, Windows, and Unix systems. hg clone http://hg.libsdl.org/SDL -If you are building SDL with an IDE, you will need to copy the file -include/SDL_config.h.default to include/SDL_config.h before building. - If you are building SDL via configure, you will need to run autogen.sh before running configure. diff --git a/3rdparty/sdl2-2.0.4/docs/README-ios.md b/3rdparty/sdl2-2.0.9/docs/README-ios.md similarity index 84% rename from 3rdparty/sdl2-2.0.4/docs/README-ios.md rename to 3rdparty/sdl2-2.0.9/docs/README-ios.md index a0afffb1fa..bf34fe482f 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-ios.md +++ b/3rdparty/sdl2-2.0.9/docs/README-ios.md @@ -8,6 +8,7 @@ Building the Simple DirectMedia Layer for iOS 5.1+ Requirements: Mac OS X 10.8 or later and the iOS 7+ SDK. Instructions: + 1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in Xcode. 2. Select your desired target, and hit build. @@ -74,17 +75,17 @@ By default SDL will not use the full pixel density of the screen on Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when creating your window to enable high-dpi support. -When high-dpi support is enabled, SDL_GetWindowSize and display mode sizes +When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes will still be in "screen coordinates" rather than pixels, but the window will have a much greater pixel density when the device supports it, and the -SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize functions (depending on +SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on whether raw OpenGL or the SDL_Render API is used) can be queried to determine the size in pixels of the drawable screen framebuffer. Some OpenGL ES functions such as glViewport expect sizes in pixels rather than sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an orthographic projection matrix using the size in screen coordinates -(SDL_GetWindowSize) can be used in order to display content at the same scale +(SDL_GetWindowSize()) can be used in order to display content at the same scale no matter whether a Retina device is used or not. ============================================================================== @@ -156,7 +157,7 @@ Notes -- Accelerometer as Joystick SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory. -The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF. +The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF. ============================================================================== Notes -- OpenGL ES @@ -164,7 +165,7 @@ Notes -- OpenGL ES Your SDL application for iOS uses OpenGL ES for video by default. -OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute. +OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute(). If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0. @@ -172,11 +173,11 @@ Finally, if your application completely redraws the screen each frame, you may f OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this: -- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow is called. -- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow is called. +- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called. +- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called. - If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called. -The above objects can be obtained via SDL_GetWindowWMInfo (in SDL_syswm.h). +The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h). ============================================================================== Notes -- Keyboard @@ -219,7 +220,7 @@ Notes -- iPhone SDL limitations ============================================================================== Windows: - Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS). + Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS). Textures: The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats. @@ -264,3 +265,20 @@ e.g. #endif return 0; } + +============================================================================== +Deploying to older versions of iOS +============================================================================== + +SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 6.1 + +In order to do that you need to download an older version of Xcode: +https://developer.apple.com/download/more/?name=Xcode + +Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport + +Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES + +Open your project and set your deployment target to the desired version of iOS + +Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController diff --git a/3rdparty/sdl2-2.0.4/docs/README-linux.md b/3rdparty/sdl2-2.0.9/docs/README-linux.md similarity index 84% rename from 3rdparty/sdl2-2.0.4/docs/README-linux.md rename to 3rdparty/sdl2-2.0.9/docs/README-linux.md index fddabf524b..fdc06a05fa 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-linux.md +++ b/3rdparty/sdl2-2.0.9/docs/README-linux.md @@ -1,82 +1,90 @@ -Linux -================================================================================ - -By default SDL will only link against glibc, the rest of the features will be -enabled dynamically at runtime depending on the available features on the target -system. So, for example if you built SDL with Xinerama support and the target -system does not have the Xinerama libraries installed, it will be disabled -at runtime, and you won't get a missing library error, at least with the -default configuration parameters. - - -================================================================================ -Build Dependencies -================================================================================ - -Ubuntu 13.04, all available features enabled: - -sudo apt-get install build-essential mercurial make cmake autoconf automake \ -libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \ -libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \ -libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \ -libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev - -Ubuntu 14.04 can also add "libwayland-dev libmirclient-dev libxkbcommon-dev" -to that command line for Wayland and Mir support. - -NOTES: -- This includes all the audio targets except arts, because Ubuntu pulled the - artsc0-dev package, but in theory SDL still supports it. -- DirectFB isn't included because the configure script (currently) fails to find - it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the - configure script to include DirectFB support. Send patches. :) - - -================================================================================ -Joystick does not work -================================================================================ - -If you compiled or are using a version of SDL with udev support (and you should!) -there's a few issues that may cause SDL to fail to detect your joystick. To -debug this, start by installing the evtest utility. On Ubuntu/Debian: - - sudo apt-get install evtest - -Then run: - - sudo evtest - -You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX" -Now run: - - cat /dev/input/event/XX - -If you get a permission error, you need to set a udev rule to change the mode of -your device (see below) - -Also, try: - - sudo udevadm info --query=all --name=input/eventXX - -If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it, -you need to set up an udev rule to force this variable. - -A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks -like: - - SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" - SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" - -You can set up similar rules for your device by changing the values listed in -idProduct and idVendor. To obtain these values, try: - - sudo udevadm info -a --name=input/eventXX | grep idVendor - sudo udevadm info -a --name=input/eventXX | grep idProduct - -If multiple values come up for each of these, the one you want is the first one of each. - -On other systems which ship with an older udev (such as CentOS), you may need -to set up a rule such as: - - SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1" - +Linux +================================================================================ + +By default SDL will only link against glibc, the rest of the features will be +enabled dynamically at runtime depending on the available features on the target +system. So, for example if you built SDL with Xinerama support and the target +system does not have the Xinerama libraries installed, it will be disabled +at runtime, and you won't get a missing library error, at least with the +default configuration parameters. + + +================================================================================ +Build Dependencies +================================================================================ + +Ubuntu 13.04, all available features enabled: + +sudo apt-get install build-essential mercurial make cmake autoconf automake \ +libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \ +libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \ +libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \ +libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \ +fcitx-libs-dev libsamplerate0-dev libsndio-dev + +Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols" +to that command line for Wayland support. + +Ubuntu 16.10 can also add "libmirclient-dev libxkbcommon-dev" to that command +line for Mir support. + +NOTES: +- This includes all the audio targets except arts, because Ubuntu pulled the + artsc0-dev package, but in theory SDL still supports it. +- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime + for higher-quality audio resampling. SDL will work without it if the library + is missing, so it's safe to build in support even if the end user doesn't + have this library installed. +- DirectFB isn't included because the configure script (currently) fails to find + it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the + configure script to include DirectFB support. Send patches. :) + + +================================================================================ +Joystick does not work +================================================================================ + +If you compiled or are using a version of SDL with udev support (and you should!) +there's a few issues that may cause SDL to fail to detect your joystick. To +debug this, start by installing the evtest utility. On Ubuntu/Debian: + + sudo apt-get install evtest + +Then run: + + sudo evtest + +You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX" +Now run: + + cat /dev/input/event/XX + +If you get a permission error, you need to set a udev rule to change the mode of +your device (see below) + +Also, try: + + sudo udevadm info --query=all --name=input/eventXX + +If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it, +you need to set up an udev rule to force this variable. + +A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks +like: + + SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" + SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" + +You can set up similar rules for your device by changing the values listed in +idProduct and idVendor. To obtain these values, try: + + sudo udevadm info -a --name=input/eventXX | grep idVendor + sudo udevadm info -a --name=input/eventXX | grep idProduct + +If multiple values come up for each of these, the one you want is the first one of each. + +On other systems which ship with an older udev (such as CentOS), you may need +to set up a rule such as: + + SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1" + diff --git a/3rdparty/sdl2-2.0.4/docs/README-macosx.md b/3rdparty/sdl2-2.0.9/docs/README-macosx.md similarity index 88% rename from 3rdparty/sdl2-2.0.4/docs/README-macosx.md rename to 3rdparty/sdl2-2.0.9/docs/README-macosx.md index 747e1e6067..15ab39e653 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-macosx.md +++ b/3rdparty/sdl2-2.0.9/docs/README-macosx.md @@ -8,12 +8,15 @@ From the developer's point of view, OS X is a sort of hybrid Mac and Unix system, and you have the option of using either traditional command line tools or Apple's IDE Xcode. +Command Line Build +================== + To build SDL using the command line, use the standard configure and make process: - ./configure - make - sudo make install + ./configure + make + sudo make install You can also build SDL as a Universal library (a single binary for both 32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using @@ -21,9 +24,9 @@ the gcc-fat.sh script in build-scripts: mkdir mybuild cd mybuild - CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++fat.sh ../configure - make - sudo make install + CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++-fat.sh ../configure + make + sudo make install This script builds SDL with 10.5 ABI compatibility on i386 and 10.6 ABI compatibility on x86_64 architectures. For best compatibility you @@ -86,17 +89,17 @@ so called "bundle", which basically is a fancy folder with a name like To get this build automatically, add something like the following rule to your Makefile.am: -bundle_contents = APP_NAME.app/Contents -APP_NAME_bundle: EXE_NAME - mkdir -p $(bundle_contents)/MacOS - mkdir -p $(bundle_contents)/Resources - echo "APPL????" > $(bundle_contents)/PkgInfo - $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ + bundle_contents = APP_NAME.app/Contents + APP_NAME_bundle: EXE_NAME + mkdir -p $(bundle_contents)/MacOS + mkdir -p $(bundle_contents)/Resources + echo "APPL????" > $(bundle_contents)/PkgInfo + $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ You should replace EXE_NAME with the name of the executable. APP_NAME is what will be visible to the user in the Finder. Usually it will be the same as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME -usually is "TestGame". You might also want to use @PACKAGE@ to use the package +usually is "TestGame". You might also want to use `@PACKAGE@` to use the package name as specified in your configure.in file. If your project builds more than one application, you will have to do a bit @@ -105,13 +108,13 @@ more. For each of your target applications, you need a separate rule. If you want the created bundles to be installed, you may want to add this rule to your Makefile.am: -install-exec-hook: APP_NAME_bundle - rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app - mkdir -p $(DESTDIR)$(prefix)/Applications/ - cp -r $< /$(DESTDIR)$(prefix)Applications/ + install-exec-hook: APP_NAME_bundle + rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app + mkdir -p $(DESTDIR)$(prefix)/Applications/ + cp -r $< /$(DESTDIR)$(prefix)Applications/ This rule takes the Bundle created by the rule from step 3 and installs them -into $(DESTDIR)$(prefix)/Applications/. +into "$(DESTDIR)$(prefix)/Applications/". Again, if you want to install multiple applications, you will have to augment the make rule accordingly. @@ -126,11 +129,16 @@ there are some more things you should do before shipping your product... unless you also install SDL on that other computer. A good solution for this dilemma is to static link against SDL. On OS X, you can achieve that by linking against the libraries listed by - sdl-config --static-libs + + sdl-config --static-libs + instead of those listed by - sdl-config --libs + + sdl-config --libs + Depending on how exactly SDL is integrated into your build systems, the way to achieve that varies, so I won't describe it here in detail + 2) Add an 'Info.plist' to your application. That is a special XML file which contains some meta-information about your application (like some copyright information, the version of your app, the name of an optional icon file, @@ -156,8 +164,10 @@ The first thing to do is to unpack the Xcode.tar.gz archive in the top level SDL directory (where the Xcode.tar.gz archive resides). Because Stuffit Expander will unpack the archive into a subdirectory, you should unpack the archive manually from the command line: - cd [path_to_SDL_source] - tar zxf Xcode.tar.gz + + cd [path_to_SDL_source] + tar zxf Xcode.tar.gz + This will create a new folder called Xcode, which you can browse normally from the Finder. @@ -227,4 +237,4 @@ following locations: Functionality may be added in the future to help this. -Known bugs are listed in the file "BUGS" +Known bugs are listed in the file "BUGS.txt". diff --git a/3rdparty/sdl2-2.0.4/docs/README-nacl.md b/3rdparty/sdl2-2.0.9/docs/README-nacl.md similarity index 97% rename from 3rdparty/sdl2-2.0.4/docs/README-nacl.md rename to 3rdparty/sdl2-2.0.9/docs/README-nacl.md index 4c9432b69b..53ada33c31 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-nacl.md +++ b/3rdparty/sdl2-2.0.9/docs/README-nacl.md @@ -1,103 +1,103 @@ -Native Client -================================================================================ - -Requirements: - -* Native Client SDK (https://developer.chrome.com/native-client), - (tested with Pepper version 33 or higher). - -The SDL backend for Chrome's Native Client has been tested only with the PNaCl -toolchain, which generates binaries designed to run on ARM and x86_32/64 -platforms. This does not mean it won't work with the other toolchains! - -================================================================================ -Building SDL for NaCl -================================================================================ - -Set up the right environment variables (see naclbuild.sh), then configure SDL with: - - configure --host=pnacl --prefix some/install/destination - -Then "make". - -As an example of how to create a deployable app a Makefile project is provided -in test/nacl/Makefile, which includes some monkey patching of the common.mk file -provided by NaCl, without which linking properly to SDL won't work (the search -path can't be modified externally, so the linker won't find SDL's binaries unless -you dump them into the SDK path, which is inconvenient). -Also provided in test/nacl is the required support file, such as index.html, -manifest.json, etc. -SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure. -This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem), -hiding the asynchronous nature of the browser behind the scenes...which is not the -same as making it disappear! - - -================================================================================ -Running tests -================================================================================ - -Due to the nature of NaCl programs, building and running SDL tests is not as -straightforward as one would hope. The script naclbuild.sh in build-scripts -automates the process and should serve as a guide for users of SDL trying to build -their own applications. - -Basic usage: - - ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35) - -This will build testgles2.c by default. - -If you want to build a different test, for example testrendercopyex.c: - - SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35 - -Once the build finishes, you have to serve the contents with a web server (the -script will give you instructions on how to do that with Python). - -================================================================================ -RWops and nacl_io -================================================================================ - -SDL_RWops work transparently with nacl_io. Two functions control the mount points: - - int mount(const char* source, const char* target, - const char* filesystemtype, - unsigned long mountflags, const void *data); - int umount(const char *target); - - For convenience, SDL will by default mount an httpfs tree at / before calling -the app's main function. Such setting can be overridden by calling: - - umount("/"); - -And then mounting a different filesystem at / - -It's important to consider that the asynchronous nature of file operations on a -browser is hidden from the application, effectively providing the developer with -a set of blocking file operations just like you get in a regular desktop -environment, which eases the job of porting to Native Client, but also introduces -a set of challenges of its own, in particular when big file sizes and slow -connections are involved. - -For more information on how nacl_io and mount points work, see: - - https://developer.chrome.com/native-client/devguide/coding/nacl_io - https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h - -To be able to save into the directory "/save/" (like backup of game) : - - mount("", "/save", "html5fs", 0, "type=PERSISTENT"); - -And add to manifest.json : - - "permissions": [ - "unlimitedStorage" - ] - -================================================================================ -TODO - Known Issues -================================================================================ -* Testing of all systems with a real application (something other than SDL's tests) -* Key events don't seem to work properly - +Native Client +================================================================================ + +Requirements: + +* Native Client SDK (https://developer.chrome.com/native-client), + (tested with Pepper version 33 or higher). + +The SDL backend for Chrome's Native Client has been tested only with the PNaCl +toolchain, which generates binaries designed to run on ARM and x86_32/64 +platforms. This does not mean it won't work with the other toolchains! + +================================================================================ +Building SDL for NaCl +================================================================================ + +Set up the right environment variables (see naclbuild.sh), then configure SDL with: + + configure --host=pnacl --prefix some/install/destination + +Then "make". + +As an example of how to create a deployable app a Makefile project is provided +in test/nacl/Makefile, which includes some monkey patching of the common.mk file +provided by NaCl, without which linking properly to SDL won't work (the search +path can't be modified externally, so the linker won't find SDL's binaries unless +you dump them into the SDK path, which is inconvenient). +Also provided in test/nacl is the required support file, such as index.html, +manifest.json, etc. +SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure. +This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem), +hiding the asynchronous nature of the browser behind the scenes...which is not the +same as making it disappear! + + +================================================================================ +Running tests +================================================================================ + +Due to the nature of NaCl programs, building and running SDL tests is not as +straightforward as one would hope. The script naclbuild.sh in build-scripts +automates the process and should serve as a guide for users of SDL trying to build +their own applications. + +Basic usage: + + ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35) + +This will build testgles2.c by default. + +If you want to build a different test, for example testrendercopyex.c: + + SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35 + +Once the build finishes, you have to serve the contents with a web server (the +script will give you instructions on how to do that with Python). + +================================================================================ +RWops and nacl_io +================================================================================ + +SDL_RWops work transparently with nacl_io. Two functions control the mount points: + + int mount(const char* source, const char* target, + const char* filesystemtype, + unsigned long mountflags, const void *data); + int umount(const char *target); + + For convenience, SDL will by default mount an httpfs tree at / before calling +the app's main function. Such setting can be overridden by calling: + + umount("/"); + +And then mounting a different filesystem at / + +It's important to consider that the asynchronous nature of file operations on a +browser is hidden from the application, effectively providing the developer with +a set of blocking file operations just like you get in a regular desktop +environment, which eases the job of porting to Native Client, but also introduces +a set of challenges of its own, in particular when big file sizes and slow +connections are involved. + +For more information on how nacl_io and mount points work, see: + + https://developer.chrome.com/native-client/devguide/coding/nacl_io + https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h + +To be able to save into the directory "/save/" (like backup of game) : + + mount("", "/save", "html5fs", 0, "type=PERSISTENT"); + +And add to manifest.json : + + "permissions": [ + "unlimitedStorage" + ] + +================================================================================ +TODO - Known Issues +================================================================================ +* Testing of all systems with a real application (something other than SDL's tests) +* Key events don't seem to work properly + diff --git a/3rdparty/sdl2-2.0.4/docs/README-pandora.md b/3rdparty/sdl2-2.0.9/docs/README-pandora.md similarity index 97% rename from 3rdparty/sdl2-2.0.4/docs/README-pandora.md rename to 3rdparty/sdl2-2.0.9/docs/README-pandora.md index e50e0c2796..a0277634b5 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-pandora.md +++ b/3rdparty/sdl2-2.0.9/docs/README-pandora.md @@ -1,7 +1,7 @@ -Pandora +Pandora ===================================================================== - -( http://openpandora.org/ ) + +( http://openpandora.org/ ) - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES support to work on the pandora under the framebuffer. This driver do not have input support for now, so if you use it you will have to add your own control code. diff --git a/3rdparty/sdl2-2.0.4/docs/README-platforms.md b/3rdparty/sdl2-2.0.9/docs/README-platforms.md similarity index 95% rename from 3rdparty/sdl2-2.0.4/docs/README-platforms.md rename to 3rdparty/sdl2-2.0.9/docs/README-platforms.md index 14454ec5d5..711557dc04 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-platforms.md +++ b/3rdparty/sdl2-2.0.9/docs/README-platforms.md @@ -1,8 +1,8 @@ -Platforms -========= - -We maintain the list of supported platforms on our wiki now, and how to -build and install SDL for those platforms: - - https://wiki.libsdl.org/Installation - +Platforms +========= + +We maintain the list of supported platforms on our wiki now, and how to +build and install SDL for those platforms: + + https://wiki.libsdl.org/Installation + diff --git a/3rdparty/sdl2-2.0.4/docs/README-porting.md b/3rdparty/sdl2-2.0.9/docs/README-porting.md similarity index 88% rename from 3rdparty/sdl2-2.0.4/docs/README-porting.md rename to 3rdparty/sdl2-2.0.9/docs/README-porting.md index f13f83b8ce..86243f6e80 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-porting.md +++ b/3rdparty/sdl2-2.0.9/docs/README-porting.md @@ -1,11 +1,11 @@ -Porting -======= +Porting +======= * Porting To A New Platform The first thing you have to do when porting to a new platform, is look at include/SDL_platform.h and create an entry there for your operating system. -The standard format is __PLATFORM__, where PLATFORM is the name of the OS. +The standard format is "__PLATFORM__", where PLATFORM is the name of the OS. Ideally SDL_platform.h will be able to auto-detect the system it's building on based on C preprocessor symbols. @@ -15,7 +15,9 @@ There are two basic ways of building SDL at the moment: If you have a GNUish system, then you might try this. Edit configure.in, take a look at the large section labelled: + "Set up the configuration based on the host platform!" + Add a section for your platform, and then re-run autogen.sh and build! 2. Using an IDE: @@ -23,10 +25,11 @@ There are two basic ways of building SDL at the moment: If you're using an IDE or other non-configure build system, you'll probably want to create a custom SDL_config.h for your platform. Edit SDL_config.h, add a section for your platform, and create a custom SDL_config_{platform}.h, - based on SDL_config.h.minimal and SDL_config.h.in + based on SDL_config_minimal.h and SDL_config.h.in Add the top level include directory to the header search path, and then add the following sources to the project: + src/*.c src/atomic/*.c src/audio/*.c @@ -37,6 +40,7 @@ There are two basic ways of building SDL at the moment: src/joystick/*.c src/power/*.c src/render/*.c + src/render/software/*.c src/stdlib/*.c src/thread/*.c src/timer/*.c diff --git a/3rdparty/sdl2-2.0.4/docs/README-psp.md b/3rdparty/sdl2-2.0.9/docs/README-psp.md similarity index 94% rename from 3rdparty/sdl2-2.0.4/docs/README-psp.md rename to 3rdparty/sdl2-2.0.9/docs/README-psp.md index 41fc9040aa..e8911363de 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-psp.md +++ b/3rdparty/sdl2-2.0.9/docs/README-psp.md @@ -1,5 +1,5 @@ -PSP -====== +PSP +====== SDL port for the Sony PSP contributed by Captian Lex diff --git a/3rdparty/sdl2-2.0.4/docs/README-raspberrypi.md b/3rdparty/sdl2-2.0.9/docs/README-raspberrypi.md similarity index 89% rename from 3rdparty/sdl2-2.0.4/docs/README-raspberrypi.md rename to 3rdparty/sdl2-2.0.9/docs/README-raspberrypi.md index ade3c81c63..5e23ad5e0c 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-raspberrypi.md +++ b/3rdparty/sdl2-2.0.9/docs/README-raspberrypi.md @@ -23,10 +23,20 @@ Raspbian (other Linux distros may work as well). sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev You also need the VideoCore binary stuff that ships in /opt/vc for EGL and -OpenGL ES 2.x, it usually comes pre installed, but in any case: +OpenGL ES 2.x, it usually comes pre-installed, but in any case: sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev + +================================================================================ + NEON +================================================================================ + +If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so +that SDL will select some otherwise-disabled highly-optimized code. The +original Pi units don't have NEON, the Pi2 probably does, and the Pi3 +definitely does. + ================================================================================ Cross compiling from x86 Linux ================================================================================ @@ -37,9 +47,9 @@ will be placed in /opt/rpi-tools sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools -You'll also need a Rasbian binary image. +You'll also need a Raspbian binary image. Get it from: http://downloads.raspberrypi.org/raspbian_latest -After unzipping, you'll get file with a name like: -wheezy-raspbian.img +After unzipping, you'll get file with a name like: "-wheezy-raspbian.img" Let's assume the sysroot will be built in /opt/rpi-sysroot. export SYSROOT=/opt/rpi-sysroot @@ -136,9 +146,9 @@ your app has read access to one of the following: This is usually not a problem if you run from the physical terminal (as opposed to running from a pseudo terminal, such as via SSH). If running from a PTS, a quick workaround is to run your app as root or add yourself to the tty group, -then re login to the system. +then re-login to the system. - sudo usermod -aG tty `whoami` + sudo usermod -aG tty `whoami` The keyboard layout used by SDL is the same as the one the kernel uses. To configure the layout on Raspbian: diff --git a/3rdparty/sdl2-2.0.4/docs/README-touch.md b/3rdparty/sdl2-2.0.9/docs/README-touch.md similarity index 86% rename from 3rdparty/sdl2-2.0.4/docs/README-touch.md rename to 3rdparty/sdl2-2.0.9/docs/README-touch.md index e76e2d3960..09188b81d0 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-touch.md +++ b/3rdparty/sdl2-2.0.9/docs/README-touch.md @@ -1,4 +1,4 @@ -Touch +Touch =========================================================================== System Specific Notes =========================================================================== @@ -42,14 +42,14 @@ Same as SDL_FINGERDOWN. =========================================================================== Functions =========================================================================== -SDL provides the ability to access the underlying Finger structures. +SDL provides the ability to access the underlying SDL_Finger structures. These structures should _never_ be modified. The following functions are included from SDL_touch.h -To get a SDL_TouchID call SDL_GetTouchDevice(index). +To get a SDL_TouchID call SDL_GetTouchDevice(int index). This returns a SDL_TouchID. -IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this! +IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this! The number of touch devices can be queried with SDL_GetNumTouchDevices(). @@ -64,13 +64,13 @@ The most common reason to access SDL_Finger is to query the fingers outside the -To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger. -This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed. +To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger. +This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed. A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled. As a result, be very careful to check for NULL return values. A SDL_Finger has the following fields: -* x,y,pressure: +* x, y: The current coordinates of the touch. * pressure: The pressure of the touch. diff --git a/3rdparty/sdl2-2.0.4/docs/README-wince.md b/3rdparty/sdl2-2.0.9/docs/README-wince.md similarity index 95% rename from 3rdparty/sdl2-2.0.4/docs/README-wince.md rename to 3rdparty/sdl2-2.0.9/docs/README-wince.md index c543ed65dd..d5fb64fcb3 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-wince.md +++ b/3rdparty/sdl2-2.0.9/docs/README-wince.md @@ -1,5 +1,5 @@ -WinCE -===== +WinCE +===== Windows CE is no longer supported by SDL. diff --git a/3rdparty/sdl2-2.0.4/docs/README-windows.md b/3rdparty/sdl2-2.0.9/docs/README-windows.md similarity index 86% rename from 3rdparty/sdl2-2.0.4/docs/README-windows.md rename to 3rdparty/sdl2-2.0.9/docs/README-windows.md index 076b1556e8..71f968eebd 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-windows.md +++ b/3rdparty/sdl2-2.0.9/docs/README-windows.md @@ -38,4 +38,8 @@ Known Bugs: * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears that there's a bug in the library which prevents the window contents from refreshing if this is set to anything other than the default value. - + +Vulkan Surface Support +============== + +Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application. diff --git a/3rdparty/sdl2-2.0.4/docs/README-winrt.md b/3rdparty/sdl2-2.0.9/docs/README-winrt.md similarity index 73% rename from 3rdparty/sdl2-2.0.4/docs/README-winrt.md rename to 3rdparty/sdl2-2.0.9/docs/README-winrt.md index 741def67f3..d04f710fcd 100644 --- a/3rdparty/sdl2-2.0.4/docs/README-winrt.md +++ b/3rdparty/sdl2-2.0.9/docs/README-winrt.md @@ -1,468 +1,544 @@ -WinRT -===== - -This port allows SDL applications to run on Microsoft's platforms that require -use of "Windows Runtime", aka. "WinRT", APIs. WinRT apps are currently -full-screen only, and run in what Microsoft sometimes refers to as their -"Modern" (formerly, "Metro"), environment. For Windows 8.x, Microsoft may also -refer to them as "Windows Store" apps, due to them being distributed, -primarily, via a Microsoft-run online store (of the same name). - -Some of the operating systems that include WinRT, are: - -* Windows 10, via its Universal Windows Platform (UWP) APIs -* Windows 8.x -* Windows RT 8.x (aka. Windows 8.x for ARM processors) -* Windows Phone 8.x - - -Requirements ------------- - -* Microsoft Visual C++ (aka Visual Studio), either 2015, 2013, or 2012 - - Free, "Community" or "Express" editions may be used, so long as they - include support for either "Windows Store" or "Windows Phone" apps. - "Express" versions marked as supporting "Windows Desktop" development - typically do not include support for creating WinRT apps, to note. - (The "Community" editions of Visual C++ do, however, support both - desktop/Win32 and WinRT development). - - Visual C++ 2012 can only build apps that target versions 8.0 of Windows, - or Windows Phone. 8.0-targetted apps will run on devices running 8.1 - editions of Windows, however they will not be able to take advantage of - 8.1-specific features. - - Visual C++ 2013 cannot create app projects that target Windows 8.0. - Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0, - Windows Phone 8.1, and Windows 8.1, but not Windows 8.0. An optional - Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8", - allows Visual C++ 2013 to load and build Windows 8.0 projects that were - created with Visual C++ 2012, so long as Visual C++ 2012 is installed - on the same machine. More details on targeting different versions of - Windows can found at the following web pages: - - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx) - - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools) -* A valid Microsoft account - This requirement is not imposed by SDL, but - rather by Microsoft's Visual C++ toolchain. This is required to launch or - debug apps. - - -Status ------- - -Here is a rough list of what works, and what doens't: - -* What works: - * compilation via Visual C++ 2012 through 2015 - * compile-time platform detection for SDL programs. The C/C++ #define, - `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT. - * GPU-accelerated 2D rendering, via SDL_Renderer. - * OpenGL ES 2, via the ANGLE library (included separately from SDL) - * software rendering, via either SDL_Surface (optionally in conjunction with - SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the - SDL_Renderer APIs - * threads - * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(), - SDL_GetPerformanceFrequency(), etc.) - * file I/O via SDL_RWops - * mouse input (unsupported on Windows Phone) - * audio, via a modified version of SDL's XAudio2 backend - * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading - anything outside of the app is not supported. - * system path retrieval via SDL's filesystem APIs - * game controllers. Support is provided via the SDL_Joystick and - SDL_GameController APIs, and is backed by Microsoft's XInput API. - * multi-touch input - * app events. SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as - appropriate. - * window events - * using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can - choose to render content directly via Direct3D, using SDL to manage the - internal WinRT window, as well as input and audio. (Use - SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into - IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.) - -* What partially works: - * keyboard input. Most of WinRT's documented virtual keys are supported, as - well as many keys with documented hardware scancodes. - * SDLmain. WinRT uses a different signature for each app's main() function. - SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp - (in `SDL\src\main\winrt\`) directly in order for their C-style main() - functions to be called. - -* What doesn't work: - * compilation with anything other than Visual C++ - * programmatically-created custom cursors. These don't appear to be supported - by WinRT. Different OS-provided cursors can, however, be created via - SDL_CreateSystemCursor() (unsupported on Windows Phone) - * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal(). This are not currently - supported by WinRT itself. - * joysticks and game controllers that aren't supported by Microsoft's XInput - API. - * turning off VSync when rendering on Windows Phone. Attempts to turn VSync - off on Windows Phone result either in Direct3D not drawing anything, or it - forcing VSync back on. As such, SDL_RENDERER_PRESENTVSYNC will always get - turned-on on Windows Phone. This limitation is not present in non-Phone - WinRT (such as Windows 8.x), where turning off VSync appears to work. - * probably anything else that's not listed as supported - - - -Upgrade Notes -------------- - -#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3 - -SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath(). -The fixes may affect older, SDL 2.0.3-based apps' save data. Please note -that these changes only apply to SDL-based WinRT apps, and not to apps for -any other platform. - -1. SDL_GetPrefPath() would return an invalid path, one in which the path's - directory had not been created. Attempts to create files there - (via fopen(), for example), would fail, unless that directory was - explicitly created beforehand. - -2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside - a WinRT 'Roaming' folder, the contents of which get automatically - synchronized across multiple devices. This process can occur while an - application runs, and can cause existing save-data to be overwritten - at unexpected times, with data from other devices. (Windows Phone apps - written with SDL 2.0.3 did not utilize a Roaming folder, due to API - restrictions in Windows Phone 8.0). - - -SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by: - -1. making sure that SDL_GetPrefPath() returns a directory in which data - can be written to immediately, without first needing to create directories. - -2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the - contents of which do not automatically get synchronized across devices - (and which require less work to use safely, in terms of data integrity). - -Apps that wish to get their Roaming folder's path can do so either by using -SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a -UCS-2/wide-char string), or directly through the WinRT class, -Windows.Storage.ApplicationData. - - - -Setup, High-Level Steps ------------------------ - -The steps for setting up a project for an SDL/WinRT app looks like the -following, at a high-level: - -1. create a new Visual C++ project using Microsoft's template for a, - "Direct3D App". -2. remove most of the files from the project. -3. make your app's project directly reference SDL/WinRT's own Visual C++ - project file, via use of Visual C++'s "References" dialog. This will setup - the linker, and will copy SDL's .dll files to your app's final output. -4. adjust your app's build settings, at minimum, telling it where to find SDL's - header files. -5. add a file that contains a WinRT-appropriate main function. -6. add SDL-specific app code. -7. build and run your app. - - -Setup, Detailed Steps ---------------------- - -### 1. Create a new project ### - -Create a new project using one of Visual C++'s templates for a plain, non-XAML, -"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use). If you -don't see one of these templates, in Visual C++'s 'New Project' dialog, try -using the textbox titled, 'Search Installed Templates' to look for one. - - -### 2. Remove unneeded files from the project ### - -In the new project, delete any file that has one of the following extensions: - -- .cpp -- .h -- .hlsl - -When you are done, you should be left with a few files, each of which will be a -necessary part of your app's project. These files will consist of: - -- an .appxmanifest file, which contains metadata on your WinRT app. This is - similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android. -- a few .png files, one of which is a splash screen (displayed when your app - launches), others are app icons. -- a .pfx file, used for code signing purposes. - - -### 3. Add references to SDL's project files ### - -SDL/WinRT can be built in multiple variations, spanning across three different -CPU architectures (x86, x64, and ARM) and two different configurations -(Debug and Release). WinRT and Visual C++ do not currently provide a means -for combining multiple variations of one library into a single file. -Furthermore, it does not provide an easy means for copying pre-built .dll files -into your app's final output (via Post-Build steps, for example). It does, -however, provide a system whereby an app can reference the MSVC projects of -libraries such that, when the app is built: - -1. each library gets built for the appropriate CPU architecture(s) and WinRT - platform(s). -2. each library's output, such as .dll files, get copied to the app's build - output. - -To set this up for SDL/WinRT, you'll need to run through the following steps: - -1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then - "Solution Explorer") -2. right click on your app's solution. -3. navigate to "Add", then to "Existing Project..." -4. find SDL/WinRT's Visual C++ project file and open it. Different project - files exist for different WinRT platforms. All of them are in SDL's - source distribution, in the following directories: - * `VisualC-WinRT/UWP_VS2015/` - for Windows 10 / UWP apps - * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps - * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps - * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps -5. once the project has been added, right-click on your app's project and - select, "References..." -6. click on the button titled, "Add New Reference..." -7. check the box next to SDL -8. click OK to close the dialog -9. SDL will now show up in the list of references. Click OK to close that - dialog. - -Your project is now linked to SDL's project, insofar that when the app is -built, SDL will be built as well, with its build output getting included with -your app. - - -### 4. Adjust Your App's Build Settings ### - -Some build settings need to be changed in your app's project. This guide will -outline the following: - -- making sure that the compiler knows where to find SDL's header files -- **Optional for C++, but NECESSARY for compiling C code:** telling the - compiler not to use Microsoft's C++ extensions for WinRT development. -- **Optional:** telling the compiler not generate errors due to missing - precompiled header files. - -To change these settings: - -1. right-click on the project -2. choose "Properties" -3. in the drop-down box next to "Configuration", choose, "All Configurations" -4. in the drop-down box next to "Platform", choose, "All Platforms" -5. in the left-hand list, expand the "C/C++" section -6. select "General" -7. edit the "Additional Include Directories" setting, and add a path to SDL's - "include" directory -8. **Optional: to enable compilation of C code:** change the setting for - "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No". If you're - working with a completely C++ based project, this step can usually be - omitted. -9. **Optional: to disable precompiled headers (which can produce - 'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand - list, select "Precompiled Headers", then change the setting for "Precompiled - Header" from "Use (/Yu)" to "Not Using Precompiled Headers". -10. close the dialog, saving settings, by clicking the "OK" button - - -### 5. Add a WinRT-appropriate main function to the app. ### - -C/C++-based WinRT apps do contain a `main` function that the OS will invoke when -the app starts launching. The parameters of WinRT main functions are different -than those found on other platforms, Win32 included. SDL/WinRT provides a -platform-appropriate main function that will perform these actions, setup key -portions of the app, then invoke a classic, C/C++-style main function (that take -in "argc" and "argv" parameters). The code for this file is contained inside -SDL's source distribution, under `src/main/winrt/SDL_winrt_main_NonXAML.cpp`. -You'll need to add this file, or a copy of it, to your app's project, and make -sure it gets compiled using a Microsoft-specific set of C++ extensions called -C++/CX. - -**NOTE: C++/CX compilation is currently required in at least one file of your -app's project. This is to make sure that Visual C++'s linker builds a 'Windows -Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** - -To include `SDL_winrt_main_NonXAML.cpp`: - -1. right-click on your project (again, in Visual C++'s Solution Explorer), - navigate to "Add", then choose "Existing Item...". -2. open `SDL_winrt_main_NonXAML.cpp`, which is found inside SDL's source - distribution, under `src/main/winrt/`. Make sure that the open-file dialog - closes, either by double-clicking on the file, or single-clicking on it and - then clicking Add. -3. right-click on the file (as listed in your project), then click on - "Properties...". -4. in the drop-down box next to "Configuration", choose, "All Configurations" -5. in the drop-down box next to "Platform", choose, "All Platforms" -6. in the left-hand list, click on "C/C++" -7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)". -8. click the OK button. This will close the dialog. - - -### 6. Add app code and assets ### - -At this point, you can add in SDL-specific source code. Be sure to include a -C-style main function (ie: `int main(int argc, char *argv[])`). From there you -should be able to create a single `SDL_Window` (WinRT apps can only have one -window, at present), as well as an `SDL_Renderer`. Direct3D will be used to -draw content. Events are received via SDL's usual event functions -(`SDL_PollEvent`, etc.) If you have a set of existing source files and assets, -you can start adding them to the project now. If not, or if you would like to -make sure that you're setup correctly, some short and simple sample code is -provided below. - - -#### 6.A. ... when creating a new app #### - -If you are creating a new app (rather than porting an existing SDL-based app), -or if you would just like a simple app to test SDL/WinRT with before trying to -get existing code working, some working SDL/WinRT code is provided below. To -set this up: - -1. right click on your app's project -2. select Add, then New Item. An "Add New Item" dialog will show up. -3. from the left-hand list, choose "Visual C++" -4. from the middle/main list, choose "C++ File (.cpp)" -5. near the bottom of the dialog, next to "Name:", type in a name for your -source file, such as, "main.cpp". -6. click on the Add button. This will close the dialog, add the new file to -your project, and open the file in Visual C++'s text editor. -7. Copy and paste the following code into the new file, then save it. - - - #include - - int main(int argc, char **argv) - { - SDL_DisplayMode mode; - SDL_Window * window = NULL; - SDL_Renderer * renderer = NULL; - SDL_Event evt; - - if (SDL_Init(SDL_INIT_VIDEO) != 0) { - return 1; - } - - if (SDL_GetCurrentDisplayMode(0, &mode) != 0) { - return 1; - } - - if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) { - return 1; - } - - while (1) { - while (SDL_PollEvent(&evt)) { - } - - SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); - SDL_RenderClear(renderer); - SDL_RenderPresent(renderer); - } - } - - -#### 6.B. Adding code and assets #### - -If you have existing code and assets that you'd like to add, you should be able -to add them now. The process for adding a set of files is as such. - -1. right click on the app's project -2. select Add, then click on "New Item..." -3. open any source, header, or asset files as appropriate. Support for C and -C++ is available. - -Do note that WinRT only supports a subset of the APIs that are available to -Win32-based apps. Many portions of the Win32 API and the C runtime are not -available. - -A list of unsupported C APIs can be found at - - -General information on using the C runtime in WinRT can be found at - - -A list of supported Win32 APIs for WinRT apps can be found at -. To note, -the list of supported Win32 APIs for Windows Phone 8.0 is different. -That list can be found at - - - -### 7. Build and run your app ### - -Your app project should now be setup, and you should be ready to build your app. -To run it on the local machine, open the Debug menu and choose "Start -Debugging". This will build your app, then run your app full-screen. To switch -out of your app, press the Windows key. Alternatively, you can choose to run -your app in a window. To do this, before building and running your app, find -the drop-down menu in Visual C++'s toolbar that says, "Local Machine". Expand -this by clicking on the arrow on the right side of the list, then click on -Simulator. Once you do that, any time you build and run the app, the app will -launch in window, rather than full-screen. - - -#### 7.A. Running apps on older, ARM-based, "Windows RT" devices #### - -**These instructions do not include Windows Phone, despite Windows Phone -typically running on ARM processors.** They are specifically for devices -that use the "Windows RT" operating system, which was a modified version of -Windows 8.x that ran primarily on ARM-based tablet computers. - -To build and run the app on ARM-based, "Windows RT" devices, you'll need to: - -- install Microsoft's "Remote Debugger" on the device. Visual C++ installs and - debugs ARM-based apps via IP networks. -- change a few options on the development machine, both to make sure it builds - for ARM (rather than x86 or x64), and to make sure it knows how to find the - Windows RT device (on the network). - -Microsoft's Remote Debugger can be found at -. Please note -that separate versions of this debugger exist for different versions of Visual -C++, one each for MSVC 2015, 2013, and 2012. - -To setup Visual C++ to launch your app on an ARM device: - -1. make sure the Remote Debugger is running on your ARM device, and that it's on - the same IP network as your development machine. -2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32". Click - it, then change the value to "ARM". -3. make sure Visual C++ knows the hostname or IP address of the ARM device. To - do this: - 1. open the app project's properties - 2. select "Debugging" - 3. next to "Machine Name", enter the hostname or IP address of the ARM - device - 4. if, and only if, you've turned off authentication in the Remote Debugger, - then change the setting for "Require Authentication" to No - 5. click "OK" -4. build and run the app (from Visual C++). The first time you do this, a - prompt will show up on the ARM device, asking for a Microsoft Account. You - do, unfortunately, need to log in here, and will need to follow the - subsequent registration steps in order to launch the app. After you do so, - if the app didn't already launch, try relaunching it again from within Visual - C++. - - -Troubleshooting ---------------- - -#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'" - -Try adding the following to your linker flags. In MSVC, this can be done by -right-clicking on the app project, navigating to Configuration Properties -> -Linker -> Command Line, then adding them to the Additional Options -section. - -* For Release builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib - -* For Debug builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib - +WinRT +===== + +This port allows SDL applications to run on Microsoft's platforms that require +use of "Windows Runtime", aka. "WinRT", APIs. Microsoft may, in some cases, +refer to them as either "Windows Store", or for Windows 10, "UWP" apps. + +Some of the operating systems that include WinRT, are: + +* Windows 10, via its Universal Windows Platform (UWP) APIs +* Windows 8.x +* Windows RT 8.x (aka. Windows 8.x for ARM processors) +* Windows Phone 8.x + + +Requirements +------------ + +* Microsoft Visual C++ (aka Visual Studio), either 2017, 2015, 2013, or 2012 + - Free, "Community" or "Express" editions may be used, so long as they + include support for either "Windows Store" or "Windows Phone" apps. + "Express" versions marked as supporting "Windows Desktop" development + typically do not include support for creating WinRT apps, to note. + (The "Community" editions of Visual C++ do, however, support both + desktop/Win32 and WinRT development). + - Visual Studio 2017 can be used, however it is recommended that you install + the Visual C++ 2015 build tools. These build tools can be installed + using VS 2017's installer. Be sure to also install the workload for + "Universal Windows Platform development", its optional component, the + "C++ Universal Windows Platform tools", and for UWP / Windows 10 + development, the "Windows 10 SDK (10.0.10240.0)". Please note that + targeting UWP / Windows 10 apps from development machine(s) running + earlier versions of Windows, such as Windows 7, is not always supported + by Visual Studio, and you may get error(s) when attempting to do so. + - Visual C++ 2012 can only build apps that target versions 8.0 of Windows, + or Windows Phone. 8.0-targeted apps will run on devices running 8.1 + editions of Windows, however they will not be able to take advantage of + 8.1-specific features. + - Visual C++ 2013 cannot create app projects that target Windows 8.0. + Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0, + Windows Phone 8.1, and Windows 8.1, but not Windows 8.0. An optional + Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8", + allows Visual C++ 2013 to load and build Windows 8.0 projects that were + created with Visual C++ 2012, so long as Visual C++ 2012 is installed + on the same machine. More details on targeting different versions of + Windows can found at the following web pages: + - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx) + - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools) +* A valid Microsoft account - This requirement is not imposed by SDL, but + rather by Microsoft's Visual C++ toolchain. This is required to launch or + debug apps. + + +Status +------ + +Here is a rough list of what works, and what doesn't: + +* What works: + * compilation via Visual C++ 2012 through 2015 + * compile-time platform detection for SDL programs. The C/C++ #define, + `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT. + * GPU-accelerated 2D rendering, via SDL_Renderer. + * OpenGL ES 2, via the ANGLE library (included separately from SDL) + * software rendering, via either SDL_Surface (optionally in conjunction with + SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the + SDL_Renderer APIs + * threads + * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(), + SDL_GetPerformanceFrequency(), etc.) + * file I/O via SDL_RWops + * mouse input (unsupported on Windows Phone) + * audio, via SDL's WASAPI backend (if you want to record, your app must + have "Microphone" capabilities enabled in its manifest, and the user must + not have blocked access. Otherwise, capture devices will fail to work, + presenting as a device disconnect shortly after opening it.) + * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading + anything outside of the app is not supported. + * system path retrieval via SDL's filesystem APIs + * game controllers. Support is provided via the SDL_Joystick and + SDL_GameController APIs, and is backed by Microsoft's XInput API. Please + note, however, that Windows limits game-controller support in UWP apps to, + "Xbox compatible controllers" (many controllers that work in Win32 apps, + do not work in UWP, due to restrictions in UWP itself.) + * multi-touch input + * app events. SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as + appropriate. + * window events + * using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can + choose to render content directly via Direct3D, using SDL to manage the + internal WinRT window, as well as input and audio. (Use + SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into + IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.) + +* What partially works: + * keyboard input. Most of WinRT's documented virtual keys are supported, as + well as many keys with documented hardware scancodes. Converting + SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs + (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs. + * SDLmain. WinRT uses a different signature for each app's main() function. + SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp + (in `SDL\src\main\winrt\`) directly in order for their C-style main() + functions to be called. + +* What doesn't work: + * compilation with anything other than Visual C++ + * programmatically-created custom cursors. These don't appear to be supported + by WinRT. Different OS-provided cursors can, however, be created via + SDL_CreateSystemCursor() (unsupported on Windows Phone) + * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal(). This are not currently + supported by WinRT itself. + * joysticks and game controllers that either are not supported by + Microsoft's XInput API, or are not supported within UWP apps (many + controllers that work in Win32, do not work in UWP, due to restrictions in + UWP itself). + * turning off VSync when rendering on Windows Phone. Attempts to turn VSync + off on Windows Phone result either in Direct3D not drawing anything, or it + forcing VSync back on. As such, SDL_RENDERER_PRESENTVSYNC will always get + turned-on on Windows Phone. This limitation is not present in non-Phone + WinRT (such as Windows 8.x), where turning off VSync appears to work. + * probably anything else that's not listed as supported + + + +Upgrade Notes +------------- + +#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3 + +SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath(). +The fixes may affect older, SDL 2.0.3-based apps' save data. Please note +that these changes only apply to SDL-based WinRT apps, and not to apps for +any other platform. + +1. SDL_GetPrefPath() would return an invalid path, one in which the path's + directory had not been created. Attempts to create files there + (via fopen(), for example), would fail, unless that directory was + explicitly created beforehand. + +2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside + a WinRT 'Roaming' folder, the contents of which get automatically + synchronized across multiple devices. This process can occur while an + application runs, and can cause existing save-data to be overwritten + at unexpected times, with data from other devices. (Windows Phone apps + written with SDL 2.0.3 did not utilize a Roaming folder, due to API + restrictions in Windows Phone 8.0). + + +SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by: + +1. making sure that SDL_GetPrefPath() returns a directory in which data + can be written to immediately, without first needing to create directories. + +2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the + contents of which do not automatically get synchronized across devices + (and which require less work to use safely, in terms of data integrity). + +Apps that wish to get their Roaming folder's path can do so either by using +SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a +UCS-2/wide-char string), or directly through the WinRT class, +Windows.Storage.ApplicationData. + + + +Setup, High-Level Steps +----------------------- + +The steps for setting up a project for an SDL/WinRT app looks like the +following, at a high-level: + +1. create a new Visual C++ project using Microsoft's template for a, + "Direct3D App". +2. remove most of the files from the project. +3. make your app's project directly reference SDL/WinRT's own Visual C++ + project file, via use of Visual C++'s "References" dialog. This will setup + the linker, and will copy SDL's .dll files to your app's final output. +4. adjust your app's build settings, at minimum, telling it where to find SDL's + header files. +5. add files that contains a WinRT-appropriate main function, along with some + data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls) + work properly. +6. add SDL-specific app code. +7. build and run your app. + + +Setup, Detailed Steps +--------------------- + +### 1. Create a new project ### + +Create a new project using one of Visual C++'s templates for a plain, non-XAML, +"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use). If you +don't see one of these templates, in Visual C++'s 'New Project' dialog, try +using the textbox titled, 'Search Installed Templates' to look for one. + + +### 2. Remove unneeded files from the project ### + +In the new project, delete any file that has one of the following extensions: + +- .cpp +- .h +- .hlsl + +When you are done, you should be left with a few files, each of which will be a +necessary part of your app's project. These files will consist of: + +- an .appxmanifest file, which contains metadata on your WinRT app. This is + similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android. +- a few .png files, one of which is a splash screen (displayed when your app + launches), others are app icons. +- a .pfx file, used for code signing purposes. + + +### 3. Add references to SDL's project files ### + +SDL/WinRT can be built in multiple variations, spanning across three different +CPU architectures (x86, x64, and ARM) and two different configurations +(Debug and Release). WinRT and Visual C++ do not currently provide a means +for combining multiple variations of one library into a single file. +Furthermore, it does not provide an easy means for copying pre-built .dll files +into your app's final output (via Post-Build steps, for example). It does, +however, provide a system whereby an app can reference the MSVC projects of +libraries such that, when the app is built: + +1. each library gets built for the appropriate CPU architecture(s) and WinRT + platform(s). +2. each library's output, such as .dll files, get copied to the app's build + output. + +To set this up for SDL/WinRT, you'll need to run through the following steps: + +1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then + "Solution Explorer") +2. right click on your app's solution. +3. navigate to "Add", then to "Existing Project..." +4. find SDL/WinRT's Visual C++ project file and open it. Different project + files exist for different WinRT platforms. All of them are in SDL's + source distribution, in the following directories: + * `VisualC-WinRT/UWP_VS2015/` - for Windows 10 / UWP apps + * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps + * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps + * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps +5. once the project has been added, right-click on your app's project and + select, "References..." +6. click on the button titled, "Add New Reference..." +7. check the box next to SDL +8. click OK to close the dialog +9. SDL will now show up in the list of references. Click OK to close that + dialog. + +Your project is now linked to SDL's project, insofar that when the app is +built, SDL will be built as well, with its build output getting included with +your app. + + +### 4. Adjust Your App's Build Settings ### + +Some build settings need to be changed in your app's project. This guide will +outline the following: + +- making sure that the compiler knows where to find SDL's header files +- **Optional for C++, but NECESSARY for compiling C code:** telling the + compiler not to use Microsoft's C++ extensions for WinRT development. +- **Optional:** telling the compiler not generate errors due to missing + precompiled header files. + +To change these settings: + +1. right-click on the project +2. choose "Properties" +3. in the drop-down box next to "Configuration", choose, "All Configurations" +4. in the drop-down box next to "Platform", choose, "All Platforms" +5. in the left-hand list, expand the "C/C++" section +6. select "General" +7. edit the "Additional Include Directories" setting, and add a path to SDL's + "include" directory +8. **Optional: to enable compilation of C code:** change the setting for + "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No". If you're + working with a completely C++ based project, this step can usually be + omitted. +9. **Optional: to disable precompiled headers (which can produce + 'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand + list, select "Precompiled Headers", then change the setting for "Precompiled + Header" from "Use (/Yu)" to "Not Using Precompiled Headers". +10. close the dialog, saving settings, by clicking the "OK" button + + +### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ### + +A few files should be included directly in your app's MSVC project, specifically: +1. a WinRT-appropriate main function (which is different than main() functions on + other platforms) +2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor + (if and when the app needs to do so). *If this cursor resource is not + included, mouse-position reporting may fail if and when the cursor is + hidden, due to possible bugs/design-oddities in Windows itself.* + +To include these files: + +1. right-click on your project (again, in Visual C++'s Solution Explorer), + navigate to "Add", then choose "Existing Item...". +2. navigate to the directory containing SDL's source code, then into its + subdirectory, 'src/main/winrt/'. Select, then add, the following files: + - `SDL_winrt_main_NonXAML.cpp` + - `SDL2-WinRTResources.rc` + - `SDL2-WinRTResource_BlankCursor.cur` +3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your + project), then click on "Properties...". +4. in the drop-down box next to "Configuration", choose, "All Configurations" +5. in the drop-down box next to "Platform", choose, "All Platforms" +6. in the left-hand list, click on "C/C++" +7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)". +8. click the OK button. This will close the dialog. + + +**NOTE: C++/CX compilation is currently required in at least one file of your +app's project. This is to make sure that Visual C++'s linker builds a 'Windows +Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** + + +### 6. Add app code and assets ### + +At this point, you can add in SDL-specific source code. Be sure to include a +C-style main function (ie: `int main(int argc, char *argv[])`). From there you +should be able to create a single `SDL_Window` (WinRT apps can only have one +window, at present), as well as an `SDL_Renderer`. Direct3D will be used to +draw content. Events are received via SDL's usual event functions +(`SDL_PollEvent`, etc.) If you have a set of existing source files and assets, +you can start adding them to the project now. If not, or if you would like to +make sure that you're setup correctly, some short and simple sample code is +provided below. + + +#### 6.A. ... when creating a new app #### + +If you are creating a new app (rather than porting an existing SDL-based app), +or if you would just like a simple app to test SDL/WinRT with before trying to +get existing code working, some working SDL/WinRT code is provided below. To +set this up: + +1. right click on your app's project +2. select Add, then New Item. An "Add New Item" dialog will show up. +3. from the left-hand list, choose "Visual C++" +4. from the middle/main list, choose "C++ File (.cpp)" +5. near the bottom of the dialog, next to "Name:", type in a name for your +source file, such as, "main.cpp". +6. click on the Add button. This will close the dialog, add the new file to +your project, and open the file in Visual C++'s text editor. +7. Copy and paste the following code into the new file, then save it. + + + #include + + int main(int argc, char **argv) + { + SDL_DisplayMode mode; + SDL_Window * window = NULL; + SDL_Renderer * renderer = NULL; + SDL_Event evt; + + if (SDL_Init(SDL_INIT_VIDEO) != 0) { + return 1; + } + + if (SDL_GetCurrentDisplayMode(0, &mode) != 0) { + return 1; + } + + if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) { + return 1; + } + + while (1) { + while (SDL_PollEvent(&evt)) { + } + + SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + } + } + + +#### 6.B. Adding code and assets #### + +If you have existing code and assets that you'd like to add, you should be able +to add them now. The process for adding a set of files is as such. + +1. right click on the app's project +2. select Add, then click on "New Item..." +3. open any source, header, or asset files as appropriate. Support for C and +C++ is available. + +Do note that WinRT only supports a subset of the APIs that are available to +Win32-based apps. Many portions of the Win32 API and the C runtime are not +available. + +A list of unsupported C APIs can be found at + + +General information on using the C runtime in WinRT can be found at + + +A list of supported Win32 APIs for WinRT apps can be found at +. To note, +the list of supported Win32 APIs for Windows Phone 8.0 is different. +That list can be found at + + + +### 7. Build and run your app ### + +Your app project should now be setup, and you should be ready to build your app. +To run it on the local machine, open the Debug menu and choose "Start +Debugging". This will build your app, then run your app full-screen. To switch +out of your app, press the Windows key. Alternatively, you can choose to run +your app in a window. To do this, before building and running your app, find +the drop-down menu in Visual C++'s toolbar that says, "Local Machine". Expand +this by clicking on the arrow on the right side of the list, then click on +Simulator. Once you do that, any time you build and run the app, the app will +launch in window, rather than full-screen. + + +#### 7.A. Running apps on older, ARM-based, "Windows RT" devices #### + +**These instructions do not include Windows Phone, despite Windows Phone +typically running on ARM processors.** They are specifically for devices +that use the "Windows RT" operating system, which was a modified version of +Windows 8.x that ran primarily on ARM-based tablet computers. + +To build and run the app on ARM-based, "Windows RT" devices, you'll need to: + +- install Microsoft's "Remote Debugger" on the device. Visual C++ installs and + debugs ARM-based apps via IP networks. +- change a few options on the development machine, both to make sure it builds + for ARM (rather than x86 or x64), and to make sure it knows how to find the + Windows RT device (on the network). + +Microsoft's Remote Debugger can be found at +. Please note +that separate versions of this debugger exist for different versions of Visual +C++, one each for MSVC 2015, 2013, and 2012. + +To setup Visual C++ to launch your app on an ARM device: + +1. make sure the Remote Debugger is running on your ARM device, and that it's on + the same IP network as your development machine. +2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32". Click + it, then change the value to "ARM". +3. make sure Visual C++ knows the hostname or IP address of the ARM device. To + do this: + 1. open the app project's properties + 2. select "Debugging" + 3. next to "Machine Name", enter the hostname or IP address of the ARM + device + 4. if, and only if, you've turned off authentication in the Remote Debugger, + then change the setting for "Require Authentication" to No + 5. click "OK" +4. build and run the app (from Visual C++). The first time you do this, a + prompt will show up on the ARM device, asking for a Microsoft Account. You + do, unfortunately, need to log in here, and will need to follow the + subsequent registration steps in order to launch the app. After you do so, + if the app didn't already launch, try relaunching it again from within Visual + C++. + + +Troubleshooting +--------------- + +#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'" + +Try adding the following to your linker flags. In MSVC, this can be done by +right-clicking on the app project, navigating to Configuration Properties -> +Linker -> Command Line, then adding them to the Additional Options +section. + +* For Release builds / MSVC-Configurations, add: + + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib + +* For Debug builds / MSVC-Configurations, add: + + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib + + +#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values + +This may be caused by a bug in Windows itself, whereby hiding the mouse +cursor can cause mouse-position reporting to fail. + +SDL provides a workaround for this, but it requires that an app links to a +set of Win32-style cursor image-resource files. A copy of suitable resource +files can be found in `src/main/winrt/`. Adding them to an app's Visual C++ +project file should be sufficient to get the app to use them. + + +#### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified." + +This can be caused for any one of a few reasons, which Visual Studio can +report, but won't always do so in an up-front manner. + +To help determine why this error comes up: + +1. open a copy of Visual Studio without opening a project file. This can be + accomplished via Windows' Start Menu, among other means. +2. show Visual Studio's Output window. This can be done by going to VS' + menu bar, then to View, and then to Output. +3. try opening the SDL project file directly by going to VS' menu bar, then + to File, then to Open, then to Project/Solution. When a File-Open dialog + appears, open the SDL project (such as the one in SDL's source code, in its + directory, VisualC-WinRT/UWP_VS2015/). +4. after attempting to open SDL's Visual Studio project file, additional error + information will be output to the Output window. + +If Visual Studio reports (via its Output window) that the project: + +"could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections: +Microsoft.VisualStudio.ComponentGroup.UWP.VC" + +... then you will need to re-launch Visual Studio's installer, and make sure that +the workflow for "Universal Windows Platform development" is checked, and that its +optional component, "C++ Universal Windows Platform tools" is also checked. While +you are there, if you are planning on targeting UWP / Windows 10, also make sure +that you check the optional component, "Windows 10 SDK (10.0.10240.0)". After +making sure these items are checked as-appropriate, install them. + +Once you install these components, try re-launching Visual Studio, and re-opening +the SDL project file. If you still get the error dialog, try using the Output +window, again, seeing what Visual Studio says about it. + + +#### Game controllers / joysticks aren't working! + +Windows only permits certain game controllers and joysticks to work within +WinRT / UWP apps. Even if a game controller or joystick works in a Win32 +app, that device is not guaranteed to work inside a WinRT / UWP app. + +According to Microsoft, "Xbox compatible controllers" should work inside +UWP apps, potentially with more working in the future. This includes, but +may not be limited to, Microsoft-made Xbox controllers and USB adapters. +(Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop) + + diff --git a/3rdparty/sdl2-2.0.4/docs/README.md b/3rdparty/sdl2-2.0.9/docs/README.md similarity index 95% rename from 3rdparty/sdl2-2.0.4/docs/README.md rename to 3rdparty/sdl2-2.0.9/docs/README.md index 4e3106920e..7e2c15108a 100644 --- a/3rdparty/sdl2-2.0.4/docs/README.md +++ b/3rdparty/sdl2-2.0.9/docs/README.md @@ -1,63 +1,63 @@ -Simple DirectMedia Layer {#mainpage} -======================== - - (SDL) - - Version 2.0 - ---- -http://www.libsdl.org/ - -Simple DirectMedia Layer is a cross-platform development library designed -to provide low level access to audio, keyboard, mouse, joystick, and graphics -hardware via OpenGL and Direct3D. It is used by video playback software, -emulators, and popular games including Valve's award winning catalog -and many Humble Bundle games. - -SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. -Support for other platforms may be found in the source code. - -SDL is written in C, works natively with C++, and there are bindings -available for several other languages, including C# and Python. - -This library is distributed under the zlib license, which can be found -in the file "COPYING.txt". - -The best way to learn how to use SDL is to check out the header files in -the "include" subdirectory and the programs in the "test" subdirectory. -The header files and test programs are well commented and always up to date. - -More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) - -- [Android](README-android.md) -- [CMake](README-cmake.md) -- [DirectFB](README-directfb.md) -- [DynAPI](README-dynapi.md) -- [Emscripten](README-emscripten.md) -- [Gesture](README-gesture.md) -- [Mercurial](README-hg.md) -- [iOS](README-ios.md) -- [Linux](README-linux.md) -- [OS X](README-macosx.md) -- [Native Client](README-nacl.md) -- [Pandora](README-pandora.md) -- [Supported Platforms](README-platforms.md) -- [Porting information](README-porting.md) -- [PSP](README-psp.md) -- [Raspberry Pi](README-raspberrypi.md) -- [Touch](README-touch.md) -- [WinCE](README-wince.md) -- [Windows](README-windows.md) -- [WinRT](README-winrt.md) - -If you need help with the library, or just want to discuss SDL related -issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php) - -If you want to report bugs or contribute patches, please submit them to -[bugzilla](http://bugzilla.libsdl.org/) - -Enjoy! - - -Sam Lantinga - +Simple DirectMedia Layer {#mainpage} +======================== + + (SDL) + + Version 2.0 + +--- +http://www.libsdl.org/ + +Simple DirectMedia Layer is a cross-platform development library designed +to provide low level access to audio, keyboard, mouse, joystick, and graphics +hardware via OpenGL and Direct3D. It is used by video playback software, +emulators, and popular games including Valve's award winning catalog +and many Humble Bundle games. + +SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. +Support for other platforms may be found in the source code. + +SDL is written in C, works natively with C++, and there are bindings +available for several other languages, including C# and Python. + +This library is distributed under the zlib license, which can be found +in the file "COPYING.txt". + +The best way to learn how to use SDL is to check out the header files in +the "include" subdirectory and the programs in the "test" subdirectory. +The header files and test programs are well commented and always up to date. + +More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) + +- [Android](README-android.md) +- [CMake](README-cmake.md) +- [DirectFB](README-directfb.md) +- [DynAPI](README-dynapi.md) +- [Emscripten](README-emscripten.md) +- [Gesture](README-gesture.md) +- [Mercurial](README-hg.md) +- [iOS](README-ios.md) +- [Linux](README-linux.md) +- [OS X](README-macosx.md) +- [Native Client](README-nacl.md) +- [Pandora](README-pandora.md) +- [Supported Platforms](README-platforms.md) +- [Porting information](README-porting.md) +- [PSP](README-psp.md) +- [Raspberry Pi](README-raspberrypi.md) +- [Touch](README-touch.md) +- [WinCE](README-wince.md) +- [Windows](README-windows.md) +- [WinRT](README-winrt.md) + +If you need help with the library, or just want to discuss SDL related +issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php) + +If you want to report bugs or contribute patches, please submit them to +[bugzilla](https://bugzilla.libsdl.org/) + +Enjoy! + + +Sam Lantinga + diff --git a/3rdparty/sdl2-2.0.4/docs/doxyfile b/3rdparty/sdl2-2.0.9/docs/doxyfile similarity index 100% rename from 3rdparty/sdl2-2.0.4/docs/doxyfile rename to 3rdparty/sdl2-2.0.9/docs/doxyfile diff --git a/3rdparty/sdl2-2.0.4/include/SDL.h b/3rdparty/sdl2-2.0.9/include/SDL.h similarity index 77% rename from 3rdparty/sdl2-2.0.4/include/SDL.h rename to 3rdparty/sdl2-2.0.9/include/SDL.h index 7647b5111e..fc35a419ef 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL.h +++ b/3rdparty/sdl2-2.0.9/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ */ -#ifndef _SDL_H -#define _SDL_H +#ifndef SDL_h_ +#define SDL_h_ #include "SDL_main.h" #include "SDL_stdinc.h" @@ -40,10 +40,10 @@ #include "SDL_error.h" #include "SDL_events.h" #include "SDL_filesystem.h" -#include "SDL_joystick.h" #include "SDL_gamecontroller.h" #include "SDL_haptic.h" #include "SDL_hints.h" +#include "SDL_joystick.h" #include "SDL_loadso.h" #include "SDL_log.h" #include "SDL_messagebox.h" @@ -51,6 +51,8 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_sensor.h" +#include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" #include "SDL_timer.h" @@ -72,17 +74,18 @@ extern "C" { * specify the subsystems which you will be using in your application. */ /* @{ */ -#define SDL_INIT_TIMER 0x00000001 -#define SDL_INIT_AUDIO 0x00000010 -#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ -#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ -#define SDL_INIT_HAPTIC 0x00001000 -#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ -#define SDL_INIT_EVENTS 0x00004000 -#define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */ +#define SDL_INIT_TIMER 0x00000001u +#define SDL_INIT_AUDIO 0x00000010u +#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ +#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ +#define SDL_INIT_HAPTIC 0x00001000u +#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ +#define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u +#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ - SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ ) /* @} */ @@ -95,8 +98,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); * This function initializes specific SDL subsystems * * Subsystem initialization is ref-counted, you must call - * SDL_QuitSubSystem for each SDL_InitSubSystem to correctly - * shutdown a subsystem manually (or call SDL_Quit to force shutdown). + * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly + * shutdown a subsystem manually (or call SDL_Quit() to force shutdown). * If a subsystem is already loaded then this call will * increase the ref-count and return. */ @@ -127,6 +130,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); #endif #include "close_code.h" -#endif /* _SDL_H */ +#endif /* SDL_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_assert.h b/3rdparty/sdl2-2.0.9/include/SDL_assert.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_assert.h rename to 3rdparty/sdl2-2.0.9/include/SDL_assert.h index 402981f967..b38f928ae1 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_assert.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_assert_h -#define _SDL_assert_h +#ifndef SDL_assert_h_ +#define SDL_assert_h_ #include "SDL_config.h" @@ -51,9 +51,11 @@ assert can have unique static variables associated with it. /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() -#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) -#elif defined(HAVE_SIGNAL_H) +#elif defined(__386__) && defined(__WATCOMC__) + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #include #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else @@ -63,7 +65,7 @@ assert can have unique static variables associated with it. #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ -#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) +#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" @@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * - * \return SDL_AssertState value of how to handle the assertion failure. + * Return SDL_AssertState value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. @@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse * * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { - * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); @@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); #endif #include "close_code.h" -#endif /* _SDL_assert_h */ +#endif /* SDL_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_atomic.h b/3rdparty/sdl2-2.0.9/include/SDL_atomic.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/include/SDL_atomic.h rename to 3rdparty/sdl2-2.0.9/include/SDL_atomic.h index 56aa81df98..b2287748c8 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_atomic.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,8 +56,8 @@ * All of the atomic operations that modify memory are full memory barriers. */ -#ifndef _SDL_atomic_h_ -#define _SDL_atomic_h_ +#ifndef SDL_atomic_h_ +#define SDL_atomic_h_ #include "SDL_stdinc.h" #include "SDL_platform.h" @@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__WATCOMC__) +extern _inline void SDL_CompilerBarrier (void); +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; #else #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } @@ -149,18 +152,24 @@ void _ReadWriteBarrier(void); * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); + #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ -extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); -extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") @@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); #include "close_code.h" -#endif /* _SDL_atomic_h_ */ +#endif /* SDL_atomic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_audio.h b/3rdparty/sdl2-2.0.9/include/SDL_audio.h similarity index 69% rename from 3rdparty/sdl2-2.0.4/include/SDL_audio.h rename to 3rdparty/sdl2-2.0.9/include/SDL_audio.h index 4f65521468..d3e1bface4 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_audio.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Access to the raw audio mixing buffer for the SDL library. */ -#ifndef _SDL_audio_h -#define _SDL_audio_h +#ifndef SDL_audio_h_ +#define SDL_audio_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) /* @} */ /* @} *//* Audio flags */ @@ -164,6 +165,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, /** * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR FC BL BR (quad + center) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { @@ -171,7 +181,7 @@ typedef struct SDL_AudioSpec SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ - Uint16 samples; /**< Audio buffer size in samples (power of 2) */ + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ @@ -184,7 +194,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** - * A structure to hold a set of audio conversion filters and buffers. + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + */ +#define SDL_AUDIOCVT_MAX_FILTERS 9 + +/** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't @@ -208,7 +234,7 @@ typedef struct SDL_AudioCVT int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ - SDL_AudioFilter filters[10]; /**< Filter list */ + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; @@ -278,7 +304,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); * protect data structures that it accesses by calling SDL_LockAudio() * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL * pointer here, and call SDL_QueueAudio() with some frequency, to queue - * more audio samples to be played. + * more audio samples to be played (or for capture devices, call + * SDL_DequeueAudio() with some frequency, to obtain audio samples). * - \c desired->userdata is passed as the first parameter to your callback * function. If you passed a NULL callback, this value is ignored. * @@ -433,10 +460,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format - * to the other. + * to the other. An unsupported format causes an error and -1 will be returned. * - * \return -1 if the format conversion is not supported, 0 if there's - * no conversion needed, or 1 if the audio filter is set up. + * \return 0 if no conversion is needed, 1 if the audio filter is set up, + * or -1 on error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, @@ -455,9 +482,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + * + * \return 0 on success or -1 if \c cvt->buf is NULL. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); +/* SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + */ +/* this is opaque to the outside world. */ +struct _SDL_AudioStream; +typedef struct _SDL_AudioStream SDL_AudioStream; + +/** + * Create a new audio stream + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \return 0 on success, or -1 on error. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate); + +/** + * Add data to be converted/resampled to the stream + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \return 0 on success, or -1 on error. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); + +/** + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \return The number of bytes read from the stream, or -1 on error + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); + +/** + * Get the number of converted/resampled bytes available. The stream may be + * buffering data behind the scenes until it has enough to resample + * correctly, so this number might be lower than what you expect, or even + * be zero. Add more data or flush the stream if you need the data now. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); + +/** + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will + * be audio gaps in the output. Generally this is intended to signal the + * end of input, so the complete output becomes available. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); + +/** + * Clear any pending data in the stream without converting it + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); + +/** + * Free an audio stream + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + */ +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); + #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes @@ -482,6 +637,10 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, /** * Queue more audio on non-callback devices. * + * (If you are looking to retrieve queued audio from a non-callback capture + * device, you want SDL_DequeueAudio() instead. This will return -1 to + * signify an error if you use it with capture devices.) + * * SDL offers two ways to feed audio to the device: you can either supply a * callback that SDL triggers with some frequency to obtain more audio * (pull method), or you can supply no callback, and then SDL will expect @@ -509,28 +668,83 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * \param dev The device ID to which we will queue audio. * \param data The data to queue to the device for later playback. * \param len The number of bytes (not samples!) to which (data) points. - * \return zero on success, -1 on error. + * \return 0 on success, or -1 on error. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio */ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); +/** + * Dequeue more audio on non-callback devices. + * + * (If you are looking to queue audio for output on a non-callback playback + * device, you want SDL_QueueAudio() instead. This will always return 0 + * if you use it with playback devices.) + * + * SDL offers two ways to retrieve audio from a capture device: you can + * either supply a callback that SDL triggers with some frequency as the + * device records more audio data, (push method), or you can supply no + * callback, and then SDL will expect you to retrieve data at regular + * intervals (pull method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Data from the device will keep queuing as + * necessary without further intervention from you. This means you will + * eventually run out of memory if you aren't routinely dequeueing data. + * + * Capture devices will not queue data when paused; if you are expecting + * to not need captured audio for some length of time, use + * SDL_PauseAudioDevice() to stop the capture device from queueing more + * data. This can be useful during, say, level loading times. When + * unpaused, capture devices will start queueing data from that point, + * having flushed any capturable data available while paused. + * + * This function is thread-safe, but dequeueing from the same device from + * two threads at once does not promise which thread will dequeued data + * first. + * + * You may not dequeue audio from a device that is using an + * application-supplied callback; doing so returns an error. You have to use + * the audio callback, or dequeue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * \param dev The device ID from which we will dequeue audio. + * \param data A pointer into where audio data should be copied. + * \param len The number of bytes (not samples!) to which (data) points. + * \return number of bytes dequeued, which could be less than requested. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_ClearQueuedAudio + */ +extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); + /** * Get the number of bytes of still-queued audio. * - * This is the number of bytes that have been queued for playback with - * SDL_QueueAudio(), but have not yet been sent to the hardware. + * For playback device: + * + * This is the number of bytes that have been queued for playback with + * SDL_QueueAudio(), but have not yet been sent to the hardware. This + * number may shrink at any time, so this only informs of pending data. + * + * Once we've sent it to the hardware, this function can not decide the + * exact byte boundary of what has been played. It's possible that we just + * gave the hardware several kilobytes right before you called this + * function, but it hasn't played any of it yet, or maybe half of it, etc. + * + * For capture devices: * - * Once we've sent it to the hardware, this function can not decide the exact - * byte boundary of what has been played. It's possible that we just gave the - * hardware several kilobytes right before you called this function, but it - * hasn't played any of it yet, or maybe half of it, etc. + * This is the number of bytes that have been captured by the device and + * are waiting for you to dequeue. This number may grow at any time, so + * this only informs of the lower-bound of available data. * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device always returns 0. - * You have to use the audio callback or queue audio with SDL_QueueAudio(), - * but not both. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before querying; SDL * handles locking internally for this function. @@ -544,10 +758,17 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); /** - * Drop any queued audio data waiting to be sent to the hardware. + * Drop any queued audio data. For playback devices, this is any queued data + * still waiting to be submitted to the hardware. For capture devices, this + * is any data that was queued by the device that hasn't yet been dequeued by + * the application. * - * Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and - * the hardware will start playing silence if more audio isn't queued. + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For + * playback devices, the hardware will start playing silence if more audio + * isn't queued. Unpaused capture devices will start filling the queue again + * as soon as they have more data available (which, depending on the state + * of the hardware and the thread, could be before this function call + * returns!). * * This will not prevent playback of queued audio that's already been sent * to the hardware, as we can not undo that, so expect there to be some @@ -557,8 +778,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device is always a no-op. - * You have to use the audio callback or queue audio with SDL_QueueAudio(), - * but not both. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before clearing the * queue; SDL handles locking internally for this function. @@ -600,6 +821,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); #endif #include "close_code.h" -#endif /* _SDL_audio_h */ +#endif /* SDL_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_bits.h b/3rdparty/sdl2-2.0.9/include/SDL_bits.h similarity index 80% rename from 3rdparty/sdl2-2.0.4/include/SDL_bits.h rename to 3rdparty/sdl2-2.0.9/include/SDL_bits.h index 528da2eac6..eb8322f0d0 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_bits.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for fiddling with bits and bitmasks. */ -#ifndef _SDL_bits_h -#define _SDL_bits_h +#ifndef SDL_bits_h_ +#define SDL_bits_h_ #include "SDL_stdinc.h" @@ -47,10 +47,20 @@ extern "C" { * * \return Index of the most significant bit, or -1 if the value is 0. */ +#if defined(__WATCOMC__) && defined(__386__) +extern _inline int _SDL_clz_watcom (Uint32); +#pragma aux _SDL_clz_watcom = \ + "bsr eax, eax" \ + "xor eax, 31" \ + parm [eax] nomemory \ + value [eax] \ + modify exact [eax] nomemory; +#endif + SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* Count Leading Zeroes builtin in GCC. * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html */ @@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x) return -1; } return 31 - __builtin_clz(x); +#elif defined(__WATCOMC__) && defined(__386__) + if (x == 0) { + return -1; + } + return 31 - _SDL_clz_watcom(x); #else /* Based off of Bit Twiddling Hacks by Sean Eron Anderson * , released in the public domain. @@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x) #endif #include "close_code.h" -#endif /* _SDL_bits_h */ +#endif /* SDL_bits_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_blendmode.h b/3rdparty/sdl2-2.0.9/include/SDL_blendmode.h new file mode 100644 index 0000000000..36a5ea76f0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_blendmode.h @@ -0,0 +1,120 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_blendmode.h + * + * Header file declaring the SDL_BlendMode enumeration + */ + +#ifndef SDL_blendmode_h_ +#define SDL_blendmode_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The blend mode used in SDL_RenderCopy() and drawing operations. + */ +typedef enum +{ + SDL_BLENDMODE_NONE = 0x00000000, /**< no blending + dstRGBA = srcRGBA */ + SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) + dstA = srcA + (dstA * (1-srcA)) */ + SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending + dstRGB = (srcRGB * srcA) + dstRGB + dstA = dstA */ + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate + dstRGB = srcRGB * dstRGB + dstA = dstA */ + SDL_BLENDMODE_INVALID = 0x7FFFFFFF + + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ + +} SDL_BlendMode; + +/** + * \brief The blend operation used when combining source and destination pixel components + */ +typedef enum +{ + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + +} SDL_BlendOperation; + +/** + * \brief The normalized factor used to multiply pixel components + */ +typedef enum +{ + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + +} SDL_BlendFactor; + +/** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor + * \param dstColorFactor + * \param colorOperation + * \param srcAlphaFactor + * \param dstAlphaFactor + * \param alphaOperation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + */ +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, + SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, + SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_blendmode_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_clipboard.h b/3rdparty/sdl2-2.0.9/include/SDL_clipboard.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/include/SDL_clipboard.h rename to 3rdparty/sdl2-2.0.9/include/SDL_clipboard.h index a5556f21c4..f28751ebb8 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_clipboard.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL clipboard handling */ -#ifndef _SDL_clipboard_h -#define _SDL_clipboard_h +#ifndef SDL_clipboard_h_ +#define SDL_clipboard_h_ #include "SDL_stdinc.h" @@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); #endif #include "close_code.h" -#endif /* _SDL_clipboard_h */ +#endif /* SDL_clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config.h b/3rdparty/sdl2-2.0.9/include/SDL_config.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/include/SDL_config.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config.h index 4270c78bf5..32f4113ffa 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -29,9 +29,7 @@ */ /* Add any platform that doesn't build using the configure system. */ -#ifdef USING_PREMAKE_CONFIG_H -#include "SDL_config_premake.h" -#elif defined(__WIN32__) +#if defined(__WIN32__) #include "SDL_config_windows.h" #elif defined(__WINRT__) #include "SDL_config_winrt.h" @@ -43,8 +41,10 @@ #include "SDL_config_android.h" #elif defined(__PSP__) #include "SDL_config_psp.h" +#elif defined(__OS2__) +#include "SDL_config_os2.h" #else -/* This is a minimal configuration just to get SDL running on new platforms */ +/* This is a minimal configuration just to get SDL running on new platforms. */ #include "SDL_config_minimal.h" #endif /* platform config */ @@ -52,4 +52,4 @@ #error Wrong SDL_config.h, check your include path? #endif -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config.h.cmake b/3rdparty/sdl2-2.0.9/include/SDL_config.h.cmake similarity index 87% rename from 3rdparty/sdl2-2.0.4/include/SDL_config.h.cmake rename to 3rdparty/sdl2-2.0.9/include/SDL_config.h.cmake index 44173a0533..48dd2d41b7 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config.h.cmake +++ b/3rdparty/sdl2-2.0.9/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -47,40 +47,32 @@ #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ -#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ -#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ -#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ -#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ -#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@ -#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ -#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ - /* Comment this if you want to build without any C library requirements */ #cmakedefine HAVE_LIBC 1 #if HAVE_LIBC /* Useful headers */ -#cmakedefine HAVE_ALLOCA_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_STDIO_H 1 #cmakedefine STDC_HEADERS 1 -#cmakedefine HAVE_STDLIB_H 1 -#cmakedefine HAVE_STDARG_H 1 -#cmakedefine HAVE_MALLOC_H 1 -#cmakedefine HAVE_MEMORY_H 1 -#cmakedefine HAVE_STRING_H 1 -#cmakedefine HAVE_STRINGS_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_CTYPE_H 1 -#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_ICONV_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_LIMITS_H 1 +#cmakedefine HAVE_MALLOC_H 1 +#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_MEMORY_H 1 #cmakedefine HAVE_SIGNAL_H 1 -#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_WCHAR_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 -#cmakedefine HAVE_LIBUDEV_H 1 -#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_LIBUNWIND_H 1 /* C library functions */ #cmakedefine HAVE_MALLOC 1 @@ -101,10 +93,13 @@ #cmakedefine HAVE_MEMCPY 1 #cmakedefine HAVE_MEMMOVE 1 #cmakedefine HAVE_MEMCMP 1 +#cmakedefine HAVE_WCSLEN 1 +#cmakedefine HAVE_WCSLCPY 1 +#cmakedefine HAVE_WCSLCAT 1 +#cmakedefine HAVE_WCSCMP 1 #cmakedefine HAVE_STRLEN 1 #cmakedefine HAVE_STRLCPY 1 #cmakedefine HAVE_STRLCAT 1 -#cmakedefine HAVE_STRDUP 1 #cmakedefine HAVE__STRREV 1 #cmakedefine HAVE__STRUPR 1 #cmakedefine HAVE__STRLWR 1 @@ -135,25 +130,43 @@ #cmakedefine HAVE_VSSCANF 1 #cmakedefine HAVE_VSNPRINTF 1 #cmakedefine HAVE_M_PI 1 -#cmakedefine HAVE_ATAN 1 -#cmakedefine HAVE_ATAN2 1 #cmakedefine HAVE_ACOS 1 +#cmakedefine HAVE_ACOSF 1 #cmakedefine HAVE_ASIN 1 +#cmakedefine HAVE_ASINF 1 +#cmakedefine HAVE_ATAN 1 +#cmakedefine HAVE_ATANF 1 +#cmakedefine HAVE_ATAN2 1 +#cmakedefine HAVE_ATAN2F 1 #cmakedefine HAVE_CEIL 1 +#cmakedefine HAVE_CEILF 1 #cmakedefine HAVE_COPYSIGN 1 +#cmakedefine HAVE_COPYSIGNF 1 #cmakedefine HAVE_COS 1 #cmakedefine HAVE_COSF 1 +#cmakedefine HAVE_EXP 1 +#cmakedefine HAVE_EXPF 1 #cmakedefine HAVE_FABS 1 +#cmakedefine HAVE_FABSF 1 #cmakedefine HAVE_FLOOR 1 +#cmakedefine HAVE_FLOORF 1 +#cmakedefine HAVE_FMOD 1 +#cmakedefine HAVE_FMODF 1 #cmakedefine HAVE_LOG 1 +#cmakedefine HAVE_LOGF 1 +#cmakedefine HAVE_LOG10 1 +#cmakedefine HAVE_LOG10F 1 #cmakedefine HAVE_POW 1 +#cmakedefine HAVE_POWF 1 #cmakedefine HAVE_SCALBN 1 +#cmakedefine HAVE_SCALBNF 1 #cmakedefine HAVE_SIN 1 #cmakedefine HAVE_SINF 1 #cmakedefine HAVE_SQRT 1 #cmakedefine HAVE_SQRTF 1 #cmakedefine HAVE_TAN 1 #cmakedefine HAVE_TANF 1 +#cmakedefine HAVE_FOPEN64 1 #cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSEEKO64 1 #cmakedefine HAVE_SIGACTION 1 @@ -169,14 +182,41 @@ #cmakedefine HAVE_PTHREAD_SETNAME_NP 1 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 #cmakedefine HAVE_SEM_TIMEDWAIT 1 +#cmakedefine HAVE_GETAUXVAL 1 +#cmakedefine HAVE_POLL 1 + #elif __WIN32__ #cmakedefine HAVE_STDARG_H 1 #cmakedefine HAVE_STDDEF_H 1 +#cmakedefine HAVE_FLOAT_H 1 #else /* We may need some replacement for stdarg.h here */ #include #endif /* HAVE_LIBC */ +#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_IBUS_IBUS_H 1 +#cmakedefine HAVE_IMMINTRIN_H 1 +#cmakedefine HAVE_LIBSAMPLERATE_H 1 +#cmakedefine HAVE_LIBUDEV_H 1 + +#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ +#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ +#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ +#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ +#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ +#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ + +#cmakedefine HAVE_ENDPOINTVOLUME_H @HAVE_ENDPOINTVOLUME_H@ +#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@ +#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@ + +#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ +#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ + /* SDL internal assertion support */ #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ @@ -188,6 +228,7 @@ #cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@ #cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@ #cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@ +#cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@ #cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@ #cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@ #cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@ @@ -197,35 +238,37 @@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ /* Enable various audio drivers */ -#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ -#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ -#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@ #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ +#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ +#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ +#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -248,9 +291,13 @@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ +#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ + +/* Enable various sensor drivers */ +#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@ +#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@ /* Enable various shared object loading systems */ -#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@ #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ @@ -282,6 +329,10 @@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ + #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ @@ -320,6 +371,7 @@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ +#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ /* Enable OpenGL support */ #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ @@ -333,6 +385,9 @@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ +/* Enable Vulkan support */ +#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ + /* Enable system power support */ #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ @@ -355,6 +410,8 @@ #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ +/* Enable dynamic libsamplerate support */ +#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ /* Platform specific definitions */ #if !defined(__WIN32__) @@ -416,4 +473,4 @@ typedef unsigned int uintptr_t; # endif /* !_STDINT_H_ && !HAVE_STDINT_H */ #endif /* __WIN32__ */ -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config.h.in b/3rdparty/sdl2-2.0.9/include/SDL_config.h.in similarity index 85% rename from 3rdparty/sdl2-2.0.4/include/SDL_config.h.in rename to 3rdparty/sdl2-2.0.9/include/SDL_config.h.in index 2071be4e50..883b6f427e 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config.h.in +++ b/3rdparty/sdl2-2.0.9/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -50,38 +50,32 @@ #undef HAVE_GCC_ATOMICS #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET -#undef HAVE_DDRAW_H -#undef HAVE_DINPUT_H -#undef HAVE_DSOUND_H -#undef HAVE_DXGI_H -#undef HAVE_XINPUT_H - /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC #if HAVE_LIBC /* Useful headers */ -#undef HAVE_ALLOCA_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_STDIO_H #undef STDC_HEADERS -#undef HAVE_STDLIB_H -#undef HAVE_STDARG_H -#undef HAVE_MALLOC_H -#undef HAVE_MEMORY_H -#undef HAVE_STRING_H -#undef HAVE_STRINGS_H -#undef HAVE_INTTYPES_H -#undef HAVE_STDINT_H +#undef HAVE_ALLOCA_H #undef HAVE_CTYPE_H -#undef HAVE_MATH_H +#undef HAVE_FLOAT_H #undef HAVE_ICONV_H +#undef HAVE_INTTYPES_H +#undef HAVE_LIMITS_H +#undef HAVE_MALLOC_H +#undef HAVE_MATH_H +#undef HAVE_MEMORY_H #undef HAVE_SIGNAL_H -#undef HAVE_ALTIVEC_H +#undef HAVE_STDARG_H +#undef HAVE_STDINT_H +#undef HAVE_STDIO_H +#undef HAVE_STDLIB_H +#undef HAVE_STRINGS_H +#undef HAVE_STRING_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_WCHAR_H #undef HAVE_PTHREAD_NP_H -#undef HAVE_LIBUDEV_H -#undef HAVE_DBUS_DBUS_H -#undef HAVE_IBUS_IBUS_H +#undef HAVE_LIBUNWIND_H /* C library functions */ #undef HAVE_MALLOC @@ -102,10 +96,13 @@ #undef HAVE_MEMCPY #undef HAVE_MEMMOVE #undef HAVE_MEMCMP +#undef HAVE_WCSLEN +#undef HAVE_WCSLCPY +#undef HAVE_WCSLCAT +#undef HAVE_WCSCMP #undef HAVE_STRLEN #undef HAVE_STRLCPY #undef HAVE_STRLCAT -#undef HAVE_STRDUP #undef HAVE__STRREV #undef HAVE__STRUPR #undef HAVE__STRLWR @@ -138,25 +135,43 @@ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF #undef HAVE_M_PI -#undef HAVE_ATAN -#undef HAVE_ATAN2 #undef HAVE_ACOS +#undef HAVE_ACOSF #undef HAVE_ASIN +#undef HAVE_ASINF +#undef HAVE_ATAN +#undef HAVE_ATANF +#undef HAVE_ATAN2 +#undef HAVE_ATAN2F #undef HAVE_CEIL +#undef HAVE_CEILF #undef HAVE_COPYSIGN +#undef HAVE_COPYSIGNF #undef HAVE_COS #undef HAVE_COSF +#undef HAVE_EXP +#undef HAVE_EXPF #undef HAVE_FABS +#undef HAVE_FABSF #undef HAVE_FLOOR +#undef HAVE_FLOORF +#undef HAVE_FMOD +#undef HAVE_FMODF #undef HAVE_LOG +#undef HAVE_LOGF +#undef HAVE_LOG10 +#undef HAVE_LOG10F #undef HAVE_POW +#undef HAVE_POWF #undef HAVE_SCALBN +#undef HAVE_SCALBNF #undef HAVE_SIN #undef HAVE_SINF #undef HAVE_SQRT #undef HAVE_SQRTF #undef HAVE_TAN #undef HAVE_TANF +#undef HAVE_FOPEN64 #undef HAVE_FSEEKO #undef HAVE_FSEEKO64 #undef HAVE_SIGACTION @@ -172,6 +187,8 @@ #undef HAVE_PTHREAD_SETNAME_NP #undef HAVE_PTHREAD_SET_NAME_NP #undef HAVE_SEM_TIMEDWAIT +#undef HAVE_GETAUXVAL +#undef HAVE_POLL #else #define HAVE_STDARG_H 1 @@ -179,6 +196,25 @@ #define HAVE_STDINT_H 1 #endif /* HAVE_LIBC */ +#undef HAVE_ALTIVEC_H +#undef HAVE_DBUS_DBUS_H +#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_IBUS_IBUS_H +#undef HAVE_IMMINTRIN_H +#undef HAVE_LIBSAMPLERATE_H +#undef HAVE_LIBUDEV_H + +#undef HAVE_DDRAW_H +#undef HAVE_DINPUT_H +#undef HAVE_DSOUND_H +#undef HAVE_DXGI_H +#undef HAVE_XINPUT_H +#undef HAVE_ENDPOINTVOLUME_H +#undef HAVE_MMDEVICEAPI_H +#undef HAVE_AUDIOCLIENT_H +#undef HAVE_XINPUT_GAMEPAD_EX +#undef HAVE_XINPUT_STATE_EX + /* SDL internal assertion support */ #undef SDL_DEFAULT_ASSERT_LEVEL @@ -190,6 +226,7 @@ #undef SDL_FILE_DISABLED #undef SDL_JOYSTICK_DISABLED #undef SDL_HAPTIC_DISABLED +#undef SDL_SENSOR_DISABLED #undef SDL_LOADSO_DISABLED #undef SDL_RENDER_DISABLED #undef SDL_THREADS_DISABLED @@ -201,34 +238,36 @@ /* Enable various audio drivers */ #undef SDL_AUDIO_DRIVER_ALSA #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#undef SDL_AUDIO_DRIVER_ANDROID #undef SDL_AUDIO_DRIVER_ARTS #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#undef SDL_AUDIO_DRIVER_PULSEAUDIO -#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_HAIKU -#undef SDL_AUDIO_DRIVER_BSD #undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_DISK -#undef SDL_AUDIO_DRIVER_DUMMY -#undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_XAUDIO2 #undef SDL_AUDIO_DRIVER_DSOUND +#undef SDL_AUDIO_DRIVER_DUMMY +#undef SDL_AUDIO_DRIVER_EMSCRIPTEN #undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#undef SDL_AUDIO_DRIVER_FUSIONSOUND +#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#undef SDL_AUDIO_DRIVER_HAIKU +#undef SDL_AUDIO_DRIVER_JACK +#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC #undef SDL_AUDIO_DRIVER_NACL #undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC -#undef SDL_AUDIO_DRIVER_SNDIO -#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OSS #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_PAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_QSA +#undef SDL_AUDIO_DRIVER_SNDIO +#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_SUNAUDIO +#undef SDL_AUDIO_DRIVER_WASAPI #undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#undef SDL_AUDIO_DRIVER_EMSCRIPTEN /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -244,15 +283,20 @@ #undef SDL_JOYSTICK_WINMM #undef SDL_JOYSTICK_USBHID #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H +#undef SDL_JOYSTICK_HIDAPI #undef SDL_JOYSTICK_EMSCRIPTEN #undef SDL_HAPTIC_DUMMY +#undef SDL_HAPTIC_ANDROID #undef SDL_HAPTIC_LINUX #undef SDL_HAPTIC_IOKIT #undef SDL_HAPTIC_DINPUT #undef SDL_HAPTIC_XINPUT +/* Enable various sensor drivers */ +#undef SDL_SENSOR_ANDROID +#undef SDL_SENSOR_DUMMY + /* Enable various shared object loading systems */ -#undef SDL_LOADSO_HAIKU #undef SDL_LOADSO_DLOPEN #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG @@ -288,6 +332,9 @@ #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON #undef SDL_VIDEO_DRIVER_X11 #undef SDL_VIDEO_DRIVER_RPI +#undef SDL_VIDEO_DRIVER_KMSDRM +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM #undef SDL_VIDEO_DRIVER_ANDROID #undef SDL_VIDEO_DRIVER_EMSCRIPTEN #undef SDL_VIDEO_DRIVER_X11_DYNAMIC @@ -313,6 +360,7 @@ #undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK +#undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 @@ -320,6 +368,7 @@ #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 #undef SDL_VIDEO_RENDER_DIRECTFB +#undef SDL_VIDEO_RENDER_METAL /* Enable OpenGL support */ #undef SDL_VIDEO_OPENGL @@ -333,6 +382,9 @@ #undef SDL_VIDEO_OPENGL_OSMESA #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC +/* Enable Vulkan support */ +#undef SDL_VIDEO_VULKAN + /* Enable system power support */ #undef SDL_POWER_LINUX #undef SDL_POWER_WINDOWS @@ -356,4 +408,13 @@ #undef SDL_ASSEMBLY_ROUTINES #undef SDL_ALTIVEC_BLITTERS -#endif /* _SDL_config_h */ +/* Enable ime support */ +#undef SDL_USE_IME + +/* Enable dynamic udev support */ +#undef SDL_UDEV_DYNAMIC + +/* Enable dynamic libsamplerate support */ +#undef SDL_LIBSAMPLERATE_DYNAMIC + +#endif /* SDL_config_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_android.h b/3rdparty/sdl2-2.0.9/include/SDL_config_android.h similarity index 76% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_android.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_android.h index a388ba8de0..f2b28cfb22 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_android.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_android_h -#define _SDL_config_android_h +#ifndef SDL_config_android_h_ +#define SDL_config_android_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -34,15 +35,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -65,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -75,36 +77,54 @@ #define HAVE_STRTOULL 1 #define HAVE_STRTOD 1 #define HAVE_ATOI 1 +#define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 #define HAVE_SQRTF 1 #define HAVE_TAN 1 #define HAVE_TANF 1 +#define HAVE_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 -#define HAVE_CLOCK_GETTIME 1 +#define HAVE_CLOCK_GETTIME 1 #define SIZEOF_VOIDP 4 @@ -114,7 +134,11 @@ /* Enable various input drivers */ #define SDL_JOYSTICK_ANDROID 1 -#define SDL_HAPTIC_DUMMY 1 +#define SDL_JOYSTICK_HIDAPI 1 +#define SDL_HAPTIC_ANDROID 1 + +/* Enable sensor driver */ +#define SDL_SENSOR_ANDROID 1 /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 @@ -136,10 +160,18 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Enable Vulkan support */ +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 +#define SDL_VIDEO_VULKAN 0 +#else +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_ANDROID 1 /* Enable the filesystem driver */ #define SDL_FILESYSTEM_ANDROID 1 -#endif /* _SDL_config_android_h */ +#endif /* SDL_config_android_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_iphoneos.h b/3rdparty/sdl2-2.0.9/include/SDL_config_iphoneos.h similarity index 73% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_iphoneos.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_iphoneos.h index 304c89201d..56e2b4338e 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_iphoneos.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_iphoneos_h -#define _SDL_config_iphoneos_h +#ifndef SDL_config_iphoneos_h_ +#define SDL_config_iphoneos_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,19 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +/* The libunwind functions are only available on x86 */ +/* #undef HAVE_LIBUNWIND_H */ /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +85,36 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -117,13 +137,17 @@ /* Enable MFi joystick support */ #define SDL_JOYSTICK_MFI 1 +/*#define SDL_JOYSTICK_HIDAPI 1*/ -/* Enable Unix style SO loading */ -/* Technically this works, but violates the iOS dev agreement prior to iOS 8 */ -/* #define SDL_LOADSO_DLOPEN 1 */ +#ifdef __TVOS__ +#define SDL_SENSOR_DUMMY 1 +#else +/* Enable the CoreMotion sensor driver */ +#define SDL_SENSOR_COREMOTION 1 +#endif -/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 +/* Enable Unix style SO loading */ +#define SDL_LOADSO_DLOPEN 1 /* Enable various threading systems */ #define SDL_THREAD_PTHREAD 1 @@ -136,12 +160,27 @@ #define SDL_VIDEO_DRIVER_UIKIT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 -/* enable OpenGL ES */ +/* Enable OpenGL ES */ #define SDL_VIDEO_OPENGL_ES2 1 #define SDL_VIDEO_OPENGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */ +#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000)) +#define SDL_PLATFORM_SUPPORTS_METAL 1 +#else +#define SDL_PLATFORM_SUPPORTS_METAL 0 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_RENDER_METAL 1 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_UIKIT 1 @@ -159,4 +198,4 @@ /* enable filesystem support */ #define SDL_FILESYSTEM_COCOA 1 -#endif /* _SDL_config_iphoneos_h */ +#endif /* SDL_config_iphoneos_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_macosx.h b/3rdparty/sdl2-2.0.9/include/SDL_config_macosx.h similarity index 76% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_macosx.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_macosx.h index 5c8b7e0335..9ebd4a335d 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_macosx.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_macosx_h -#define _SDL_config_macosx_h +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -36,16 +37,19 @@ #endif /* Useful headers */ -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_LIBUNWIND_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -67,7 +71,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -84,15 +87,37 @@ #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -104,10 +129,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_COREAUDIO 1 @@ -116,8 +137,12 @@ /* Enable various input drivers */ #define SDL_JOYSTICK_IOKIT 1 +#define SDL_JOYSTICK_HIDAPI 1 #define SDL_HAPTIC_IOKIT 1 +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 @@ -162,10 +187,29 @@ #define SDL_VIDEO_RENDER_OGL 1 #endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif + +#ifndef SDL_VIDEO_RENDER_METAL +/* Metal only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_RENDER_METAL 1 +#else +#define SDL_VIDEO_RENDER_METAL 0 +#endif +#endif + /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL #define SDL_VIDEO_OPENGL 1 #endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif #ifndef SDL_VIDEO_OPENGL_CGL #define SDL_VIDEO_OPENGL_CGL 1 #endif @@ -173,6 +217,14 @@ #define SDL_VIDEO_OPENGL_GLX 1 #endif +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + /* Enable system power support */ #define SDL_POWER_MACOSX 1 @@ -185,4 +237,4 @@ #define SDL_ALTIVEC_BLITTERS 1 #endif -#endif /* _SDL_config_macosx_h */ +#endif /* SDL_config_macosx_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_minimal.h b/3rdparty/sdl2-2.0.9/include/SDL_config_minimal.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_minimal.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_minimal.h index 3c9d09afcf..bf7fc447f9 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_minimal.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_minimal_h -#define _SDL_config_minimal_h +#ifndef SDL_config_minimal_h_ +#define SDL_config_minimal_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -63,6 +64,9 @@ typedef unsigned long uintptr_t; /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ #define SDL_HAPTIC_DISABLED 1 +/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ +#define SDL_SENSOR_DISABLED 1 + /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ #define SDL_LOADSO_DISABLED 1 @@ -78,4 +82,4 @@ typedef unsigned long uintptr_t; /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ #define SDL_FILESYSTEM_DUMMY 1 -#endif /* _SDL_config_minimal_h */ +#endif /* SDL_config_minimal_h_ */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_config_os2.h b/3rdparty/sdl2-2.0.9/include/SDL_config_os2.h new file mode 100644 index 0000000000..d1e4bb24d6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_os2.h @@ -0,0 +1,170 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_os2_h_ +#define SDL_config_os2_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_DISK 1 + +#define SDL_POWER_DISABLED 1 +#define SDL_JOYSTICK_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 +/*#undef SDL_JOYSTICK_HIDAPI */ + +#define SDL_SENSOR_DUMMY 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* Enable OpenGL support */ +/* #undef SDL_VIDEO_OPENGL */ + +/* Enable Vulkan support */ +/* #undef SDL_VIDEO_VULKAN */ + +#define SDL_LOADSO_DISABLED 1 +#define SDL_THREADS_DISABLED 1 +#define SDL_TIMERS_DISABLED 1 +#define SDL_FILESYSTEM_DUMMY 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 + +/* #undef HAVE_LIBSAMPLERATE_H */ + +/* Enable dynamic libsamplerate support */ +/* #undef SDL_LIBSAMPLERATE_DYNAMIC */ + +#define HAVE_LIBC 1 + +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_WCHAR_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_SIGNAL_H 1 + +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#if defined(__WATCOMC__) +#define HAVE__FSEEKI64 1 +#define HAVE__FTELLI64 1 +#endif +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_WCSLEN 1 +#define HAVE_WCSLCPY 1 +#define HAVE_WCSLCAT 1 +#define HAVE_WCSCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +#define HAVE__STRLWR 1 +#define HAVE_INDEX 1 +#define HAVE_RINDEX 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_ITOA 1 +#define HAVE__LTOA 1 +#define HAVE__ULTOA 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE__I64TOA 1 +#define HAVE__UI64TOA 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_SETJMP 1 +#define HAVE_ACOS 1 +/* #undef HAVE_ACOSF */ +#define HAVE_ASIN 1 +/* #undef HAVE_ASINF */ +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +/* #undef HAVE_ATAN2F */ +#define HAVE_CEIL 1 +/* #undef HAVE_CEILF */ +/* #undef HAVE_COPYSIGN */ +/* #undef HAVE_COPYSIGNF */ +#define HAVE_COS 1 +/* #undef HAVE_COSF */ +#define HAVE_EXP 1 +/* #undef HAVE_EXPF */ +#define HAVE_FABS 1 +/* #undef HAVE_FABSF */ +#define HAVE_FLOOR 1 +/* #undef HAVE_FLOORF */ +#define HAVE_FMOD 1 +/* #undef HAVE_FMODF */ +#define HAVE_LOG 1 +/* #undef HAVE_LOGF */ +#define HAVE_LOG10 1 +/* #undef HAVE_LOG10F */ +#define HAVE_POW 1 +/* #undef HAVE_POWF */ +#define HAVE_SIN 1 +/* #undef HAVE_SINF */ +/* #undef HAVE_SCALBN */ +/* #undef HAVE_SCALBNF */ +#define HAVE_SQRT 1 +/* #undef HAVE_SQRTF */ +#define HAVE_TAN 1 +/* #undef HAVE_TANF */ + +#endif /* SDL_config_os2_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_pandora.h b/3rdparty/sdl2-2.0.9/include/SDL_config_pandora.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_pandora.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_pandora.h index 7b51e571fa..64111a1206 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_pandora.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_pandora_h_ +#define SDL_config_pandora_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -35,22 +36,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -67,7 +70,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -88,9 +90,11 @@ #define HAVE_COPYSIGN 1 #define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 #define HAVE_FABS 1 #define HAVE_FLOOR 1 #define HAVE_LOG 1 +#define HAVE_LOG10 1 #define HAVE_SCALBN 1 #define HAVE_SIN 1 #define HAVE_SINF 1 @@ -110,6 +114,8 @@ #define SDL_JOYSTICK_LINUX 1 #define SDL_HAPTIC_LINUX 1 +#define SDL_SENSOR_DUMMY 1 + #define SDL_LOADSO_DLOPEN 1 #define SDL_THREAD_PTHREAD 1 @@ -124,4 +130,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_pandora_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_psp.h b/3rdparty/sdl2-2.0.9/include/SDL_config_psp.h similarity index 77% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_psp.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_psp.h index a6e49609a5..2422672a41 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_psp.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_psp_h -#define _SDL_config_psp_h +#ifndef SDL_config_psp_h_ +#define SDL_config_psp_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +66,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +83,36 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -110,22 +128,25 @@ /* PSP isn't that sophisticated */ #define LACKS_SYS_MMAN_H 1 -/* Enable the stub thread support (src/thread/psp/\*.c) */ +/* Enable the PSP thread support (src/thread/psp/\*.c) */ #define SDL_THREAD_PSP 1 -/* Enable the stub timer support (src/timer/psp/\*.c) */ +/* Enable the PSP timer support (src/timer/psp/\*.c) */ #define SDL_TIMERS_PSP 1 -/* Enable the stub joystick driver (src/joystick/psp/\*.c) */ +/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */ #define SDL_JOYSTICK_PSP 1 -/* Enable the stub audio driver (src/audio/psp/\*.c) */ +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + +/* Enable the PSP audio driver (src/audio/psp/\*.c) */ #define SDL_AUDIO_DRIVER_PSP 1 -/* PSP video dirver */ +/* PSP video driver */ #define SDL_VIDEO_DRIVER_PSP 1 -/* PSP render dirver */ +/* PSP render driver */ #define SDL_VIDEO_RENDER_PSP 1 #define SDL_POWER_PSP 1 @@ -140,4 +161,4 @@ #define SDL_LOADSO_DISABLED 1 -#endif /* _SDL_config_psp_h */ +#endif /* SDL_config_psp_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_windows.h b/3rdparty/sdl2-2.0.9/include/SDL_config_windows.h similarity index 74% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_windows.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_windows.h index 890986cc4e..c58be8e72e 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_windows.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -81,16 +82,21 @@ typedef unsigned int uintptr_t; #define HAVE_DSOUND_H 1 #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC /* Useful headers */ -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -106,13 +112,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -122,28 +130,50 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 -#define HAVE_COPYSIGN 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif #endif #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) #define HAVE_M_PI 1 @@ -154,8 +184,8 @@ typedef unsigned int uintptr_t; #endif /* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -163,9 +193,13 @@ typedef unsigned int uintptr_t; /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_XINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 #define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_XINPUT 1 +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -183,7 +217,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ @@ -206,6 +240,8 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_OPENGL_EGL 1 #endif +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 @@ -218,4 +254,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* SDL_config_windows_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_winrt.h b/3rdparty/sdl2-2.0.9/include/SDL_config_winrt.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_winrt.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_winrt.h index e392f773e9..e3fe55b073 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_winrt.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_winrt_h -#define _SDL_config_winrt_h +#ifndef SDL_config_winrt_h_ +#define SDL_config_winrt_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -43,7 +44,7 @@ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 +#define HAVE_STDINT_H 1 #elif defined(_MSC_VER) typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; @@ -96,14 +97,20 @@ typedef unsigned int uintptr_t; #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP #define HAVE_XINPUT_H 1 #endif + +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 + #define HAVE_LIBC 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -120,13 +127,13 @@ typedef unsigned int uintptr_t; #define HAVE_STRLEN 1 #define HAVE__STRREV 1 #define HAVE__STRUPR 1 -//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead +//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 //#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead -//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead -//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead +//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead +//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 //#define HAVE_STRTOLL 1 @@ -138,44 +145,63 @@ typedef unsigned int uintptr_t; #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 #define HAVE_VSNPRINTF 1 -//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead +//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead #define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE__COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -//#define HAVE_SCALBN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE__SCALB 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE__FSEEKI64 1 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_XAUDIO2 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 #else #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_XINPUT 1 #endif +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 +#define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ #if (NTDDI_VERSION >= NTDDI_WINBLUE) @@ -186,10 +212,10 @@ typedef unsigned int uintptr_t; #endif /* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 +#define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_WINRT 1 +#define SDL_VIDEO_DRIVER_WINRT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ @@ -208,7 +234,7 @@ typedef unsigned int uintptr_t; /* Enable assembly routines (Win64 doesn't have inline asm) */ #ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_winrt_h */ +#endif /* SDL_config_winrt_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_config_wiz.h b/3rdparty/sdl2-2.0.9/include/SDL_config_wiz.h similarity index 72% rename from 3rdparty/sdl2-2.0.4/include/SDL_config_wiz.h rename to 3rdparty/sdl2-2.0.9/include/SDL_config_wiz.h index e090a1a907..b6c00d0fec 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_config_wiz.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_wiz_h_ +#define SDL_config_wiz_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -29,22 +30,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -61,7 +64,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -78,20 +80,42 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SCALBNF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 @@ -105,6 +129,8 @@ #define SDL_JOYSTICK_LINUX 1 #define SDL_HAPTIC_LINUX 1 +#define SDL_SENSOR_DUMMY 1 + #define SDL_LOADSO_DLOPEN 1 #define SDL_THREAD_PTHREAD 1 @@ -117,4 +143,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_wiz_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_copying.h b/3rdparty/sdl2-2.0.9/include/SDL_copying.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_copying.h rename to 3rdparty/sdl2-2.0.9/include/SDL_copying.h index 212da0ee0e..15616ace5f 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_copying.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/include/SDL_cpuinfo.h b/3rdparty/sdl2-2.0.9/include/SDL_cpuinfo.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/include/SDL_cpuinfo.h rename to 3rdparty/sdl2-2.0.9/include/SDL_cpuinfo.h index d0ba47bf7f..ee3a47e841 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_cpuinfo.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,14 +25,20 @@ * CPU feature detection for SDL. */ -#ifndef _SDL_cpuinfo_h -#define _SDL_cpuinfo_h +#ifndef SDL_cpuinfo_h_ +#define SDL_cpuinfo_h_ #include "SDL_stdinc.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) +#ifdef __clang__ +/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ +#undef __MMX__ +#undef __SSE__ +#undef __SSE2__ +#else #include #ifndef _WIN64 #define __MMX__ @@ -40,28 +46,40 @@ #endif #define __SSE__ #define __SSE2__ +#endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include +#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) +#include #endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) +#include #endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -144,18 +162,27 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + +/** + * This function returns true if the CPU has NEON (ARM SIMD) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); + /** * This function returns the amount of RAM configured in the system, in MB. */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_cpuinfo_h */ +#endif /* SDL_cpuinfo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_egl.h b/3rdparty/sdl2-2.0.9/include/SDL_egl.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/include/SDL_egl.h rename to 3rdparty/sdl2-2.0.9/include/SDL_egl.h index bea2a6c0ec..d65ed437c3 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_egl.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include @@ -132,7 +132,7 @@ *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C diff --git a/3rdparty/sdl2-2.0.4/include/SDL_endian.h b/3rdparty/sdl2-2.0.9/include/SDL_endian.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/include/SDL_endian.h rename to 3rdparty/sdl2-2.0.9/include/SDL_endian.h index 9100b103db..ed0bf5ba8f 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_endian.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for reading and writing endian-specific values */ -#ifndef _SDL_endian_h -#define _SDL_endian_h +#ifndef SDL_endian_h_ +#define SDL_endian_h_ #include "SDL_stdinc.h" @@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x) __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint16 SDL_Swap16(Uint16); +#pragma aux SDL_Swap16 = \ + "xchg al, ah" \ + parm [ax] \ + modify [ax]; #else SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) @@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x) __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint32 SDL_Swap32(Uint32); +#ifndef __SW_3 /* 486+ */ +#pragma aux SDL_Swap32 = \ + "bswap eax" \ + parm [eax] \ + modify [eax]; +#else /* 386-only */ +#pragma aux SDL_Swap32 = \ + "xchg al, ah" \ + "ror eax, 16" \ + "xchg al, ah" \ + parm [eax] \ + modify [eax]; +#endif #else SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) @@ -234,6 +255,6 @@ SDL_SwapFloat(float x) #endif #include "close_code.h" -#endif /* _SDL_endian_h */ +#endif /* SDL_endian_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_error.h b/3rdparty/sdl2-2.0.9/include/SDL_error.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_error.h rename to 3rdparty/sdl2-2.0.9/include/SDL_error.h index 2f3b4b5008..c0e46298e8 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_error.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Simple error message routines for SDL. */ -#ifndef _SDL_error_h -#define _SDL_error_h +#ifndef SDL_error_h_ +#define SDL_error_h_ #include "SDL_stdinc.h" @@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); #endif #include "close_code.h" -#endif /* _SDL_error_h */ +#endif /* SDL_error_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_events.h b/3rdparty/sdl2-2.0.9/include/SDL_events.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/include/SDL_events.h rename to 3rdparty/sdl2-2.0.9/include/SDL_events.h index 1437f4c705..af22eb6466 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_events.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL event handling. */ -#ifndef _SDL_events_h -#define _SDL_events_h +#ifndef SDL_events_h_ +#define SDL_events_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -85,6 +85,9 @@ typedef enum Called on Android in onResume() */ + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -136,11 +139,17 @@ typedef enum /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ + SDL_DROPTEXT, /**< text/plain drag-and-drop event */ + SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ + SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ /* Audio hotplug events */ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ @@ -162,16 +171,31 @@ typedef enum typedef struct SDL_CommonEvent { Uint32 type; - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + /** * \brief Window state change event data (event.window.*) */ typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; @@ -187,7 +211,7 @@ typedef struct SDL_WindowEvent typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ @@ -203,7 +227,7 @@ typedef struct SDL_KeyboardEvent typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ Sint32 start; /**< The start cursor of selected editing text */ @@ -218,7 +242,7 @@ typedef struct SDL_TextEditingEvent typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -229,7 +253,7 @@ typedef struct SDL_TextInputEvent typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 state; /**< The current button state */ @@ -245,7 +269,7 @@ typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ @@ -262,7 +286,7 @@ typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ @@ -276,7 +300,7 @@ typedef struct SDL_MouseWheelEvent typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; @@ -292,7 +316,7 @@ typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; @@ -308,7 +332,7 @@ typedef struct SDL_JoyBallEvent typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. @@ -328,7 +352,7 @@ typedef struct SDL_JoyHatEvent typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -342,7 +366,7 @@ typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; @@ -353,7 +377,7 @@ typedef struct SDL_JoyDeviceEvent typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 padding1; @@ -370,7 +394,7 @@ typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -385,7 +409,7 @@ typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -395,7 +419,7 @@ typedef struct SDL_ControllerDeviceEvent typedef struct SDL_AudioDeviceEvent { Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 padding1; @@ -410,7 +434,7 @@ typedef struct SDL_AudioDeviceEvent typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; float x; /**< Normalized in the range 0...1 */ @@ -427,8 +451,8 @@ typedef struct SDL_TouchFingerEvent typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ - Uint32 timestamp; - SDL_TouchID touchId; /**< The touch device index */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ float dTheta; float dDist; float x; @@ -444,7 +468,7 @@ typedef struct SDL_MultiGestureEvent typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; @@ -461,19 +485,31 @@ typedef struct SDL_DollarGestureEvent */ typedef struct SDL_DropEvent { - Uint32 type; /**< ::SDL_DROPFILE */ - Uint32 timestamp; - char *file; /**< The file name, which should be freed with SDL_free() */ + Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ + Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + /** * \brief The "quit requested" event */ typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; /** @@ -482,7 +518,7 @@ typedef struct SDL_QuitEvent typedef struct SDL_OSEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_OSEvent; /** @@ -491,7 +527,7 @@ typedef struct SDL_OSEvent typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window if any */ Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ @@ -511,7 +547,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; @@ -522,6 +558,7 @@ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -538,6 +575,7 @@ typedef union SDL_Event SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ @@ -720,7 +758,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, /** * This function allows you to set the state of processing certain events. * - If \c state is set to ::SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. + * dropped from the event queue and will not be filtered. * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the @@ -745,6 +783,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); #endif #include "close_code.h" -#endif /* _SDL_events_h */ +#endif /* SDL_events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_filesystem.h b/3rdparty/sdl2-2.0.9/include/SDL_filesystem.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/include/SDL_filesystem.h rename to 3rdparty/sdl2-2.0.9/include/SDL_filesystem.h index 02999ed270..fa6a1fa6e7 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_filesystem.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * \brief Include file for filesystem SDL API functions */ -#ifndef _SDL_filesystem_h -#define _SDL_filesystem_h +#ifndef SDL_filesystem_h_ +#define SDL_filesystem_h_ #include "SDL_stdinc.h" @@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); #endif #include "close_code.h" -#endif /* _SDL_filesystem_h */ +#endif /* SDL_filesystem_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_gamecontroller.h b/3rdparty/sdl2-2.0.9/include/SDL_gamecontroller.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/include/SDL_gamecontroller.h rename to 3rdparty/sdl2-2.0.9/include/SDL_gamecontroller.h index 42087eea16..6ae9c95428 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_gamecontroller.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL game controller event handling */ -#ifndef _SDL_gamecontroller_h -#define _SDL_gamecontroller_h +#ifndef SDL_gamecontroller_h_ +#define SDL_gamecontroller_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -51,7 +51,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The gamecontroller structure used to identify an SDL game controller */ +/** + * The gamecontroller structure used to identify an SDL game controller + */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; @@ -87,13 +89,13 @@ typedef struct SDL_GameControllerButtonBind * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) { - * if ( SDL_IsGameController(i) ) { + * for (int i = 0; i < nJoysticks; i++) { + * if (SDL_IsGameController(i)) { * nGameControllers++; * } * } * - * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: * guid,name,mappings * * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. @@ -105,7 +107,7 @@ typedef struct SDL_GameControllerButtonBind * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ @@ -117,7 +119,7 @@ typedef struct SDL_GameControllerButtonBind * * \return number of mappings added, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() @@ -131,28 +133,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, * * \return 1 if mapping is added, 0 if updated, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); + +/** + * Get the number of mappings installed + * + * \return the number of mappings + */ +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); + +/** + * Get the mapping at a particular index. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); /** * Get a mapping string for a GUID * - * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); /** * Get a mapping string for an open GameController * - * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); - /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. @@ -160,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. @@ -181,6 +204,31 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + +/** + * Get the USB vendor ID of an opened controller, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); + +/** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); + +/** + * Get the product version of an opened controller, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); + /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. @@ -214,6 +262,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller + * + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, + * and are centered within ~8000 of zero, though advanced UI will allow users to set + * or autodetect the dead zone, which varies between controllers. + * + * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. */ typedef enum { @@ -306,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a controller previously opened with SDL_GameControllerOpen(). */ @@ -318,6 +385,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon #endif #include "close_code.h" -#endif /* _SDL_gamecontroller_h */ +#endif /* SDL_gamecontroller_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_gesture.h b/3rdparty/sdl2-2.0.9/include/SDL_gesture.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_gesture.h rename to 3rdparty/sdl2-2.0.9/include/SDL_gesture.h index 3c29ca7ac8..b223d80d44 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_gesture.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL gesture event handling. */ -#ifndef _SDL_gesture_h -#define _SDL_gesture_h +#ifndef SDL_gesture_h_ +#define SDL_gesture_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo #endif #include "close_code.h" -#endif /* _SDL_gesture_h */ +#endif /* SDL_gesture_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_haptic.h b/3rdparty/sdl2-2.0.9/include/SDL_haptic.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_haptic.h rename to 3rdparty/sdl2-2.0.9/include/SDL_haptic.h index b36d78b127..2ea1bfc160 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_haptic.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,12 +22,12 @@ /** * \file SDL_haptic.h * - * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) + * \brief The SDL haptic subsystem allows you to control haptic (force feedback) * devices. * * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. + * - Initialize the subsystem (::SDL_INIT_HAPTIC). + * - Open a haptic device. * - SDL_HapticOpen() to open from index. * - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - Create an effect (::SDL_HapticEffect). @@ -104,8 +104,8 @@ * \endcode */ -#ifndef _SDL_haptic_h -#define _SDL_haptic_h +#ifndef SDL_haptic_h_ +#define SDL_haptic_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -117,6 +117,17 @@ extern "C" { #endif /* __cplusplus */ +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + /** * \typedef SDL_Haptic * @@ -149,7 +160,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_CONSTANT (1<<0) +#define SDL_HAPTIC_CONSTANT (1u<<0) /** * \brief Sine wave effect supported. @@ -158,7 +169,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SINE (1<<1) +#define SDL_HAPTIC_SINE (1u<<1) /** * \brief Left/Right effect supported. @@ -169,7 +180,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry, * we ran out of bits, and this is important for XInput devices. */ -#define SDL_HAPTIC_LEFTRIGHT (1<<2) +#define SDL_HAPTIC_LEFTRIGHT (1u<<2) /* !!! FIXME: put this back when we have more bits in 2.1 */ /* #define SDL_HAPTIC_SQUARE (1<<2) */ @@ -181,7 +192,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_TRIANGLE (1<<3) +#define SDL_HAPTIC_TRIANGLE (1u<<3) /** * \brief Sawtoothup wave effect supported. @@ -190,7 +201,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SAWTOOTHUP (1<<4) +#define SDL_HAPTIC_SAWTOOTHUP (1u<<4) /** * \brief Sawtoothdown wave effect supported. @@ -199,7 +210,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) +#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5) /** * \brief Ramp effect supported. @@ -208,7 +219,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticRamp */ -#define SDL_HAPTIC_RAMP (1<<6) +#define SDL_HAPTIC_RAMP (1u<<6) /** * \brief Spring effect supported - uses axes position. @@ -218,7 +229,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_SPRING (1<<7) +#define SDL_HAPTIC_SPRING (1u<<7) /** * \brief Damper effect supported - uses axes velocity. @@ -228,7 +239,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_DAMPER (1<<8) +#define SDL_HAPTIC_DAMPER (1u<<8) /** * \brief Inertia effect supported - uses axes acceleration. @@ -238,7 +249,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_INERTIA (1<<9) +#define SDL_HAPTIC_INERTIA (1u<<9) /** * \brief Friction effect supported - uses axes movement. @@ -248,14 +259,14 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_FRICTION (1<<10) +#define SDL_HAPTIC_FRICTION (1u<<10) /** * \brief Custom effect is supported. * * User defined custom haptic effect. */ -#define SDL_HAPTIC_CUSTOM (1<<11) +#define SDL_HAPTIC_CUSTOM (1u<<11) /* @} *//* Haptic effects */ @@ -268,7 +279,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticSetGain */ -#define SDL_HAPTIC_GAIN (1<<12) +#define SDL_HAPTIC_GAIN (1u<<12) /** * \brief Device can set autocenter. @@ -277,24 +288,26 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticSetAutocenter */ -#define SDL_HAPTIC_AUTOCENTER (1<<13) +#define SDL_HAPTIC_AUTOCENTER (1u<<13) /** * \brief Device can be queried for effect status. * - * Device can be queried for effect status. + * Device supports querying effect status. * * \sa SDL_HapticGetEffectStatus */ -#define SDL_HAPTIC_STATUS (1<<14) +#define SDL_HAPTIC_STATUS (1u<<14) /** * \brief Device can be paused. * + * Devices supports being paused. + * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ -#define SDL_HAPTIC_PAUSE (1<<15) +#define SDL_HAPTIC_PAUSE (1u<<15) /** @@ -444,7 +457,7 @@ typedef struct SDL_HapticDirection /** * \brief A structure containing a template for a Constant effect. * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction * to the joystick. @@ -654,8 +667,8 @@ typedef struct SDL_HapticRamp * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -666,7 +679,7 @@ typedef struct SDL_HapticLeftRight Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ - Uint32 length; /**< Duration of the effect. */ + Uint32 length; /**< Duration of the effect in milliseconds. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ @@ -676,6 +689,8 @@ typedef struct SDL_HapticLeftRight /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * + * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect. + * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. @@ -804,7 +819,7 @@ typedef union SDL_HapticEffect extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** - * \brief Get the implementation dependent name of a Haptic device. + * \brief Get the implementation dependent name of a haptic device. * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. @@ -817,9 +832,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** - * \brief Opens a Haptic device for usage. + * \brief Opens a haptic device for use. * - * The index passed as an argument refers to the N'th Haptic device on this + * The index passed as an argument refers to the N'th haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and @@ -885,15 +900,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); * \brief Checks to see if a joystick has haptic features. * * \param joystick Joystick to test for haptic capabilities. - * \return 1 if the joystick is haptic, 0 if it isn't - * or -1 if an error ocurred. + * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't + * or -1 if an error occurred. * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** - * \brief Opens a Haptic device for usage from a Joystick device. + * \brief Opens a haptic device for use from a joystick device. * * You must still close the haptic device separately. It will not be closed * with the joystick. @@ -913,7 +928,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); /** - * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). + * \brief Closes a haptic device previously opened with SDL_HapticOpen(). * * \param haptic Haptic device to close. */ @@ -957,7 +972,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); * Example: * \code * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { - * printf("We have constant haptic effect!"); + * printf("We have constant haptic effect!\n"); * } * \endcode * @@ -996,7 +1011,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. - * \return The id of the effect on success or -1 on error. + * \return The identifier of the effect on success or -1 on error. * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect @@ -1008,13 +1023,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, /** * \brief Updates the properties of an effect. * - * Can be used dynamically, although behaviour when dynamically changing + * Can be used dynamically, although behavior when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). * * \param haptic Haptic device that has the effect. - * \param effect Effect to update. + * \param effect Identifier of the effect to update. * \param data New effect properties to use. * \return 0 on success or -1 on error. * @@ -1218,6 +1233,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); #endif #include "close_code.h" -#endif /* _SDL_haptic_h */ +#endif /* SDL_haptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_hints.h b/3rdparty/sdl2-2.0.9/include/SDL_hints.h similarity index 58% rename from 3rdparty/sdl2-2.0.4/include/SDL_hints.h rename to 3rdparty/sdl2-2.0.9/include/SDL_hints.h index 3bd5435fb0..4ee72e97d6 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_hints.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * to how they would like the library to work. */ -#ifndef _SDL_hints_h -#define _SDL_hints_h +#ifndef SDL_hints_h_ +#define SDL_hints_h_ #include "SDL_stdinc.h" @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -118,6 +119,17 @@ extern "C" { */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" +/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */ +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" + /** * \brief A variable controlling the scaling quality * @@ -199,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -210,6 +234,12 @@ extern "C" { */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" +/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */ +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" + /** * \brief A variable controlling whether the windows message loop is processed by SDL * @@ -233,16 +263,58 @@ extern "C" { #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" /** -* \brief A variable controlling whether relative mouse mode is implemented using mouse warping -* -* This variable can be set to the following values: -* "0" - Relative mouse mode uses raw input -* "1" - Relative mouse mode uses mouse warping -* -* By default SDL will use raw input for relative mouse mode -*/ + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + +/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */ +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" + +/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */ +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" + +/** + * \brief A variable controlling whether relative mouse mode is implemented using mouse warping + * + * This variable can be set to the following values: + * "0" - Relative mouse mode uses raw input + * "1" - Relative mouse mode uses mouse warping + * + * By default SDL will use raw input for relative mouse mode + */ #define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" +/** + * \brief Allow mouse click events when clicking to focus an SDL window + * + * This variable can be set to the following values: + * "0" - Ignore mouse clicks that activate a window + * "1" - Generate events for mouse clicks that activate a window + * + * By default SDL will ignore mouse clicks that activate a window + */ +#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" + +/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */ +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" + /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * @@ -257,8 +329,8 @@ extern "C" { * this is problematic. This functionality can be disabled by setting this * hint. * - * As of SDL 2.0.4, SDL_EnableScreenSaver and SDL_DisableScreenSaver accomplish - * the same thing on iOS. They should be preferred over this hint. + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() + * accomplish the same thing on iOS. They should be preferred over this hint. * * This variable can be set to the following values: * "0" - Enable idle timer @@ -267,7 +339,7 @@ extern "C" { #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** - * \brief A variable controlling which orientations are allowed on iOS. + * \brief A variable controlling which orientations are allowed on iOS/Android. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. @@ -276,18 +348,65 @@ extern "C" { * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" */ #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" - + +/** + * \brief A variable controlling whether controllers used with the Apple TV + * generate UI events. + * + * When UI events are generated by controller input, the app will be + * backgrounded when the Apple TV remote's menu button is pressed, and when the + * pause or B buttons on gamepads are pressed. + * + * More information about properly making use of controllers for the Apple TV + * can be found here: + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ + * + * This variable can be set to the following values: + * "0" - Controller input does not generate UI events (the default). + * "1" - Controller input generates UI events. + */ +#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" + +/** + * \brief A variable controlling whether the Apple TV remote's joystick axes + * will automatically match the rotation of the remote. + * + * This variable can be set to the following values: + * "0" - Remote orientation does not affect joystick axes (the default). + * "1" - Joystick axes are based on the orientation of the remote. + */ +#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" + +/** + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. + * + * This variable can be set to the following values: + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + /** * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * accelerometer should be listed as a joystick device. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices @@ -298,7 +417,6 @@ extern "C" { */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" - /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * @@ -308,9 +426,8 @@ extern "C" { */ #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" - /** - * \brief A variable that lets you manually hint extra gamecontroller db entries + * \brief A variable that lets you manually hint extra gamecontroller db entries. * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * @@ -319,6 +436,31 @@ extern "C" { */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" +/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" + +/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. @@ -333,6 +475,87 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. @@ -344,7 +567,6 @@ extern "C" { */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" - /** * \brief A variable that controls the timer resolution, in milliseconds. * @@ -362,6 +584,33 @@ extern "C" { #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" +/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */ +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" + +/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */ +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" /** * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size @@ -369,7 +618,11 @@ extern "C" { * Use this hint in case you need to set SDL's threads stack size to other than the default. * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). -* Support for this hint is currently available only in the pthread backend. +* Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" @@ -431,7 +684,7 @@ extern "C" { * privacy policy. * * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL - * before calling any SDL_Init functions. The contents of the hint should + * before calling any SDL_Init() functions. The contents of the hint should * be a valid URL. For example, "http://www.example.com". * * The default value is "", which will prevent SDL from adding a privacy policy @@ -461,7 +714,7 @@ extern "C" { * The contents of this hint should be encoded as a UTF8 string. * * The default value is "Privacy Policy". This hint should only be set during app - * initialization, preferably before any calls to SDL_Init. + * initialization, preferably before any calls to SDL_Init(). * * For additional information on linking to a privacy policy, see the documentation for * SDL_HINT_WINRT_PRIVACY_POLICY_URL. @@ -595,6 +848,35 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -628,7 +910,138 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" + +/** + * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. + * + * The bitmap header version 4 is required for proper alpha channel support and + * SDL will use it when required. Should this not be desired, this hint can + * force the use of the 40 byte header version which is supported everywhere. + * + * The variable can be set to the following values: + * "0" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file with an alpha mask. SDL will use the bitmap + * header version 4 and set the alpha mask accordingly. + * "1" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file without an alpha mask. The alpha channel data + * will be in the file, but applications are going to ignore it. + * + * The default value is "0". + */ +#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" + +/** + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a + * thread's name, but it tends to cause problems with other debuggers, + * and the .NET runtime. Note that SDL 2.0.6 and later will still use + * the (safer) SetThreadDescription API, introduced in the Windows 10 + * Creators Update, if available. + * + * The variable can be set to the following values: + * "0" - SDL will raise the 0x406D1388 Exception to name threads. + * This is the default behavior of SDL <= 2.0.4. + * "1" - SDL will not raise this exception, and threads will be unnamed. (default) + * This is necessary with .NET languages or debuggers that aren't Visual Studio. + */ +#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" + +/** + * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI + * + * Also known as Z-order. The variable can take a negative or positive value. + * The default is 10000. + */ +#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" + +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + +/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */ +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" + +/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */ +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" + +/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */ +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" /** * \brief An enumeration of hint priorities @@ -669,6 +1082,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, */ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); +/** + * \brief Get a hint + * + * \return The boolean value of a hint variable. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); + +/** + * \brief type definition of the hint callback function. + */ +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); + /** * \brief Add a function to watch a particular hint * @@ -676,7 +1101,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); @@ -706,6 +1130,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void); #endif #include "close_code.h" -#endif /* _SDL_hints_h */ +#endif /* SDL_hints_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_joystick.h b/3rdparty/sdl2-2.0.9/include/SDL_joystick.h similarity index 60% rename from 3rdparty/sdl2-2.0.4/include/SDL_joystick.h rename to 3rdparty/sdl2-2.0.9/include/SDL_joystick.h index 266f3b3871..6e05a9c205 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_joystick.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * Include file for SDL joystick event handling * - * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick * behind a device_index changing as joysticks are plugged and unplugged. * * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted @@ -36,8 +36,8 @@ * */ -#ifndef _SDL_joystick_h -#define _SDL_joystick_h +#ifndef SDL_joystick_h_ +#define SDL_joystick_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -60,7 +60,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The joystick structure used to identify an SDL joystick */ +/** + * The joystick structure used to identify an SDL joystick + */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; @@ -69,20 +71,55 @@ typedef struct { Uint8 data[16]; } SDL_JoystickGUID; +/** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ typedef Sint32 SDL_JoystickID; +typedef enum +{ + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMECONTROLLER, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE +} SDL_JoystickType; + typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, - SDL_JOYSTICK_POWER_EMPTY, - SDL_JOYSTICK_POWER_LOW, - SDL_JOYSTICK_POWER_MEDIUM, - SDL_JOYSTICK_POWER_FULL, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; /* Function prototypes */ + +/** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); + /** * Count the number of joysticks attached to the system right now */ @@ -95,6 +132,52 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + +/** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** + * Get the type of a joystick, if available. + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); + +/** + * Get the instance ID of a joystick. + * This can be called before any joysticks are opened. + * If the index is out of range, this function will return -1. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); + /** * Open a joystick for use. * The index passed as an argument refers to the N'th joystick on the system. @@ -118,15 +201,40 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); /** - * Return the GUID for the joystick at this index + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); /** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); +/** + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick); + +/** + * Get the type of an opened joystick. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick); + /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes * (32 for the string plus a NULL terminator). @@ -134,7 +242,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** - * convert a string into a joystick formatted guid + * Convert a string into a joystick guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); @@ -190,6 +298,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); +#define SDL_JOYSTICK_AXIS_MAX 32767 +#define SDL_JOYSTICK_AXIS_MIN -32768 /** * Get the current state of an axis control on a joystick. * @@ -200,6 +310,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); +/** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, + int axis, Sint16 *state); + /** * \name Hat positions */ @@ -252,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a joystick previously opened with SDL_JoystickOpen(). */ @@ -268,6 +403,6 @@ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL #endif #include "close_code.h" -#endif /* _SDL_joystick_h */ +#endif /* SDL_joystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_keyboard.h b/3rdparty/sdl2-2.0.9/include/SDL_keyboard.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/include/SDL_keyboard.h rename to 3rdparty/sdl2-2.0.9/include/SDL_keyboard.h index bbba0f07bc..8748231716 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_keyboard.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL keyboard event handling */ -#ifndef _SDL_keyboard_h -#define _SDL_keyboard_h +#ifndef SDL_keyboard_h_ +#define SDL_keyboard_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -136,7 +136,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); * copy it. If the key doesn't have a name, this function returns an * empty string (""). * - * \sa SDL_Key + * \sa SDL_Keycode */ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); @@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); #endif #include "close_code.h" -#endif /* _SDL_keyboard_h */ +#endif /* SDL_keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_keycode.h b/3rdparty/sdl2-2.0.9/include/SDL_keycode.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_keycode.h rename to 3rdparty/sdl2-2.0.9/include/SDL_keycode.h index 7be9635710..d7d5b1dbcd 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_keycode.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines constants which identify keyboard keys and modifiers. */ -#ifndef _SDL_keycode_h -#define _SDL_keycode_h +#ifndef SDL_keycode_h_ +#define SDL_keycode_h_ #include "SDL_stdinc.h" #include "SDL_scancode.h" @@ -38,6 +38,9 @@ * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. */ typedef Sint32 SDL_Keycode; @@ -308,7 +311,12 @@ enum SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), - SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), + + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) }; /** @@ -336,6 +344,6 @@ typedef enum #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) -#endif /* _SDL_keycode_h */ +#endif /* SDL_keycode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_loadso.h b/3rdparty/sdl2-2.0.9/include/SDL_loadso.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/include/SDL_loadso.h rename to 3rdparty/sdl2-2.0.9/include/SDL_loadso.h index 3d540bd7dd..da56fb4527 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_loadso.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,8 @@ * the results you expect. :) */ -#ifndef _SDL_loadso_h -#define _SDL_loadso_h +#ifndef SDL_loadso_h_ +#define SDL_loadso_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); #endif #include "close_code.h" -#endif /* _SDL_loadso_h */ +#endif /* SDL_loadso_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_log.h b/3rdparty/sdl2-2.0.9/include/SDL_log.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_log.h rename to 3rdparty/sdl2-2.0.9/include/SDL_log.h index 09be1104de..e12b658860 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_log.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,8 +34,8 @@ * Others: standard error output (stderr) */ -#ifndef _SDL_log_h -#define _SDL_log_h +#ifndef SDL_log_h_ +#define SDL_log_h_ #include "SDL_stdinc.h" @@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, /** * \brief The prototype for the log output function */ -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. @@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call #endif #include "close_code.h" -#endif /* _SDL_log_h */ +#endif /* SDL_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_main.h b/3rdparty/sdl2-2.0.9/include/SDL_main.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/include/SDL_main.h rename to 3rdparty/sdl2-2.0.9/include/SDL_main.h index 9ce3754e93..98558217fc 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_main.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_main_h -#define _SDL_main_h +#ifndef SDL_main_h_ +#define SDL_main_h_ #include "SDL_stdinc.h" @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.txt for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" @@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v #endif #include "close_code.h" -#endif /* _SDL_main_h */ +#endif /* SDL_main_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_messagebox.h b/3rdparty/sdl2-2.0.9/include/SDL_messagebox.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_messagebox.h rename to 3rdparty/sdl2-2.0.9/include/SDL_messagebox.h index ec370dbbe0..b7be59d88f 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_messagebox.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_messagebox_h -#define _SDL_messagebox_h +#ifndef SDL_messagebox_h_ +#define SDL_messagebox_h_ #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ @@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t #endif #include "close_code.h" -#endif /* _SDL_messagebox_h */ +#endif /* SDL_messagebox_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_mouse.h b/3rdparty/sdl2-2.0.9/include/SDL_mouse.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_mouse.h rename to 3rdparty/sdl2-2.0.9/include/SDL_mouse.h index ea9622f0f7..d3c9f6156c 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_mouse.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL mouse event handling. */ -#ifndef _SDL_mouse_h -#define _SDL_mouse_h +#ifndef SDL_mouse_h_ +#define SDL_mouse_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -38,10 +38,10 @@ extern "C" { #endif -typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ +typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** - * \brief Cursor types for SDL_CreateSystemCursor. + * \brief Cursor types for SDL_CreateSystemCursor(). */ typedef enum { @@ -254,9 +254,11 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); /** - * \brief Frees a cursor created with SDL_CreateCursor(). + * \brief Frees a cursor created with SDL_CreateCursor() or similar functions. * * \sa SDL_CreateCursor() + * \sa SDL_CreateColorCursor() + * \sa SDL_CreateSystemCursor() */ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); @@ -295,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); #endif #include "close_code.h" -#endif /* _SDL_mouse_h */ +#endif /* SDL_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_mutex.h b/3rdparty/sdl2-2.0.9/include/SDL_mutex.h similarity index 98% rename from 3rdparty/sdl2-2.0.4/include/SDL_mutex.h rename to 3rdparty/sdl2-2.0.9/include/SDL_mutex.h index b7e39734e9..ba4247ced8 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_mutex.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mutex_h -#define _SDL_mutex_h +#ifndef SDL_mutex_h_ +#define SDL_mutex_h_ /** * \file SDL_mutex.h @@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, #endif #include "close_code.h" -#endif /* _SDL_mutex_h */ +#endif /* SDL_mutex_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_name.h b/3rdparty/sdl2-2.0.9/include/SDL_name.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/include/SDL_name.h rename to 3rdparty/sdl2-2.0.9/include/SDL_name.h index 06cd4a5e25..ecd863f4ca 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_name.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDLname_h_ -#define _SDLname_h_ +#ifndef SDLname_h_ +#define SDLname_h_ #if defined(__STDC__) || defined(__cplusplus) #define NeedFunctionPrototypes 1 @@ -28,6 +28,6 @@ #define SDL_NAME(X) SDL_##X -#endif /* _SDLname_h_ */ +#endif /* SDLname_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengl.h b/3rdparty/sdl2-2.0.9/include/SDL_opengl.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengl.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengl.h index 780919bc48..253d9c93a9 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_opengl.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,8 @@ * version included in SDL_opengl.h. */ -#ifndef _SDL_opengl_h -#define _SDL_opengl_h +#ifndef SDL_opengl_h_ +#define SDL_opengl_h_ #include "SDL_config.h" @@ -97,6 +97,13 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall +#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ +# define GLAPI extern +# define GLAPIENTRY _System +# define APIENTRY _System +# if defined(__GNUC__) && !defined(_System) +# define _System +# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY @@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t #endif /* !__IPHONEOS__ */ -#endif /* _SDL_opengl_h */ +#endif /* SDL_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengl_glext.h b/3rdparty/sdl2-2.0.9/include/SDL_opengl_glext.h similarity index 100% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengl_glext.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengl_glext.h diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles.h index bcc127779d..18dd984b3e 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_opengles.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ * * This is a simple file to encapsulate the OpenGL ES 1.X API headers. */ +#include "SDL_config.h" #ifdef __IPHONEOS__ #include diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles2.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles2.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles2.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles2.h index edcd1a24ae..6ccecf2165 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_opengles2.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ * * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. */ +#include "SDL_config.h" + #ifndef _MSC_VER #ifdef __IPHONEOS__ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2.h similarity index 100% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2.h diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2ext.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2ext.h similarity index 100% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2ext.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2ext.h diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2platform.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2platform.h similarity index 100% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2platform.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2platform.h diff --git a/3rdparty/sdl2-2.0.4/include/SDL_opengles2_khrplatform.h b/3rdparty/sdl2-2.0.9/include/SDL_opengles2_khrplatform.h similarity index 100% rename from 3rdparty/sdl2-2.0.4/include/SDL_opengles2_khrplatform.h rename to 3rdparty/sdl2-2.0.9/include/SDL_opengles2_khrplatform.h diff --git a/3rdparty/sdl2-2.0.4/include/SDL_pixels.h b/3rdparty/sdl2-2.0.9/include/SDL_pixels.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_pixels.h rename to 3rdparty/sdl2-2.0.9/include/SDL_pixels.h index 8499c32896..0b4364b185 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_pixels.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,11 @@ * Header for the enumerated pixel format definitions. */ -#ifndef _SDL_pixels_h -#define _SDL_pixels_h +#ifndef SDL_pixels_h_ +#define SDL_pixels_h_ #include "SDL_stdinc.h" +#include "SDL_endian.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -260,6 +261,19 @@ enum SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4), + /* Aliases for RGBA byte arrays of color data, for the current platform */ +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, +#else + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, +#endif + SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ @@ -273,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color @@ -449,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); #endif #include "close_code.h" -#endif /* _SDL_pixels_h */ +#endif /* SDL_pixels_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_platform.h b/3rdparty/sdl2-2.0.9/include/SDL_platform.h similarity index 77% rename from 3rdparty/sdl2-2.0.4/include/SDL_platform.h rename to 3rdparty/sdl2-2.0.9/include/SDL_platform.h index c6c21398b2..7dea4ce940 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_platform.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Try to get a standard set of platform defines. */ -#ifndef _SDL_platform_h -#define _SDL_platform_h +#ifndef SDL_platform_h_ +#define SDL_platform_h_ #if defined(_AIX) #undef __AIX__ @@ -70,18 +70,22 @@ /* lets us know what version of Mac OS X we're compiling on */ #include "AvailabilityMacros.h" #include "TargetConditionals.h" +#if TARGET_OS_TV +#undef __TVOS__ +#define __TVOS__ 1 +#endif #if TARGET_OS_IPHONE -/* if compiling for iPhone */ +/* if compiling for iOS */ #undef __IPHONEOS__ #define __IPHONEOS__ 1 #undef __MACOSX__ #else -/* if not compiling for iPhone */ +/* if not compiling for iOS */ #undef __MACOSX__ #define __MACOSX__ 1 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# error SDL for Mac OS X only supports deploying on 10.5 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error SDL for Mac OS X only supports deploying on 10.6 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ @@ -93,7 +97,7 @@ #undef __OPENBSD__ #define __OPENBSD__ 1 #endif -#if defined(__OS2__) +#if defined(__OS2__) || defined(__EMX__) #undef __OS2__ #define __OS2__ 1 #endif @@ -116,21 +120,34 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ -/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H #include -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#undef __WINDOWS__ -#define __WINDOWS__ 1 -/* See if we're compiling for WinRT: */ -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 -#endif #else #undef __WINDOWS__ -#define __WINDOWS__ 1 -#endif /* _MSC_VER < 1700 */ +#define __WINDOWS__ 1 +#endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ #if defined(__WINDOWS__) @@ -176,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); #endif #include "close_code.h" -#endif /* _SDL_platform_h */ +#endif /* SDL_platform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_power.h b/3rdparty/sdl2-2.0.9/include/SDL_power.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_power.h rename to 3rdparty/sdl2-2.0.9/include/SDL_power.h index 24c0501149..a4fe8a9359 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_power.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_power_h -#define _SDL_power_h +#ifndef SDL_power_h_ +#define SDL_power_h_ /** * \file SDL_power.h @@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); #endif #include "close_code.h" -#endif /* _SDL_power_h */ +#endif /* SDL_power_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_quit.h b/3rdparty/sdl2-2.0.9/include/SDL_quit.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_quit.h rename to 3rdparty/sdl2-2.0.9/include/SDL_quit.h index cc06f28d89..fea56a8d88 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_quit.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL quit event handling. */ -#ifndef _SDL_quit_h -#define _SDL_quit_h +#ifndef SDL_quit_h_ +#define SDL_quit_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -55,4 +55,4 @@ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) -#endif /* _SDL_quit_h */ +#endif /* SDL_quit_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_rect.h b/3rdparty/sdl2-2.0.9/include/SDL_rect.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/include/SDL_rect.h rename to 3rdparty/sdl2-2.0.9/include/SDL_rect.h index bbcb9a3b8a..543bb61869 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_rect.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL_rect definition and management functions. */ -#ifndef _SDL_rect_h -#define _SDL_rect_h +#ifndef SDL_rect_h_ +#define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * #endif #include "close_code.h" -#endif /* _SDL_rect_h */ +#endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_render.h b/3rdparty/sdl2-2.0.9/include/SDL_render.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_render.h rename to 3rdparty/sdl2-2.0.9/include/SDL_render.h index e4ed2af693..d336192974 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_render.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,8 +45,8 @@ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ -#ifndef _SDL_render_h -#define _SDL_render_h +#ifndef SDL_render_h_ +#define SDL_render_h_ #include "SDL_stdinc.h" #include "SDL_rect.h" @@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, * active, the format was unsupported, or the width or height were out * of range. * + * \note The contents of the texture are not defined at creation. + * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() @@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. - * \param pixels The raw pixel data. + * \param pixels The raw pixel data in the format of the texture. * \param pitch The number of bytes in a row of pixel data, including padding between lines. * + * The pixel data must be in the format of the texture. The pixel format can be + * queried with SDL_QueryTexture. + * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. @@ -499,6 +504,30 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in */ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); +/** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, + SDL_bool enable); + +/** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer); + /** * \brief Set the drawing area for rendering on the current target. * @@ -658,7 +687,8 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, /** * \brief Clear the current rendering target with the drawing color * - * This function clears the entire rendering target, ignoring the viewport. + * This function clears the entire rendering target, ignoring the viewport and + * the clip rectangle. * * \return 0 on success, or -1 on error */ @@ -791,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. - * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * @@ -868,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -875,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); #endif #include "close_code.h" -#endif /* _SDL_render_h */ +#endif /* SDL_render_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_revision.h b/3rdparty/sdl2-2.0.9/include/SDL_revision.h new file mode 100644 index 0000000000..92fbe67b13 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_revision.h @@ -0,0 +1,2 @@ +#define SDL_REVISION "hg-12373:8feb5da6f2fb" +#define SDL_REVISION_NUMBER 12373 diff --git a/3rdparty/sdl2-2.0.4/include/SDL_rwops.h b/3rdparty/sdl2-2.0.9/include/SDL_rwops.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/include/SDL_rwops.h rename to 3rdparty/sdl2-2.0.9/include/SDL_rwops.h index f460ae7d40..0960699d48 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_rwops.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ * data streams. It can easily be extended to files, memory, etc. */ -#ifndef _SDL_rwops_h -#define _SDL_rwops_h +#ifndef SDL_rwops_h_ +#define SDL_rwops_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -39,12 +39,12 @@ extern "C" { #endif /* RWops Types */ -#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ -#define SDL_RWOPS_WINFILE 1 /* Win32 file */ -#define SDL_RWOPS_STDFILE 2 /* Stdio file */ -#define SDL_RWOPS_JNIFILE 3 /* Android asset */ -#define SDL_RWOPS_MEMORY 4 /* Memory stream */ -#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ +#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ +#define SDL_RWOPS_WINFILE 1U /**< Win32 file */ +#define SDL_RWOPS_STDFILE 2U /**< Stdio file */ +#define SDL_RWOPS_JNIFILE 3U /**< Android asset */ +#define SDL_RWOPS_MEMORY 4U /**< Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. @@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); /* @} *//* Read/write macros */ +/** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, + int freesrc); + +/** + * Load an entire file. + * + * Convenience macro. + */ +#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) + /** * \name Read endian functions * @@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); #endif #include "close_code.h" -#endif /* _SDL_rwops_h */ +#endif /* SDL_rwops_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_scancode.h b/3rdparty/sdl2-2.0.9/include/SDL_scancode.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_scancode.h rename to 3rdparty/sdl2-2.0.9/include/SDL_scancode.h index 0af1dd59f8..63871aa3b1 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_scancode.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines keyboard scancodes. */ -#ifndef _SDL_scancode_h -#define _SDL_scancode_h +#ifndef SDL_scancode_h_ +#define SDL_scancode_h_ #include "SDL_stdinc.h" @@ -38,7 +38,7 @@ * SDL_Event structure. * * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf */ typedef enum { @@ -390,12 +390,24 @@ typedef enum /* @} *//* Walther keys */ + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + + /* @} *//* Usage page 0x0C (additional media keys) */ + /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; -#endif /* _SDL_scancode_h */ +#endif /* SDL_scancode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_sensor.h b/3rdparty/sdl2-2.0.9/include/SDL_sensor.h new file mode 100644 index 0000000000..ac163a8cd1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_sensor.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef _SDL_sensor_h +#define _SDL_sensor_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This includes gravity, so a device at rest will have + * an acceleration of SDL_STANDARD_GRAVITY straight down. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis + * values[1]: Angular speed around the y axis + * values[2]: Angular speed around the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_sensor_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_shape.h b/3rdparty/sdl2-2.0.9/include/SDL_shape.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/include/SDL_shape.h rename to 3rdparty/sdl2-2.0.9/include/SDL_shape.h index db10a8f010..40a6baaaec 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_shape.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_shape_h -#define _SDL_shape_h +#ifndef SDL_shape_h_ +#define SDL_shape_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * \param window The window to query for being shaped. * * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * * \sa SDL_CreateShapedWindow */ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); @@ -91,7 +92,7 @@ typedef enum { /** \brief A union containing parameters for shaped windows. */ typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ Uint8 binarizationCutoff; SDL_Color colorKey; } SDL_WindowShapeParams; @@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode { * \param shape A surface encoding the desired shape for the window. * \param shape_mode The parameters to set for the shaped window. * - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW - * if the SDL_Window* given does not reference a valid shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window given does not reference a valid shaped window. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode. @@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s * * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if - * the SDL_Window* given is a shapeable window currently lacking a shape. + * the SDL_Window given is a shapeable window currently lacking a shape. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape @@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo #endif #include "close_code.h" -#endif /* _SDL_shape_h */ +#endif /* SDL_shape_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_stdinc.h b/3rdparty/sdl2-2.0.9/include/SDL_stdinc.h similarity index 79% rename from 3rdparty/sdl2-2.0.4/include/SDL_stdinc.h rename to 3rdparty/sdl2-2.0.9/include/SDL_stdinc.h index 887bcd2d46..e373bc380f 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_stdinc.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This is a general header that includes C language support. */ -#ifndef _SDL_stdinc_h -#define _SDL_stdinc_h +#ifndef SDL_stdinc_h_ +#define SDL_stdinc_h_ #include "SDL_config.h" @@ -62,6 +62,9 @@ #ifdef HAVE_STRINGS_H # include #endif +#ifdef HAVE_WCHAR_H +# include +#endif #if defined(HAVE_INTTYPES_H) # include #elif defined(HAVE_STDINT_H) @@ -83,8 +86,27 @@ #ifdef HAVE_FLOAT_H # include #endif -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -# include +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif #endif /** @@ -93,6 +115,13 @@ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_TABLESIZE(table) SDL_arraysize(table) +/** + * Macro useful for building other macros with strings in them + * + * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n") + */ +#define SDL_STRINGIFY_ARG(arg) #arg + /** * \name Cast operators * @@ -123,44 +152,67 @@ */ /* @{ */ +#ifdef __CC_ARM +/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ +#define SDL_FALSE 0 +#define SDL_TRUE 1 +typedef int SDL_bool; +#else typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; +#endif /** * \brief A signed 8-bit integer type. */ +#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ +#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ +#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ +#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ +#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ +#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ +#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ +#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ +#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ +#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ +#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ +#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ +#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ +#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ +#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ +#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ typedef uint64_t Uint64; /* @} *//* Basic data types */ @@ -258,7 +310,7 @@ typedef uint64_t Uint64; #endif /* SDL_DISABLE_ANALYZE_MACROS */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] + typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -298,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -333,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); +typedef void *(SDLCALL *SDL_malloc_func)(size_t size); +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); +typedef void (SDLCALL *SDL_free_func)(void *mem); + +/** + * \brief Get the current set of SDL memory functions + */ +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** + * \brief Replace SDL's memory allocation functions with a custom set + * + * \note If you are replacing SDL's memory functions, you should call + * SDL_GetNumAllocations() and be very careful if it returns non-zero. + * That means that your free function will be called with memory + * allocated by the previous memory allocation functions. + */ +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func); + +/** + * \brief Get the number of outstanding (unfreed) allocations + */ +extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); + extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); @@ -375,24 +436,25 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) return; switch (dwords % 4) { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); @@ -405,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -433,23 +496,40 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #ifndef HAVE_M_PI #ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 /* pi */ +#define M_PI 3.14159265358979323846264338327950288 /**< pi */ #endif #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); @@ -522,6 +602,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B #endif #include "close_code.h" -#endif /* _SDL_stdinc_h */ +#endif /* SDL_stdinc_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_surface.h b/3rdparty/sdl2-2.0.9/include/SDL_surface.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/include/SDL_surface.h rename to 3rdparty/sdl2-2.0.9/include/SDL_surface.h index e63ca89038..730d49fc80 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_surface.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for ::SDL_Surface definition and management functions. */ -#ifndef _SDL_surface_h -#define _SDL_surface_h +#ifndef SDL_surface_h_ +#define SDL_surface_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -94,8 +94,19 @@ typedef struct SDL_Surface /** * \brief The type of function used for surface blitting functions. */ -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, - struct SDL_Surface * dst, SDL_Rect * dstrect); +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; /** * Allocate and free an RGB surface. @@ -118,6 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); + +/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat + (Uint32 flags, int width, int height, int depth, Uint32 format); + extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, @@ -127,6 +143,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom + (void *pixels, int width, int height, int depth, int pitch, Uint32 format); extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); /** @@ -184,6 +202,12 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, /** * Save a surface to a seekable SDL data stream (memory or file). * + * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + * BMP directly. Other RGB formats with 8-bit or higher get converted to a + * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + * not supported. + * * If \c freedst is non-zero, the stream will be closed after being written. * * \return 0 if successful or -1 if there was an error. @@ -224,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + /** * \brief Gets the color key (transparent pixel) in a blittable surface. * @@ -346,6 +377,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); +/* + * Creates a new surface identical to the existing surface + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface); + /** * Creates a new surface of the specified format, and then copies and maps * the given surface to it so the blit of the converted surface will be as @@ -491,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -498,6 +548,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled #endif #include "close_code.h" -#endif /* _SDL_surface_h */ +#endif /* SDL_surface_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_system.h b/3rdparty/sdl2-2.0.9/include/SDL_system.h similarity index 79% rename from 3rdparty/sdl2-2.0.4/include/SDL_system.h rename to 3rdparty/sdl2-2.0.9/include/SDL_system.h index 5da9adb459..4dc372d6b1 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_system.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for platform specific SDL API functions */ -#ifndef _SDL_system_h -#define _SDL_system_h +#ifndef SDL_system_h_ +#define SDL_system_h_ #include "SDL_stdinc.h" #include "SDL_keyboard.h" @@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a #endif /* __WIN32__ */ +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ @@ -96,7 +108,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application @@ -106,7 +118,27 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); + +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); /** See the official Android developer guide for more information: @@ -121,7 +153,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); This path is unique to your application and cannot be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: @@ -130,7 +162,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); If external storage is currently unavailable, this will return 0. */ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. @@ -138,7 +170,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); This path is unique to your application, but is public and can be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ @@ -169,6 +201,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,14 +254,26 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_system_h */ +#endif /* SDL_system_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_syswm.h b/3rdparty/sdl2-2.0.9/include/SDL_syswm.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/include/SDL_syswm.h rename to 3rdparty/sdl2-2.0.9/include/SDL_syswm.h index 1056e526bc..f1c4021cc8 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_syswm.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,20 +25,14 @@ * Include file for SDL custom system window manager hooks. */ -#ifndef _SDL_syswm_h -#define _SDL_syswm_h +#ifndef SDL_syswm_h_ +#define SDL_syswm_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -106,6 +100,16 @@ typedef struct ANativeWindow ANativeWindow; typedef void *EGLSurface; #endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) +#include "SDL_egl.h" +#endif + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ @@ -120,7 +124,9 @@ typedef enum SDL_SYSWM_WAYLAND, SDL_SYSWM_MIR, SDL_SYSWM_WINRT, - SDL_SYSWM_ANDROID + SDL_SYSWM_ANDROID, + SDL_SYSWM_VIVANTE, + SDL_SYSWM_OS2 } SDL_SYSWM_TYPE; /** @@ -166,6 +172,13 @@ struct SDL_SysWMmsg int dummy; /* No UIKit window events yet */ } uikit; +#endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + int dummy; + /* No Vivante window events yet */ + } vivante; #endif /* Can't have an empty union */ int dummy; @@ -189,6 +202,7 @@ struct SDL_SysWMinfo { HWND window; /**< The window handle */ HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) @@ -216,9 +230,9 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - NSWindow __unsafe_unretained *window; /* The Cocoa window */ + NSWindow __unsafe_unretained *window; /**< The Cocoa window */ #else - NSWindow *window; /* The Cocoa window */ + NSWindow *window; /**< The Cocoa window */ #endif } cocoa; #endif @@ -226,13 +240,13 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - UIWindow __unsafe_unretained *window; /* The UIKit window */ + UIWindow __unsafe_unretained *window; /**< The UIKit window */ #else - UIWindow *window; /* The UIKit window */ + UIWindow *window; /**< The UIKit window */ #endif - GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ - GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ - GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ + GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ + GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ + GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ } uikit; #endif #if defined(SDL_VIDEO_DRIVER_WAYLAND) @@ -259,8 +273,17 @@ struct SDL_SysWMinfo } android; #endif - /* Can't have an empty union */ - int dummy; +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + EGLNativeDisplayType display; + EGLNativeWindowType window; + } vivante; +#endif + + /* Make sure this union is always 64 bytes (8 64-bit pointers). */ + /* Be careful not to overflow this if you add a new target! */ + Uint8 dummy[64]; } info; }; @@ -296,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, #endif #include "close_code.h" -#endif /* _SDL_syswm_h */ +#endif /* SDL_syswm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test.h b/3rdparty/sdl2-2.0.9/include/SDL_test.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/include/SDL_test.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test.h index 217847bfc9..6cc373bf80 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,21 +27,22 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_h -#define _SDL_test_h +#ifndef SDL_test_h_ +#define SDL_test_h_ #include "SDL.h" +#include "SDL_test_assert.h" #include "SDL_test_common.h" +#include "SDL_test_compare.h" +#include "SDL_test_crc32.h" #include "SDL_test_font.h" -#include "SDL_test_random.h" #include "SDL_test_fuzzer.h" -#include "SDL_test_crc32.h" -#include "SDL_test_md5.h" -#include "SDL_test_log.h" -#include "SDL_test_assert.h" #include "SDL_test_harness.h" #include "SDL_test_images.h" -#include "SDL_test_compare.h" +#include "SDL_test_log.h" +#include "SDL_test_md5.h" +#include "SDL_test_memory.h" +#include "SDL_test_random.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -63,6 +64,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_h */ +#endif /* SDL_test_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_assert.h b/3rdparty/sdl2-2.0.9/include/SDL_test_assert.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_assert.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_assert.h index 29277e1221..1788d7a206 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_assert.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_assert_h -#define _SDL_test_assert_h +#ifndef SDL_test_assert_h_ +#define SDL_test_assert_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /** * \brief Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary(); +void SDLTest_ResetAssertSummary(void); /** * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ -void SDLTest_LogAssertSummary(); +void SDLTest_LogAssertSummary(void); /** @@ -93,13 +93,13 @@ void SDLTest_LogAssertSummary(); * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ -int SDLTest_AssertSummaryToTestResult(); +int SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_assert_h */ +#endif /* SDL_test_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_common.h b/3rdparty/sdl2-2.0.9/include/SDL_test_common.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_common.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_common.h index 0ebf31cb67..be2e6b2aab 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_common.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,8 @@ /* Ported from original test\common.h file. */ -#ifndef _SDL_test_common_h -#define _SDL_test_common_h +#ifndef SDL_test_common_h_ +#define SDL_test_common_h_ #include "SDL.h" @@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state); #endif #include "close_code.h" -#endif /* _SDL_test_common_h */ +#endif /* SDL_test_common_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_compare.h b/3rdparty/sdl2-2.0.9/include/SDL_test_compare.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_compare.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_compare.h index 772cf9fbd7..c22e447d8a 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_compare.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_compare_h -#define _SDL_test_compare_h +#ifndef SDL_test_compare_h_ +#define SDL_test_compare_h_ #include "SDL.h" @@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, #endif #include "close_code.h" -#endif /* _SDL_test_compare_h */ +#endif /* SDL_test_compare_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_crc32.h b/3rdparty/sdl2-2.0.9/include/SDL_test_crc32.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_crc32.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_crc32.h index 572a3d9551..3d235d0740 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_crc32.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_crc32_h -#define _SDL_test_crc32_h +#ifndef SDL_test_crc32_h_ +#define SDL_test_crc32_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -93,7 +93,7 @@ extern "C" { * \returns 0 for OK, -1 on error * */ -int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); +int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); @@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); #endif #include "close_code.h" -#endif /* _SDL_test_crc32_h */ +#endif /* SDL_test_crc32_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_font.h b/3rdparty/sdl2-2.0.9/include/SDL_test_font.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_font.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_font.h index 3378ea85b2..59cbdcad6b 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_font.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,8 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_font_h -#define _SDL_test_font_h +#ifndef SDL_test_font_h_ +#define SDL_test_font_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -50,7 +50,7 @@ extern "C" { * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); /** * \brief Draw a string in the currently set font. @@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); +int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); +/** + * \brief Cleanup textures used by font drawing functions. + */ +void SDLTest_CleanupTextDrawing(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_font_h */ +#endif /* SDL_test_font_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_fuzzer.h b/3rdparty/sdl2-2.0.9/include/SDL_test_fuzzer.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_fuzzer.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_fuzzer.h index 9603652b28..8fcb9ebbfa 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_fuzzer.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_fuzzer_h -#define _SDL_test_fuzzer_h +#ifndef SDL_test_fuzzer_h_ +#define SDL_test_fuzzer_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey); * * \returns Generated integer */ -Uint8 SDLTest_RandomUint8(); +Uint8 SDLTest_RandomUint8(void); /** * Returns a random Sint8 * * \returns Generated signed integer */ -Sint8 SDLTest_RandomSint8(); +Sint8 SDLTest_RandomSint8(void); /** @@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8(); * * \returns Generated integer */ -Uint16 SDLTest_RandomUint16(); +Uint16 SDLTest_RandomUint16(void); /** * Returns a random Sint16 * * \returns Generated signed integer */ -Sint16 SDLTest_RandomSint16(); +Sint16 SDLTest_RandomSint16(void); /** @@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16(); * * \returns Generated integer */ -Sint32 SDLTest_RandomSint32(); +Sint32 SDLTest_RandomSint32(void); /** @@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32(); * * \returns Generated integer */ -Uint32 SDLTest_RandomUint32(); +Uint32 SDLTest_RandomUint32(void); /** * Returns random Uint64. * * \returns Generated integer */ -Uint64 SDLTest_RandomUint64(); +Uint64 SDLTest_RandomUint64(void); /** @@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64(); * * \returns Generated signed integer */ -Sint64 SDLTest_RandomSint64(); +Sint64 SDLTest_RandomSint64(void); /** * \returns random float in range [0.0 - 1.0[ */ -float SDLTest_RandomUnitFloat(); +float SDLTest_RandomUnitFloat(void); /** * \returns random double in range [0.0 - 1.0[ */ -double SDLTest_RandomUnitDouble(); +double SDLTest_RandomUnitDouble(void); /** * \returns random float. * */ -float SDLTest_RandomFloat(); +float SDLTest_RandomFloat(void); /** * \returns random double. * */ -double SDLTest_RandomDouble(); +double SDLTest_RandomDouble(void); /** * Returns a random boundary value for Uint8 within the given boundaries. @@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); * * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. */ -char * SDLTest_RandomAsciiString(); +char * SDLTest_RandomAsciiString(void); /** @@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size); /** * Returns the invocation count for the fuzzer since last ...FuzzerInit. */ -int SDLTest_GetFuzzerInvocationCount(); +int SDLTest_GetFuzzerInvocationCount(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount(); #endif #include "close_code.h" -#endif /* _SDL_test_fuzzer_h */ +#endif /* SDL_test_fuzzer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_harness.h b/3rdparty/sdl2-2.0.9/include/SDL_test_harness.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_harness.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_harness.h index 74c0950cda..8641e0a7e3 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_harness.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ Based on original GSOC code by Markus Kauppila */ -#ifndef _SDL_test_harness_h -#define _SDL_test_harness_h +#ifndef SDL_test_h_arness_h +#define SDL_test_h_arness_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -98,6 +98,17 @@ typedef struct SDLTest_TestSuiteReference { } SDLTest_TestSuiteReference; +/** + * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * + * Note: The returned string needs to be deallocated by the caller. + * + * \param length The length of the seed string to generate + * + * \returns The generated seed string + */ +char *SDLTest_GenerateRunSeed(const int length); + /** * \brief Execute a test suite using the given run seed and execution key. * @@ -118,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user #endif #include "close_code.h" -#endif /* _SDL_test_harness_h */ +#endif /* SDL_test_h_arness_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_images.h b/3rdparty/sdl2-2.0.9/include/SDL_test_images.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_images.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_images.h index 8c64b4feb4..9c4dd5b829 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_images.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_images_h -#define _SDL_test_images_h +#ifndef SDL_test_images_h_ +#define SDL_test_images_h_ #include "SDL.h" @@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s { } SDLTest_SurfaceImage_t; /* Test images */ -SDL_Surface *SDLTest_ImageBlit(); -SDL_Surface *SDLTest_ImageBlitColor(); -SDL_Surface *SDLTest_ImageBlitAlpha(); -SDL_Surface *SDLTest_ImageBlitBlendAdd(); -SDL_Surface *SDLTest_ImageBlitBlend(); -SDL_Surface *SDLTest_ImageBlitBlendMod(); -SDL_Surface *SDLTest_ImageBlitBlendNone(); -SDL_Surface *SDLTest_ImageBlitBlendAll(); -SDL_Surface *SDLTest_ImageFace(); -SDL_Surface *SDLTest_ImagePrimitives(); -SDL_Surface *SDLTest_ImagePrimitivesBlend(); +SDL_Surface *SDLTest_ImageBlit(void); +SDL_Surface *SDLTest_ImageBlitColor(void); +SDL_Surface *SDLTest_ImageBlitAlpha(void); +SDL_Surface *SDLTest_ImageBlitBlendAdd(void); +SDL_Surface *SDLTest_ImageBlitBlend(void); +SDL_Surface *SDLTest_ImageBlitBlendMod(void); +SDL_Surface *SDLTest_ImageBlitBlendNone(void); +SDL_Surface *SDLTest_ImageBlitBlendAll(void); +SDL_Surface *SDLTest_ImageFace(void); +SDL_Surface *SDLTest_ImagePrimitives(void); +SDL_Surface *SDLTest_ImagePrimitivesBlend(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend(); #endif #include "close_code.h" -#endif /* _SDL_test_images_h */ +#endif /* SDL_test_images_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_log.h b/3rdparty/sdl2-2.0.9/include/SDL_test_log.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_log.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_log.h index 73a5c016fb..ebd44fb502 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_log.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_log_h -#define _SDL_test_log_h +#ifndef SDL_test_log_h_ +#define SDL_test_log_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_ #endif #include "close_code.h" -#endif /* _SDL_test_log_h */ +#endif /* SDL_test_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_md5.h b/3rdparty/sdl2-2.0.9/include/SDL_test_md5.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_md5.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_md5.h index f2d9a7d7e3..0e4105768f 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_md5.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,8 +53,8 @@ *********************************************************************** */ -#ifndef _SDL_test_md5_h -#define _SDL_test_md5_h +#ifndef SDL_test_md5_h_ +#define SDL_test_md5_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -124,6 +124,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_md5_h */ +#endif /* SDL_test_md5_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_test_memory.h b/3rdparty/sdl2-2.0.9/include/SDL_test_memory.h new file mode 100644 index 0000000000..4827ae6f2c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_memory.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_memory.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_memory_h_ +#define SDL_test_memory_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \brief Start tracking SDL memory allocations + * + * \note This should be called before any other SDL functions for complete tracking coverage + */ +int SDLTest_TrackAllocations(); + +/** + * \brief Print a log of any outstanding allocations + * + * \note This can be called after SDL_Quit() + */ +void SDLTest_LogAllocations(); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_memory_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_test_random.h b/3rdparty/sdl2-2.0.9/include/SDL_test_random.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/include/SDL_test_random.h rename to 3rdparty/sdl2-2.0.9/include/SDL_test_random.h index 91c36526cb..0eb414ff2e 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_test_random.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,8 @@ */ -#ifndef _SDL_test_random_h -#define _SDL_test_random_h +#ifndef SDL_test_random_h_ +#define SDL_test_random_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -110,6 +110,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_random_h */ +#endif /* SDL_test_random_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_thread.h b/3rdparty/sdl2-2.0.9/include/SDL_thread.h similarity index 70% rename from 3rdparty/sdl2-2.0.4/include/SDL_thread.h rename to 3rdparty/sdl2-2.0.9/include/SDL_thread.h index 377e6c73d1..554dd0b61d 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_thread.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_thread_h -#define _SDL_thread_h +#ifndef SDL_thread_h_ +#define SDL_thread_h_ /** * \file SDL_thread.h @@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * - * \note On many systems you require special privileges to set high priority. + * \note On many systems you require special privileges to set high or time critical priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL } SDL_ThreadPriority; /** @@ -74,15 +75,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will + * API. There is a problem with this, that only the RTL of the SDL2.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL2.DLL which uses this API, + * then the RTL of SDL2.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -90,14 +91,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD -#include /* This has _beginthread() and _endthread() defined! */ - -typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall * - func) (void - *), - void *arg, unsigned, - unsigned *threadID); +#include /* _beginthreadex() and _endthreadex() */ + +typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) + (void *, unsigned, unsigned (__stdcall *func)(void *), + void * /*arg*/, unsigned, unsigned * /* threadID */); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** @@ -108,18 +106,68 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#endif + +#elif defined(__OS2__) +/* + * just like the windows case above: We compile SDL2 + * into a dll with Watcom's runtime statically linked. + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#ifndef __EMX__ +#include +#else +#include +#endif +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); +typedef void (*pfnSDL_CurrentEndThread)(void); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + /** * Create a thread. * @@ -137,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. */ extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); #endif @@ -273,7 +329,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); /* Ends C function definitions when using C++ */ @@ -282,6 +338,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d #endif #include "close_code.h" -#endif /* _SDL_thread_h */ +#endif /* SDL_thread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_timer.h b/3rdparty/sdl2-2.0.9/include/SDL_timer.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_timer.h rename to 3rdparty/sdl2-2.0.9/include/SDL_timer.h index e0d3785ee8..5600618ff4 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_timer.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_timer_h -#define _SDL_timer_h +#ifndef SDL_timer_h_ +#define SDL_timer_h_ /** * \file SDL_timer.h @@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); #endif #include "close_code.h" -#endif /* _SDL_timer_h */ +#endif /* SDL_timer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_touch.h b/3rdparty/sdl2-2.0.9/include/SDL_touch.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_touch.h rename to 3rdparty/sdl2-2.0.9/include/SDL_touch.h index 2643e36796..f4075e79a5 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_touch.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL touch event handling. */ -#ifndef _SDL_touch_h -#define _SDL_touch_h +#ifndef SDL_touch_h_ +#define SDL_touch_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int #endif #include "close_code.h" -#endif /* _SDL_touch_h */ +#endif /* SDL_touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_types.h b/3rdparty/sdl2-2.0.9/include/SDL_types.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/include/SDL_types.h rename to 3rdparty/sdl2-2.0.9/include/SDL_types.h index 5118af2191..4ac248c8c5 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_types.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/include/SDL_version.h b/3rdparty/sdl2-2.0.9/include/SDL_version.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/include/SDL_version.h rename to 3rdparty/sdl2-2.0.9/include/SDL_version.h index de1f160565..31443e149a 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_version.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This header defines the current SDL version. */ -#ifndef _SDL_version_h -#define _SDL_version_h +#ifndef SDL_version_h_ +#define SDL_version_h_ #include "SDL_stdinc.h" @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 4 +#define SDL_PATCHLEVEL 9 /** * \brief Macro to determine SDL version program was compiled against. @@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); #endif #include "close_code.h" -#endif /* _SDL_version_h */ +#endif /* SDL_version_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/include/SDL_video.h b/3rdparty/sdl2-2.0.9/include/SDL_video.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/include/SDL_video.h rename to 3rdparty/sdl2-2.0.9/include/SDL_video.h index 52dbbc765d..461f138051 100644 --- a/3rdparty/sdl2-2.0.4/include/SDL_video.h +++ b/3rdparty/sdl2-2.0.9/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL video functions. */ -#ifndef _SDL_video_h -#define _SDL_video_h +#ifndef SDL_video_h_ +#define SDL_video_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -83,6 +83,7 @@ typedef struct * \sa SDL_SetWindowPosition() * \sa SDL_SetWindowSize() * \sa SDL_SetWindowBordered() + * \sa SDL_SetWindowResizable() * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ @@ -95,6 +96,7 @@ typedef struct SDL_Window SDL_Window; */ typedef enum { + /* !!! FIXME: change this to name = (1<0. * \param h The height of the window, in screen coordinates. Must be >0. * - * \note You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. + * \note Fullscreen windows automatically match the size of the display mode, + * and you should use SDL_SetWindowDisplayMode() to change their size. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with @@ -563,6 +642,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_GetWindowSize() + * \sa SDL_SetWindowDisplayMode() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); @@ -586,6 +666,25 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); +/** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, + int *top, int *left, + int *bottom, int *right); + /** * \brief Set the minimum size of a window's client area. * @@ -661,6 +760,23 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered); +/** + * \brief Set the user-resizable state of a window. + * + * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and + * allow/disallow user resizing of the window. This is a no-op if the + * window's resizable state already matches the requested state. + * + * \param window The window of which to change the resizable state. + * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. + * + * \note You can't change the resizable state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window, + SDL_bool resizable); + /** * \brief Show a window. * @@ -744,7 +860,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() - * \sa SDL_UpdateWindowSurfaceRect() + * \sa SDL_UpdateWindowSurface() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, @@ -801,6 +917,58 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); +/** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); + +/** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); + +/** + * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); + +/** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); + /** * \brief Set the gamma ramp for a window. * @@ -920,7 +1088,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** - * \brief Returns whether the screensaver is currently enabled (default on). + * \brief Returns whether the screensaver is currently enabled (default off). * * \sa SDL_EnableScreenSaver() * \sa SDL_DisableScreenSaver() @@ -995,11 +1163,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. + * + * \return 0 on success, or -1 if the attribute could not be set. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. + * + * \return 0 on success, or -1 if the attribute could not be retrieved. + * The integer at \c value will be modified in either case. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); @@ -1098,6 +1271,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); #endif #include "close_code.h" -#endif /* _SDL_video_h */ +#endif /* SDL_video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/include/SDL_vulkan.h b/3rdparty/sdl2-2.0.9/include/SDL_vulkan.h new file mode 100644 index 0000000000..972cca4d7c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/include/SDL_vulkan.h @@ -0,0 +1,278 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_vulkan.h + * + * Header file for functions to creating Vulkan surfaces on SDL windows. + */ + +#ifndef SDL_vulkan_h_ +#define SDL_vulkan_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ + +typedef VkInstance SDL_vulkanInstance; +typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ + +/** + * \name Vulkan support functions + * + * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API + * is compatable with Tizen's implementation of Vulkan in SDL. + */ +/* @{ */ + +/** + * \brief Dynamically load a Vulkan loader library. + * + * \param [in] path The platform dependent Vulkan loader library name, or + * \c NULL. + * + * \return \c 0 on success, or \c -1 if the library couldn't be loaded. + * + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before + * creating any Vulkan windows. If no Vulkan loader library is loaded, the + * default library will be loaded upon creation of the first Vulkan window. + * + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using + * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee + * \c path points to the same vulkan loader library the application + * linked to. + * + * \note On Apple devices, if \a path is NULL, SDL will attempt to find + * the vkGetInstanceProcAddr address within all the mach-o images of + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. + * + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. + * + * \note This function will fail if there are no working Vulkan drivers + * installed. + * + * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() + * \sa SDL_Vulkan_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); + +/** + * \brief Get the address of the \c vkGetInstanceProcAddr function. + * + * \note This should be called after either calling SDL_Vulkan_LoadLibrary + * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. + */ +extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); + +/** + * \brief Unload the Vulkan loader library previously loaded by + * \c SDL_Vulkan_LoadLibrary(). + * + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); + +/** + * \brief Get the names of the Vulkan instance extensions needed to create + * a surface with \c SDL_Vulkan_CreateSurface(). + * + * \param [in] \c NULL or window Window for which the required Vulkan instance + * extensions should be retrieved + * \param [in,out] pCount pointer to an \c unsigned related to the number of + * required Vulkan instance extensions + * \param [out] pNames \c NULL or a pointer to an array to be filled with the + * required Vulkan instance extensions + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * If \a pNames is \c NULL, then the number of required Vulkan instance + * extensions is returned in pCount. Otherwise, \a pCount must point to a + * variable set to the number of elements in the \a pNames array, and on + * return the variable is overwritten with the number of names actually + * written to \a pNames. If \a pCount is less than the number of required + * extensions, at most \a pCount structures will be written. If \a pCount + * is smaller than the number of required extensions, \c SDL_FALSE will be + * returned instead of \c SDL_TRUE, to indicate that not all the required + * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. + * + * \note The returned list of extensions will contain \c VK_KHR_surface + * and zero or more platform specific extensions + * + * \note The extension names queried here must be enabled when calling + * VkCreateInstance, otherwise surface creation will fail. + * + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL + * + * \code + * unsigned int count; + * // get count of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) + * handle_error(); + * + * static const char *const additionalExtensions[] = + * { + * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension + * }; + * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); + * size_t extensionCount = count + additionalExtensionsCount; + * const char **names = malloc(sizeof(const char *) * extensionCount); + * if(!names) + * handle_error(); + * + * // get names of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) + * handle_error(); + * + * // copy additional extensions after required extensions + * for(size_t i = 0; i < additionalExtensionsCount; i++) + * names[i + count] = additionalExtensions[i]; + * + * VkInstanceCreateInfo instanceCreateInfo = {}; + * instanceCreateInfo.enabledExtensionCount = extensionCount; + * instanceCreateInfo.ppEnabledExtensionNames = names; + * // fill in rest of instanceCreateInfo + * + * VkInstance instance; + * // create the Vulkan instance + * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); + * free(names); + * \endcode + * + * \sa SDL_Vulkan_CreateSurface() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions( + SDL_Window *window, + unsigned int *pCount, + const char **pNames); + +/** + * \brief Create a Vulkan rendering surface for a window. + * + * \param [in] window SDL_Window to which to attach the rendering surface. + * \param [in] instance handle to the Vulkan instance to use. + * \param [out] surface pointer to a VkSurfaceKHR handle to receive the + * handle of the newly created surface. + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * \code + * VkInstance instance; + * SDL_Window *window; + * + * // create instance and window + * + * // create the Vulkan surface + * VkSurfaceKHR surface; + * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) + * handle_error(); + * \endcode + * + * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \note \a instance should have been created with the extensions returned + * by \c SDL_Vulkan_CreateSurface() enabled. + * + * \sa SDL_Vulkan_GetInstanceExtensions() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR* surface); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, + int *w, int *h); + +/* @} *//* Vulkan support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_vulkan_h_ */ diff --git a/3rdparty/sdl2-2.0.4/include/begin_code.h b/3rdparty/sdl2-2.0.9/include/begin_code.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/include/begin_code.h rename to 3rdparty/sdl2-2.0.9/include/begin_code.h index 04e78c64d4..6c2106246f 100644 --- a/3rdparty/sdl2-2.0.4/include/begin_code.h +++ b/3rdparty/sdl2-2.0.9/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,12 @@ # else # define DECLSPEC __declspec(dllexport) # endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -74,6 +80,11 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif #else #define SDLCALL #endif @@ -111,7 +122,7 @@ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) + defined(__DECC) || defined(__CC_ARM) #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline @@ -134,6 +145,16 @@ #endif #endif /* SDL_FORCE_INLINE not defined */ +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL diff --git a/3rdparty/sdl2-2.0.4/include/close_code.h b/3rdparty/sdl2-2.0.9/include/close_code.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/include/close_code.h rename to 3rdparty/sdl2-2.0.9/include/close_code.h index d908b00eb6..b3b70a4c83 100644 --- a/3rdparty/sdl2-2.0.4/include/close_code.h +++ b/3rdparty/sdl2-2.0.9/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif diff --git a/3rdparty/sdl2-2.0.4/sdl2-config.cmake.in b/3rdparty/sdl2-2.0.9/sdl2-config.cmake.in similarity index 87% rename from 3rdparty/sdl2-2.0.4/sdl2-config.cmake.in rename to 3rdparty/sdl2-2.0.9/sdl2-config.cmake.in index e5a036adfa..03efbe174d 100644 --- a/3rdparty/sdl2-2.0.4/sdl2-config.cmake.in +++ b/3rdparty/sdl2-2.0.9/sdl2-config.cmake.in @@ -8,3 +8,4 @@ set(SDL2_EXEC_PREFIX "@prefix@") set(SDL2_LIBDIR "@libdir@") set(SDL2_INCLUDE_DIRS "@includedir@/SDL2") set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") +string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) diff --git a/3rdparty/sdl2-2.0.4/sdl2-config.in b/3rdparty/sdl2-2.0.9/sdl2-config.in similarity index 100% rename from 3rdparty/sdl2-2.0.4/sdl2-config.in rename to 3rdparty/sdl2-2.0.9/sdl2-config.in diff --git a/3rdparty/sdl2-2.0.4/sdl2.m4 b/3rdparty/sdl2-2.0.9/sdl2.m4 similarity index 82% rename from 3rdparty/sdl2-2.0.4/sdl2.m4 rename to 3rdparty/sdl2-2.0.9/sdl2.m4 index a03b2d2706..b915f99ede 100644 --- a/3rdparty/sdl2-2.0.4/sdl2.m4 +++ b/3rdparty/sdl2-2.0.9/sdl2.m4 @@ -4,6 +4,9 @@ # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor +# +# Changelog: +# * also look for SDL2.framework under Mac OS X # serial 1 @@ -20,6 +23,10 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], + , search_sdl_framework=yes) + +AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) min_sdl_version=ifelse([$1], ,2.0.0,$1) @@ -53,14 +60,36 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run fi AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) PATH="$as_save_PATH" - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL2.framework) + if test "x$SDL2_FRAMEWORK" != x; then + sdl_framework=$SDL2_FRAMEWORK + else + for d in / ~/ /System/; do + if test -d "$dLibrary/Frameworks/SDL2.framework"; then + sdl_framework="$dLibrary/Frameworks/SDL2.framework" + fi + done + fi + + if test -d $sdl_framework; then + AC_MSG_RESULT($sdl_framework) + sdl_framework_dir=`dirname $sdl_framework` + SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" + SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + else + no_sdl=yes + fi + fi + + if test "$SDL2_CONFIG" != "no"; then + if test "x$sdl_pc" = "xno"; then + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + fi sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` @@ -141,12 +170,15 @@ int main (int argc, char *argv[]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" + + fi + if test "x$sdl_pc" = "xno"; then + if test "x$no_sdl" = "xyes"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) fi fi if test "x$no_sdl" = x ; then diff --git a/3rdparty/sdl2-2.0.4/sdl2.pc.in b/3rdparty/sdl2-2.0.9/sdl2.pc.in similarity index 100% rename from 3rdparty/sdl2-2.0.4/sdl2.pc.in rename to 3rdparty/sdl2-2.0.9/sdl2.pc.in diff --git a/3rdparty/sdl2-2.0.4/src/SDL.c b/3rdparty/sdl2-2.0.9/src/SDL.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/SDL.c rename to 3rdparty/sdl2-2.0.9/src/SDL.c index 5d310021a5..6d7e166629 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL.c +++ b/3rdparty/sdl2-2.0.9/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,13 +33,11 @@ #include "events/SDL_events_c.h" #include "haptic/SDL_haptic_c.h" #include "joystick/SDL_joystick_c.h" +#include "sensor/SDL_sensor_c.h" /* Initialization/Cleanup routines */ #if !SDL_TIMERS_DISABLED -extern int SDL_TimerInit(void); -extern void SDL_TimerQuit(void); -extern void SDL_TicksInit(void); -extern void SDL_TicksQuit(void); +# include "timer/SDL_timer_c.h" #endif #if SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); @@ -81,7 +79,7 @@ SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0); + return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ @@ -95,7 +93,7 @@ SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit; + return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void @@ -115,18 +113,6 @@ SDL_InitSubSystem(Uint32 flags) /* Clear the error message */ SDL_ClearError(); -#if SDL_VIDEO_DRIVER_WINDOWS - if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { - if (SDL_HelperWindowCreate() < 0) { - return -1; - } - } -#endif - -#if !SDL_TIMERS_DISABLED - SDL_TicksInit(); -#endif - if ((flags & SDL_INIT_GAMECONTROLLER)) { /* game controller implies joystick */ flags |= SDL_INIT_JOYSTICK; @@ -137,6 +123,18 @@ SDL_InitSubSystem(Uint32 flags) flags |= SDL_INIT_EVENTS; } +#if SDL_VIDEO_DRIVER_WINDOWS + if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { + if (SDL_HelperWindowCreate() < 0) { + return -1; + } + } +#endif + +#if !SDL_TIMERS_DISABLED + SDL_TicksInit(); +#endif + /* Initialize the event subsystem */ if ((flags & SDL_INIT_EVENTS)) { #if !SDL_EVENTS_DISABLED @@ -235,6 +233,20 @@ SDL_InitSubSystem(Uint32 flags) #endif } + /* Initialize the sensor subsystem */ + if ((flags & SDL_INIT_SENSOR)){ +#if !SDL_SENSOR_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) { + if (SDL_SensorInit() < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_SENSOR); +#else + return SDL_SetError("SDL not built with sensor support"); +#endif + } + return (0); } @@ -248,6 +260,15 @@ void SDL_QuitSubSystem(Uint32 flags) { /* Shut down requested initialized subsystems */ +#if !SDL_SENSOR_DISABLED + if ((flags & SDL_INIT_SENSOR)) { + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) { + SDL_SensorQuit(); + } + SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR); + } +#endif + #if !SDL_JOYSTICK_DISABLED if ((flags & SDL_INIT_GAMECONTROLLER)) { /* game controller implies joystick */ @@ -443,6 +464,8 @@ SDL_GetPlatform() return "Windows"; #elif __WINRT__ return "WinRT"; +#elif __TVOS__ + return "tvOS"; #elif __IPHONEOS__ return "iOS"; #elif __PSP__ @@ -452,9 +475,23 @@ SDL_GetPlatform() #endif } +SDL_bool +SDL_IsTablet() +{ +#if __ANDROID__ + extern SDL_bool SDL_IsAndroidTablet(void); + return SDL_IsAndroidTablet(); +#elif __IPHONEOS__ + extern SDL_bool SDL_IsIPad(void); + return SDL_IsIPad(); +#else + return SDL_FALSE; +#endif +} + #if defined(__WIN32__) -#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) +#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) /* Need to include DllMain() on Watcom C for some reason.. */ BOOL APIENTRY @@ -470,7 +507,7 @@ _DllMainCRTStartup(HANDLE hModule, } return TRUE; } -#endif /* building DLL with Watcom C */ +#endif /* Building DLL */ #endif /* __WIN32__ */ diff --git a/3rdparty/sdl2-2.0.4/src/SDL_assert.c b/3rdparty/sdl2-2.0.9/src/SDL_assert.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/SDL_assert.c rename to 3rdparty/sdl2-2.0.9/src/SDL_assert.c index a21f70b68c..1ca083ad4c 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_assert.c +++ b/3rdparty/sdl2-2.0.9/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,12 @@ #endif #endif -static SDL_assert_state +#if defined(__EMSCRIPTEN__) +#include +#endif + + +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); /* @@ -53,7 +58,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); */ static SDL_assert_data *triggered_assertions = NULL; +#ifndef SDL_THREADS_DISABLED static SDL_mutex *assertion_mutex = NULL; +#endif + static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion; static void *assertion_userdata = NULL; @@ -111,15 +119,31 @@ static void SDL_GenerateAssertionReport(void) } } + +#if defined(__WATCOMC__) +#pragma aux SDL_ExitProcess aborts; +#endif static void SDL_ExitProcess(int exitcode) { #ifdef __WIN32__ - ExitProcess(exitcode); + /* "if you do not know the state of all threads in your process, it is + better to call TerminateProcess than ExitProcess" + https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */ + TerminateProcess(GetCurrentProcess(), exitcode); + +#elif defined(__EMSCRIPTEN__) + emscripten_cancel_main_loop(); /* this should "kill" the app. */ + emscripten_force_exit(exitcode); /* this should "kill" the app. */ + exit(exitcode); #else _exit(exitcode); #endif } + +#if defined(__WATCOMC__) +#pragma aux SDL_AbortAssertion aborts; +#endif static void SDL_AbortAssertion(void) { SDL_Quit(); @@ -127,7 +151,7 @@ static void SDL_AbortAssertion(void) } -static SDL_assert_state +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { #ifdef __WIN32__ @@ -216,9 +240,45 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) state = (SDL_assert_state)selected; } } -#ifdef HAVE_STDIO_H + else { +#if defined(__EMSCRIPTEN__) + /* This is nasty, but we can't block on a custom UI. */ + for ( ; ; ) { + SDL_bool okay = SDL_TRUE; + char *buf = (char *) EM_ASM_INT({ + var str = + Pointer_stringify($0) + '\n\n' + + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; + var reply = window.prompt(str, "i"); + if (reply === null) { + reply = "i"; + } + return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); + }, message); + + if (SDL_strcmp(buf, "a") == 0) { + state = SDL_ASSERTION_ABORT; + /* (currently) no break functionality on Emscripten + } else if (SDL_strcmp(buf, "b") == 0) { + state = SDL_ASSERTION_BREAK; */ + } else if (SDL_strcmp(buf, "r") == 0) { + state = SDL_ASSERTION_RETRY; + } else if (SDL_strcmp(buf, "i") == 0) { + state = SDL_ASSERTION_IGNORE; + } else if (SDL_strcmp(buf, "A") == 0) { + state = SDL_ASSERTION_ALWAYS_IGNORE; + } else { + okay = SDL_FALSE; + } + free(buf); + + if (okay) { + break; + } + } +#elif defined(HAVE_STDIO_H) /* this is a little hacky. */ for ( ; ; ) { char buf[32]; @@ -228,25 +288,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) break; } - if (SDL_strcmp(buf, "a") == 0) { + if (SDL_strncmp(buf, "a", 1) == 0) { state = SDL_ASSERTION_ABORT; break; - } else if (SDL_strcmp(buf, "b") == 0) { + } else if (SDL_strncmp(buf, "b", 1) == 0) { state = SDL_ASSERTION_BREAK; break; - } else if (SDL_strcmp(buf, "r") == 0) { + } else if (SDL_strncmp(buf, "r", 1) == 0) { state = SDL_ASSERTION_RETRY; break; - } else if (SDL_strcmp(buf, "i") == 0) { + } else if (SDL_strncmp(buf, "i", 1) == 0) { state = SDL_ASSERTION_IGNORE; break; - } else if (SDL_strcmp(buf, "A") == 0) { + } else if (SDL_strncmp(buf, "A", 1) == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; } } - } #endif /* HAVE_STDIO_H */ + } /* Re-enter fullscreen mode */ if (window) { @@ -263,10 +323,11 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line) { - static int assertion_running = 0; - static SDL_SpinLock spinlock = 0; SDL_assert_state state = SDL_ASSERTION_IGNORE; + static int assertion_running = 0; +#ifndef SDL_THREADS_DISABLED + static SDL_SpinLock spinlock = 0; SDL_AtomicLock(&spinlock); if (assertion_mutex == NULL) { /* never called SDL_Init()? */ assertion_mutex = SDL_CreateMutex(); @@ -280,6 +341,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, if (SDL_LockMutex(assertion_mutex) < 0) { return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ } +#endif /* doing this because Visual C is upset over assigning in the macro. */ if (data->trigger_count == 0) { @@ -323,7 +385,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, } assertion_running--; + +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(assertion_mutex); +#endif return state; } @@ -332,10 +397,12 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, void SDL_AssertionsQuit(void) { SDL_GenerateAssertionReport(); +#ifndef SDL_THREADS_DISABLED if (assertion_mutex != NULL) { SDL_DestroyMutex(assertion_mutex); assertion_mutex = NULL; } +#endif } void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) diff --git a/3rdparty/sdl2-2.0.4/src/SDL_assert_c.h b/3rdparty/sdl2-2.0.9/src/SDL_assert_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/SDL_assert_c.h rename to 3rdparty/sdl2-2.0.9/src/SDL_assert_c.h index bc3b631e07..93263d6a15 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_assert_c.h +++ b/3rdparty/sdl2-2.0.9/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,11 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_assert_c_h_ +#define SDL_assert_c_h_ + extern void SDL_AssertionsQuit(void); +#endif /* SDL_assert_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.c b/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.c new file mode 100644 index 0000000000..97916f43fb --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.c @@ -0,0 +1,339 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "./SDL_internal.h" +#include "SDL.h" +#include "./SDL_dataqueue.h" +#include "SDL_assert.h" + +typedef struct SDL_DataQueuePacket +{ + size_t datalen; /* bytes currently in use in this packet. */ + size_t startpos; /* bytes currently consumed in this packet. */ + struct SDL_DataQueuePacket *next; /* next item in linked list. */ + Uint8 data[SDL_VARIABLE_LENGTH_ARRAY]; /* packet data */ +} SDL_DataQueuePacket; + +struct SDL_DataQueue +{ + SDL_DataQueuePacket *head; /* device fed from here. */ + SDL_DataQueuePacket *tail; /* queue fills to here. */ + SDL_DataQueuePacket *pool; /* these are unused packets. */ + size_t packet_size; /* size of new packets */ + size_t queued_bytes; /* number of bytes of data in the queue. */ +}; + +static void +SDL_FreeDataQueueList(SDL_DataQueuePacket *packet) +{ + while (packet) { + SDL_DataQueuePacket *next = packet->next; + SDL_free(packet); + packet = next; + } +} + + +/* this all expects that you managed thread safety elsewhere. */ + +SDL_DataQueue * +SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack) +{ + SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue)); + + if (!queue) { + SDL_OutOfMemory(); + return NULL; + } else { + const size_t packetlen = _packetlen ? _packetlen : 1024; + const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen; + size_t i; + + SDL_zerop(queue); + queue->packet_size = packetlen; + + for (i = 0; i < wantpackets; i++) { + SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen); + if (packet) { /* don't care if this fails, we'll deal later. */ + packet->datalen = 0; + packet->startpos = 0; + packet->next = queue->pool; + queue->pool = packet; + } + } + } + + return queue; +} + +void +SDL_FreeDataQueue(SDL_DataQueue *queue) +{ + if (queue) { + SDL_FreeDataQueueList(queue->head); + SDL_FreeDataQueueList(queue->pool); + SDL_free(queue); + } +} + +void +SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack) +{ + const size_t packet_size = queue ? queue->packet_size : 1; + const size_t slackpackets = (slack + (packet_size-1)) / packet_size; + SDL_DataQueuePacket *packet; + SDL_DataQueuePacket *prev = NULL; + size_t i; + + if (!queue) { + return; + } + + packet = queue->head; + + /* merge the available pool and the current queue into one list. */ + if (packet) { + queue->tail->next = queue->pool; + } else { + packet = queue->pool; + } + + /* Remove the queued packets from the device. */ + queue->tail = NULL; + queue->head = NULL; + queue->queued_bytes = 0; + queue->pool = packet; + + /* Optionally keep some slack in the pool to reduce malloc pressure. */ + for (i = 0; packet && (i < slackpackets); i++) { + prev = packet; + packet = packet->next; + } + + if (prev) { + prev->next = NULL; + } else { + queue->pool = NULL; + } + + SDL_FreeDataQueueList(packet); /* free extra packets */ +} + +static SDL_DataQueuePacket * +AllocateDataQueuePacket(SDL_DataQueue *queue) +{ + SDL_DataQueuePacket *packet; + + SDL_assert(queue != NULL); + + packet = queue->pool; + if (packet != NULL) { + /* we have one available in the pool. */ + queue->pool = packet->next; + } else { + /* Have to allocate a new one! */ + packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size); + if (packet == NULL) { + return NULL; + } + } + + packet->datalen = 0; + packet->startpos = 0; + packet->next = NULL; + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + if (queue->tail == NULL) { + queue->head = packet; + } else { + queue->tail->next = packet; + } + queue->tail = packet; + return packet; +} + + +int +SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len) +{ + size_t len = _len; + const Uint8 *data = (const Uint8 *) _data; + const size_t packet_size = queue ? queue->packet_size : 0; + SDL_DataQueuePacket *orighead; + SDL_DataQueuePacket *origtail; + size_t origlen; + size_t datalen; + + if (!queue) { + return SDL_InvalidParamError("queue"); + } + + orighead = queue->head; + origtail = queue->tail; + origlen = origtail ? origtail->datalen : 0; + + while (len > 0) { + SDL_DataQueuePacket *packet = queue->tail; + SDL_assert(!packet || (packet->datalen <= packet_size)); + if (!packet || (packet->datalen >= packet_size)) { + /* tail packet missing or completely full; we need a new packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + /* uhoh, reset so we've queued nothing new, free what we can. */ + if (!origtail) { + packet = queue->head; /* whole queue. */ + } else { + packet = origtail->next; /* what we added to existing queue. */ + origtail->next = NULL; + origtail->datalen = origlen; + } + queue->head = orighead; + queue->tail = origtail; + queue->pool = NULL; + + SDL_FreeDataQueueList(packet); /* give back what we can. */ + return SDL_OutOfMemory(); + } + } + + datalen = SDL_min(len, packet_size - packet->datalen); + SDL_memcpy(packet->data + packet->datalen, data, datalen); + data += datalen; + len -= datalen; + packet->datalen += datalen; + queue->queued_bytes += datalen; + } + + return 0; +} + +size_t +SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + for (packet = queue->head; len && packet; packet = packet->next) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + ptr += cpy; + len -= cpy; + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + while ((len > 0) && ((packet = queue->head) != NULL)) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + packet->startpos += cpy; + ptr += cpy; + queue->queued_bytes -= cpy; + len -= cpy; + + if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ + queue->head = packet->next; + SDL_assert((packet->next != NULL) || (packet == queue->tail)); + packet->next = queue->pool; + queue->pool = packet; + } + } + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + + if (queue->head == NULL) { + queue->tail = NULL; /* in case we drained the queue entirely. */ + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_CountDataQueue(SDL_DataQueue *queue) +{ + return queue ? queue->queued_bytes : 0; +} + +void * +SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len) +{ + SDL_DataQueuePacket *packet; + + if (!queue) { + SDL_InvalidParamError("queue"); + return NULL; + } else if (len == 0) { + SDL_InvalidParamError("len"); + return NULL; + } else if (len > queue->packet_size) { + SDL_SetError("len is larger than packet size"); + return NULL; + } + + packet = queue->head; + if (packet) { + const size_t avail = queue->packet_size - packet->datalen; + if (len <= avail) { /* we can use the space at end of this packet. */ + void *retval = packet->data + packet->datalen; + packet->datalen += len; + queue->queued_bytes += len; + return retval; + } + } + + /* Need a fresh packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + SDL_OutOfMemory(); + return NULL; + } + + packet->datalen = len; + queue->queued_bytes += len; + return packet->data; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.h b/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.h new file mode 100644 index 0000000000..d44f58db11 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/SDL_dataqueue.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_dataqueue_h_ +#define SDL_dataqueue_h_ + +/* this is not (currently) a public API. But maybe it should be! */ + +struct SDL_DataQueue; +typedef struct SDL_DataQueue SDL_DataQueue; + +SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack); +void SDL_FreeDataQueue(SDL_DataQueue *queue); +void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack); +int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len); +size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_CountDataQueue(SDL_DataQueue *queue); + +/* this sets a section of the data queue aside (possibly allocating memory for it) + as if it's been written to, but returns a pointer to that space. You may write + to this space until a read would consume it. Writes (and other calls to this + function) will safely append their data after this reserved space and can + be in flight at the same time. There is no thread safety. + If there isn't an existing block of memory that can contain the reserved + space, one will be allocated for it. You can not (currently) allocate + a space larger than the packetlen requested in SDL_NewDataQueue. + Returned buffer is uninitialized. + This lets you avoid an extra copy in some cases, but it's safer to use + SDL_WriteToDataQueue() unless you know what you're doing. + Returns pointer to buffer of at least (len) bytes, NULL on error. +*/ +void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len); + +#endif /* SDL_dataqueue_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/SDL_error.c b/3rdparty/sdl2-2.0.9/src/SDL_error.c similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/SDL_error.c rename to 3rdparty/sdl2-2.0.9/src/SDL_error.c index ace5cc3972..14761c5441 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_error.c +++ b/3rdparty/sdl2-2.0.9/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,6 +49,8 @@ SDL_LookupString(const char *key) /* Public functions */ +static char *SDL_GetErrorMsg(char *errstr, int maxlen); + int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { @@ -74,6 +76,16 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) case 0: /* Malformed format string.. */ --fmt; break; + case 'l': + switch (*fmt++) { + case 0: /* Malformed format string.. */ + --fmt; + break; + case 'i': case 'd': case 'u': + error->args[error->argc++].value_l = va_arg(ap, long); + break; + } + break; case 'c': case 'i': case 'd': @@ -110,12 +122,83 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) } va_end(ap); - /* If we are in debug mode, print out an error message */ - SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); - + if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { + /* If we are in debug mode, print out an error message + * Avoid stomping on the static buffer in GetError, just + * in case this is called while processing a ShowMessageBox to + * show an error already in that static buffer. + */ + char errmsg[SDL_ERRBUFIZE]; + SDL_GetErrorMsg(errmsg, sizeof(errmsg)); + SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg); + } return -1; } +/* Available for backwards compatibility */ +const char * +SDL_GetError(void) +{ + static char errmsg[SDL_ERRBUFIZE]; + + return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); +} + +void +SDL_ClearError(void) +{ + SDL_error *error; + + error = SDL_GetErrBuf(); + error->error = 0; +} + +/* Very common errors go here */ +int +SDL_Error(SDL_errorcode code) +{ + switch (code) { + case SDL_ENOMEM: + return SDL_SetError("Out of memory"); + case SDL_EFREAD: + return SDL_SetError("Error reading from datastream"); + case SDL_EFWRITE: + return SDL_SetError("Error writing to datastream"); + case SDL_EFSEEK: + return SDL_SetError("Error seeking in datastream"); + case SDL_UNSUPPORTED: + return SDL_SetError("That operation is not supported"); + default: + return SDL_SetError("Unknown SDL error"); + } +} + +#ifdef TEST_ERROR +int +main(int argc, char *argv[]) +{ + char buffer[BUFSIZ + 1]; + + SDL_SetError("Hi there!"); + printf("Error 1: %s\n", SDL_GetError()); + SDL_ClearError(); + SDL_memset(buffer, '1', BUFSIZ); + buffer[BUFSIZ] = 0; + SDL_SetError("This is the error: %s (%f)", buffer, 1.0); + printf("Error 2: %s\n", SDL_GetError()); + exit(0); +} +#endif + + +/* keep this at the end of the file so it works with GCC builds that don't + support "#pragma GCC diagnostic push" ... we'll just leave the warning + disabled after this. */ +/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */ +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2)))) +#pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif + /* This function has a bit more overhead than most error functions so that it supports internationalization and thread-safe errors. */ @@ -146,6 +229,22 @@ SDL_GetErrorMsg(char *errstr, int maxlen) && spot < (tmp + SDL_arraysize(tmp) - 2)) { *spot++ = *fmt++; } + if (*fmt == 'l') { + *spot++ = *fmt++; + *spot++ = *fmt++; + *spot++ = '\0'; + switch (spot[-2]) { + case 'i': case 'd': case 'u': + len = SDL_snprintf(msg, maxlen, tmp, + error->args[argi++].value_l); + if (len > 0) { + msg += len; + maxlen -= len; + } + break; + } + continue; + } *spot++ = *fmt++; *spot++ = '\0'; switch (spot[-2]) { @@ -217,59 +316,4 @@ SDL_GetErrorMsg(char *errstr, int maxlen) return (errstr); } -/* Available for backwards compatibility */ -const char * -SDL_GetError(void) -{ - static char errmsg[SDL_ERRBUFIZE]; - - return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); -} - -void -SDL_ClearError(void) -{ - SDL_error *error; - - error = SDL_GetErrBuf(); - error->error = 0; -} - -/* Very common errors go here */ -int -SDL_Error(SDL_errorcode code) -{ - switch (code) { - case SDL_ENOMEM: - return SDL_SetError("Out of memory"); - case SDL_EFREAD: - return SDL_SetError("Error reading from datastream"); - case SDL_EFWRITE: - return SDL_SetError("Error writing to datastream"); - case SDL_EFSEEK: - return SDL_SetError("Error seeking in datastream"); - case SDL_UNSUPPORTED: - return SDL_SetError("That operation is not supported"); - default: - return SDL_SetError("Unknown SDL error"); - } -} - -#ifdef TEST_ERROR -int -main(int argc, char *argv[]) -{ - char buffer[BUFSIZ + 1]; - - SDL_SetError("Hi there!"); - printf("Error 1: %s\n", SDL_GetError()); - SDL_ClearError(); - SDL_memset(buffer, '1', BUFSIZ); - buffer[BUFSIZ] = 0; - SDL_SetError("This is the error: %s (%f)", buffer, 1.0); - printf("Error 2: %s\n", SDL_GetError()); - exit(0); -} -#endif - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/SDL_error_c.h b/3rdparty/sdl2-2.0.9/src/SDL_error_c.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/SDL_error_c.h rename to 3rdparty/sdl2-2.0.9/src/SDL_error_c.h index 76ccf2b945..6bb9caaf8f 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_error_c.h +++ b/3rdparty/sdl2-2.0.9/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ error messages */ -#ifndef _SDL_error_c_h -#define _SDL_error_c_h +#ifndef SDL_error_c_h_ +#define SDL_error_c_h_ #define ERR_MAX_STRLEN 128 #define ERR_MAX_ARGS 5 @@ -51,6 +51,7 @@ typedef struct SDL_error unsigned char value_c; #endif int value_i; + long value_l; double value_f; char buf[ERR_MAX_STRLEN]; } args[ERR_MAX_ARGS]; @@ -59,6 +60,6 @@ typedef struct SDL_error /* Defined in SDL_thread.c */ extern SDL_error *SDL_GetErrBuf(void); -#endif /* _SDL_error_c_h */ +#endif /* SDL_error_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/SDL_hints.c b/3rdparty/sdl2-2.0.9/src/SDL_hints.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/SDL_hints.c rename to 3rdparty/sdl2-2.0.9/src/SDL_hints.c index 04523327ad..09689aa14f 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_hints.c +++ b/3rdparty/sdl2-2.0.9/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,19 @@ SDL_GetHint(const char *name) return env; } +SDL_bool +SDL_GetHintBoolean(const char *name, SDL_bool default_value) +{ + const char *hint = SDL_GetHint(name); + if (!hint || !*hint) { + return default_value; + } + if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { + return SDL_FALSE; + } + return SDL_TRUE; +} + void SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) { diff --git a/3rdparty/sdl2-2.0.9/src/SDL_internal.h b/3rdparty/sdl2-2.0.9/src/SDL_internal.h new file mode 100644 index 0000000000..e0ba2a82c3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/SDL_internal.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_internal_h_ +#define SDL_internal_h_ + +/* Many of SDL's features require _GNU_SOURCE on various platforms */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +/* This is for a variable-length array at the end of a struct: + struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; }; + Use this because GCC 2 needs different magic than other compilers. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus) +#define SDL_VARIABLE_LENGTH_ARRAY 1 +#else +#define SDL_VARIABLE_LENGTH_ARRAY +#endif + +#include "dynapi/SDL_dynapi.h" + +#if SDL_DYNAMIC_API +#include "dynapi/SDL_dynapi_overrides.h" +/* force DECLSPEC and SDLCALL off...it's all internal symbols now. + These will have actual #defines during SDL_dynapi.c only */ +#define DECLSPEC +#define SDLCALL +#endif + +#include "SDL_config.h" + +#endif /* SDL_internal_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/SDL_log.c b/3rdparty/sdl2-2.0.9/src/SDL_log.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/SDL_log.c rename to 3rdparty/sdl2-2.0.9/src/SDL_log.c index 60bac9f652..b1bf27d7a1 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_log.c +++ b/3rdparty/sdl2-2.0.9/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,9 +50,7 @@ typedef struct SDL_LogLevel } SDL_LogLevel; /* The default log output function */ -static void SDL_LogOutput(void *userdata, - int category, SDL_LogPriority priority, - const char *message); +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); static SDL_LogLevel *SDL_loglevels; static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; @@ -304,15 +302,15 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list SDL_stack_free(message); } -#if defined(__WIN32__) -/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */ +#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) +/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ static int consoleAttached = 0; /* Handle to stderr output of console. */ static HANDLE stderrHandle = NULL; #endif -static void +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) { @@ -324,10 +322,11 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, size_t length; LPTSTR tstr; -#ifndef __WINRT__ +#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) BOOL attachResult; DWORD attachError; unsigned long charsWritten; + DWORD consoleMode; /* Maybe attach console and get stderr handle */ if (consoleAttached == 0) { @@ -335,7 +334,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, if (!attachResult) { attachError = GetLastError(); if (attachError == ERROR_INVALID_HANDLE) { - OutputDebugString(TEXT("Parent process has no console\r\n")); + /* This is expected when running from Visual Studio */ + /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/ consoleAttached = -1; } else if (attachError == ERROR_GEN_FAILURE) { OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); @@ -351,12 +351,17 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, /* Newly attached */ consoleAttached = 1; } - + if (consoleAttached == 1) { stderrHandle = GetStdHandle(STD_ERROR_HANDLE); + + if (GetConsoleMode(stderrHandle, &consoleMode) == 0) { + /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */ + consoleAttached = 2; + } } } -#endif /* ifndef __WINRT__ */ +#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; output = SDL_stack_alloc(char, length); @@ -366,7 +371,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, /* Output to debugger */ OutputDebugString(tstr); -#ifndef __WINRT__ +#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) /* Screen output to stderr, if console was attached. */ if (consoleAttached == 1) { if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) { @@ -375,8 +380,13 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, OutputDebugString(TEXT("Insufficient heap memory to write message\r\n")); } } + + } else if (consoleAttached == 2) { + if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) { + OutputDebugString(TEXT("Error calling WriteFile\r\n")); + } } -#endif /* ifndef __WINRT__ */ +#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ SDL_free(tstr); SDL_stack_free(output); diff --git a/3rdparty/sdl2-2.0.4/src/atomic/SDL_atomic.c b/3rdparty/sdl2-2.0.9/src/atomic/SDL_atomic.c similarity index 72% rename from 3rdparty/sdl2-2.0.4/src/atomic/SDL_atomic.c rename to 3rdparty/sdl2-2.0.9/src/atomic/SDL_atomic.c index db86d6eda8..d0022cdc17 100644 --- a/3rdparty/sdl2-2.0.4/src/atomic/SDL_atomic.c +++ b/3rdparty/sdl2-2.0.9/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,49 @@ #include #endif +/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */ +#if defined(HAVE_GCC_ATOMICS) +# if defined(__clang__) +# if __has_builtin(__atomic_load_n) + /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have. + It might be in a later NDK or we might need an extra library? --ryan. */ +# if !defined(__ANDROID__) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +# elif defined(__GNUC__) +# if (__GNUC__ >= 5) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +#endif + +#if defined(__WATCOMC__) && defined(__386__) +SDL_COMPILE_TIME_ASSERT(intsize, 4==sizeof(int)); +#define HAVE_WATCOM_ATOMICS +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "lock xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; + +extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval); +#pragma aux _SDL_cmpxchg_watcom = \ + "lock cmpxchg [edx], ecx" \ + "setz al" \ + parm [edx] [ecx] [eax] \ + value [al] \ + modify exact [eax]; + +extern _inline int _SDL_xadd_watcom(volatile int *a, int v); +#pragma aux _SDL_xadd_watcom = \ + "lock xadd [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* If any of the operations are not provided then we must emulate some of them. That means we need a nice implementation of spin locks @@ -58,7 +101,7 @@ Contributed by Bob Pendleton, bob@pendleton.com */ -#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) +#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) #define EMULATE_CAS 1 #endif @@ -88,10 +131,12 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); -#elif defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval); #elif defined(HAVE_GCC_ATOMICS) return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); +#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(__SOLARIS__) && defined(_LP64) return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval); #elif defined(__SOLARIS__) && !defined(_LP64) @@ -119,12 +164,14 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval) return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); -#elif defined(__MACOSX__) && defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); -#elif defined(__MACOSX__) && !defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); #elif defined(HAVE_GCC_ATOMICS) return __sync_bool_compare_and_swap(a, oldval, newval); +#elif defined(__MACOSX__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); +#elif defined(__MACOSX__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); #elif defined(__SOLARIS__) return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval); #elif EMULATE_CAS @@ -148,6 +195,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchange((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xchg_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); #elif defined(__SOLARIS__) && defined(_LP64) @@ -170,6 +219,8 @@ SDL_AtomicSetPtr(void **a, void *v) return (void *) _InterlockedExchange((long *)a, (long) v); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return _InterlockedExchangePointer(a, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return (void *) _SDL_xchg_watcom((int *)a, (long)v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(a, v); #elif defined(__SOLARIS__) @@ -188,6 +239,8 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchangeAdd((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xadd_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(__SOLARIS__) @@ -211,36 +264,41 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) int SDL_AtomicGet(SDL_atomic_t *a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#else int value; do { value = a->value; } while (!SDL_AtomicCAS(a, value, value)); return value; +#endif } void * SDL_AtomicGetPtr(void **a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(a, __ATOMIC_SEQ_CST); +#else void *value; do { value = *a; } while (!SDL_AtomicCASPtr(a, value, value)); return value; +#endif } -#ifdef __thumb__ -#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) -__asm__( -" .align 2\n" -" .globl _SDL_MemoryBarrierRelease\n" -" .globl _SDL_MemoryBarrierAcquire\n" -"_SDL_MemoryBarrierRelease:\n" -"_SDL_MemoryBarrierAcquire:\n" -" mov r0, #0\n" -" mcr p15, 0, r0, c7, c10, 5\n" -" bx lr\n" -); -#endif -#endif +void +SDL_MemoryBarrierReleaseFunction(void) +{ + SDL_MemoryBarrierRelease(); +} + +void +SDL_MemoryBarrierAcquireFunction(void) +{ + SDL_MemoryBarrierAcquire(); +} /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/atomic/SDL_spinlock.c b/3rdparty/sdl2-2.0.9/src/atomic/SDL_spinlock.c similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/atomic/SDL_spinlock.c rename to 3rdparty/sdl2-2.0.9/src/atomic/SDL_spinlock.c index f582afb4e2..6a7b14a981 100644 --- a/3rdparty/sdl2-2.0.4/src/atomic/SDL_spinlock.c +++ b/3rdparty/sdl2-2.0.9/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,20 @@ #include #endif +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) +#include +#endif + +#if defined(__WATCOMC__) && defined(__386__) +SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock)); +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "lock xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* This function is where all the magic happens... */ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) @@ -58,6 +72,9 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); return (InterlockedExchange((long*)lock, 1) == 0); +#elif defined(__WATCOMC__) && defined(__386__) + return _SDL_xchg_watcom(lock, 1) == 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET return (__sync_lock_test_and_set(lock, 1) == 0); @@ -103,12 +120,32 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) #endif } +/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ +#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) + #define PAUSE_INSTRUCTION() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) + #define PAUSE_INSTRUCTION() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */ +#elif defined(__WATCOMC__) && defined(__386__) + /* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ + extern _inline void PAUSE_INSTRUCTION(void); + #pragma aux PAUSE_INSTRUCTION = "db 0f3h,90h" +#else + #define PAUSE_INSTRUCTION() +#endif + void SDL_AtomicLock(SDL_SpinLock *lock) { + int iterations = 0; /* FIXME: Should we have an eventual timeout? */ while (!SDL_AtomicTryLock(lock)) { - SDL_Delay(0); + if (iterations < 32) { + iterations++; + PAUSE_INSTRUCTION(); + } else { + /* !!! FIXME: this doesn't definitely give up the current timeslice, it does different things on various platforms. */ + SDL_Delay(0); + } } } @@ -119,6 +156,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock) _ReadWriteBarrier(); *lock = 0; +#elif defined(__WATCOMC__) && defined(__386__) + SDL_CompilerBarrier (); + *lock = 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET __sync_lock_release(lock); diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audio.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_audio.c similarity index 59% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_audio.c rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_audio.c index 2ffd216c0a..f4999f1363 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,53 +25,14 @@ #include "SDL.h" #include "SDL_audio.h" #include "SDL_audio_c.h" -#include "SDL_audiomem.h" #include "SDL_sysaudio.h" +#include "../thread/SDL_systhread.h" #define _THIS SDL_AudioDevice *_this static SDL_AudioDriver current_audio; static SDL_AudioDevice *open_devices[16]; -/* !!! FIXME: These are wordy and unlocalized... */ -#define DEFAULT_OUTPUT_DEVNAME "System audio output device" -#define DEFAULT_INPUT_DEVNAME "System audio capture device" - - -/* - * Not all of these will be compiled and linked in, but it's convenient - * to have a complete list here and saves yet-another block of #ifdefs... - * Please see bootstrap[], below, for the actual #ifdef mess. - */ -extern AudioBootStrap BSD_AUDIO_bootstrap; -extern AudioBootStrap DSP_bootstrap; -extern AudioBootStrap ALSA_bootstrap; -extern AudioBootStrap PULSEAUDIO_bootstrap; -extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; -extern AudioBootStrap NACLAUD_bootstrap; -extern AudioBootStrap NAS_bootstrap; -extern AudioBootStrap XAUDIO2_bootstrap; -extern AudioBootStrap DSOUND_bootstrap; -extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; -extern AudioBootStrap HAIKUAUDIO_bootstrap; -extern AudioBootStrap COREAUDIO_bootstrap; -extern AudioBootStrap SNDMGR_bootstrap; -extern AudioBootStrap DISKAUD_bootstrap; -extern AudioBootStrap DUMMYAUD_bootstrap; -extern AudioBootStrap DCAUD_bootstrap; -extern AudioBootStrap DART_bootstrap; -extern AudioBootStrap NDSAUD_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; -extern AudioBootStrap ANDROIDAUD_bootstrap; -extern AudioBootStrap PSPAUD_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; -extern AudioBootStrap EmscriptenAudio_bootstrap; - - /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_PULSEAUDIO @@ -83,8 +44,8 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_SNDIO &SNDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_BSD - &BSD_AUDIO_bootstrap, +#if SDL_AUDIO_DRIVER_NETBSD + &NETBSDAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, @@ -102,13 +63,13 @@ static const AudioBootStrap *const bootstrap[] = { &ESD_bootstrap, #endif #if SDL_AUDIO_DRIVER_NACL - &NACLAUD_bootstrap, + &NACLAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_NAS &NAS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_XAUDIO2 - &XAUDIO2_bootstrap, +#if SDL_AUDIO_DRIVER_WASAPI + &WASAPI_bootstrap, #endif #if SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, @@ -125,27 +86,113 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DISK - &DISKAUD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DUMMY - &DUMMYAUD_bootstrap, -#endif #if SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif #if SDL_AUDIO_DRIVER_ANDROID - &ANDROIDAUD_bootstrap, + &ANDROIDAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_PSP - &PSPAUD_bootstrap, + &PSPAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_EMSCRIPTEN - &EmscriptenAudio_bootstrap, + &EMSCRIPTENAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_JACK + &JACK_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DISK + &DISKAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DUMMY + &DUMMYAUDIO_bootstrap, #endif NULL }; + +#ifdef HAVE_LIBSAMPLERATE_H +#ifdef SDL_LIBSAMPLERATE_DYNAMIC +static void *SRC_lib = NULL; +#endif +SDL_bool SRC_available = SDL_FALSE; +int SRC_converter = 0; +SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error) = NULL; +int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL; +int (*SRC_src_reset)(SRC_STATE *state) = NULL; +SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL; +const char* (*SRC_src_strerror)(int error) = NULL; + +static SDL_bool +LoadLibSampleRate(void) +{ + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_RESAMPLING_MODE); + + SRC_available = SDL_FALSE; + SRC_converter = 0; + + if (!hint || *hint == '0' || SDL_strcasecmp(hint, "default") == 0) { + return SDL_FALSE; /* don't load anything. */ + } else if (*hint == '1' || SDL_strcasecmp(hint, "fast") == 0) { + SRC_converter = SRC_SINC_FASTEST; + } else if (*hint == '2' || SDL_strcasecmp(hint, "medium") == 0) { + SRC_converter = SRC_SINC_MEDIUM_QUALITY; + } else if (*hint == '3' || SDL_strcasecmp(hint, "best") == 0) { + SRC_converter = SRC_SINC_BEST_QUALITY; + } else { + return SDL_FALSE; /* treat it like "default", don't load anything. */ + } + +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + SDL_assert(SRC_lib == NULL); + SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC); + if (!SRC_lib) { + SDL_ClearError(); + return SDL_FALSE; + } + + SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new"); + SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process"); + SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset"); + SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete"); + SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror"); + + if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) { + SDL_UnloadObject(SRC_lib); + SRC_lib = NULL; + return SDL_FALSE; + } +#else + SRC_src_new = src_new; + SRC_src_process = src_process; + SRC_src_reset = src_reset; + SRC_src_delete = src_delete; + SRC_src_strerror = src_strerror; +#endif + + SRC_available = SDL_TRUE; + return SDL_TRUE; +} + +static void +UnloadLibSampleRate(void) +{ +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + if (SRC_lib != NULL) { + SDL_UnloadObject(SRC_lib); + } + SRC_lib = NULL; +#endif + + SRC_available = SDL_FALSE; + SRC_src_new = NULL; + SRC_src_process = NULL; + SRC_src_reset = NULL; + SRC_src_delete = NULL; + SRC_src_strerror = NULL; +} +#endif + static SDL_AudioDevice * get_audio_device(SDL_AudioDeviceID id) { @@ -165,7 +212,7 @@ SDL_AudioDetectDevices_Default(void) { /* you have to write your own implementation if these assertions fail. */ SDL_assert(current_audio.impl.OnlyHasDefaultOutputDevice); - SDL_assert(current_audio.impl.OnlyHasDefaultInputDevice || !current_audio.impl.HasCaptureSupport); + SDL_assert(current_audio.impl.OnlyHasDefaultCaptureDevice || !current_audio.impl.HasCaptureSupport); SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) ((size_t) 0x1)); if (current_audio.impl.HasCaptureSupport) { @@ -178,6 +225,16 @@ SDL_AudioThreadInit_Default(_THIS) { /* no-op. */ } +static void +SDL_AudioThreadDeinit_Default(_THIS) +{ /* no-op. */ +} + +static void +SDL_AudioBeginLoopIteration_Default(_THIS) +{ /* no-op. */ +} + static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ @@ -200,8 +257,19 @@ SDL_AudioGetDeviceBuf_Default(_THIS) return NULL; } +static int +SDL_AudioCaptureFromDevice_Default(_THIS, void *buffer, int buflen) +{ + return -1; /* just fail immediately. */ +} + +static void +SDL_AudioFlushCapture_Default(_THIS) +{ /* no-op. */ +} + static void -SDL_AudioWaitDone_Default(_THIS) +SDL_AudioPrepareToClose_Default(_THIS) { /* no-op. */ } @@ -257,15 +325,28 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device) } } +static void +SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device) +{ +} static void -finalize_audio_entry_points(void) +finish_audio_entry_points_init(void) { /* * Fill in stub functions for unused driver entry points. This lets us * blindly call them without having to check for validity first. */ + if (current_audio.impl.SkipMixerLock) { + if (current_audio.impl.LockDevice == NULL) { + current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; + } + if (current_audio.impl.UnlockDevice == NULL) { + current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; + } + } + #define FILL_STUB(x) \ if (current_audio.impl.x == NULL) { \ current_audio.impl.x = SDL_Audio##x##_Default; \ @@ -273,11 +354,15 @@ finalize_audio_entry_points(void) FILL_STUB(DetectDevices); FILL_STUB(OpenDevice); FILL_STUB(ThreadInit); + FILL_STUB(ThreadDeinit); + FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); FILL_STUB(GetPendingBytes); FILL_STUB(GetDeviceBuf); - FILL_STUB(WaitDone); + FILL_STUB(CaptureFromDevice); + FILL_STUB(FlushCapture); + FILL_STUB(PrepareToClose); FILL_STUB(CloseDevice); FILL_STUB(LockDevice); FILL_STUB(UnlockDevice); @@ -293,21 +378,57 @@ static int add_audio_device(const char *name, void *handle, SDL_AudioDeviceItem **devices, int *devCount) { int retval = -1; - const size_t size = sizeof (SDL_AudioDeviceItem) + SDL_strlen(name) + 1; - SDL_AudioDeviceItem *item = (SDL_AudioDeviceItem *) SDL_malloc(size); - if (item == NULL) { - return -1; - } + SDL_AudioDeviceItem *item; + const SDL_AudioDeviceItem *i; + int dupenum = 0; SDL_assert(handle != NULL); /* we reserve NULL, audio backends can't use it. */ + SDL_assert(name != NULL); + item = (SDL_AudioDeviceItem *) SDL_malloc(sizeof (SDL_AudioDeviceItem)); + if (!item) { + return SDL_OutOfMemory(); + } + + item->original_name = SDL_strdup(name); + if (!item->original_name) { + SDL_free(item); + return SDL_OutOfMemory(); + } + + item->dupenum = 0; + item->name = item->original_name; item->handle = handle; - SDL_strlcpy(item->name, name, size - sizeof (SDL_AudioDeviceItem)); SDL_LockMutex(current_audio.detectionLock); + + for (i = *devices; i != NULL; i = i->next) { + if (SDL_strcmp(name, i->original_name) == 0) { + dupenum = i->dupenum + 1; + break; /* stop at the highest-numbered dupe. */ + } + } + + if (dupenum) { + const size_t len = SDL_strlen(name) + 16; + char *replacement = (char *) SDL_malloc(len); + if (!replacement) { + SDL_UnlockMutex(current_audio.detectionLock); + SDL_free(item->original_name); + SDL_free(item); + SDL_OutOfMemory(); + return -1; + } + + SDL_snprintf(replacement, len, "%s (%d)", name, dupenum + 1); + item->dupenum = dupenum; + item->name = replacement; + } + item->next = *devices; *devices = item; - retval = (*devCount)++; + retval = (*devCount)++; /* !!! FIXME: this should be an atomic increment */ + SDL_UnlockMutex(current_audio.detectionLock); return retval; @@ -316,7 +437,7 @@ add_audio_device(const char *name, void *handle, SDL_AudioDeviceItem **devices, static SDL_INLINE int add_capture_device(const char *name, void *handle) { - /* !!! FIXME: add this later. SDL_assert(current_audio.impl.HasCaptureSupport);*/ + SDL_assert(current_audio.impl.HasCaptureSupport); return add_audio_device(name, handle, ¤t_audio.inputDevices, ¤t_audio.inputDeviceCount); } @@ -335,6 +456,11 @@ free_device_list(SDL_AudioDeviceItem **devices, int *devCount) if (item->handle != NULL) { current_audio.impl.FreeDeviceHandle(item->handle); } + /* these two pointers are the same if not a duplicate devname */ + if (item->name != item->original_name) { + SDL_free(item->name); + } + SDL_free(item->original_name); SDL_free(item); } *devices = NULL; @@ -365,14 +491,18 @@ void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device) { SDL_assert(get_audio_device(device->id) == device); - if (!device->enabled) { - return; + if (!SDL_AtomicGet(&device->enabled)) { + return; /* don't report disconnects more than once. */ + } + + if (SDL_AtomicGet(&device->shutdown)) { + return; /* don't report disconnect if we're trying to close device. */ } /* Ends the audio callback and mark the device as STOPPED, but the app still needs to close the device to free resources. */ current_audio.impl.LockDevice(device); - device->enabled = 0; + SDL_AtomicSet(&device->enabled, 0); current_audio.impl.UnlockDevice(device); /* Post the event, if desired */ @@ -404,13 +534,26 @@ mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *remove void SDL_RemoveAudioDevice(const int iscapture, void *handle) { + int device_index; + SDL_AudioDevice *device = NULL; + SDL_LockMutex(current_audio.detectionLock); if (iscapture) { mark_device_removed(handle, current_audio.inputDevices, ¤t_audio.captureDevicesRemoved); } else { mark_device_removed(handle, current_audio.outputDevices, ¤t_audio.outputDevicesRemoved); } + for (device_index = 0; device_index < SDL_arraysize(open_devices); device_index++) + { + device = open_devices[device_index]; + if (device != NULL && device->handle == handle) + { + SDL_OpenedAudioDeviceDisconnected(device); + break; + } + } SDL_UnlockMutex(current_audio.detectionLock); + current_audio.impl.FreeDeviceHandle(handle); } @@ -418,139 +561,83 @@ SDL_RemoveAudioDevice(const int iscapture, void *handle) /* buffer queueing support... */ -/* this expects that you managed thread safety elsewhere. */ -static void -free_audio_queue(SDL_AudioBufferQueue *buffer) -{ - while (buffer) { - SDL_AudioBufferQueue *next = buffer->next; - SDL_free(buffer); - buffer = next; - } -} - static void SDLCALL -SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int _len) +SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len) { /* this function always holds the mixer lock before being called. */ - Uint32 len = (Uint32) _len; SDL_AudioDevice *device = (SDL_AudioDevice *) userdata; - SDL_AudioBufferQueue *buffer; + size_t dequeued; SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */ - SDL_assert(_len >= 0); /* this shouldn't ever happen, right?! */ - - while ((len > 0) && ((buffer = device->buffer_queue_head) != NULL)) { - const Uint32 avail = buffer->datalen - buffer->startpos; - const Uint32 cpy = SDL_min(len, avail); - SDL_assert(device->queued_bytes >= avail); - - SDL_memcpy(stream, buffer->data + buffer->startpos, cpy); - buffer->startpos += cpy; - stream += cpy; - device->queued_bytes -= cpy; - len -= cpy; - - if (buffer->startpos == buffer->datalen) { /* packet is done, put it in the pool. */ - device->buffer_queue_head = buffer->next; - SDL_assert((buffer->next != NULL) || (buffer == device->buffer_queue_tail)); - buffer->next = device->buffer_queue_pool; - device->buffer_queue_pool = buffer; - } - } + SDL_assert(!device->iscapture); /* this shouldn't ever happen, right?! */ + SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */ - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); + dequeued = SDL_ReadFromDataQueue(device->buffer_queue, stream, len); + stream += dequeued; + len -= (int) dequeued; if (len > 0) { /* fill any remaining space in the stream with silence. */ - SDL_assert(device->buffer_queue_head == NULL); + SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0); SDL_memset(stream, device->spec.silence, len); } +} - if (device->buffer_queue_head == NULL) { - device->buffer_queue_tail = NULL; /* in case we drained the queue entirely. */ - } +static void SDLCALL +SDL_BufferQueueFillCallback(void *userdata, Uint8 *stream, int len) +{ + /* this function always holds the mixer lock before being called. */ + SDL_AudioDevice *device = (SDL_AudioDevice *) userdata; + + SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */ + SDL_assert(device->iscapture); /* this shouldn't ever happen, right?! */ + SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */ + + /* note that if this needs to allocate more space and run out of memory, + we have no choice but to quietly drop the data and hope it works out + later, but you probably have bigger problems in this case anyhow. */ + SDL_WriteToDataQueue(device->buffer_queue, stream, len); } int -SDL_QueueAudio(SDL_AudioDeviceID devid, const void *_data, Uint32 len) +SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len) { SDL_AudioDevice *device = get_audio_device(devid); - const Uint8 *data = (const Uint8 *) _data; - SDL_AudioBufferQueue *orighead; - SDL_AudioBufferQueue *origtail; - Uint32 origlen; - Uint32 datalen; + int rc = 0; if (!device) { return -1; /* get_audio_device() will have set the error state */ - } - - if (device->spec.callback != SDL_BufferQueueDrainCallback) { + } else if (device->iscapture) { + return SDL_SetError("This is a capture device, queueing not allowed"); + } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) { return SDL_SetError("Audio device has a callback, queueing not allowed"); } - current_audio.impl.LockDevice(device); - - orighead = device->buffer_queue_head; - origtail = device->buffer_queue_tail; - origlen = origtail ? origtail->datalen : 0; - - while (len > 0) { - SDL_AudioBufferQueue *packet = device->buffer_queue_tail; - SDL_assert(!packet || (packet->datalen <= SDL_AUDIOBUFFERQUEUE_PACKETLEN)); - if (!packet || (packet->datalen >= SDL_AUDIOBUFFERQUEUE_PACKETLEN)) { - /* tail packet missing or completely full; we need a new packet. */ - packet = device->buffer_queue_pool; - if (packet != NULL) { - /* we have one available in the pool. */ - device->buffer_queue_pool = packet->next; - } else { - /* Have to allocate a new one! */ - packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet == NULL) { - /* uhoh, reset so we've queued nothing new, free what we can. */ - if (!origtail) { - packet = device->buffer_queue_head; /* whole queue. */ - } else { - packet = origtail->next; /* what we added to existing queue. */ - origtail->next = NULL; - origtail->datalen = origlen; - } - device->buffer_queue_head = orighead; - device->buffer_queue_tail = origtail; - device->buffer_queue_pool = NULL; - - current_audio.impl.UnlockDevice(device); - - free_audio_queue(packet); /* give back what we can. */ + if (len > 0) { + current_audio.impl.LockDevice(device); + rc = SDL_WriteToDataQueue(device->buffer_queue, data, len); + current_audio.impl.UnlockDevice(device); + } - return SDL_OutOfMemory(); - } - } - packet->datalen = 0; - packet->startpos = 0; - packet->next = NULL; + return rc; +} - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); - if (device->buffer_queue_tail == NULL) { - device->buffer_queue_head = packet; - } else { - device->buffer_queue_tail->next = packet; - } - device->buffer_queue_tail = packet; - } +Uint32 +SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len) +{ + SDL_AudioDevice *device = get_audio_device(devid); + Uint32 rc; - datalen = SDL_min(len, SDL_AUDIOBUFFERQUEUE_PACKETLEN - packet->datalen); - SDL_memcpy(packet->data + packet->datalen, data, datalen); - data += datalen; - len -= datalen; - packet->datalen += datalen; - device->queued_bytes += datalen; + if ( (len == 0) || /* nothing to do? */ + (!device) || /* called with bogus device id */ + (!device->iscapture) || /* playback devices can't dequeue */ + (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ + return 0; /* just report zero bytes dequeued. */ } + current_audio.impl.LockDevice(device); + rc = (Uint32) SDL_ReadFromDataQueue(device->buffer_queue, data, len); current_audio.impl.UnlockDevice(device); - - return 0; + return rc; } Uint32 @@ -559,10 +646,18 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid) Uint32 retval = 0; SDL_AudioDevice *device = get_audio_device(devid); + if (!device) { + return 0; + } + /* Nothing to do unless we're set up for queueing. */ - if (device && (device->spec.callback == SDL_BufferQueueDrainCallback)) { + if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) { + current_audio.impl.LockDevice(device); + retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device); + current_audio.impl.UnlockDevice(device); + } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) { current_audio.impl.LockDevice(device); - retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device); + retval = (Uint32) SDL_CountDataQueue(device->buffer_queue); current_audio.impl.UnlockDevice(device); } @@ -573,94 +668,220 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) { SDL_AudioDevice *device = get_audio_device(devid); - SDL_AudioBufferQueue *buffer = NULL; + if (!device) { return; /* nothing to do. */ } /* Blank out the device and release the mutex. Free it afterwards. */ current_audio.impl.LockDevice(device); - buffer = device->buffer_queue_head; - device->buffer_queue_tail = NULL; - device->buffer_queue_head = NULL; - device->queued_bytes = 0; - current_audio.impl.UnlockDevice(device); - free_audio_queue(buffer); + /* Keep up to two packets in the pool to reduce future malloc pressure. */ + SDL_ClearDataQueue(device->buffer_queue, SDL_AUDIOBUFFERQUEUE_PACKETLEN * 2); + + current_audio.impl.UnlockDevice(device); } /* The general mixing thread function */ -int SDLCALL +static int SDLCALL SDL_RunAudio(void *devicep) { SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; - const int silence = (int) device->spec.silence; - const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); - const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size; - Uint8 *stream; - void *udata = device->spec.userdata; - void (SDLCALL *fill) (void *, Uint8 *, int) = device->spec.callback; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; + int data_len = 0; + Uint8 *data; + + SDL_assert(!device->iscapture); /* The audio mixing is always a high priority thread */ - SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL); /* Perform any thread setup */ device->threadid = SDL_ThreadID(); current_audio.impl.ThreadInit(device); /* Loop, filling the audio buffers */ - while (!device->shutdown) { + while (!SDL_AtomicGet(&device->shutdown)) { + current_audio.impl.BeginLoopIteration(device); + data_len = device->callbackspec.size; + /* Fill the current buffer with sound */ - if (device->convert.needed) { - stream = device->convert.buf; - } else if (device->enabled) { - stream = current_audio.impl.GetDeviceBuf(device); + if (!device->stream && SDL_AtomicGet(&device->enabled)) { + SDL_assert(data_len == device->spec.size); + data = current_audio.impl.GetDeviceBuf(device); } else { /* if the device isn't enabled, we still write to the - fake_stream, so the app's callback will fire with + work_buffer, so the app's callback will fire with a regular frequency, in case they depend on that for timing or progress. They can use hotplug - now to know if the device failed. */ - stream = NULL; + now to know if the device failed. + Streaming playback uses work_buffer, too. */ + data = NULL; } - if (stream == NULL) { - stream = device->fake_stream; + if (data == NULL) { + data = device->work_buffer; } /* !!! FIXME: this should be LockDevice. */ SDL_LockMutex(device->mixer_lock); - if (device->paused) { - SDL_memset(stream, silence, stream_len); + if (SDL_AtomicGet(&device->paused)) { + SDL_memset(data, device->spec.silence, data_len); } else { - (*fill) (udata, stream, stream_len); + callback(udata, data, data_len); } SDL_UnlockMutex(device->mixer_lock); - /* Convert the audio if necessary */ - if (device->enabled && device->convert.needed) { - SDL_ConvertAudio(&device->convert); - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } else { - SDL_memcpy(stream, device->convert.buf, - device->convert.len_cvt); + if (device->stream) { + /* Stream available audio to device, converting/resampling. */ + /* if this fails...oh well. We'll play silence here. */ + SDL_AudioStreamPut(device->stream, data, data_len); + + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->spec.size)) { + int got; + data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL; + got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size); + SDL_assert((got < 0) || (got == device->spec.size)); + + if (data == NULL) { /* device is having issues... */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */ + } else { + if (got != device->spec.size) { + SDL_memset(data, device->spec.silence, device->spec.size); + } + current_audio.impl.PlayDevice(device); + current_audio.impl.WaitDevice(device); + } } - } - - /* Ready current buffer for play and change current buffer */ - if (stream == device->fake_stream) { + } else if (data == device->work_buffer) { + /* nothing to do; pause like we queued a buffer to play. */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); SDL_Delay(delay); - } else { + } else { /* writing directly to the device. */ + /* queue this buffer and wait for it to finish playing. */ current_audio.impl.PlayDevice(device); current_audio.impl.WaitDevice(device); } } + current_audio.impl.PrepareToClose(device); + /* Wait for the audio to drain. */ - current_audio.impl.WaitDone(device); + SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2); + + current_audio.impl.ThreadDeinit(device); + + return 0; +} + +/* !!! FIXME: this needs to deal with device spec changes. */ +/* The general capture thread function */ +static int SDLCALL +SDL_CaptureAudio(void *devicep) +{ + SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; + const int silence = (int) device->spec.silence; + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + const int data_len = device->spec.size; + Uint8 *data; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; + + SDL_assert(device->iscapture); + + /* The audio mixing is always a high priority thread */ + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); + + /* Perform any thread setup */ + device->threadid = SDL_ThreadID(); + current_audio.impl.ThreadInit(device); + + /* Loop, filling the audio buffers */ + while (!SDL_AtomicGet(&device->shutdown)) { + int still_need; + Uint8 *ptr; + + current_audio.impl.BeginLoopIteration(device); + + if (SDL_AtomicGet(&device->paused)) { + SDL_Delay(delay); /* just so we don't cook the CPU. */ + if (device->stream) { + SDL_AudioStreamClear(device->stream); + } + current_audio.impl.FlushCapture(device); /* dump anything pending. */ + continue; + } + + /* Fill the current buffer with sound */ + still_need = data_len; + + /* Use the work_buffer to hold data read from the device. */ + data = device->work_buffer; + SDL_assert(data != NULL); + + ptr = data; + + /* We still read from the device when "paused" to keep the state sane, + and block when there isn't data so this thread isn't eating CPU. + But we don't process it further or call the app's callback. */ + + if (!SDL_AtomicGet(&device->enabled)) { + SDL_Delay(delay); /* try to keep callback firing at normal pace. */ + } else { + while (still_need > 0) { + const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need); + SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */ + if (rc > 0) { + still_need -= rc; + ptr += rc; + } else { /* uhoh, device failed for some reason! */ + SDL_OpenedAudioDeviceDisconnected(device); + break; + } + } + } + + if (still_need > 0) { + /* Keep any data we already read, silence the rest. */ + SDL_memset(ptr, silence, still_need); + } + + if (device->stream) { + /* if this fails...oh well. */ + SDL_AudioStreamPut(device->stream, data, data_len); + + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) { + const int got = SDL_AudioStreamGet(device->stream, device->work_buffer, device->callbackspec.size); + SDL_assert((got < 0) || (got == device->callbackspec.size)); + if (got != device->callbackspec.size) { + SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size); + } + + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, device->work_buffer, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); + } + } else { /* feeding user callback directly without streaming. */ + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, data, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); + } + } + + current_audio.impl.PrepareToClose(device); + + current_audio.impl.FlushCapture(device); + + current_audio.impl.ThreadDeinit(device); return 0; } @@ -757,11 +978,15 @@ SDL_AudioInit(const char *driver_name) current_audio.detectionLock = SDL_CreateMutex(); - finalize_audio_entry_points(); + finish_audio_entry_points_init(); /* Make sure we have a list of devices available at startup. */ current_audio.impl.DetectDevices(); +#ifdef HAVE_LIBSAMPLERATE_H + LoadLibSampleRate(); +#endif + return 0; } @@ -793,6 +1018,11 @@ clean_out_device_list(SDL_AudioDeviceItem **devices, int *devCount, SDL_bool *re } else { *devices = next; } + /* these two pointers are the same if not a duplicate devname */ + if (item->name != item->original_name) { + SDL_free(item->name); + } + SDL_free(item->original_name); SDL_free(item); } item = next; @@ -819,7 +1049,6 @@ SDL_GetNumAudioDevices(int iscapture) if (!iscapture && current_audio.outputDevicesRemoved) { clean_out_device_list(¤t_audio.outputDevices, ¤t_audio.outputDeviceCount, ¤t_audio.outputDevicesRemoved); - current_audio.outputDevicesRemoved = SDL_FALSE; } retval = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; @@ -872,27 +1101,43 @@ SDL_GetAudioDeviceName(int index, int iscapture) static void close_audio_device(SDL_AudioDevice * device) { - device->enabled = 0; - device->shutdown = 1; + if (!device) { + return; + } + + /* make sure the device is paused before we do anything else, so the + audio callback definitely won't fire again. */ + current_audio.impl.LockDevice(device); + SDL_AtomicSet(&device->paused, 1); + SDL_AtomicSet(&device->shutdown, 1); + SDL_AtomicSet(&device->enabled, 0); + current_audio.impl.UnlockDevice(device); + if (device->thread != NULL) { SDL_WaitThread(device->thread, NULL); } if (device->mixer_lock != NULL) { SDL_DestroyMutex(device->mixer_lock); } - SDL_FreeAudioMem(device->fake_stream); - if (device->convert.needed) { - SDL_FreeAudioMem(device->convert.buf); + + SDL_free(device->work_buffer); + SDL_FreeAudioStream(device->stream); + + if (device->id > 0) { + SDL_AudioDevice *opendev = open_devices[device->id - 1]; + SDL_assert((opendev == device) || (opendev == NULL)); + if (opendev == device) { + open_devices[device->id - 1] = NULL; + } } - if (device->opened) { + + if (device->hidden != NULL) { current_audio.impl.CloseDevice(device); - device->opened = 0; } - free_audio_queue(device->buffer_queue_head); - free_audio_queue(device->buffer_queue_pool); + SDL_FreeDataQueue(device->buffer_queue); - SDL_FreeAudioMem(device); + SDL_free(device); } @@ -930,8 +1175,9 @@ prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared) } case 1: /* Mono */ case 2: /* Stereo */ - case 4: /* surround */ - case 6: /* surround with center and lfe */ + case 4: /* Quadrophonic */ + case 6: /* 5.1 surround */ + case 8: /* 7.1 surround */ break; default: SDL_SetError("Unsupported number of audio channels."); @@ -963,12 +1209,12 @@ open_audio_device(const char *devname, int iscapture, const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, int allowed_changes, int min_id) { + const SDL_bool is_internal_thread = (desired->callback == NULL); SDL_AudioDeviceID id = 0; SDL_AudioSpec _obtained; SDL_AudioDevice *device; - SDL_bool build_cvt; + SDL_bool build_stream; void *handle = NULL; - Uint32 stream_len; int i = 0; if (!SDL_WasInit(SDL_INIT_AUDIO)) { @@ -981,6 +1227,7 @@ open_audio_device(const char *devname, int iscapture, return 0; } + /* !!! FIXME: there is a race condition here if two devices open from two threads at once. */ /* Find an available device ID... */ for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { if (open_devices[id] == NULL) { @@ -1015,7 +1262,7 @@ open_audio_device(const char *devname, int iscapture, * opens of the default system device. */ - if ((iscapture) && (current_audio.impl.OnlyHasDefaultInputDevice)) { + if ((iscapture) && (current_audio.impl.OnlyHasDefaultCaptureDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) { SDL_SetError("No such device"); return 0; @@ -1067,17 +1314,19 @@ open_audio_device(const char *devname, int iscapture, } } - device = (SDL_AudioDevice *) SDL_AllocAudioMem(sizeof(SDL_AudioDevice)); + device = (SDL_AudioDevice *) SDL_calloc(1, sizeof (SDL_AudioDevice)); if (device == NULL) { SDL_OutOfMemory(); return 0; } - SDL_zerop(device); device->id = id + 1; device->spec = *obtained; - device->enabled = 1; - device->paused = 1; - device->iscapture = iscapture; + device->iscapture = iscapture ? SDL_TRUE : SDL_FALSE; + device->handle = handle; + + SDL_AtomicSet(&device->shutdown, 0); /* just in case. */ + SDL_AtomicSet(&device->paused, 1); + SDL_AtomicSet(&device->enabled, 1); /* Create a mutex for locking the sound buffers */ if (!current_audio.impl.SkipMixerLock) { @@ -1093,119 +1342,104 @@ open_audio_device(const char *devname, int iscapture, close_audio_device(device); return 0; } - device->opened = 1; + + /* if your target really doesn't need it, set it to 0x1 or something. */ + /* otherwise, close_audio_device() won't call impl.CloseDevice(). */ + SDL_assert(device->hidden != NULL); /* See if we need to do any conversion */ - build_cvt = SDL_FALSE; + build_stream = SDL_FALSE; if (obtained->freq != device->spec.freq) { if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) { obtained->freq = device->spec.freq; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->format != device->spec.format) { if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) { obtained->format = device->spec.format; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->channels != device->spec.channels) { if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) { obtained->channels = device->spec.channels; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } - - /* If the audio driver changes the buffer size, accept it. - This needs to be done after the format is modified above, - otherwise it might not have the correct buffer size. - */ if (device->spec.samples != obtained->samples) { - obtained->samples = device->spec.samples; - SDL_CalculateAudioSpec(obtained); + if (allowed_changes & SDL_AUDIO_ALLOW_SAMPLES_CHANGE) { + obtained->samples = device->spec.samples; + } else { + build_stream = SDL_TRUE; + } } - if (build_cvt) { - /* Build an audio conversion block */ - if (SDL_BuildAudioCVT(&device->convert, - obtained->format, obtained->channels, - obtained->freq, - device->spec.format, device->spec.channels, - device->spec.freq) < 0) { + SDL_CalculateAudioSpec(obtained); /* recalc after possible changes. */ + + device->callbackspec = *obtained; + + if (build_stream) { + if (iscapture) { + device->stream = SDL_NewAudioStream(device->spec.format, + device->spec.channels, device->spec.freq, + obtained->format, obtained->channels, obtained->freq); + } else { + device->stream = SDL_NewAudioStream(obtained->format, obtained->channels, + obtained->freq, device->spec.format, + device->spec.channels, device->spec.freq); + } + + if (!device->stream) { close_audio_device(device); return 0; } - if (device->convert.needed) { - device->convert.len = (int) (((double) device->spec.size) / - device->convert.len_ratio); - - device->convert.buf = - (Uint8 *) SDL_AllocAudioMem(device->convert.len * - device->convert.len_mult); - if (device->convert.buf == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } + } + + if (device->spec.callback == NULL) { /* use buffer queueing? */ + /* pool a few packets to start. Enough for two callbacks. */ + device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); + if (!device->buffer_queue) { + close_audio_device(device); + SDL_SetError("Couldn't create audio buffer queue"); + return 0; } + device->callbackspec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback; + device->callbackspec.userdata = device; } - /* Allocate a fake audio memory buffer */ - stream_len = (device->convert.needed) ? device->convert.len_cvt : 0; - if (device->spec.size > stream_len) { - stream_len = device->spec.size; + /* Allocate a scratch audio buffer */ + device->work_buffer_len = build_stream ? device->callbackspec.size : 0; + if (device->spec.size > device->work_buffer_len) { + device->work_buffer_len = device->spec.size; } - SDL_assert(stream_len > 0); - device->fake_stream = (Uint8 *)SDL_AllocAudioMem(stream_len); - if (device->fake_stream == NULL) { + SDL_assert(device->work_buffer_len > 0); + + device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len); + if (device->work_buffer == NULL) { close_audio_device(device); SDL_OutOfMemory(); return 0; } - if (device->spec.callback == NULL) { /* use buffer queueing? */ - /* pool a few packets to start. Enough for two callbacks. */ - const int packetlen = SDL_AUDIOBUFFERQUEUE_PACKETLEN; - const int wantbytes = ((device->convert.needed) ? device->convert.len : device->spec.size) * 2; - const int wantpackets = (wantbytes / packetlen) + ((wantbytes % packetlen) ? packetlen : 0); - for (i = 0; i < wantpackets; i++) { - SDL_AudioBufferQueue *packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet) { /* don't care if this fails, we'll deal later. */ - packet->datalen = 0; - packet->startpos = 0; - packet->next = device->buffer_queue_pool; - device->buffer_queue_pool = packet; - } - } - - device->spec.callback = SDL_BufferQueueDrainCallback; - device->spec.userdata = device; - } - - /* add it to our list of open devices. */ - open_devices[id] = device; + open_devices[id] = device; /* add it to our list of open devices. */ /* Start the audio thread if necessary */ if (!current_audio.impl.ProvidesOwnCallbackThread) { /* Start the audio thread */ - char name[64]; - SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) device->id); -/* !!! FIXME: this is nasty. */ -#if defined(__WIN32__) && !defined(HAVE_LIBC) -#undef SDL_CreateThread -#if SDL_DYNAMIC_API - device->thread = SDL_CreateThread_REAL(SDL_RunAudio, name, device, NULL, NULL); -#else - device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL); -#endif -#else - device->thread = SDL_CreateThread(SDL_RunAudio, name, device); -#endif + /* !!! FIXME: we don't force the audio thread stack size here if it calls into user code, but maybe we should? */ + /* buffer queueing callback only needs a few bytes, so make the stack tiny. */ + const size_t stacksize = is_internal_thread ? 64 * 1024 : 0; + char threadname[64]; + + SDL_snprintf(threadname, sizeof (threadname), "SDLAudio%c%d", (iscapture) ? 'C' : 'P', (int) device->id); + device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device); + if (device->thread == NULL) { - SDL_CloseAudioDevice(device->id); + close_audio_device(device); SDL_SetError("Couldn't create audio thread"); return 0; } @@ -1237,7 +1471,14 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) id = open_audio_device(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE, 1); } else { - id = open_audio_device(NULL, 0, desired, NULL, 0, 1); + SDL_AudioSpec _obtained; + SDL_zero(_obtained); + id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1); + /* On successful open, copy calculated values into 'desired'. */ + if (id > 0) { + desired->size = _obtained.size; + desired->silence = _obtained.silence; + } } SDL_assert((id == 0) || (id == 1)); @@ -1258,8 +1499,8 @@ SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid) { SDL_AudioDevice *device = get_audio_device(devid); SDL_AudioStatus status = SDL_AUDIO_STOPPED; - if (device && device->enabled) { - if (device->paused) { + if (device && SDL_AtomicGet(&device->enabled)) { + if (SDL_AtomicGet(&device->paused)) { status = SDL_AUDIO_PAUSED; } else { status = SDL_AUDIO_PLAYING; @@ -1281,7 +1522,7 @@ SDL_PauseAudioDevice(SDL_AudioDeviceID devid, int pause_on) SDL_AudioDevice *device = get_audio_device(devid); if (device) { current_audio.impl.LockDevice(device); - device->paused = pause_on; + SDL_AtomicSet(&device->paused, pause_on ? 1 : 0); current_audio.impl.UnlockDevice(device); } } @@ -1328,11 +1569,7 @@ SDL_UnlockAudio(void) void SDL_CloseAudioDevice(SDL_AudioDeviceID devid) { - SDL_AudioDevice *device = get_audio_device(devid); - if (device) { - close_audio_device(device); - open_devices[devid - 1] = NULL; - } + close_audio_device(get_audio_device(devid)); } void @@ -1351,9 +1588,7 @@ SDL_AudioQuit(void) } for (i = 0; i < SDL_arraysize(open_devices); i++) { - if (open_devices[i] != NULL) { - SDL_CloseAudioDevice(i+1); - } + close_audio_device(open_devices[i]); } free_device_list(¤t_audio.outputDevices, ¤t_audio.outputDeviceCount); @@ -1366,6 +1601,12 @@ SDL_AudioQuit(void) SDL_zero(current_audio); SDL_zero(open_devices); + +#ifdef HAVE_LIBSAMPLERATE_H + UnloadLibSampleRate(); +#endif + + SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 @@ -1442,13 +1683,7 @@ SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume) /* Mix the user-level audio format */ SDL_AudioDevice *device = get_audio_device(1); if (device != NULL) { - SDL_AudioFormat format; - if (device->convert.needed) { - format = device->convert.src_format; - } else { - format = device->spec.format; - } - SDL_MixAudioFormat(dst, src, format, len, volume); + SDL_MixAudioFormat(dst, src, device->callbackspec.format, len, volume); } } diff --git a/3rdparty/sdl2-2.0.9/src/audio/SDL_audio_c.h b/3rdparty/sdl2-2.0.9/src/audio/SDL_audio_c.h new file mode 100644 index 0000000000..d47ebb1308 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audio_c.h @@ -0,0 +1,79 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_audio_c_h_ +#define SDL_audio_c_h_ + +#include "../SDL_internal.h" + +#ifndef DEBUG_CONVERT +#define DEBUG_CONVERT 0 +#endif + +#if DEBUG_CONVERT +#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to); +#else +#define LOG_DEBUG_CONVERT(from, to) +#endif + +/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ + +#ifdef HAVE_LIBSAMPLERATE_H +#include "samplerate.h" +extern SDL_bool SRC_available; +extern int SRC_converter; +extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error); +extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data); +extern int (*SRC_src_reset)(SRC_STATE *state); +extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state); +extern const char* (*SRC_src_strerror)(int error); +#endif + +/* Functions to get a list of "close" audio formats */ +extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format); +extern SDL_AudioFormat SDL_NextAudioFormat(void); + +/* Function to calculate the size and silence for a SDL_AudioSpec */ +extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec); + +/* Choose the audio filter functions below */ +extern void SDL_ChooseAudioConverters(void); + +/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */ +extern SDL_AudioFilter SDL_Convert_S8_to_F32; +extern SDL_AudioFilter SDL_Convert_U8_to_F32; +extern SDL_AudioFilter SDL_Convert_S16_to_F32; +extern SDL_AudioFilter SDL_Convert_U16_to_F32; +extern SDL_AudioFilter SDL_Convert_S32_to_F32; +extern SDL_AudioFilter SDL_Convert_F32_to_S8; +extern SDL_AudioFilter SDL_Convert_F32_to_U8; +extern SDL_AudioFilter SDL_Convert_F32_to_S16; +extern SDL_AudioFilter SDL_Convert_F32_to_U16; +extern SDL_AudioFilter SDL_Convert_F32_to_S32; + +/* You need to call SDL_PrepareResampleFilter() before using the internal resampler. + SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */ +extern int SDL_PrepareResampleFilter(void); +extern void SDL_FreeResampleFilter(void); + +#endif /* SDL_audio_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/SDL_audiocvt.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiocvt.c new file mode 100644 index 0000000000..ee0ba321b4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiocvt.c @@ -0,0 +1,1673 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* Functions for audio drivers to perform runtime conversion of audio format */ + +/* FIXME: Channel weights when converting from more channels to fewer may need to be adjusted, see https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx +*/ + +#include "SDL.h" +#include "SDL_audio.h" +#include "SDL_audio_c.h" + +#include "SDL_loadso.h" +#include "SDL_assert.h" +#include "../SDL_dataqueue.h" +#include "SDL_cpuinfo.h" + +#define DEBUG_AUDIOSTREAM 0 + +#ifdef __SSE3__ +#define HAVE_SSE3_INTRINSICS 1 +#endif + +#if HAVE_SSE3_INTRINSICS +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i = cvt->len_cvt / 8; + + LOG_DEBUG_CONVERT("stereo", "mono (using SSE3)"); + SDL_assert(format == AUDIO_F32SYS); + + /* We can only do this if dst is aligned to 16 bytes; since src is the + same pointer and it moves by 2, it can't be forcibly aligned. */ + if ((((size_t) dst) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby2 = _mm_set1_ps(0.5f); + while (i >= 4) { /* 4 * float32 */ + _mm_store_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_load_ps(src+4)), divby2)); + i -= 4; src += 8; dst += 4; + } + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (src[0] + src[1]) * 0.5f; + dst++; i--; src += 2; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} +#endif + +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("stereo", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / 8; i; --i, src += 2) { + *(dst++) = (src[0] + src[1]) * 0.5f; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ +static void SDLCALL +SDL_Convert51ToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed + src[4]) / 2.5f; /* left */ + dst[1] = (src[1] + front_center_distributed + src[5]) / 2.5f; /* right */ + } + + cvt->len_cvt /= 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from quad to stereo. Average left and right. */ +static void SDLCALL +SDL_ConvertQuadToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("quad", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 4); i; --i, src += 4, dst += 2) { + dst[0] = (src[0] + src[2]) * 0.5f; /* left */ + dst[1] = (src[1] + src[3]) * 0.5f; /* right */ + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 7.1 to 5.1. Distribute sides across front and back. */ +static void SDLCALL +SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 6) { + const float surround_left_distributed = src[6] * 0.5f; + const float surround_right_distributed = src[7] * 0.5f; + dst[0] = (src[0] + surround_left_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + surround_right_distributed) / 1.5f; /* FR */ + dst[2] = src[2] / 1.5f; /* CC */ + dst[3] = src[3] / 1.5f; /* LFE */ + dst[4] = (src[4] + surround_left_distributed) / 1.5f; /* BL */ + dst[5] = (src[5] + surround_right_distributed) / 1.5f; /* BR */ + } + + cvt->len_cvt /= 8; + cvt->len_cvt *= 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 5.1 to quad. Distribute center across front, discard LFE. */ +static void SDLCALL +SDL_Convert51ToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* SDL's 4.0 layout: FL+FR+BL+BR */ + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + front_center_distributed) / 1.5f; /* FR */ + dst[2] = src[4] / 1.5f; /* BL */ + dst[3] = src[5] / 1.5f; /* BR */ + } + + cvt->len_cvt /= 6; + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix mono to stereo (by duplication) */ +static void SDLCALL +SDL_ConvertMonoToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); + int i; + + LOG_DEBUG_CONVERT("mono", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / sizeof (float); i; --i) { + src--; + dst -= 2; + dst[0] = dst[1] = *src; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix stereo to a pseudo-5.1 stream */ +static void SDLCALL +SDL_ConvertStereoTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + int i; + float lf, rf, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); + + LOG_DEBUG_CONVERT("stereo", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 6; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lf; /* BL */ + dst[5] = rf; /* BR */ + } + + cvt->len_cvt *= 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix quad to a pseudo-5.1 stream */ +static void SDLCALL +SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + int i; + float lf, rf, lb, rb, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3 / 2); + + LOG_DEBUG_CONVERT("quad", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 4) == 0); + + for (i = cvt->len_cvt / (sizeof(float) * 4); i; --i) { + dst -= 6; + src -= 4; + lf = src[0]; + rf = src[1]; + lb = src[2]; + rb = src[3]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lb; /* BL */ + dst[5] = rb; /* BR */ + } + + cvt->len_cvt = cvt->len_cvt * 3 / 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix stereo to a pseudo-4.0 stream (by duplication) */ +static void SDLCALL +SDL_ConvertStereoToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); + float lf, rf; + int i; + + LOG_DEBUG_CONVERT("stereo", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 4; + src -= 2; + lf = src[0]; + rf = src[1]; + dst[0] = lf; /* FL */ + dst[1] = rf; /* FR */ + dst[2] = lf; /* BL */ + dst[3] = rf; /* BR */ + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix 5.1 to 7.1 */ +static void SDLCALL +SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float lf, rf, lb, rb, ls, rs; + int i; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 4 / 3); + + LOG_DEBUG_CONVERT("5.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 6) == 0); + + for (i = cvt->len_cvt / (sizeof(float) * 6); i; --i) { + dst -= 8; + src -= 6; + lf = src[0]; + rf = src[1]; + lb = src[4]; + rb = src[5]; + ls = (lf + lb) * 0.5f; + rs = (rf + rb) * 0.5f; + /* !!! FIXME: these four may clip */ + lf += lf - ls; + rf += rf - ls; + lb += lb - ls; + rb += rb - ls; + dst[3] = src[3]; /* LFE */ + dst[2] = src[2]; /* FC */ + dst[7] = rs; /* SR */ + dst[6] = ls; /* SL */ + dst[5] = rb; /* BR */ + dst[4] = lb; /* BL */ + dst[1] = rf; /* FR */ + dst[0] = lf; /* FL */ + } + + cvt->len_cvt = cvt->len_cvt * 4 / 3; + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +/* SDL's resampler uses a "bandlimited interpolation" algorithm: + https://ccrma.stanford.edu/~jos/resample/ */ + +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +/* This is a "modified" bessel function, so you can't use POSIX j0() */ +static double +bessel(const double x) +{ + const double xdiv2 = x / 2.0; + double i0 = 1.0f; + double f = 1.0f; + int i = 1; + + while (SDL_TRUE) { + const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2); + if (diff < 1.0e-21f) { + break; + } + i0 += diff; + i++; + f *= (double) i; + } + + return i0; +} + +/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ +static void +kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) +{ + const int lenm1 = tablelen - 1; + const int lenm1div2 = lenm1 / 2; + int i; + + table[0] = 1.0f; + for (i = 1; i < tablelen; i++) { + const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta); + table[tablelen - i] = (float) kaiser; + } + + for (i = 1; i < tablelen; i++) { + const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); + table[i] *= SDL_sinf(x) / x; + diffs[i - 1] = table[i] - table[i - 1]; + } + diffs[lenm1] = 0.0f; +} + + +static SDL_SpinLock ResampleFilterSpinlock = 0; +static float *ResamplerFilter = NULL; +static float *ResamplerFilterDifference = NULL; + +int +SDL_PrepareResampleFilter(void) +{ + SDL_AtomicLock(&ResampleFilterSpinlock); + if (!ResamplerFilter) { + /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ + const double dB = 80.0; + const double beta = 0.1102 * (dB - 8.7); + const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float); + + ResamplerFilter = (float *) SDL_malloc(alloclen); + if (!ResamplerFilter) { + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + + ResamplerFilterDifference = (float *) SDL_malloc(alloclen); + if (!ResamplerFilterDifference) { + SDL_free(ResamplerFilter); + ResamplerFilter = NULL; + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); + } + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return 0; +} + +void +SDL_FreeResampleFilter(void) +{ + SDL_free(ResamplerFilter); + SDL_free(ResamplerFilterDifference); + ResamplerFilter = NULL; + ResamplerFilterDifference = NULL; +} + +static int +ResamplerPadding(const int inrate, const int outrate) +{ + if (inrate == outrate) { + return 0; + } else if (inrate > outrate) { + return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + } + return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; +} + +/* lpadding and rpadding are expected to be buffers of (ResamplePadding(inrate, outrate) * chans * sizeof (float)) bytes. */ +static int +SDL_ResampleAudio(const int chans, const int inrate, const int outrate, + const float *lpadding, const float *rpadding, + const float *inbuf, const int inbuflen, + float *outbuf, const int outbuflen) +{ + const double finrate = (double) inrate; + const double outtimeincr = 1.0 / ((float) outrate); + const double ratio = ((float) outrate) / ((float) inrate); + const int paddinglen = ResamplerPadding(inrate, outrate); + const int framelen = chans * (int)sizeof (float); + const int inframes = inbuflen / framelen; + const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */ + const int maxoutframes = outbuflen / framelen; + const int outframes = SDL_min(wantedoutframes, maxoutframes); + float *dst = outbuf; + double outtime = 0.0; + int i, j, chan; + + for (i = 0; i < outframes; i++) { + const int srcindex = (int) (outtime * inrate); + const double intime = ((double) srcindex) / finrate; + const double innexttime = ((double) (srcindex + 1)) / finrate; + const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime)); + const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + const double interpolation2 = 1.0 - interpolation1; + const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + + for (chan = 0; chan < chans; chan++) { + float outsample = 0.0f; + + /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */ + /* !!! FIXME: do both wings in one loop */ + for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex - j; + /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */ + const float insample = (srcframe < 0) ? lpadding[((paddinglen + srcframe) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + + for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex + 1 + j; + /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */ + const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + *(dst++) = outsample; + } + + outtime += outtimeincr; + } + + return outframes * chans * sizeof (float); +} + +int +SDL_ConvertAudio(SDL_AudioCVT * cvt) +{ + /* !!! FIXME: (cvt) should be const; stack-copy it here. */ + /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */ + + /* Make sure there's data to convert */ + if (cvt->buf == NULL) { + return SDL_SetError("No buffer allocated for conversion"); + } + + /* Return okay if no conversion is necessary */ + cvt->len_cvt = cvt->len; + if (cvt->filters[0] == NULL) { + return 0; + } + + /* Set up the conversion and go! */ + cvt->filter_index = 0; + cvt->filters[0] (cvt, cvt->src_format); + return 0; +} + +static void SDLCALL +SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ +#if DEBUG_CONVERT + printf("Converting byte order\n"); +#endif + + switch (SDL_AUDIO_BITSIZE(format)) { + #define CASESWAP(b) \ + case b: { \ + Uint##b *ptr = (Uint##b *) cvt->buf; \ + int i; \ + for (i = cvt->len_cvt / sizeof (*ptr); i; --i, ++ptr) { \ + *ptr = SDL_Swap##b(*ptr); \ + } \ + break; \ + } + + CASESWAP(16); + CASESWAP(32); + CASESWAP(64); + + #undef CASESWAP + + default: SDL_assert(!"unhandled byteswap datatype!"); break; + } + + if (cvt->filters[++cvt->filter_index]) { + /* flip endian flag for data. */ + if (format & SDL_AUDIO_MASK_ENDIAN) { + format &= ~SDL_AUDIO_MASK_ENDIAN; + } else { + format |= SDL_AUDIO_MASK_ENDIAN; + } + cvt->filters[cvt->filter_index](cvt, format); + } +} + +static int +SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter) +{ + if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS); + } + if (filter == NULL) { + return SDL_SetError("Audio filter pointer is NULL"); + } + cvt->filters[cvt->filter_index++] = filter; + cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */ + return 0; +} + +static int +SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) +{ + int retval = 0; /* 0 == no conversion necessary. */ + + if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + if (!SDL_AUDIO_ISFLOAT(src_fmt)) { + const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); + const Uint16 dst_bitsize = 32; + SDL_AudioFilter filter = NULL; + + switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break; + case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break; + case AUDIO_S16: filter = SDL_Convert_S16_to_F32; break; + case AUDIO_U16: filter = SDL_Convert_U16_to_F32; break; + case AUDIO_S32: filter = SDL_Convert_S32_to_F32; break; + default: SDL_assert(!"Unexpected audio format!"); break; + } + + if (!filter) { + return SDL_SetError("No conversion from source format to float available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + if (src_bitsize < dst_bitsize) { + const int mult = (dst_bitsize / src_bitsize); + cvt->len_mult *= mult; + cvt->len_ratio *= mult; + } else if (src_bitsize > dst_bitsize) { + cvt->len_ratio /= (src_bitsize / dst_bitsize); + } + + retval = 1; /* added a converter. */ + } + + return retval; +} + +static int +SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) +{ + int retval = 0; /* 0 == no conversion necessary. */ + + if (!SDL_AUDIO_ISFLOAT(dst_fmt)) { + const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); + const Uint16 src_bitsize = 32; + SDL_AudioFilter filter = NULL; + switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_F32_to_S8; break; + case AUDIO_U8: filter = SDL_Convert_F32_to_U8; break; + case AUDIO_S16: filter = SDL_Convert_F32_to_S16; break; + case AUDIO_U16: filter = SDL_Convert_F32_to_U16; break; + case AUDIO_S32: filter = SDL_Convert_F32_to_S32; break; + default: SDL_assert(!"Unexpected audio format!"); break; + } + + if (!filter) { + return SDL_SetError("No conversion from float to destination format available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + if (src_bitsize < dst_bitsize) { + const int mult = (dst_bitsize / src_bitsize); + cvt->len_mult *= mult; + cvt->len_ratio *= mult; + } else if (src_bitsize > dst_bitsize) { + cvt->len_ratio /= (src_bitsize / dst_bitsize); + } + retval = 1; /* added a converter. */ + } + + if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + return retval; +} + +static void +SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) +{ + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + const int inrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1]; + const int outrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS]; + const float *src = (const float *) cvt->buf; + const int srclen = cvt->len_cvt; + /*float *dst = (float *) cvt->buf; + const int dstlen = (cvt->len * cvt->len_mult);*/ + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + float *dst = (float *) (cvt->buf + srclen); + const int dstlen = (cvt->len * cvt->len_mult) - srclen; + const int paddingsamples = (ResamplerPadding(inrate, outrate) * chans); + float *padding; + + SDL_assert(format == AUDIO_F32SYS); + + /* we keep no streaming state here, so pad with silence on both ends. */ + padding = (float *) SDL_calloc(paddingsamples ? paddingsamples : 1, sizeof (float)); + if (!padding) { + SDL_OutOfMemory(); + return; + } + + cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen); + + SDL_free(padding); + + SDL_memmove(cvt->buf, dst, cvt->len_cvt); /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* !!! FIXME: We only have this macro salsa because SDL_AudioCVT doesn't + !!! FIXME: store channel info, so we have to have function entry + !!! FIXME: points for each supported channel count and multiple + !!! FIXME: vs arbitrary. When we rev the ABI, clean this up. */ +#define RESAMPLER_FUNCS(chans) \ + static void SDLCALL \ + SDL_ResampleCVT_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \ + SDL_ResampleCVT(cvt, chans, format); \ + } +RESAMPLER_FUNCS(1) +RESAMPLER_FUNCS(2) +RESAMPLER_FUNCS(4) +RESAMPLER_FUNCS(6) +RESAMPLER_FUNCS(8) +#undef RESAMPLER_FUNCS + +static SDL_AudioFilter +ChooseCVTResampler(const int dst_channels) +{ + switch (dst_channels) { + case 1: return SDL_ResampleCVT_c1; + case 2: return SDL_ResampleCVT_c2; + case 4: return SDL_ResampleCVT_c4; + case 6: return SDL_ResampleCVT_c6; + case 8: return SDL_ResampleCVT_c8; + default: break; + } + + return NULL; +} + +static int +SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels, + const int src_rate, const int dst_rate) +{ + SDL_AudioFilter filter; + + if (src_rate == dst_rate) { + return 0; /* no conversion necessary. */ + } + + filter = ChooseCVTResampler(dst_channels); + if (filter == NULL) { + return SDL_SetError("No conversion available for these rates"); + } + + if (SDL_PrepareResampleFilter() < 0) { + return -1; + } + + /* Update (cvt) with filter details... */ + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + if (cvt->filter_index >= (SDL_AUDIOCVT_MAX_FILTERS-2)) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS-2); + } + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1] = (SDL_AudioFilter) (size_t) src_rate; + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS] = (SDL_AudioFilter) (size_t) dst_rate; + + if (src_rate < dst_rate) { + const double mult = ((double) dst_rate) / ((double) src_rate); + cvt->len_mult *= (int) SDL_ceil(mult); + cvt->len_ratio *= mult; + } else { + cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); + } + + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + /* the buffer is big enough to hold the destination now, but + we need it large enough to hold a separate scratch buffer. */ + cvt->len_mult *= 2; + + return 1; /* added a converter. */ +} + +static SDL_bool +SDL_SupportedAudioFormat(const SDL_AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_U8: + case AUDIO_S8: + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + case AUDIO_S32LSB: + case AUDIO_S32MSB: + case AUDIO_F32LSB: + case AUDIO_F32MSB: + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ +} + +static SDL_bool +SDL_SupportedChannelCount(const int channels) +{ + switch (channels) { + case 1: /* mono */ + case 2: /* stereo */ + case 4: /* quad */ + case 6: /* 5.1 */ + case 8: /* 7.1 */ + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ +} + + +/* Creates a set of audio filters to convert from one format to another. + Returns 0 if no conversion is needed, 1 if the audio filter is set up, + or -1 if an error like invalid parameter, unsupported format, etc. occurred. +*/ + +int +SDL_BuildAudioCVT(SDL_AudioCVT * cvt, + SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, + SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) +{ + /* Sanity check target pointer */ + if (cvt == NULL) { + return SDL_InvalidParamError("cvt"); + } + + /* Make sure we zero out the audio conversion before error checking */ + SDL_zerop(cvt); + + if (!SDL_SupportedAudioFormat(src_fmt)) { + return SDL_SetError("Invalid source format"); + } else if (!SDL_SupportedAudioFormat(dst_fmt)) { + return SDL_SetError("Invalid destination format"); + } else if (!SDL_SupportedChannelCount(src_channels)) { + return SDL_SetError("Invalid source channels"); + } else if (!SDL_SupportedChannelCount(dst_channels)) { + return SDL_SetError("Invalid destination channels"); + } else if (src_rate == 0) { + return SDL_SetError("Source rate is zero"); + } else if (dst_rate == 0) { + return SDL_SetError("Destination rate is zero"); + } + +#if DEBUG_CONVERT + printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", + src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); +#endif + + /* Start off with no conversion necessary */ + cvt->src_format = src_fmt; + cvt->dst_format = dst_fmt; + cvt->needed = 0; + cvt->filter_index = 0; + SDL_zero(cvt->filters); + cvt->len_mult = 1; + cvt->len_ratio = 1.0; + cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); + + /* Make sure we've chosen audio conversion functions (MMX, scalar, etc.) */ + SDL_ChooseAudioConverters(); + + /* Type conversion goes like this now: + - byteswap to CPU native format first if necessary. + - convert to native Float32 if necessary. + - resample and change channel count if necessary. + - convert back to native format. + - byteswap back to foreign format if necessary. + + The expectation is we can process data faster in float32 + (possibly with SIMD), and making several passes over the same + buffer is likely to be CPU cache-friendly, avoiding the + biggest performance hit in modern times. Previously we had + (script-generated) custom converters for every data type and + it was a bloat on SDL compile times and final library size. */ + + /* see if we can skip float conversion entirely. */ + if (src_rate == dst_rate && src_channels == dst_channels) { + if (src_fmt == dst_fmt) { + return 0; + } + + /* just a byteswap needed? */ + if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + cvt->needed = 1; + return 1; + } + } + + /* Convert data types, if necessary. Updates (cvt). */ + if (SDL_BuildAudioTypeCVTToFloat(cvt, src_fmt) < 0) { + return -1; /* shouldn't happen, but just in case... */ + } + + /* Channel conversion */ + if (src_channels < dst_channels) { + /* Upmixing */ + /* Mono -> Stereo [-> ...] */ + if ((src_channels == 1) && (dst_channels > 1)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertMonoToStereo) < 0) { + return -1; + } + cvt->len_mult *= 2; + src_channels = 2; + cvt->len_ratio *= 2; + } + /* [Mono ->] Stereo -> 5.1 [-> 7.1] */ + if ((src_channels == 2) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoTo51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_mult *= 3; + cvt->len_ratio *= 3; + } + /* Quad -> 5.1 [-> 7.1] */ + if ((src_channels == 4) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadTo51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_mult = (cvt->len_mult * 3 + 1) / 2; + cvt->len_ratio *= 1.5; + } + /* [[Mono ->] Stereo ->] 5.1 -> 7.1 */ + if ((src_channels == 6) && (dst_channels == 8)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To71) < 0) { + return -1; + } + src_channels = 8; + cvt->len_mult = (cvt->len_mult * 4 + 2) / 3; + /* Should be numerically exact with every valid input to this + function */ + cvt->len_ratio = cvt->len_ratio * 4 / 3; + } + /* [Mono ->] Stereo -> Quad */ + if ((src_channels == 2) && (dst_channels == 4)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoToQuad) < 0) { + return -1; + } + src_channels = 4; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + } + } else if (src_channels > dst_channels) { + /* Downmixing */ + /* 7.1 -> 5.1 [-> Stereo [-> Mono]] */ + /* 7.1 -> 5.1 [-> Quad] */ + if ((src_channels == 8) && (dst_channels <= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_ratio *= 0.75; + } + /* [7.1 ->] 5.1 -> Stereo [-> Mono] */ + if ((src_channels == 6) && (dst_channels <= 2)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToStereo) < 0) { + return -1; + } + src_channels = 2; + cvt->len_ratio /= 3; + } + /* 5.1 -> Quad */ + if ((src_channels == 6) && (dst_channels == 4)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToQuad) < 0) { + return -1; + } + src_channels = 4; + cvt->len_ratio = cvt->len_ratio * 2 / 3; + } + /* Quad -> Stereo [-> Mono] */ + if ((src_channels == 4) && (dst_channels <= 2)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadToStereo) < 0) { + return -1; + } + src_channels = 2; + cvt->len_ratio /= 2; + } + /* [... ->] Stereo -> Mono */ + if ((src_channels == 2) && (dst_channels == 1)) { + SDL_AudioFilter filter = NULL; + + #if HAVE_SSE3_INTRINSICS + if (SDL_HasSSE3()) { + filter = SDL_ConvertStereoToMono_SSE3; + } + #endif + + if (!filter) { + filter = SDL_ConvertStereoToMono; + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + src_channels = 1; + cvt->len_ratio /= 2; + } + } + + if (src_channels != dst_channels) { + /* All combinations of supported channel counts should have been + handled by now, but let's be defensive */ + return SDL_SetError("Invalid channel combination"); + } + + /* Do rate conversion, if necessary. Updates (cvt). */ + if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) < 0) { + return -1; /* shouldn't happen, but just in case... */ + } + + /* Move to final data type. */ + if (SDL_BuildAudioTypeCVTFromFloat(cvt, dst_fmt) < 0) { + return -1; /* shouldn't happen, but just in case... */ + } + + cvt->needed = (cvt->filter_index != 0); + return (cvt->needed); +} + +typedef int (*SDL_ResampleAudioStreamFunc)(SDL_AudioStream *stream, const void *inbuf, const int inbuflen, void *outbuf, const int outbuflen); +typedef void (*SDL_ResetAudioStreamResamplerFunc)(SDL_AudioStream *stream); +typedef void (*SDL_CleanupAudioStreamResamplerFunc)(SDL_AudioStream *stream); + +struct _SDL_AudioStream +{ + SDL_AudioCVT cvt_before_resampling; + SDL_AudioCVT cvt_after_resampling; + SDL_DataQueue *queue; + SDL_bool first_run; + Uint8 *staging_buffer; + int staging_buffer_size; + int staging_buffer_filled; + Uint8 *work_buffer_base; /* maybe unaligned pointer from SDL_realloc(). */ + int work_buffer_len; + int src_sample_frame_size; + SDL_AudioFormat src_format; + Uint8 src_channels; + int src_rate; + int dst_sample_frame_size; + SDL_AudioFormat dst_format; + Uint8 dst_channels; + int dst_rate; + double rate_incr; + Uint8 pre_resample_channels; + int packetlen; + int resampler_padding_samples; + float *resampler_padding; + void *resampler_state; + SDL_ResampleAudioStreamFunc resampler_func; + SDL_ResetAudioStreamResamplerFunc reset_resampler_func; + SDL_CleanupAudioStreamResamplerFunc cleanup_resampler_func; +}; + +static Uint8 * +EnsureStreamBufferSize(SDL_AudioStream *stream, const int newlen) +{ + Uint8 *ptr; + size_t offset; + + if (stream->work_buffer_len >= newlen) { + ptr = stream->work_buffer_base; + } else { + ptr = (Uint8 *) SDL_realloc(stream->work_buffer_base, newlen + 32); + if (!ptr) { + SDL_OutOfMemory(); + return NULL; + } + /* Make sure we're aligned to 16 bytes for SIMD code. */ + stream->work_buffer_base = ptr; + stream->work_buffer_len = newlen; + } + + offset = ((size_t) ptr) & 15; + return offset ? ptr + (16 - offset) : ptr; +} + +#ifdef HAVE_LIBSAMPLERATE_H +static int +SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int framelen = sizeof(float) * stream->pre_resample_channels; + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + SRC_DATA data; + int result; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + data.data_in = (float *)inbuf; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */ + data.input_frames = inbuflen / framelen; + data.input_frames_used = 0; + + data.data_out = outbuf; + data.output_frames = outbuflen / framelen; + + data.end_of_input = 0; + data.src_ratio = stream->rate_incr; + + result = SRC_src_process(state, &data); + if (result != 0) { + SDL_SetError("src_process() failed: %s", SRC_src_strerror(result)); + return 0; + } + + /* If this fails, we need to store them off somewhere */ + SDL_assert(data.input_frames_used == data.input_frames); + + return data.output_frames_gen * (sizeof(float) * stream->pre_resample_channels); +} + +static void +SDL_ResetAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_src_reset((SRC_STATE *)stream->resampler_state); +} + +static void +SDL_CleanupAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + if (state) { + SRC_src_delete(state); + } + + stream->resampler_state = NULL; + stream->resampler_func = NULL; + stream->reset_resampler_func = NULL; + stream->cleanup_resampler_func = NULL; +} + +static SDL_bool +SetupLibSampleRateResampling(SDL_AudioStream *stream) +{ + int result = 0; + SRC_STATE *state = NULL; + + if (SRC_available) { + state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result); + if (!state) { + SDL_SetError("src_new() failed: %s", SRC_src_strerror(result)); + } + } + + if (!state) { + SDL_CleanupAudioStreamResampler_SRC(stream); + return SDL_FALSE; + } + + stream->resampler_state = state; + stream->resampler_func = SDL_ResampleAudioStream_SRC; + stream->reset_resampler_func = SDL_ResetAudioStreamResampler_SRC; + stream->cleanup_resampler_func = SDL_CleanupAudioStreamResampler_SRC; + + return SDL_TRUE; +} +#endif /* HAVE_LIBSAMPLERATE_H */ + + +static int +SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const Uint8 *inbufend = ((const Uint8 *) _inbuf) + inbuflen; + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int chans = (int) stream->pre_resample_channels; + const int inrate = stream->src_rate; + const int outrate = stream->dst_rate; + const int paddingsamples = stream->resampler_padding_samples; + const int paddingbytes = paddingsamples * sizeof (float); + float *lpadding = (float *) stream->resampler_state; + const float *rpadding = (const float *) inbufend; /* we set this up so there are valid padding samples at the end of the input buffer. */ + const int cpy = SDL_min(inbuflen, paddingbytes); + int retval; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + retval = SDL_ResampleAudio(chans, inrate, outrate, lpadding, rpadding, inbuf, inbuflen, outbuf, outbuflen); + + /* update our left padding with end of current input, for next run. */ + SDL_memcpy((lpadding + paddingsamples) - (cpy / sizeof (float)), inbufend - cpy, cpy); + return retval; +} + +static void +SDL_ResetAudioStreamResampler(SDL_AudioStream *stream) +{ + /* set all the padding to silence. */ + const int len = stream->resampler_padding_samples; + SDL_memset(stream->resampler_state, '\0', len * sizeof (float)); +} + +static void +SDL_CleanupAudioStreamResampler(SDL_AudioStream *stream) +{ + SDL_free(stream->resampler_state); +} + +SDL_AudioStream * +SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate) +{ + const int packetlen = 4096; /* !!! FIXME: good enough for now. */ + Uint8 pre_resample_channels; + SDL_AudioStream *retval; + + retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream)); + if (!retval) { + return NULL; + } + + /* If increasing channels, do it after resampling, since we'd just + do more work to resample duplicate channels. If we're decreasing, do + it first so we resample the interpolated data instead of interpolating + the resampled data (!!! FIXME: decide if that works in practice, though!). */ + pre_resample_channels = SDL_min(src_channels, dst_channels); + + retval->first_run = SDL_TRUE; + retval->src_sample_frame_size = (SDL_AUDIO_BITSIZE(src_format) / 8) * src_channels; + retval->src_format = src_format; + retval->src_channels = src_channels; + retval->src_rate = src_rate; + retval->dst_sample_frame_size = (SDL_AUDIO_BITSIZE(dst_format) / 8) * dst_channels; + retval->dst_format = dst_format; + retval->dst_channels = dst_channels; + retval->dst_rate = dst_rate; + retval->pre_resample_channels = pre_resample_channels; + retval->packetlen = packetlen; + retval->rate_incr = ((double) dst_rate) / ((double) src_rate); + retval->resampler_padding_samples = ResamplerPadding(retval->src_rate, retval->dst_rate) * pre_resample_channels; + retval->resampler_padding = (float *) SDL_calloc(retval->resampler_padding_samples ? retval->resampler_padding_samples : 1, sizeof (float)); + + if (retval->resampler_padding == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + retval->staging_buffer_size = ((retval->resampler_padding_samples / retval->pre_resample_channels) * retval->src_sample_frame_size); + if (retval->staging_buffer_size > 0) { + retval->staging_buffer = (Uint8 *) SDL_malloc(retval->staging_buffer_size); + if (retval->staging_buffer == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + } + + /* Not resampling? It's an easy conversion (and maybe not even that!) */ + if (src_rate == dst_rate) { + retval->cvt_before_resampling.needed = SDL_FALSE; + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, src_format, src_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } else { + /* Don't resample at first. Just get us to Float32 format. */ + /* !!! FIXME: convert to int32 on devices without hardware float. */ + if (SDL_BuildAudioCVT(&retval->cvt_before_resampling, src_format, src_channels, src_rate, AUDIO_F32SYS, pre_resample_channels, src_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + +#ifdef HAVE_LIBSAMPLERATE_H + SetupLibSampleRateResampling(retval); +#endif + + if (!retval->resampler_func) { + retval->resampler_state = SDL_calloc(retval->resampler_padding_samples, sizeof (float)); + if (!retval->resampler_state) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + if (SDL_PrepareResampleFilter() < 0) { + SDL_free(retval->resampler_state); + retval->resampler_state = NULL; + SDL_FreeAudioStream(retval); + return NULL; + } + + retval->resampler_func = SDL_ResampleAudioStream; + retval->reset_resampler_func = SDL_ResetAudioStreamResampler; + retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler; + } + + /* Convert us to the final format after resampling. */ + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, AUDIO_F32SYS, pre_resample_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } + + retval->queue = SDL_NewDataQueue(packetlen, packetlen * 2); + if (!retval->queue) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_NewDataQueue should have called SDL_SetError. */ + } + + return retval; +} + +static int +SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, int *maxputbytes) +{ + int buflen = len; + int workbuflen; + Uint8 *workbuf; + Uint8 *resamplebuf = NULL; + int resamplebuflen = 0; + int neededpaddingbytes; + int paddingbytes; + + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + /* no padding prepended on first run. */ + neededpaddingbytes = stream->resampler_padding_samples * sizeof (float); + paddingbytes = stream->first_run ? 0 : neededpaddingbytes; + stream->first_run = SDL_FALSE; + + /* Make sure the work buffer can hold all the data we need at once... */ + workbuflen = buflen; + if (stream->cvt_before_resampling.needed) { + workbuflen *= stream->cvt_before_resampling.len_mult; + } + + if (stream->dst_rate != stream->src_rate) { + /* resamples can't happen in place, so make space for second buf. */ + const int framesize = stream->pre_resample_channels * sizeof (float); + const int frames = workbuflen / framesize; + resamplebuflen = ((int) SDL_ceil(frames * stream->rate_incr)) * framesize; + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr); + #endif + workbuflen += resamplebuflen; + } + + if (stream->cvt_after_resampling.needed) { + /* !!! FIXME: buffer might be big enough already? */ + workbuflen *= stream->cvt_after_resampling.len_mult; + } + + workbuflen += neededpaddingbytes; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen); + #endif + + workbuf = EnsureStreamBufferSize(stream, workbuflen); + if (!workbuf) { + return -1; /* probably out of memory. */ + } + + resamplebuf = workbuf; /* default if not resampling. */ + + SDL_memcpy(workbuf + paddingbytes, buf, buflen); + + if (stream->cvt_before_resampling.needed) { + stream->cvt_before_resampling.buf = workbuf + paddingbytes; + stream->cvt_before_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_before_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_before_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen); + #endif + } + + if (stream->dst_rate != stream->src_rate) { + /* save off some samples at the end; they are used for padding now so + the resampler is coherent and then used at the start of the next + put operation. Prepend last put operation's padding, too. */ + + /* prepend prior put's padding. :P */ + if (paddingbytes) { + SDL_memcpy(workbuf, stream->resampler_padding, paddingbytes); + buflen += paddingbytes; + } + + /* save off the data at the end for the next run. */ + SDL_memcpy(stream->resampler_padding, workbuf + (buflen - neededpaddingbytes), neededpaddingbytes); + + resamplebuf = workbuf + buflen; /* skip to second piece of workbuf. */ + SDL_assert(buflen >= neededpaddingbytes); + if (buflen > neededpaddingbytes) { + buflen = stream->resampler_func(stream, workbuf, buflen - neededpaddingbytes, resamplebuf, resamplebuflen); + } else { + buflen = 0; + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After resampling we have %d bytes\n", buflen); + #endif + } + + if (stream->cvt_after_resampling.needed && (buflen > 0)) { + stream->cvt_after_resampling.buf = resamplebuf; + stream->cvt_after_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_after_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_after_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen); + #endif + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Final output is %d bytes\n", buflen); + #endif + + if (maxputbytes) { + const int maxbytes = *maxputbytes; + if (buflen > maxbytes) + buflen = maxbytes; + *maxputbytes -= buflen; + } + + /* resamplebuf holds the final output, even if we didn't resample. */ + return buflen ? SDL_WriteToDataQueue(stream->queue, resamplebuf, buflen) : 0; +} + +int +SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) +{ + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len == 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->src_sample_frame_size) != 0) { + return SDL_SetError("Can't add partial sample frames"); + } + + if (!stream->cvt_before_resampling.needed && + (stream->dst_rate == stream->src_rate) && + !stream->cvt_after_resampling.needed) { + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len); + #endif + return SDL_WriteToDataQueue(stream->queue, buf, len); + } + + while (len > 0) { + int amount; + + /* If we don't have a staging buffer or we're given enough data that + we don't need to store it for later, skip the staging process. + */ + if (!stream->staging_buffer_filled && len >= stream->staging_buffer_size) { + return SDL_AudioStreamPutInternal(stream, buf, len, NULL); + } + + /* If there's not enough data to fill the staging buffer, just save it */ + if ((stream->staging_buffer_filled + len) < stream->staging_buffer_size) { + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, len); + stream->staging_buffer_filled += len; + return 0; + } + + /* Fill the staging buffer, process it, and continue */ + amount = (stream->staging_buffer_size - stream->staging_buffer_filled); + SDL_assert(amount > 0); + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, amount); + stream->staging_buffer_filled = 0; + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, NULL) < 0) { + return -1; + } + buf = (void *)((Uint8 *)buf + amount); + len -= amount; + } + return 0; +} + +int SDL_AudioStreamFlush(SDL_AudioStream *stream) +{ + if (!stream) { + return SDL_InvalidParamError("stream"); + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled); + #endif + + /* shouldn't use a staging buffer if we're not resampling. */ + SDL_assert((stream->dst_rate != stream->src_rate) || (stream->staging_buffer_filled == 0)); + + if (stream->staging_buffer_filled > 0) { + /* push the staging buffer + silence. We need to flush out not just + the staging buffer, but the piece that the stream was saving off + for right-side resampler padding. */ + const SDL_bool first_run = stream->first_run; + const int filled = stream->staging_buffer_filled; + int actual_input_frames = filled / stream->src_sample_frame_size; + if (!first_run) + actual_input_frames += stream->resampler_padding_samples / stream->pre_resample_channels; + + if (actual_input_frames > 0) { /* don't bother if nothing to flush. */ + /* This is how many bytes we're expecting without silence appended. */ + int flush_remaining = ((int) SDL_ceil(actual_input_frames * stream->rate_incr)) * stream->dst_sample_frame_size; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining); + #endif + + SDL_memset(stream->staging_buffer + filled, '\0', stream->staging_buffer_size - filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + + /* we have flushed out (or initially filled) the pending right-side + resampler padding, but we need to push more silence to guarantee + the staging buffer is fully flushed out, too. */ + SDL_memset(stream->staging_buffer, '\0', filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + } + } + + stream->staging_buffer_filled = 0; + stream->first_run = SDL_TRUE; + + return 0; +} + +/* get converted/resampled data from the stream */ +int +SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) +{ + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: want to get %d converted bytes\n", len); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len <= 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->dst_sample_frame_size) != 0) { + return SDL_SetError("Can't request partial sample frames"); + } + + return (int) SDL_ReadFromDataQueue(stream->queue, buf, len); +} + +/* number of converted/resampled bytes available */ +int +SDL_AudioStreamAvailable(SDL_AudioStream *stream) +{ + return stream ? (int) SDL_CountDataQueue(stream->queue) : 0; +} + +void +SDL_AudioStreamClear(SDL_AudioStream *stream) +{ + if (!stream) { + SDL_InvalidParamError("stream"); + } else { + SDL_ClearDataQueue(stream->queue, stream->packetlen * 2); + if (stream->reset_resampler_func) { + stream->reset_resampler_func(stream); + } + stream->first_run = SDL_TRUE; + stream->staging_buffer_filled = 0; + } +} + +/* dispose of a stream */ +void +SDL_FreeAudioStream(SDL_AudioStream *stream) +{ + if (stream) { + if (stream->cleanup_resampler_func) { + stream->cleanup_resampler_func(stream); + } + SDL_FreeDataQueue(stream->queue); + SDL_free(stream->staging_buffer); + SDL_free(stream->work_buffer_base); + SDL_free(stream->resampler_padding); + SDL_free(stream); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev.c rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev.c index 5c392cfb72..d0b94a0556 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev.c +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ /* Get the name of the audio device we use for output */ -#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO +#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO #include #include @@ -103,9 +103,10 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (* if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) { int instance = 0; - while (instance++ <= 64) { + while (instance <= 64) { SDL_snprintf(audiopath, SDL_arraysize(audiopath), "%s%d", audiodev, instance); + instance++; test_device(iscapture, audiopath, flags, test); } } diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev_c.h b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev_c.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev_c.h rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev_c.h index fa60bcdb17..2d3b0eac91 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev_c.h +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_audiodev_c_h_ +#define SDL_audiodev_c_h_ + #include "SDL.h" #include "../SDL_internal.h" #include "SDL_sysaudio.h" @@ -35,4 +39,6 @@ extern void SDL_EnumUnixAudioDevices(const int classic, int (*test)(int)); +#endif /* SDL_audiodev_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/SDL_audiotypecvt.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiotypecvt.c new file mode 100644 index 0000000000..5f8cc22dae --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_audiotypecvt.c @@ -0,0 +1,1431 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../SDL_internal.h" +#include "SDL_audio.h" +#include "SDL_audio_c.h" +#include "SDL_cpuinfo.h" +#include "SDL_assert.h" + +/* !!! FIXME: disabled until we fix https://bugzilla.libsdl.org/show_bug.cgi?id=4186 */ +#if 0 /*def __ARM_NEON__*/ +#define HAVE_NEON_INTRINSICS 1 +#endif + +#ifdef __SSE2__ +#define HAVE_SSE2_INTRINSICS 1 +#endif + +#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ +#elif __MACOSX__ && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ +#endif + +/* Set to zero if platform is guaranteed to use a SIMD codepath here. */ +#ifndef NEED_SCALAR_CONVERTER_FALLBACKS +#define NEED_SCALAR_CONVERTER_FALLBACKS 1 +#endif + +/* Function pointers set to a CPU-specific implementation. */ +SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL; + + +#define DIVBY128 0.0078125f +#define DIVBY32768 0.000030517578125f +#define DIVBY8388607 0.00000011920930376163766f + + +#if NEED_SCALAR_CONVERTER_FALLBACKS +static void SDLCALL +SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32"); + + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32"); + + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) { + *dst = ((float) (*src>>8)) * DIVBY8388607; + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 127; + } else if (sample <= -1.0f) { + *dst = -128; + } else { + *dst = (Sint8)(sample * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 255; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 32767; + } else if (sample <= -1.0f) { + *dst = -32768; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 65535; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint32 *dst = (Sint32 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 2147483647; + } else if (sample <= -1.0f) { + *dst = (Sint32) -2147483648LL; + } else { + *dst = ((Sint32)(sample * 8388607.0f)) << 8; + } + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); + } +} +#endif + + +#if HAVE_SSE2_INTRINSICS +static void SDLCALL +SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 sint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */ + const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-sign-extend gets us sint16 with the other set of values. */ + const __m128i shorts2 = _mm_srai_epi16(bytes, 8); + /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */ + const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128); + const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Sint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY128; + i--; src--; dst--; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + const __m128 minus1 = _mm_set1_ps(-1.0f); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 uint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */ + const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-zero-extend gets us uint16 with the other set of values. */ + const __m128i shorts2 = _mm_srli_epi16(bytes, 8); + /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */ + /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */ + const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1); + const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Uint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + i--; src--; dst--; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; + } + + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */ + const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srai_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768)); + _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY32768; + i--; src--; dst--; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + const __m128 minus1 = _mm_set1_ps(1.0f); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */ + const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srli_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1)); + _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + i--; src--; dst--; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = ((float) (*src>>8)) * DIVBY8388607; + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby8388607 = _mm_set1_ps(DIVBY8388607); + const __m128i *mmsrc = (const __m128i *) src; + while (i >= 4) { /* 4 * sint32 */ + /* shift out lowest bits so int fits in a float32. Small precision loss, but much faster. */ + _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_load_si128(mmsrc), 8)), divby8388607)); + i -= 4; mmsrc++; dst += 4; + } + src = (const Sint32 *) mmsrc; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) (*src>>8)) * DIVBY8388607; + i--; src++; dst++; + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 127; + } else if (sample <= -1.0f) { + *dst = -128; + } else { + *dst = (Sint8)(sample * 127.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 one = _mm_set1_ps(1.0f); + const __m128 negone = _mm_set1_ps(-1.0f); + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+4)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+8)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+12)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Sint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 127; + } else if (sample <= -1.0f) { + *dst = -128; + } else { + *dst = (Sint8)(sample * 127.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 255; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 one = _mm_set1_ps(1.0f); + const __m128 negone = _mm_set1_ps(-1.0f); + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+4)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+8)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+12)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Uint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 255; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 32767; + } else if (sample <= -1.0f) { + *dst = -32768; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 one = _mm_set1_ps(1.0f); + const __m128 negone = _mm_set1_ps(-1.0f); + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+4)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2)); /* pack to sint16, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Sint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 32767; + } else if (sample <= -1.0f) { + *dst = -32768; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 65535; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + /* This calculates differently than the scalar path because SSE2 can't + pack int32 data down to unsigned int16. _mm_packs_epi32 does signed + saturation, so that would corrupt our data. _mm_packus_epi32 exists, + but not before SSE 4.1. So we convert from float to sint16, packing + that down with legit signed saturation, and then xor the top bit + against 1. This results in the correct unsigned 16-bit value, even + though it looks like dark magic. */ + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + const __m128i topbit = _mm_set1_epi16(-32768); + const __m128 one = _mm_set1_ps(1.0f); + const __m128 negone = _mm_set1_ps(-1.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src+4)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit)); /* pack to sint16, xor top bit, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Uint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 65535; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint32 *dst = (Sint32 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 2147483647; + } else if (sample <= -1.0f) { + *dst = (Sint32) -2147483648LL; + } else { + *dst = ((Sint32)(sample * 8388607.0f)) << 8; + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 one = _mm_set1_ps(1.0f); + const __m128 negone = _mm_set1_ps(-1.0f); + const __m128 mulby8388607 = _mm_set1_ps(8388607.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 4) { /* 4 * float32 */ + _mm_store_si128(mmdst, _mm_slli_epi32(_mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby8388607)), 8)); /* load 4 floats, clamp, convert to sint32 */ + i -= 4; src += 4; mmdst++; + } + dst = (Sint32 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 2147483647; + } else if (sample <= -1.0f) { + *dst = (Sint32) -2147483648LL; + } else { + *dst = ((Sint32)(sample * 8388607.0f)) << 8; + } + i--; src++; dst++; + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); + } +} +#endif + + +#if HAVE_NEON_INTRINSICS +static void SDLCALL +SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using NEON)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; + } + + src -= 15; dst -= 15; /* adjust to read NEON blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const int8_t *mmsrc = (const int8_t *) src; + const float32x4_t divby128 = vdupq_n_f32(DIVBY128); + while (i >= 16) { /* 16 * 8-bit */ + const int8x16_t bytes = vld1q_s8(mmsrc); /* get 16 sint8 into a NEON register. */ + const int16x8_t int16hi = vmovl_s8(vget_high_s8(bytes)); /* convert top 8 bytes to 8 int16 */ + const int16x8_t int16lo = vmovl_s8(vget_low_s8(bytes)); /* convert bottom 8 bytes to 8 int16 */ + /* split int16 to two int32, then convert to float, then multiply to normalize, store. */ + vst1q_f32(dst, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16hi))), divby128)); + vst1q_f32(dst+4, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16hi))), divby128)); + vst1q_f32(dst+8, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(int16lo))), divby128)); + vst1q_f32(dst+12, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(int16lo))), divby128)); + i -= 16; mmsrc -= 16; dst -= 16; + } + + src = (const Sint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY128; + i--; src--; dst--; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using NEON)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + } + + src -= 15; dst -= 15; /* adjust to read NEON blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const uint8_t *mmsrc = (const uint8_t *) src; + const float32x4_t divby128 = vdupq_n_f32(DIVBY128); + const float32x4_t one = vdupq_n_f32(1.0f); + while (i >= 16) { /* 16 * 8-bit */ + const uint8x16_t bytes = vld1q_u8(mmsrc); /* get 16 uint8 into a NEON register. */ + const uint16x8_t uint16hi = vmovl_u8(vget_high_u8(bytes)); /* convert top 8 bytes to 8 uint16 */ + const uint16x8_t uint16lo = vmovl_u8(vget_low_u8(bytes)); /* convert bottom 8 bytes to 8 uint16 */ + /* split uint16 to two uint32, then convert to float, then multiply to normalize, subtract to adjust for sign, store. */ + vst1q_f32(dst, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16hi))), divby128, one)); + vst1q_f32(dst+4, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16hi))), divby128, one)); + vst1q_f32(dst+8, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_high_u16(uint16lo))), divby128, one)); + vst1q_f32(dst+12, vmlsq_f32(vcvtq_f32_u32(vmovl_u16(vget_low_u16(uint16lo))), divby128, one)); + i -= 16; mmsrc -= 16; dst -= 16; + } + + src = (const Uint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + i--; src--; dst--; + } + + cvt->len_cvt *= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using NEON)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; + } + + src -= 7; dst -= 7; /* adjust to read NEON blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768); + while (i >= 8) { /* 8 * 16-bit */ + const int16x8_t ints = vld1q_s16((int16_t const *) src); /* get 8 sint16 into a NEON register. */ + /* split int16 to two int32, then convert to float, then multiply to normalize, store. */ + vst1q_f32(dst, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(ints))), divby32768)); + vst1q_f32(dst+4, vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(ints))), divby32768)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY32768; + i--; src--; dst--; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using NEON)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + src -= 7; dst -= 7; /* adjust to read NEON blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768); + const float32x4_t one = vdupq_n_f32(1.0f); + while (i >= 8) { /* 8 * 16-bit */ + const uint16x8_t uints = vld1q_u16((uint16_t const *) src); /* get 8 uint16 into a NEON register. */ + /* split uint16 to two int32, then convert to float, then multiply to normalize, subtract for sign, store. */ + vst1q_f32(dst, vmlsq_f32(one, vcvtq_f32_u32(vmovl_u16(vget_low_u16(uints))), divby32768)); + vst1q_f32(dst+4, vmlsq_f32(one, vcvtq_f32_u32(vmovl_u16(vget_high_u16(uints))), divby32768)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + i--; src--; dst--; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S32_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = ((float) (*src>>8)) * DIVBY8388607; + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t divby8388607 = vdupq_n_f32(DIVBY8388607); + const int32_t *mmsrc = (const int32_t *) src; + while (i >= 4) { /* 4 * sint32 */ + /* shift out lowest bits so int fits in a float32. Small precision loss, but much faster. */ + vst1q_f32(dst, vmulq_f32(vcvtq_f32_s32(vshrq_n_s32(vld1q_s32(mmsrc), 8)), divby8388607)); + i -= 4; mmsrc += 4; dst += 4; + } + src = (const Sint32 *) mmsrc; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) (*src>>8)) * DIVBY8388607; + i--; src++; dst++; + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S8_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 127; + } else if (sample <= -1.0f) { + *dst = -128; + } else { + *dst = (Sint8)(sample * 127.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); + const float32x4_t mulby127 = vdupq_n_f32(127.0f); + int8_t *mmdst = (int8_t *) dst; + while (i >= 16) { /* 16 * float32 */ + const int32x4_t ints1 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const int32x4_t ints2 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+4)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const int32x4_t ints3 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+8)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const int32x4_t ints4 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+12)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ + const int8x8_t i8lo = vmovn_s16(vcombine_s16(vmovn_s32(ints1), vmovn_s32(ints2))); /* narrow to sint16, combine, narrow to sint8 */ + const int8x8_t i8hi = vmovn_s16(vcombine_s16(vmovn_s32(ints3), vmovn_s32(ints4))); /* narrow to sint16, combine, narrow to sint8 */ + vst1q_s8(mmdst, vcombine_s8(i8lo, i8hi)); /* combine to int8x16_t, store out */ + i -= 16; src += 16; mmdst += 16; + } + dst = (Sint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 127; + } else if (sample <= -1.0f) { + *dst = -128; + } else { + *dst = (Sint8)(sample * 127.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U8_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 255; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); + const float32x4_t mulby127 = vdupq_n_f32(127.0f); + uint8_t *mmdst = (uint8_t *) dst; + while (i >= 16) { /* 16 * float32 */ + const uint32x4_t uints1 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src)), one), one), mulby127)); /* load 4 floats, clamp, convert to uint32 */ + const uint32x4_t uints2 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+4)), one), one), mulby127)); /* load 4 floats, clamp, convert to uint32 */ + const uint32x4_t uints3 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+8)), one), one), mulby127)); /* load 4 floats, clamp, convert to uint32 */ + const uint32x4_t uints4 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+12)), one), one), mulby127)); /* load 4 floats, clamp, convert to uint32 */ + const uint8x8_t ui8lo = vmovn_u16(vcombine_u16(vmovn_u32(uints1), vmovn_u32(uints2))); /* narrow to uint16, combine, narrow to uint8 */ + const uint8x8_t ui8hi = vmovn_u16(vcombine_u16(vmovn_u32(uints3), vmovn_u32(uints4))); /* narrow to uint16, combine, narrow to uint8 */ + vst1q_u8(mmdst, vcombine_u8(ui8lo, ui8hi)); /* combine to uint8x16_t, store out */ + i -= 16; src += 16; mmdst += 16; + } + + dst = (Uint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 255; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S16_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 32767; + } else if (sample <= -1.0f) { + *dst = -32768; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); + const float32x4_t mulby32767 = vdupq_n_f32(32767.0f); + int16_t *mmdst = (int16_t *) dst; + while (i >= 8) { /* 8 * float32 */ + const int32x4_t ints1 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + const int32x4_t ints2 = vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+4)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ + vst1q_s16(mmdst, vcombine_s16(vmovn_s32(ints1), vmovn_s32(ints2))); /* narrow to sint16, combine, store out. */ + i -= 8; src += 8; mmdst += 8; + } + dst = (Sint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 32767; + } else if (sample <= -1.0f) { + *dst = -32768; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U16_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 65535; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); + const float32x4_t mulby32767 = vdupq_n_f32(32767.0f); + uint16_t *mmdst = (uint16_t *) dst; + while (i >= 8) { /* 8 * float32 */ + const uint32x4_t uints1 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src)), one), one), mulby32767)); /* load 4 floats, clamp, convert to uint32 */ + const uint32x4_t uints2 = vcvtq_u32_f32(vmulq_f32(vaddq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src+4)), one), one), mulby32767)); /* load 4 floats, clamp, convert to uint32 */ + vst1q_u16(mmdst, vcombine_u16(vmovn_u32(uints1), vmovn_u32(uints2))); /* narrow to uint16, combine, store out. */ + i -= 8; src += 8; mmdst += 8; + } + dst = (Uint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 65535; + } else if (sample <= -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + i--; src++; dst++; + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint32 *dst = (Sint32 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using NEON)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 2147483647; + } else if (sample <= -1.0f) { + *dst = -2147483648; + } else { + *dst = ((Sint32)(sample * 8388607.0f)) << 8; + } + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ + const float32x4_t one = vdupq_n_f32(1.0f); + const float32x4_t negone = vdupq_n_f32(-1.0f); + const float32x4_t mulby8388607 = vdupq_n_f32(8388607.0f); + int32_t *mmdst = (int32_t *) dst; + while (i >= 4) { /* 4 * float32 */ + vst1q_s32(mmdst, vshlq_n_s32(vcvtq_s32_f32(vmulq_f32(vminq_f32(vmaxq_f32(negone, vld1q_f32(src)), one), mulby8388607)), 8)); + i -= 4; src += 4; mmdst += 4; + } + dst = (Sint32 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + const float sample = *src; + if (sample >= 1.0f) { + *dst = 2147483647; + } else if (sample <= -1.0f) { + *dst = -2147483648; + } else { + *dst = ((Sint32)(sample * 8388607.0f)) << 8; + } + i--; src++; dst++; + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); + } +} +#endif + + + +void SDL_ChooseAudioConverters(void) +{ + static SDL_bool converters_chosen = SDL_FALSE; + + if (converters_chosen) { + return; + } + +#define SET_CONVERTER_FUNCS(fntype) \ + SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \ + SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \ + SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \ + SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \ + SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \ + SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \ + SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \ + SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \ + SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \ + SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ + converters_chosen = SDL_TRUE + +#if HAVE_SSE2_INTRINSICS + if (SDL_HasSSE2()) { + SET_CONVERTER_FUNCS(SSE2); + return; + } +#endif + +#if HAVE_NEON_INTRINSICS + if (SDL_HasNEON()) { + SET_CONVERTER_FUNCS(NEON); + return; + } +#endif + +#if NEED_SCALAR_CONVERTER_FALLBACKS + SET_CONVERTER_FUNCS(Scalar); +#endif + +#undef SET_CONVERTER_FUNCS + + SDL_assert(converters_chosen == SDL_TRUE); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_mixer.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_mixer.c similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_mixer.c rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_mixer.c index b49c73daba..d416a94c2f 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_mixer.c +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -202,6 +202,54 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, } break; + case AUDIO_U16LSB: + { + Uint16 src1, src2; + int dst_sample; + const int max_audioval = 0xFFFF; + + len /= 2; + while (len--) { + src1 = ((src[1]) << 8 | src[0]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[1]) << 8 | dst[0]); + src += 2; + dst_sample = src1 + src2; + if (dst_sample > max_audioval) { + dst_sample = max_audioval; + } + dst[0] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[1] = dst_sample & 0xFF; + dst += 2; + } + } + break; + + case AUDIO_U16MSB: + { + Uint16 src1, src2; + int dst_sample; + const int max_audioval = 0xFFFF; + + len /= 2; + while (len--) { + src1 = ((src[0]) << 8 | src[1]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[0]) << 8 | dst[1]); + src += 2; + dst_sample = src1 + src2; + if (dst_sample > max_audioval) { + dst_sample = max_audioval; + } + dst[1] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[0] = dst_sample & 0xFF; + dst += 2; + } + } + break; + case AUDIO_S32LSB: { const Uint32 *src32 = (Uint32 *) src; @@ -313,7 +361,7 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, break; default: /* If this happens... FIXME! */ - SDL_SetError("SDL_MixAudio(): unknown audio format"); + SDL_SetError("SDL_MixAudioFormat(): unknown audio format"); return; } } diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_sysaudio.h b/3rdparty/sdl2-2.0.9/src/audio/SDL_sysaudio.h similarity index 65% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_sysaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_sysaudio.h index 426a190f18..579dea5b40 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_sysaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,17 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysaudio_h -#define _SDL_sysaudio_h +#ifndef SDL_sysaudio_h_ +#define SDL_sysaudio_h_ #include "SDL_mutex.h" #include "SDL_thread.h" +#include "../SDL_dataqueue.h" +#include "./SDL_audio_c.h" + +/* !!! FIXME: These are wordy and unlocalized... */ +#define DEFAULT_OUTPUT_DEVNAME "System audio output device" +#define DEFAULT_INPUT_DEVNAME "System audio capture device" /* The SDL audio driver */ typedef struct SDL_AudioDevice SDL_AudioDevice; @@ -45,7 +51,6 @@ extern void SDL_RemoveAudioDevice(const int iscapture, void *handle); as appropriate so SDL's list of devices is accurate. */ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); - /* This is the size of a packet when using SDL_QueueAudio(). We allocate these as necessary and pool them, under the assumption that we'll eventually end up with a handful that keep recycling, meeting whatever @@ -57,25 +62,20 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); The system preallocates enough packets for 2 callbacks' worth of data. */ #define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024) -/* Used by apps that queue audio instead of using the callback. */ -typedef struct SDL_AudioBufferQueue -{ - Uint8 data[SDL_AUDIOBUFFERQUEUE_PACKETLEN]; /* packet data. */ - Uint32 datalen; /* bytes currently in use in this packet. */ - Uint32 startpos; /* bytes currently consumed in this packet. */ - struct SDL_AudioBufferQueue *next; /* next item in linked list. */ -} SDL_AudioBufferQueue; - typedef struct SDL_AudioDriverImpl { void (*DetectDevices) (void); int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture); void (*ThreadInit) (_THIS); /* Called by audio thread at start */ + void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */ + void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); int (*GetPendingBytes) (_THIS); Uint8 *(*GetDeviceBuf) (_THIS); - void (*WaitDone) (_THIS); + int (*CaptureFromDevice) (_THIS, void *buffer, int buflen); + void (*FlushCapture) (_THIS); + void (*PrepareToClose) (_THIS); /**< Called between run and draining wait for playback devices */ void (*CloseDevice) (_THIS); void (*LockDevice) (_THIS); void (*UnlockDevice) (_THIS); @@ -87,10 +87,10 @@ typedef struct SDL_AudioDriverImpl /* Some flags to push duplicate code into the core and reduce #ifdefs. */ /* !!! FIXME: these should be SDL_bool */ int ProvidesOwnCallbackThread; - int SkipMixerLock; /* !!! FIXME: do we need this anymore? */ + int SkipMixerLock; int HasCaptureSupport; int OnlyHasDefaultOutputDevice; - int OnlyHasDefaultInputDevice; + int OnlyHasDefaultCaptureDevice; int AllowsArbitraryDeviceNames; } SDL_AudioDriverImpl; @@ -98,12 +98,10 @@ typedef struct SDL_AudioDriverImpl typedef struct SDL_AudioDeviceItem { void *handle; + char *name; + char *original_name; + int dupenum; struct SDL_AudioDeviceItem *next; - #if (defined(__GNUC__) && (__GNUC__ <= 2)) - char name[1]; /* actually variable length. */ - #else - char name[]; - #endif } SDL_AudioDeviceItem; @@ -130,15 +128,6 @@ typedef struct SDL_AudioDriver } SDL_AudioDriver; -/* Streamer */ -typedef struct -{ - Uint8 *buffer; - int max_len; /* the maximum length in bytes */ - int read_pos, write_pos; /* the position of the write and read heads in bytes */ -} SDL_AudioStreamer; - - /* Define the SDL audio driver structure */ struct SDL_AudioDevice { @@ -146,26 +135,26 @@ struct SDL_AudioDevice /* Data common to all devices */ SDL_AudioDeviceID id; - /* The current audio specification (shared with audio thread) */ + /* The device's current audio specification */ SDL_AudioSpec spec; - /* An audio conversion block for audio format emulation */ - SDL_AudioCVT convert; + /* The callback's expected audio specification (converted vs device's spec). */ + SDL_AudioSpec callbackspec; - /* The streamer, if sample rate conversion necessitates it */ - int use_streamer; - SDL_AudioStreamer streamer; + /* Stream that converts and resamples. NULL if not needed. */ + SDL_AudioStream *stream; /* Current state flags */ - /* !!! FIXME: should be SDL_bool */ - int iscapture; - int enabled; /* true if device is functioning and connected. */ - int shutdown; /* true if we are signaling the play thread to end. */ - int paused; - int opened; + SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */ + SDL_atomic_t enabled; /* true if device is functioning and connected. */ + SDL_atomic_t paused; + SDL_bool iscapture; + + /* Scratch buffer used in the bridge between SDL and the user callback. */ + Uint8 *work_buffer; - /* Fake audio buffer for when the audio hardware is busy */ - Uint8 *fake_stream; + /* Size, in bytes, of work_buffer. */ + Uint32 work_buffer_len; /* A mutex for locking the mixing buffers */ SDL_mutex *mixer_lock; @@ -175,14 +164,13 @@ struct SDL_AudioDevice SDL_threadID threadid; /* Queued buffers (if app not using callback). */ - SDL_AudioBufferQueue *buffer_queue_head; /* device fed from here. */ - SDL_AudioBufferQueue *buffer_queue_tail; /* queue fills to here. */ - SDL_AudioBufferQueue *buffer_queue_pool; /* these are unused packets. */ - Uint32 queued_bytes; /* number of bytes of audio data in the queue. */ + SDL_DataQueue *buffer_queue; /* * * */ /* Data private to this driver */ struct SDL_PrivateAudioData *hidden; + + void *handle; }; #undef _THIS @@ -194,6 +182,32 @@ typedef struct AudioBootStrap int demand_only; /* 1==request explicitly, or it won't be available. */ } AudioBootStrap; -#endif /* _SDL_sysaudio_h */ +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +extern AudioBootStrap PULSEAUDIO_bootstrap; +extern AudioBootStrap ALSA_bootstrap; +extern AudioBootStrap JACK_bootstrap; +extern AudioBootStrap SNDIO_bootstrap; +extern AudioBootStrap NETBSDAUDIO_bootstrap; +extern AudioBootStrap DSP_bootstrap; +extern AudioBootStrap QSAAUDIO_bootstrap; +extern AudioBootStrap SUNAUDIO_bootstrap; +extern AudioBootStrap ARTS_bootstrap; +extern AudioBootStrap ESD_bootstrap; +extern AudioBootStrap NACLAUDIO_bootstrap; +extern AudioBootStrap NAS_bootstrap; +extern AudioBootStrap WASAPI_bootstrap; +extern AudioBootStrap DSOUND_bootstrap; +extern AudioBootStrap WINMM_bootstrap; +extern AudioBootStrap PAUDIO_bootstrap; +extern AudioBootStrap HAIKUAUDIO_bootstrap; +extern AudioBootStrap COREAUDIO_bootstrap; +extern AudioBootStrap DISKAUDIO_bootstrap; +extern AudioBootStrap DUMMYAUDIO_bootstrap; +extern AudioBootStrap FUSIONSOUND_bootstrap; +extern AudioBootStrap ANDROIDAUDIO_bootstrap; +extern AudioBootStrap PSPAUDIO_bootstrap; +extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; + +#endif /* SDL_sysaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_wave.c b/3rdparty/sdl2-2.0.9/src/audio/SDL_wave.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_wave.c rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_wave.c index 99daac64ba..2c76a8ce94 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_wave.c +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -403,6 +403,47 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) return (0); } + +static int +ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len) +{ + const double DIVBY8388608 = 0.00000011920928955078125; + const Uint32 original_len = *audio_len; + const Uint32 samples = original_len / 3; + const Uint32 expanded_len = samples * sizeof (Uint32); + Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len); + const Uint8 *src; + Uint32 *dst; + Uint32 i; + + if (!ptr) { + return SDL_OutOfMemory(); + } + + *audio_buf = ptr; + *audio_len = expanded_len; + + /* work from end to start, since we're expanding in-place. */ + src = (ptr + original_len) - 3; + dst = ((Uint32 *) (ptr + expanded_len)) - 1; + for (i = 0; i < samples; i++) { + /* There's probably a faster way to do all this. */ + const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) | + (((Uint32) src[1]) << 16) | + (((Uint32) src[0]) << 8) )) >> 8; + const double scaled = (((double) converted) * DIVBY8388608); + src -= 3; + *(dst--) = (Sint32) (scaled * 2147483647.0); + } + + return 0; +} + + +/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */ +static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; +static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; + SDL_AudioSpec * SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len) @@ -421,6 +462,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, /* FMT chunk */ WaveFMT *format = NULL; + WaveExtensibleFMT *ext = NULL; SDL_zero(chunk); @@ -494,6 +536,24 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } IMA_ADPCM_encoded = 1; break; + case EXTENSIBLE_CODE: + /* note that this ignores channel masks, smaller valid bit counts + inside a larger container, and most subtypes. This is just enough + to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE + to be useful working when they use this format flag. */ + ext = (WaveExtensibleFMT *) format; + if (SDL_SwapLE16(ext->size) < 22) { + SDL_SetError("bogus extended .wav header"); + was_error = 1; + goto done; + } + if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) { + break; /* cool. */ + } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) { + IEEE_float_encoded = 1; + break; + } + break; case MP3_CODE: SDL_SetError("MPEG Layer 3 data not supported"); was_error = 1; @@ -504,7 +564,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, was_error = 1; goto done; } - SDL_memset(spec, 0, (sizeof *spec)); + SDL_zerop(spec); spec->freq = SDL_SwapLE32(format->frequency); if (IEEE_float_encoded) { @@ -528,6 +588,9 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, case 16: spec->format = AUDIO_S16; break; + case 24: /* convert this. */ + spec->format = AUDIO_S32; + break; case 32: spec->format = AUDIO_S32; break; @@ -575,6 +638,13 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } } + if (SDL_SwapLE16(format->bitspersample) == 24) { + if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) { + was_error = 1; + goto done; + } + } + /* Don't return a buffer that isn't a multiple of samplesize */ samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels; *audio_len &= ~(samplesize - 1); diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_wave.h b/3rdparty/sdl2-2.0.9/src/audio/SDL_wave.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_wave.h rename to 3rdparty/sdl2-2.0.9/src/audio/SDL_wave.h index f2f93986ee..5c60f75386 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_wave.h +++ b/3rdparty/sdl2-2.0.9/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ #define IEEE_FLOAT_CODE 0x0003 #define IMA_ADPCM_CODE 0x0011 #define MP3_CODE 0x0055 +#define EXTENSIBLE_CODE 0xFFFE #define WAVE_MONO 1 #define WAVE_STEREO 2 @@ -64,4 +65,13 @@ typedef struct Chunk Uint8 *data; } Chunk; +typedef struct WaveExtensibleFMT +{ + WaveFMT format; + Uint16 size; + Uint16 validbits; + Uint32 channelmask; + Uint8 subformat[16]; /* a GUID. */ +} WaveExtensibleFMT; + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.c b/3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.c new file mode 100644 index 0000000000..eff192b7e8 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.c @@ -0,0 +1,990 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_ALSA + +#ifndef SDL_ALSA_NON_BLOCKING +#define SDL_ALSA_NON_BLOCKING 0 +#endif + +/* Allow access to a raw mixing buffer */ + +#include +#include /* For kill() */ +#include + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_alsa_audio.h" + +#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#include "SDL_loadso.h" +#endif + +static int (*ALSA_snd_pcm_open) + (snd_pcm_t **, const char *, snd_pcm_stream_t, int); +static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm); +static snd_pcm_sframes_t (*ALSA_snd_pcm_writei) + (snd_pcm_t *, const void *, snd_pcm_uframes_t); +static snd_pcm_sframes_t (*ALSA_snd_pcm_readi) + (snd_pcm_t *, void *, snd_pcm_uframes_t); +static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int); +static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *); +static int (*ALSA_snd_pcm_drain) (snd_pcm_t *); +static const char *(*ALSA_snd_strerror) (int); +static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void); +static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void); +static void (*ALSA_snd_pcm_hw_params_copy) + (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *); +static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *); +static int (*ALSA_snd_pcm_hw_params_set_access) + (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t); +static int (*ALSA_snd_pcm_hw_params_set_format) + (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t); +static int (*ALSA_snd_pcm_hw_params_set_channels) + (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int); +static int (*ALSA_snd_pcm_hw_params_get_channels) + (const snd_pcm_hw_params_t *, unsigned int *); +static int (*ALSA_snd_pcm_hw_params_set_rate_near) + (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); +static int (*ALSA_snd_pcm_hw_params_set_period_size_near) + (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); +static int (*ALSA_snd_pcm_hw_params_get_period_size) + (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *); +static int (*ALSA_snd_pcm_hw_params_set_periods_near) + (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *); +static int (*ALSA_snd_pcm_hw_params_get_periods) + (const snd_pcm_hw_params_t *, unsigned int *, int *); +static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near) + (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *); +static int (*ALSA_snd_pcm_hw_params_get_buffer_size) + (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *); +static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *); +static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *, + snd_pcm_sw_params_t *); +static int (*ALSA_snd_pcm_sw_params_set_start_threshold) + (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); +static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *); +static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int); +static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int); +static int (*ALSA_snd_pcm_sw_params_set_avail_min) + (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); +static int (*ALSA_snd_pcm_reset)(snd_pcm_t *); +static int (*ALSA_snd_device_name_hint) (int, const char *, void ***); +static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *); +static int (*ALSA_snd_device_name_free_hint) (void **); +static snd_pcm_sframes_t (*ALSA_snd_pcm_avail)(snd_pcm_t *); +#ifdef SND_CHMAP_API_VERSION +static snd_pcm_chmap_t* (*ALSA_snd_pcm_get_chmap) (snd_pcm_t *); +static int (*ALSA_snd_pcm_chmap_print) (const snd_pcm_chmap_t *map, size_t maxlen, char *buf); +#endif + +#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof +#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof + +static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC; +static void *alsa_handle = NULL; + +static int +load_alsa_sym(const char *fn, void **addr) +{ + *addr = SDL_LoadFunction(alsa_handle, fn); + if (*addr == NULL) { + /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ + return 0; + } + + return 1; +} + +/* cast funcs to char* first, to please GCC's strict aliasing rules. */ +#define SDL_ALSA_SYM(x) \ + if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1 +#else +#define SDL_ALSA_SYM(x) ALSA_##x = x +#endif + +static int +load_alsa_syms(void) +{ + SDL_ALSA_SYM(snd_pcm_open); + SDL_ALSA_SYM(snd_pcm_close); + SDL_ALSA_SYM(snd_pcm_writei); + SDL_ALSA_SYM(snd_pcm_readi); + SDL_ALSA_SYM(snd_pcm_recover); + SDL_ALSA_SYM(snd_pcm_prepare); + SDL_ALSA_SYM(snd_pcm_drain); + SDL_ALSA_SYM(snd_strerror); + SDL_ALSA_SYM(snd_pcm_hw_params_sizeof); + SDL_ALSA_SYM(snd_pcm_sw_params_sizeof); + SDL_ALSA_SYM(snd_pcm_hw_params_copy); + SDL_ALSA_SYM(snd_pcm_hw_params_any); + SDL_ALSA_SYM(snd_pcm_hw_params_set_access); + SDL_ALSA_SYM(snd_pcm_hw_params_set_format); + SDL_ALSA_SYM(snd_pcm_hw_params_set_channels); + SDL_ALSA_SYM(snd_pcm_hw_params_get_channels); + SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near); + SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near); + SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size); + SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near); + SDL_ALSA_SYM(snd_pcm_hw_params_get_periods); + SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near); + SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size); + SDL_ALSA_SYM(snd_pcm_hw_params); + SDL_ALSA_SYM(snd_pcm_sw_params_current); + SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold); + SDL_ALSA_SYM(snd_pcm_sw_params); + SDL_ALSA_SYM(snd_pcm_nonblock); + SDL_ALSA_SYM(snd_pcm_wait); + SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min); + SDL_ALSA_SYM(snd_pcm_reset); + SDL_ALSA_SYM(snd_device_name_hint); + SDL_ALSA_SYM(snd_device_name_get_hint); + SDL_ALSA_SYM(snd_device_name_free_hint); + SDL_ALSA_SYM(snd_pcm_avail); +#ifdef SND_CHMAP_API_VERSION + SDL_ALSA_SYM(snd_pcm_get_chmap); + SDL_ALSA_SYM(snd_pcm_chmap_print); +#endif + + return 0; +} + +#undef SDL_ALSA_SYM + +#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC + +static void +UnloadALSALibrary(void) +{ + if (alsa_handle != NULL) { + SDL_UnloadObject(alsa_handle); + alsa_handle = NULL; + } +} + +static int +LoadALSALibrary(void) +{ + int retval = 0; + if (alsa_handle == NULL) { + alsa_handle = SDL_LoadObject(alsa_library); + if (alsa_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = load_alsa_syms(); + if (retval < 0) { + UnloadALSALibrary(); + } + } + } + return retval; +} + +#else + +static void +UnloadALSALibrary(void) +{ +} + +static int +LoadALSALibrary(void) +{ + load_alsa_syms(); + return 0; +} + +#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ + +static const char * +get_audio_device(void *handle, const int channels) +{ + const char *device; + + if (handle != NULL) { + return (const char *) handle; + } + + /* !!! FIXME: we also check "SDL_AUDIO_DEVICE_NAME" at the higher level. */ + device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ + if (device != NULL) { + return device; + } + + if (channels == 6) { + return "plug:surround51"; + } else if (channels == 4) { + return "plug:surround40"; + } + + return "default"; +} + + +/* This function waits until it is possible to write a full sound buffer */ +static void +ALSA_WaitDevice(_THIS) +{ +#if SDL_ALSA_NON_BLOCKING + const snd_pcm_sframes_t needed = (snd_pcm_sframes_t) this->spec.samples; + while (SDL_AtomicGet(&this->enabled)) { + const snd_pcm_sframes_t rc = ALSA_snd_pcm_avail(this->hidden->pcm_handle); + if ((rc < 0) && (rc != -EAGAIN)) { + /* Hmm, not much we can do - abort */ + fprintf(stderr, "ALSA snd_pcm_avail failed (unrecoverable): %s\n", + ALSA_snd_strerror(rc)); + SDL_OpenedAudioDeviceDisconnected(this); + return; + } else if (rc < needed) { + const Uint32 delay = ((needed - (SDL_max(rc, 0))) * 1000) / this->spec.freq; + SDL_Delay(SDL_max(delay, 10)); + } else { + break; /* ready to go! */ + } + } +#endif +} + + +/* !!! FIXME: is there a channel swizzler in alsalib instead? */ +/* + * http://bugzilla.libsdl.org/show_bug.cgi?id=110 + * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE + * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR" + */ +#define SWIZ6(T, buf, numframes) \ + T *ptr = (T *) buf; \ + Uint32 i; \ + for (i = 0; i < numframes; i++, ptr += 6) { \ + T tmp; \ + tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \ + tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ + } + +static void +swizzle_alsa_channels_6_64bit(void *buffer, Uint32 bufferlen) +{ + SWIZ6(Uint64, buffer, bufferlen); +} + +static void +swizzle_alsa_channels_6_32bit(void *buffer, Uint32 bufferlen) +{ + SWIZ6(Uint32, buffer, bufferlen); +} + +static void +swizzle_alsa_channels_6_16bit(void *buffer, Uint32 bufferlen) +{ + SWIZ6(Uint16, buffer, bufferlen); +} + +static void +swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen) +{ + SWIZ6(Uint8, buffer, bufferlen); +} + +#undef SWIZ6 + + +/* + * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle + * channels from Windows/Mac order to the format alsalib will want. + */ +static void +swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen) +{ + if (this->spec.channels == 6) { + switch (SDL_AUDIO_BITSIZE(this->spec.format)) { + case 8: swizzle_alsa_channels_6_8bit(buffer, bufferlen); break; + case 16: swizzle_alsa_channels_6_16bit(buffer, bufferlen); break; + case 32: swizzle_alsa_channels_6_32bit(buffer, bufferlen); break; + case 64: swizzle_alsa_channels_6_64bit(buffer, bufferlen); break; + default: SDL_assert(!"unhandled bitsize"); break; + } + } + + /* !!! FIXME: update this for 7.1 if needed, later. */ +} + +#ifdef SND_CHMAP_API_VERSION +/* Some devices have the right channel map, no swizzling necessary */ +static void +no_swizzle(_THIS, void *buffer, Uint32 bufferlen) +{ + return; +} +#endif /* SND_CHMAP_API_VERSION */ + + +static void +ALSA_PlayDevice(_THIS) +{ + const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf; + const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) * + this->spec.channels; + snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples); + + this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left); + + while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { + int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, + sample_buf, frames_left); + + if (status < 0) { + if (status == -EAGAIN) { + /* Apparently snd_pcm_recover() doesn't handle this case - + does it assume snd_pcm_wait() above? */ + SDL_Delay(1); + continue; + } + status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); + if (status < 0) { + /* Hmm, not much we can do - abort */ + fprintf(stderr, "ALSA write failed (unrecoverable): %s\n", + ALSA_snd_strerror(status)); + SDL_OpenedAudioDeviceDisconnected(this); + return; + } + continue; + } + else if (status == 0) { + /* No frames were written (no available space in pcm device). + Allow other threads to catch up. */ + Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq; + SDL_Delay(delay); + } + + sample_buf += status * frame_size; + frames_left -= status; + } +} + +static Uint8 * +ALSA_GetDeviceBuf(_THIS) +{ + return (this->hidden->mixbuf); +} + +static int +ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + Uint8 *sample_buf = (Uint8 *) buffer; + const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) * + this->spec.channels; + const int total_frames = buflen / frame_size; + snd_pcm_uframes_t frames_left = total_frames; + snd_pcm_uframes_t wait_time = frame_size / 2; + + SDL_assert((buflen % frame_size) == 0); + + while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { + int status; + + status = ALSA_snd_pcm_readi(this->hidden->pcm_handle, + sample_buf, frames_left); + + if (status == -EAGAIN) { + ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time); + status = 0; + } + else if (status < 0) { + /*printf("ALSA: capture error %d\n", status);*/ + status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); + if (status < 0) { + /* Hmm, not much we can do - abort */ + fprintf(stderr, "ALSA read failed (unrecoverable): %s\n", + ALSA_snd_strerror(status)); + return -1; + } + continue; + } + + /*printf("ALSA: captured %d bytes\n", status * frame_size);*/ + sample_buf += status * frame_size; + frames_left -= status; + } + + this->hidden->swizzle_func(this, buffer, total_frames - frames_left); + + return (total_frames - frames_left) * frame_size; +} + +static void +ALSA_FlushCapture(_THIS) +{ + ALSA_snd_pcm_reset(this->hidden->pcm_handle); +} + +static void +ALSA_CloseDevice(_THIS) +{ + if (this->hidden->pcm_handle) { + /* Wait for the submitted audio to drain + ALSA_snd_pcm_drop() can hang, so don't use that. + */ + Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2; + SDL_Delay(delay); + + ALSA_snd_pcm_close(this->hidden->pcm_handle); + } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); +} + +static int +ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) +{ + int status; + snd_pcm_hw_params_t *hwparams; + snd_pcm_uframes_t bufsize; + snd_pcm_uframes_t persize; + + /* Copy the hardware parameters for this setup */ + snd_pcm_hw_params_alloca(&hwparams); + ALSA_snd_pcm_hw_params_copy(hwparams, params); + + /* Prioritize matching the period size to the requested buffer size */ + persize = this->spec.samples; + status = ALSA_snd_pcm_hw_params_set_period_size_near( + this->hidden->pcm_handle, hwparams, &persize, NULL); + if ( status < 0 ) { + return(-1); + } + + /* Next try to restrict the parameters to having only two periods */ + bufsize = this->spec.samples * 2; + status = ALSA_snd_pcm_hw_params_set_buffer_size_near( + this->hidden->pcm_handle, hwparams, &bufsize); + if ( status < 0 ) { + return(-1); + } + + /* "set" the hardware with the desired parameters */ + status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams); + if ( status < 0 ) { + return(-1); + } + + this->spec.samples = persize; + + /* This is useful for debugging */ + if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) { + unsigned int periods = 0; + + ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL); + + fprintf(stderr, + "ALSA: period size = %ld, periods = %u, buffer size = %lu\n", + persize, periods, bufsize); + } + + return(0); +} + +static int +ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + int status = 0; + snd_pcm_t *pcm_handle = NULL; + snd_pcm_hw_params_t *hwparams = NULL; + snd_pcm_sw_params_t *swparams = NULL; + snd_pcm_format_t format = 0; + SDL_AudioFormat test_format = 0; + unsigned int rate = 0; + unsigned int channels = 0; +#ifdef SND_CHMAP_API_VERSION + snd_pcm_chmap_t *chmap; + char chmap_str[64]; +#endif + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + /* Open the audio device */ + /* Name of device should depend on # channels in spec */ + status = ALSA_snd_pcm_open(&pcm_handle, + get_audio_device(handle, this->spec.channels), + iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, + SND_PCM_NONBLOCK); + + if (status < 0) { + return SDL_SetError("ALSA: Couldn't open audio device: %s", + ALSA_snd_strerror(status)); + } + + this->hidden->pcm_handle = pcm_handle; + + /* Figure out what the hardware is capable of */ + snd_pcm_hw_params_alloca(&hwparams); + status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't get hardware config: %s", + ALSA_snd_strerror(status)); + } + + /* SDL only uses interleaved sample output */ + status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams, + SND_PCM_ACCESS_RW_INTERLEAVED); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't set interleaved access: %s", + ALSA_snd_strerror(status)); + } + + /* Try for a closest match on audio format */ + status = -1; + for (test_format = SDL_FirstAudioFormat(this->spec.format); + test_format && (status < 0);) { + status = 0; /* if we can't support a format, it'll become -1. */ + switch (test_format) { + case AUDIO_U8: + format = SND_PCM_FORMAT_U8; + break; + case AUDIO_S8: + format = SND_PCM_FORMAT_S8; + break; + case AUDIO_S16LSB: + format = SND_PCM_FORMAT_S16_LE; + break; + case AUDIO_S16MSB: + format = SND_PCM_FORMAT_S16_BE; + break; + case AUDIO_U16LSB: + format = SND_PCM_FORMAT_U16_LE; + break; + case AUDIO_U16MSB: + format = SND_PCM_FORMAT_U16_BE; + break; + case AUDIO_S32LSB: + format = SND_PCM_FORMAT_S32_LE; + break; + case AUDIO_S32MSB: + format = SND_PCM_FORMAT_S32_BE; + break; + case AUDIO_F32LSB: + format = SND_PCM_FORMAT_FLOAT_LE; + break; + case AUDIO_F32MSB: + format = SND_PCM_FORMAT_FLOAT_BE; + break; + default: + status = -1; + break; + } + if (status >= 0) { + status = ALSA_snd_pcm_hw_params_set_format(pcm_handle, + hwparams, format); + } + if (status < 0) { + test_format = SDL_NextAudioFormat(); + } + } + if (status < 0) { + return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); + } + this->spec.format = test_format; + + /* Validate number of channels and determine if swizzling is necessary + * Assume original swizzling, until proven otherwise. + */ + this->hidden->swizzle_func = swizzle_alsa_channels; +#ifdef SND_CHMAP_API_VERSION + chmap = ALSA_snd_pcm_get_chmap(pcm_handle); + if (chmap) { + ALSA_snd_pcm_chmap_print(chmap, sizeof(chmap_str), chmap_str); + if (SDL_strcmp("FL FR FC LFE RL RR", chmap_str) == 0 || + SDL_strcmp("FL FR FC LFE SL SR", chmap_str) == 0) { + this->hidden->swizzle_func = no_swizzle; + } + free(chmap); + } +#endif /* SND_CHMAP_API_VERSION */ + + /* Set the number of channels */ + status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams, + this->spec.channels); + channels = this->spec.channels; + if (status < 0) { + status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't set audio channels"); + } + this->spec.channels = channels; + } + + /* Set the audio rate */ + rate = this->spec.freq; + status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, + &rate, NULL); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't set audio frequency: %s", + ALSA_snd_strerror(status)); + } + this->spec.freq = rate; + + /* Set the buffer size, in samples */ + status = ALSA_set_buffer_size(this, hwparams); + if (status < 0) { + return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status)); + } + + /* Set the software parameters */ + snd_pcm_sw_params_alloca(&swparams); + status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't get software config: %s", + ALSA_snd_strerror(status)); + } + status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples); + if (status < 0) { + return SDL_SetError("Couldn't set minimum available samples: %s", + ALSA_snd_strerror(status)); + } + status = + ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't set start threshold: %s", + ALSA_snd_strerror(status)); + } + status = ALSA_snd_pcm_sw_params(pcm_handle, swparams); + if (status < 0) { + return SDL_SetError("Couldn't set software audio parameters: %s", + ALSA_snd_strerror(status)); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(&this->spec); + + /* Allocate mixing buffer */ + if (!iscapture) { + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); + } + + #if !SDL_ALSA_NON_BLOCKING + if (!iscapture) { + ALSA_snd_pcm_nonblock(pcm_handle, 0); + } + #endif + + /* We're ready to rock and roll. :-) */ + return 0; +} + +typedef struct ALSA_Device +{ + char *name; + SDL_bool iscapture; + struct ALSA_Device *next; +} ALSA_Device; + +static void +add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen) +{ + ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device)); + char *desc; + char *handle = NULL; + char *ptr; + + if (!dev) { + return; + } + + /* Not all alsa devices are enumerable via snd_device_name_get_hint + (i.e. bluetooth devices). Therefore if hint is passed in to this + function as NULL, assume name contains desc. + Make sure not to free the storage associated with desc in this case */ + if (hint) { + desc = ALSA_snd_device_name_get_hint(hint, "DESC"); + if (!desc) { + SDL_free(dev); + return; + } + } else { + desc = (char *) name; + } + + SDL_assert(name != NULL); + + /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output". + just chop the extra lines off, this seems to get a reasonable device + name without extra details. */ + if ((ptr = strchr(desc, '\n')) != NULL) { + *ptr = '\0'; + } + + /*printf("ALSA: adding %s device '%s' (%s)\n", iscapture ? "capture" : "output", name, desc);*/ + + handle = SDL_strdup(name); + if (!handle) { + if (hint) { + free(desc); + } + SDL_free(dev); + return; + } + + SDL_AddAudioDevice(iscapture, desc, handle); + if (hint) + free(desc); + dev->name = handle; + dev->iscapture = iscapture; + dev->next = *pSeen; + *pSeen = dev; +} + + +static SDL_atomic_t ALSA_hotplug_shutdown; +static SDL_Thread *ALSA_hotplug_thread; + +static int SDLCALL +ALSA_HotplugThread(void *arg) +{ + SDL_sem *first_run_semaphore = (SDL_sem *) arg; + ALSA_Device *devices = NULL; + ALSA_Device *next; + ALSA_Device *dev; + Uint32 ticks; + + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); + + while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) { + void **hints = NULL; + ALSA_Device *unseen; + ALSA_Device *seen; + ALSA_Device *prev; + + if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) { + int i, j; + const char *match = NULL; + int bestmatch = 0xFFFF; + size_t match_len = 0; + int defaultdev = -1; + static const char * const prefixes[] = { + "hw:", "sysdefault:", "default:", NULL + }; + + unseen = devices; + seen = NULL; + /* Apparently there are several different ways that ALSA lists + actual hardware. It could be prefixed with "hw:" or "default:" + or "sysdefault:" and maybe others. Go through the list and see + if we can find a preferred prefix for the system. */ + for (i = 0; hints[i]; i++) { + char *name = ALSA_snd_device_name_get_hint(hints[i], "NAME"); + if (!name) { + continue; + } + + /* full name, not a prefix */ + if ((defaultdev == -1) && (SDL_strcmp(name, "default") == 0)) { + defaultdev = i; + } + + for (j = 0; prefixes[j]; j++) { + const char *prefix = prefixes[j]; + const size_t prefixlen = SDL_strlen(prefix); + if (SDL_strncmp(name, prefix, prefixlen) == 0) { + if (j < bestmatch) { + bestmatch = j; + match = prefix; + match_len = prefixlen; + } + } + } + + free(name); + } + + /* look through the list of device names to find matches */ + for (i = 0; hints[i]; i++) { + char *name; + + /* if we didn't find a device name prefix we like at all... */ + if ((!match) && (defaultdev != i)) { + continue; /* ...skip anything that isn't the default device. */ + } + + name = ALSA_snd_device_name_get_hint(hints[i], "NAME"); + if (!name) { + continue; + } + + /* only want physical hardware interfaces */ + if (!match || (SDL_strncmp(name, match, match_len) == 0)) { + char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID"); + const SDL_bool isoutput = (ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0); + const SDL_bool isinput = (ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0); + SDL_bool have_output = SDL_FALSE; + SDL_bool have_input = SDL_FALSE; + + free(ioid); + + if (!isoutput && !isinput) { + free(name); + continue; + } + + prev = NULL; + for (dev = unseen; dev; dev = next) { + next = dev->next; + if ( (SDL_strcmp(dev->name, name) == 0) && (((isinput) && dev->iscapture) || ((isoutput) && !dev->iscapture)) ) { + if (prev) { + prev->next = next; + } else { + unseen = next; + } + dev->next = seen; + seen = dev; + if (isinput) have_input = SDL_TRUE; + if (isoutput) have_output = SDL_TRUE; + } else { + prev = dev; + } + } + + if (isinput && !have_input) { + add_device(SDL_TRUE, name, hints[i], &seen); + } + if (isoutput && !have_output) { + add_device(SDL_FALSE, name, hints[i], &seen); + } + } + + free(name); + } + + ALSA_snd_device_name_free_hint(hints); + + devices = seen; /* now we have a known-good list of attached devices. */ + + /* report anything still in unseen as removed. */ + for (dev = unseen; dev; dev = next) { + /*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ + next = dev->next; + SDL_RemoveAudioDevice(dev->iscapture, dev->name); + SDL_free(dev->name); + SDL_free(dev); + } + } + + /* On first run, tell ALSA_DetectDevices() that we have a complete device list so it can return. */ + if (first_run_semaphore) { + SDL_SemPost(first_run_semaphore); + first_run_semaphore = NULL; /* let other thread clean it up. */ + } + + /* Block awhile before checking again, unless we're told to stop. */ + ticks = SDL_GetTicks() + 5000; + while (!SDL_AtomicGet(&ALSA_hotplug_shutdown) && !SDL_TICKS_PASSED(SDL_GetTicks(), ticks)) { + SDL_Delay(100); + } + } + + /* Shutting down! Clean up any data we've gathered. */ + for (dev = devices; dev; dev = next) { + /*printf("ALSA: at shutdown, removing %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ + next = dev->next; + SDL_free(dev->name); + SDL_free(dev); + } + + return 0; +} + +static void +ALSA_DetectDevices(void) +{ + /* Start the device detection thread here, wait for an initial iteration to complete. */ + SDL_sem *semaphore = SDL_CreateSemaphore(0); + if (!semaphore) { + return; /* oh well. */ + } + + SDL_AtomicSet(&ALSA_hotplug_shutdown, 0); + + ALSA_hotplug_thread = SDL_CreateThread(ALSA_HotplugThread, "SDLHotplugALSA", semaphore); + if (ALSA_hotplug_thread) { + SDL_SemWait(semaphore); /* wait for the first iteration to finish. */ + } + + SDL_DestroySemaphore(semaphore); +} + +static void +ALSA_Deinitialize(void) +{ + if (ALSA_hotplug_thread != NULL) { + SDL_AtomicSet(&ALSA_hotplug_shutdown, 1); + SDL_WaitThread(ALSA_hotplug_thread, NULL); + ALSA_hotplug_thread = NULL; + } + + UnloadALSALibrary(); +} + +static int +ALSA_Init(SDL_AudioDriverImpl * impl) +{ + if (LoadALSALibrary() < 0) { + return 0; + } + + /* Set the function pointers */ + impl->DetectDevices = ALSA_DetectDevices; + impl->OpenDevice = ALSA_OpenDevice; + impl->WaitDevice = ALSA_WaitDevice; + impl->GetDeviceBuf = ALSA_GetDeviceBuf; + impl->PlayDevice = ALSA_PlayDevice; + impl->CloseDevice = ALSA_CloseDevice; + impl->Deinitialize = ALSA_Deinitialize; + impl->CaptureFromDevice = ALSA_CaptureFromDevice; + impl->FlushCapture = ALSA_FlushCapture; + + impl->HasCaptureSupport = SDL_TRUE; + + return 1; /* this audio target is available. */ +} + + +AudioBootStrap ALSA_bootstrap = { + "alsa", "ALSA PCM audio", ALSA_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_ALSA */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.h b/3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.h rename to 3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.h index 3080aea230..f620500171 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/alsa/SDL_alsa_audio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_ALSA_audio_h -#define _SDL_ALSA_audio_h +#ifndef SDL_ALSA_audio_h_ +#define SDL_ALSA_audio_h_ #include @@ -38,8 +38,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* swizzle function */ + void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen); }; -#endif /* _SDL_ALSA_audio_h */ +#endif /* SDL_ALSA_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.c b/3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.c similarity index 55% rename from 3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.c index 4a4faadcfb..77a5f0da81 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ /* Output audio to Android */ +#include "SDL_assert.h" #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_androidaudio.h" @@ -33,23 +34,22 @@ #include static SDL_AudioDevice* audioDevice = NULL; +static SDL_AudioDevice* captureDevice = NULL; static int -AndroidAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { SDL_AudioFormat test_format; - if (iscapture) { - /* TODO: implement capture */ - return SDL_SetError("Capture not supported on Android"); - } + SDL_assert((captureDevice == NULL) || !iscapture); + SDL_assert((audioDevice == NULL) || iscapture); - if (audioDevice != NULL) { - return SDL_SetError("Only one audio device at a time please!"); + if (iscapture) { + captureDevice = this; + } else { + audioDevice = this; } - audioDevice = this; - this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); @@ -57,7 +57,9 @@ AndroidAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) test_format = SDL_FirstAudioFormat(this->spec.format); while (test_format != 0) { /* no "UNKNOWN" constant */ - if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) { + if ((test_format == AUDIO_U8) || + (test_format == AUDIO_S16) || + (test_format == AUDIO_F32)) { this->spec.format = test_format; break; } @@ -69,115 +71,139 @@ AndroidAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("No compatible audio format!"); } - if (this->spec.channels > 1) { - this->spec.channels = 2; - } else { - this->spec.channels = 1; + if (Android_JNI_OpenAudioDevice(iscapture, &this->spec) < 0) { + return -1; } - if (this->spec.freq < 8000) { - this->spec.freq = 8000; - } - if (this->spec.freq > 48000) { - this->spec.freq = 48000; - } - - /* TODO: pass in/return a (Java) device ID, also whether we're opening for input or output */ - this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples); SDL_CalculateAudioSpec(&this->spec); - if (this->spec.samples == 0) { - /* Init failed? */ - return SDL_SetError("Java-side initialization failed!"); - } - return 0; } static void -AndroidAUD_PlayDevice(_THIS) +ANDROIDAUDIO_PlayDevice(_THIS) { Android_JNI_WriteAudioBuffer(); } static Uint8 * -AndroidAUD_GetDeviceBuf(_THIS) +ANDROIDAUDIO_GetDeviceBuf(_THIS) { return Android_JNI_GetAudioBuffer(); } +static int +ANDROIDAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + return Android_JNI_CaptureAudioBuffer(buffer, buflen); +} + +static void +ANDROIDAUDIO_FlushCapture(_THIS) +{ + Android_JNI_FlushCapturedAudio(); +} + static void -AndroidAUD_CloseDevice(_THIS) +ANDROIDAUDIO_CloseDevice(_THIS) { /* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread so it's safe to terminate the Java side buffer and AudioTrack */ - Android_JNI_CloseAudioDevice(); - - if (audioDevice == this) { - if (audioDevice->hidden != NULL) { - SDL_free(this->hidden); - this->hidden = NULL; - } + Android_JNI_CloseAudioDevice(this->iscapture); + if (this->iscapture) { + SDL_assert(captureDevice == this); + captureDevice = NULL; + } else { + SDL_assert(audioDevice == this); audioDevice = NULL; } + SDL_free(this->hidden); } static int -AndroidAUD_Init(SDL_AudioDriverImpl * impl) +ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ - impl->OpenDevice = AndroidAUD_OpenDevice; - impl->PlayDevice = AndroidAUD_PlayDevice; - impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf; - impl->CloseDevice = AndroidAUD_CloseDevice; + impl->OpenDevice = ANDROIDAUDIO_OpenDevice; + impl->PlayDevice = ANDROIDAUDIO_PlayDevice; + impl->GetDeviceBuf = ANDROIDAUDIO_GetDeviceBuf; + impl->CloseDevice = ANDROIDAUDIO_CloseDevice; + impl->CaptureFromDevice = ANDROIDAUDIO_CaptureFromDevice; + impl->FlushCapture = ANDROIDAUDIO_FlushCapture; /* and the capabilities */ - impl->HasCaptureSupport = 0; /* TODO */ + impl->HasCaptureSupport = SDL_TRUE; impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultInputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; return 1; /* this audio target is available. */ } -AudioBootStrap ANDROIDAUD_bootstrap = { - "android", "SDL Android audio driver", AndroidAUD_Init, 0 +AudioBootStrap ANDROIDAUDIO_bootstrap = { + "android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0 }; /* Pause (block) all non already paused audio devices by taking their mixer lock */ -void AndroidAUD_PauseDevices(void) +void ANDROIDAUDIO_PauseDevices(void) { /* TODO: Handle multiple devices? */ struct SDL_PrivateAudioData *private; if(audioDevice != NULL && audioDevice->hidden != NULL) { private = (struct SDL_PrivateAudioData *) audioDevice->hidden; - if (audioDevice->paused) { + if (SDL_AtomicGet(&audioDevice->paused)) { /* The device is already paused, leave it alone */ private->resume = SDL_FALSE; } else { SDL_LockMutex(audioDevice->mixer_lock); - audioDevice->paused = SDL_TRUE; + SDL_AtomicSet(&audioDevice->paused, 1); + private->resume = SDL_TRUE; + } + } + + if(captureDevice != NULL && captureDevice->hidden != NULL) { + private = (struct SDL_PrivateAudioData *) captureDevice->hidden; + if (SDL_AtomicGet(&captureDevice->paused)) { + /* The device is already paused, leave it alone */ + private->resume = SDL_FALSE; + } + else { + SDL_LockMutex(captureDevice->mixer_lock); + SDL_AtomicSet(&captureDevice->paused, 1); private->resume = SDL_TRUE; } } } /* Resume (unblock) all non already paused audio devices by releasing their mixer lock */ -void AndroidAUD_ResumeDevices(void) +void ANDROIDAUDIO_ResumeDevices(void) { /* TODO: Handle multiple devices? */ struct SDL_PrivateAudioData *private; if(audioDevice != NULL && audioDevice->hidden != NULL) { private = (struct SDL_PrivateAudioData *) audioDevice->hidden; if (private->resume) { - audioDevice->paused = SDL_FALSE; + SDL_AtomicSet(&audioDevice->paused, 0); private->resume = SDL_FALSE; SDL_UnlockMutex(audioDevice->mixer_lock); } } + + if(captureDevice != NULL && captureDevice->hidden != NULL) { + private = (struct SDL_PrivateAudioData *) captureDevice->hidden; + if (private->resume) { + SDL_AtomicSet(&captureDevice->paused, 0); + private->resume = SDL_FALSE; + SDL_UnlockMutex(captureDevice->mixer_lock); + } + } } +#else + +void ANDROIDAUDIO_ResumeDevices(void) {} +void ANDROIDAUDIO_PauseDevices(void) {} #endif /* SDL_AUDIO_DRIVER_ANDROID */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.h b/3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.h index 639be9c087..c732ac6871 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/android/SDL_androidaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidaudio_h -#define _SDL_androidaudio_h +#ifndef SDL_androidaudio_h_ +#define SDL_androidaudio_h_ #include "../SDL_sysaudio.h" @@ -34,8 +34,9 @@ struct SDL_PrivateAudioData int resume; }; -static void AndroidAUD_CloseDevice(_THIS); +void ANDROIDAUDIO_ResumeDevices(void); +void ANDROIDAUDIO_PauseDevices(void); -#endif /* _SDL_androidaudio_h */ +#endif /* SDL_androidaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.c b/3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.c index 5d40cd14e8..47bad4bd4c 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,6 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_artsaudio.h" @@ -40,7 +39,7 @@ #include "SDL_name.h" #include "SDL_loadso.h" #else -#define SDL_NAME(X) X +#define SDL_NAME(X) X #endif #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC @@ -186,13 +185,6 @@ ARTS_PlayDevice(_THIS) #endif } -static void -ARTS_WaitDone(_THIS) -{ - /* !!! FIXME: camp here until buffer drains... SDL_Delay(???); */ -} - - static Uint8 * ARTS_GetDeviceBuf(_THIS) { @@ -203,17 +195,12 @@ ARTS_GetDeviceBuf(_THIS) static void ARTS_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->stream) { - SDL_NAME(arts_close_stream) (this->hidden->stream); - this->hidden->stream = 0; - } - SDL_NAME(arts_free) (); - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->stream) { + SDL_NAME(arts_close_stream) (this->hidden->stream); } + SDL_NAME(arts_free) (); + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static int @@ -241,7 +228,7 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Try for a closest match on audio format */ for (test_format = SDL_FirstAudioFormat(this->spec.format); @@ -267,19 +254,16 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } } if (format == 0) { - ARTS_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; if ((rc = SDL_NAME(arts_init) ()) != 0) { - ARTS_CloseDevice(this); return SDL_SetError("Unable to initialize ARTS: %s", SDL_NAME(arts_error_text) (rc)); } if (!ARTS_Suspend()) { - ARTS_CloseDevice(this); return SDL_SetError("ARTS can not open audio device"); } @@ -297,7 +281,6 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Determine the power of two of the fragment size */ for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec); if ((0x01 << frag_spec) != this->spec.size) { - ARTS_CloseDevice(this); return SDL_SetError("Fragment size must be a power of two"); } frag_spec |= 0x00020000; /* two fragments, for low latency */ @@ -316,9 +299,8 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { - ARTS_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -367,7 +349,6 @@ ARTS_Init(SDL_AudioDriverImpl * impl) impl->WaitDevice = ARTS_WaitDevice; impl->GetDeviceBuf = ARTS_GetDeviceBuf; impl->CloseDevice = ARTS_CloseDevice; - impl->WaitDone = ARTS_WaitDone; impl->Deinitialize = ARTS_Deinitialize; impl->OnlyHasDefaultOutputDevice = 1; diff --git a/3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.h b/3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.h index 6b9bf3037b..7743654864 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/arts/SDL_artsaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_artscaudio_h -#define _SDL_artscaudio_h +#ifndef SDL_artsaudio_h_ +#define SDL_artsaudio_h_ #include @@ -42,11 +42,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_artscaudio_h */ +#endif /* SDL_artsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.h b/3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.h index 577f9fb320..dcce3f7c6f 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_coreaudio_h -#define _SDL_coreaudio_h +#ifndef SDL_coreaudio_h_ +#define SDL_coreaudio_h_ #include "../SDL_sysaudio.h" @@ -33,9 +33,11 @@ #include #include #else -#include +#import +#import #endif +#include #include /* Hidden "this" pointer for the audio functions */ @@ -43,15 +45,22 @@ struct SDL_PrivateAudioData { - AudioUnit audioUnit; - int audioUnitOpened; + AudioQueueRef audioQueue; + int numAudioBuffers; + AudioQueueBufferRef *audioBuffer; void *buffer; - UInt32 bufferOffset; UInt32 bufferSize; + AudioStreamBasicDescription strdesc; + SDL_bool refill; + SDL_AudioStream *capturestream; #if MACOSX_COREAUDIO AudioDeviceID deviceID; +#else + SDL_bool interrupted; + CFTypeRef interruption_listener; #endif }; -#endif /* _SDL_coreaudio_h */ +#endif /* SDL_coreaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.m b/3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.m new file mode 100644 index 0000000000..59242f935a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.m @@ -0,0 +1,861 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_COREAUDIO + +/* !!! FIXME: clean out some of the macro salsa in here. */ + +#include "SDL_audio.h" +#include "SDL_hints.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_coreaudio.h" +#include "SDL_assert.h" +#include "../../thread/SDL_systhread.h" + +#define DEBUG_COREAUDIO 0 + +#define CHECK_RESULT(msg) \ + if (result != noErr) { \ + SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \ + return 0; \ + } + +#if MACOSX_COREAUDIO +static const AudioObjectPropertyAddress devlist_address = { + kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster +}; + +typedef void (*addDevFn)(const char *name, const int iscapture, AudioDeviceID devId, void *data); + +typedef struct AudioDeviceList +{ + AudioDeviceID devid; + SDL_bool alive; + struct AudioDeviceList *next; +} AudioDeviceList; + +static AudioDeviceList *output_devs = NULL; +static AudioDeviceList *capture_devs = NULL; + +static SDL_bool +add_to_internal_dev_list(const int iscapture, AudioDeviceID devId) +{ + AudioDeviceList *item = (AudioDeviceList *) SDL_malloc(sizeof (AudioDeviceList)); + if (item == NULL) { + return SDL_FALSE; + } + item->devid = devId; + item->alive = SDL_TRUE; + item->next = iscapture ? capture_devs : output_devs; + if (iscapture) { + capture_devs = item; + } else { + output_devs = item; + } + + return SDL_TRUE; +} + +static void +addToDevList(const char *name, const int iscapture, AudioDeviceID devId, void *data) +{ + if (add_to_internal_dev_list(iscapture, devId)) { + SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); + } +} + +static void +build_device_list(int iscapture, addDevFn addfn, void *addfndata) +{ + OSStatus result = noErr; + UInt32 size = 0; + AudioDeviceID *devs = NULL; + UInt32 i = 0; + UInt32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + return; + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + return; + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + return; + + max = size / sizeof (AudioDeviceID); + for (i = 0; i < max; i++) { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[i]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + continue; + + buflist = (AudioBufferList *) SDL_malloc(size); + if (buflist == NULL) + continue; + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, + &size, buflist); + + if (result == noErr) { + UInt32 j; + for (j = 0; j < buflist->mNumberBuffers; j++) { + if (buflist->mBuffers[j].mNumberChannels > 0) { + usable = 1; + break; + } + } + } + + SDL_free(buflist); + + if (!usable) + continue; + + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + continue; + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) SDL_malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) { + len = strlen(ptr); + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) { + len--; + } + usable = (len > 0); + } + + if (usable) { + ptr[len] = '\0'; + +#if DEBUG_COREAUDIO + printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", + ((iscapture) ? "capture" : "output"), + (int) i, ptr, (int) dev); +#endif + addfn(ptr, iscapture, dev, addfndata); + } + SDL_free(ptr); /* addfn() would have copied the string. */ + } +} + +static void +free_audio_device_list(AudioDeviceList **list) +{ + AudioDeviceList *item = *list; + while (item) { + AudioDeviceList *next = item->next; + SDL_free(item); + item = next; + } + *list = NULL; +} + +static void +COREAUDIO_DetectDevices(void) +{ + build_device_list(SDL_TRUE, addToDevList, NULL); + build_device_list(SDL_FALSE, addToDevList, NULL); +} + +static void +build_device_change_list(const char *name, const int iscapture, AudioDeviceID devId, void *data) +{ + AudioDeviceList **list = (AudioDeviceList **) data; + AudioDeviceList *item; + for (item = *list; item != NULL; item = item->next) { + if (item->devid == devId) { + item->alive = SDL_TRUE; + return; + } + } + + add_to_internal_dev_list(iscapture, devId); /* new device, add it. */ + SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); +} + +static void +reprocess_device_list(const int iscapture, AudioDeviceList **list) +{ + AudioDeviceList *item; + AudioDeviceList *prev = NULL; + for (item = *list; item != NULL; item = item->next) { + item->alive = SDL_FALSE; + } + + build_device_list(iscapture, build_device_change_list, list); + + /* free items in the list that aren't still alive. */ + item = *list; + while (item != NULL) { + AudioDeviceList *next = item->next; + if (item->alive) { + prev = item; + } else { + SDL_RemoveAudioDevice(iscapture, (void *) ((size_t) item->devid)); + if (prev) { + prev->next = item->next; + } else { + *list = item->next; + } + SDL_free(item); + } + item = next; + } +} + +/* this is called when the system's list of available audio devices changes. */ +static OSStatus +device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) +{ + reprocess_device_list(SDL_TRUE, &capture_devs); + reprocess_device_list(SDL_FALSE, &output_devs); + return 0; +} +#endif + + +static int open_playback_devices = 0; +static int open_capture_devices = 0; + +#if !MACOSX_COREAUDIO + +static void interruption_begin(_THIS) +{ + if (this != NULL && this->hidden->audioQueue != NULL) { + this->hidden->interrupted = SDL_TRUE; + AudioQueuePause(this->hidden->audioQueue); + } +} + +static void interruption_end(_THIS) +{ + if (this != NULL && this->hidden != NULL && this->hidden->audioQueue != NULL + && this->hidden->interrupted + && AudioQueueStart(this->hidden->audioQueue, NULL) == AVAudioSessionErrorCodeNone) { + this->hidden->interrupted = SDL_FALSE; + } +} + +@interface SDLInterruptionListener : NSObject + +@property (nonatomic, assign) SDL_AudioDevice *device; + +@end + +@implementation SDLInterruptionListener + +- (void)audioSessionInterruption:(NSNotification *)note +{ + @synchronized (self) { + NSNumber *type = note.userInfo[AVAudioSessionInterruptionTypeKey]; + if (type.unsignedIntegerValue == AVAudioSessionInterruptionTypeBegan) { + interruption_begin(self.device); + } else { + interruption_end(self.device); + } + } +} + +- (void)applicationBecameActive:(NSNotification *)note +{ + @synchronized (self) { + interruption_end(self.device); + } +} + +@end + +static BOOL update_audio_session(_THIS, SDL_bool open) +{ + @autoreleasepool { + AVAudioSession *session = [AVAudioSession sharedInstance]; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + /* Set category to ambient by default so that other music continues playing. */ + NSString *category = AVAudioSessionCategoryAmbient; + NSError *err = nil; + + if (open_playback_devices && open_capture_devices) { + category = AVAudioSessionCategoryPlayAndRecord; + } else if (open_capture_devices) { + category = AVAudioSessionCategoryRecord; + } else { + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY); + if (hint) { + if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) { + category = AVAudioSessionCategoryAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) { + category = AVAudioSessionCategorySoloAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 || + SDL_strcasecmp(hint, "playback") == 0) { + category = AVAudioSessionCategoryPlayback; + } + } + } + + if (![session setCategory:category error:&err]) { + NSString *desc = err.description; + SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String); + return NO; + } + + if (open && (open_playback_devices + open_capture_devices) == 1) { + if (![session setActive:YES error:&err]) { + NSString *desc = err.description; + SDL_SetError("Could not activate Audio Session: %s", desc.UTF8String); + return NO; + } + } else if (!open_playback_devices && !open_capture_devices) { + [session setActive:NO error:nil]; + } + + if (open) { + SDLInterruptionListener *listener = [SDLInterruptionListener new]; + listener.device = this; + + [center addObserver:listener + selector:@selector(audioSessionInterruption:) + name:AVAudioSessionInterruptionNotification + object:session]; + + /* An interruption end notification is not guaranteed to be sent if + we were previously interrupted... resuming if needed when the app + becomes active seems to be the way to go. */ + [center addObserver:listener + selector:@selector(applicationBecameActive:) + name:UIApplicationDidBecomeActiveNotification + object:session]; + + [center addObserver:listener + selector:@selector(applicationBecameActive:) + name:UIApplicationWillEnterForegroundNotification + object:session]; + + this->hidden->interruption_listener = CFBridgingRetain(listener); + } else { + if (this->hidden->interruption_listener != NULL) { + SDLInterruptionListener *listener = nil; + listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener); + [center removeObserver:listener]; + @synchronized (listener) { + listener.device = NULL; + } + } + } + } + + return YES; +} +#endif + + +/* The AudioQueue callback */ +static void +outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; + SDL_assert(inBuffer->mAudioDataBytesCapacity == this->hidden->bufferSize); + SDL_memcpy(inBuffer->mAudioData, this->hidden->buffer, this->hidden->bufferSize); + SDL_memset(this->hidden->buffer, '\0', this->hidden->bufferSize); /* zero out in case we have to fill again without new data. */ + inBuffer->mAudioDataByteSize = this->hidden->bufferSize; + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); + this->hidden->refill = SDL_TRUE; +} + +static Uint8 * +COREAUDIO_GetDeviceBuf(_THIS) +{ + return this->hidden->buffer; +} + +static void +COREAUDIO_WaitDevice(_THIS) +{ + while (SDL_AtomicGet(&this->enabled) && !this->hidden->refill) { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + } + this->hidden->refill = SDL_FALSE; +} + +static void +inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, + const AudioTimeStamp *inStartTime, UInt32 inNumberPacketDescriptions, + const AudioStreamPacketDescription *inPacketDescs ) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; + if (SDL_AtomicGet(&this->enabled)) { + SDL_AudioStream *stream = this->hidden->capturestream; + if (SDL_AudioStreamPut(stream, inBuffer->mAudioData, inBuffer->mAudioDataByteSize) == -1) { + /* yikes, out of memory or something. I guess drop the buffer. Our WASAPI target kills the device in this case, though */ + } + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); + this->hidden->refill = SDL_TRUE; + } +} + +static int +COREAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_AudioStream *stream = this->hidden->capturestream; + while (SDL_AtomicGet(&this->enabled)) { + const int avail = SDL_AudioStreamAvailable(stream); + if (avail > 0) { + const int cpy = SDL_min(buflen, avail); + SDL_AudioStreamGet(stream, buffer, cpy); + return cpy; + } + + /* wait for more data, try again. */ + while (SDL_AtomicGet(&this->enabled) && !this->hidden->refill) { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + } + this->hidden->refill = SDL_FALSE; + } + + return 0; /* not enabled, giving up. */ +} + +static void +COREAUDIO_FlushCapture(_THIS) +{ + while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, 1) == kCFRunLoopRunHandledSource) { + /* spin. */ + } + this->hidden->refill = SDL_FALSE; + SDL_AudioStreamClear(this->hidden->capturestream); +} + + +#if MACOSX_COREAUDIO +static const AudioObjectPropertyAddress alive_address = +{ + kAudioDevicePropertyDeviceIsAlive, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster +}; + +static OSStatus +device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) data; + SDL_bool dead = SDL_FALSE; + UInt32 isAlive = 1; + UInt32 size = sizeof (isAlive); + OSStatus error; + + if (!SDL_AtomicGet(&this->enabled)) { + return 0; /* already known to be dead. */ + } + + error = AudioObjectGetPropertyData(this->hidden->deviceID, &alive_address, + 0, NULL, &size, &isAlive); + + if (error == kAudioHardwareBadDeviceError) { + dead = SDL_TRUE; /* device was unplugged. */ + } else if ((error == kAudioHardwareNoError) && (!isAlive)) { + dead = SDL_TRUE; /* device died in some other way. */ + } + + if (dead) { + SDL_OpenedAudioDeviceDisconnected(this); + } + + return 0; +} +#endif + +static void +COREAUDIO_CloseDevice(_THIS) +{ + const SDL_bool iscapture = this->iscapture; + +/* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ +/* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ +#if MACOSX_COREAUDIO + /* Fire a callback if the device stops being "alive" (disconnected, etc). */ + AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); +#endif + +#if !MACOSX_COREAUDIO + update_audio_session(this, SDL_FALSE); +#endif + + if (this->hidden->audioQueue) { + AudioQueueDispose(this->hidden->audioQueue, 1); + } + + if (this->hidden->capturestream) { + SDL_FreeAudioStream(this->hidden->capturestream); + } + + /* AudioQueueDispose() frees the actual buffer objects. */ + SDL_free(this->hidden->audioBuffer); + SDL_free(this->hidden->buffer); + SDL_free(this->hidden); + + if (iscapture) { + open_capture_devices--; + } else { + open_playback_devices--; + } +} + +#if MACOSX_COREAUDIO +static int +prepare_device(_THIS, void *handle, int iscapture) +{ + AudioDeviceID devid = (AudioDeviceID) ((size_t) handle); + OSStatus result = noErr; + UInt32 size = 0; + UInt32 alive = 0; + pid_t pid = 0; + + AudioObjectPropertyAddress addr = { + 0, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster + }; + + if (handle == NULL) { + size = sizeof (AudioDeviceID); + addr.mSelector = + ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : + kAudioHardwarePropertyDefaultOutputDevice); + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, + 0, NULL, &size, &devid); + CHECK_RESULT("AudioHardwareGetProperty (default device)"); + } + + addr.mSelector = kAudioDevicePropertyDeviceIsAlive; + addr.mScope = iscapture ? kAudioDevicePropertyScopeInput : + kAudioDevicePropertyScopeOutput; + + size = sizeof (alive); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); + CHECK_RESULT + ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); + + if (!alive) { + SDL_SetError("CoreAudio: requested device exists, but isn't alive."); + return 0; + } + + addr.mSelector = kAudioDevicePropertyHogMode; + size = sizeof (pid); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); + + /* some devices don't support this property, so errors are fine here. */ + if ((result == noErr) && (pid != -1)) { + SDL_SetError("CoreAudio: requested device is being hogged."); + return 0; + } + + this->hidden->deviceID = devid; + return 1; +} +#endif + + +/* this all happens in the audio thread, since it needs a separate runloop. */ +static int +prepare_audioqueue(_THIS) +{ + const AudioStreamBasicDescription *strdesc = &this->hidden->strdesc; + const int iscapture = this->iscapture; + OSStatus result; + int i; + + SDL_assert(CFRunLoopGetCurrent() != NULL); + + if (iscapture) { + result = AudioQueueNewInput(strdesc, inputCallback, this, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &this->hidden->audioQueue); + CHECK_RESULT("AudioQueueNewInput"); + } else { + result = AudioQueueNewOutput(strdesc, outputCallback, this, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &this->hidden->audioQueue); + CHECK_RESULT("AudioQueueNewOutput"); + } + +#if MACOSX_COREAUDIO +{ + const AudioObjectPropertyAddress prop = { + kAudioDevicePropertyDeviceUID, + iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster + }; + CFStringRef devuid; + UInt32 devuidsize = sizeof (devuid); + result = AudioObjectGetPropertyData(this->hidden->deviceID, &prop, 0, NULL, &devuidsize, &devuid); + CHECK_RESULT("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID)"); + result = AudioQueueSetProperty(this->hidden->audioQueue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize); + CHECK_RESULT("AudioQueueSetProperty (kAudioQueueProperty_CurrentDevice)"); + + /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ + /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ + /* Fire a callback if the device stops being "alive" (disconnected, etc). */ + AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); +} +#endif + + /* Make sure we can feed the device a minimum amount of time */ + double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; +#if defined(__IPHONEOS__) + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { + /* Older iOS hardware, use 40 ms as a minimum time */ + MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; + } +#endif + const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0; + int numAudioBuffers = 2; + if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { /* use more buffers if we have a VERY small sample set. */ + numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); + } + + this->hidden->numAudioBuffers = numAudioBuffers; + this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers); + if (this->hidden->audioBuffer == NULL) { + SDL_OutOfMemory(); + return 0; + } + +#if DEBUG_COREAUDIO + printf("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers); +#endif + + for (i = 0; i < numAudioBuffers; i++) { + result = AudioQueueAllocateBuffer(this->hidden->audioQueue, this->spec.size, &this->hidden->audioBuffer[i]); + CHECK_RESULT("AudioQueueAllocateBuffer"); + SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity); + this->hidden->audioBuffer[i]->mAudioDataByteSize = this->hidden->audioBuffer[i]->mAudioDataBytesCapacity; + result = AudioQueueEnqueueBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i], 0, NULL); + CHECK_RESULT("AudioQueueEnqueueBuffer"); + } + + result = AudioQueueStart(this->hidden->audioQueue, NULL); + CHECK_RESULT("AudioQueueStart"); + + /* We're running! */ + return 1; +} + +static void +COREAUDIO_ThreadInit(_THIS) +{ + const int rc = prepare_audioqueue(this); + if (!rc) { + /* !!! FIXME: do this in RunAudio, and maybe block OpenDevice until ThreadInit finishes, too, to report an opening error */ + SDL_OpenedAudioDeviceDisconnected(this); /* oh well. */ + } +} + +static void +COREAUDIO_PrepareToClose(_THIS) +{ + /* run long enough to queue some silence, so we know our actual audio + has been played */ + CFRunLoopRunInMode(kCFRunLoopDefaultMode, (((this->spec.samples * 1000) / this->spec.freq) * 2) / 1000.0f, 0); + AudioQueueStop(this->hidden->audioQueue, 1); +} + +static int +COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + AudioStreamBasicDescription *strdesc; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + int valid_datatype = 0; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + strdesc = &this->hidden->strdesc; + + if (iscapture) { + open_capture_devices++; + } else { + open_playback_devices++; + } + +#if !MACOSX_COREAUDIO + if (!update_audio_session(this, SDL_TRUE)) { + return -1; + } + + /* Stop CoreAudio from doing expensive audio rate conversion */ + @autoreleasepool { + AVAudioSession* session = [AVAudioSession sharedInstance]; + [session setPreferredSampleRate:this->spec.freq error:nil]; + this->spec.freq = (int)session.sampleRate; + } +#endif + + /* Setup a AudioStreamBasicDescription with the requested format */ + SDL_zerop(strdesc); + strdesc->mFormatID = kAudioFormatLinearPCM; + strdesc->mFormatFlags = kLinearPCMFormatFlagIsPacked; + strdesc->mChannelsPerFrame = this->spec.channels; + strdesc->mSampleRate = this->spec.freq; + strdesc->mFramesPerPacket = 1; + + while ((!valid_datatype) && (test_format)) { + this->spec.format = test_format; + /* Just a list of valid SDL formats, so people don't pass junk here. */ + switch (test_format) { + case AUDIO_U8: + case AUDIO_S8: + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + case AUDIO_S32LSB: + case AUDIO_S32MSB: + case AUDIO_F32LSB: + case AUDIO_F32MSB: + valid_datatype = 1; + strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); + if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; + + if (SDL_AUDIO_ISFLOAT(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat; + else if (SDL_AUDIO_ISSIGNED(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; + break; + } + } + + if (!valid_datatype) { /* shouldn't happen, but just in case... */ + return SDL_SetError("Unsupported audio format"); + } + + strdesc->mBytesPerFrame = strdesc->mBitsPerChannel * strdesc->mChannelsPerFrame / 8; + strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; + +#if MACOSX_COREAUDIO + if (!prepare_device(this, handle, iscapture)) { + return -1; + } +#endif + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(&this->spec); + + if (iscapture) { + this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq); + if (!this->hidden->capturestream) { + return -1; /* already set SDL_Error */ + } + } else { + this->hidden->bufferSize = this->spec.size; + this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); + if (this->hidden->buffer == NULL) { + return SDL_OutOfMemory(); + } + } + + return 0; +} + +static void +COREAUDIO_Deinitialize(void) +{ +#if MACOSX_COREAUDIO + AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); + free_audio_device_list(&capture_devs); + free_audio_device_list(&output_devs); +#endif +} + +static int +COREAUDIO_Init(SDL_AudioDriverImpl * impl) +{ + /* Set the function pointers */ + impl->OpenDevice = COREAUDIO_OpenDevice; + impl->CloseDevice = COREAUDIO_CloseDevice; + impl->Deinitialize = COREAUDIO_Deinitialize; + impl->ThreadInit = COREAUDIO_ThreadInit; + impl->WaitDevice = COREAUDIO_WaitDevice; + impl->GetDeviceBuf = COREAUDIO_GetDeviceBuf; + impl->PrepareToClose = COREAUDIO_PrepareToClose; + impl->CaptureFromDevice = COREAUDIO_CaptureFromDevice; + impl->FlushCapture = COREAUDIO_FlushCapture; + +#if MACOSX_COREAUDIO + impl->DetectDevices = COREAUDIO_DetectDevices; + AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); +#else + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; +#endif + + impl->HasCaptureSupport = 1; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap COREAUDIO_bootstrap = { + "coreaudio", "CoreAudio", COREAUDIO_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_COREAUDIO */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.c b/3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.c similarity index 63% rename from 3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.c rename to 3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.c index 065e163a67..a943ba29e3 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.c +++ b/3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ /* Allow access to a raw mixing buffer */ +#include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_loadso.h" #include "SDL_audio.h" @@ -36,11 +37,13 @@ /* DirectX function pointers for audio */ static void* DSoundDLL = NULL; -typedef HRESULT(WINAPI*fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN); -typedef HRESULT(WINAPI*fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID); -typedef HRESULT(WINAPI*fnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW,LPVOID); +typedef HRESULT (WINAPI *fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN); +typedef HRESULT (WINAPI *fnDirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID); +typedef HRESULT (WINAPI *fnDirectSoundCaptureCreate8)(LPCGUID,LPDIRECTSOUNDCAPTURE8 *,LPUNKNOWN); +typedef HRESULT (WINAPI *fnDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW,LPVOID); static fnDirectSoundCreate8 pDirectSoundCreate8 = NULL; static fnDirectSoundEnumerateW pDirectSoundEnumerateW = NULL; +static fnDirectSoundCaptureCreate8 pDirectSoundCaptureCreate8 = NULL; static fnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL; static void @@ -48,6 +51,7 @@ DSOUND_Unload(void) { pDirectSoundCreate8 = NULL; pDirectSoundEnumerateW = NULL; + pDirectSoundCaptureCreate8 = NULL; pDirectSoundCaptureEnumerateW = NULL; if (DSoundDLL != NULL) { @@ -76,6 +80,7 @@ DSOUND_Load(void) loaded = 1; /* will reset if necessary. */ DSOUNDLOAD(DirectSoundCreate8); DSOUNDLOAD(DirectSoundEnumerateW); + DSOUNDLOAD(DirectSoundCaptureCreate8); DSOUNDLOAD(DirectSoundCaptureEnumerateW); #undef DSOUNDLOAD @@ -155,7 +160,7 @@ FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID data) { const int iscapture = (int) ((size_t) data); if (guid != NULL) { /* skip default device */ - char *str = WIN_StringToUTF8(desc); + char *str = WIN_LookupAudioDeviceName(desc, guid); if (str != NULL) { LPGUID cpyguid = (LPGUID) SDL_malloc(sizeof (GUID)); SDL_memcpy(cpyguid, guid, sizeof (GUID)); @@ -197,7 +202,7 @@ DSOUND_WaitDevice(_THIS) return; } - while ((cursor / this->hidden->mixlen) == this->hidden->lastchunk) { + while ((cursor / this->spec.size) == this->hidden->lastchunk) { /* FIXME: find out how much time is left and sleep that long */ SDL_Delay(1); @@ -239,9 +244,8 @@ DSOUND_PlayDevice(_THIS) if (this->hidden->locked_buf) { IDirectSoundBuffer_Unlock(this->hidden->mixbuf, this->hidden->locked_buf, - this->hidden->mixlen, NULL, 0); + this->spec.size, NULL, 0); } - } static Uint8 * @@ -265,7 +269,7 @@ DSOUND_GetDeviceBuf(_THIS) SetDSerror("DirectSound GetCurrentPosition", result); return (NULL); } - cursor /= this->hidden->mixlen; + cursor /= this->spec.size; #ifdef DEBUG_SOUND /* Detect audio dropouts */ { @@ -281,17 +285,17 @@ DSOUND_GetDeviceBuf(_THIS) #endif this->hidden->lastchunk = cursor; cursor = (cursor + 1) % this->hidden->num_buffers; - cursor *= this->hidden->mixlen; + cursor *= this->spec.size; /* Lock the audio buffer */ result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, - this->hidden->mixlen, + this->spec.size, (LPVOID *) & this->hidden->locked_buf, &rawlen, NULL, &junk, 0); if (result == DSERR_BUFFERLOST) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, - this->hidden->mixlen, + this->spec.size, (LPVOID *) & this-> hidden->locked_buf, &rawlen, NULL, &junk, 0); @@ -303,109 +307,106 @@ DSOUND_GetDeviceBuf(_THIS) return (this->hidden->locked_buf); } -static void -DSOUND_WaitDone(_THIS) +static int +DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen) { - Uint8 *stream = DSOUND_GetDeviceBuf(this); + struct SDL_PrivateAudioData *h = this->hidden; + DWORD junk, cursor, ptr1len, ptr2len; + VOID *ptr1, *ptr2; + + SDL_assert(buflen == this->spec.size); + + while (SDL_TRUE) { + if (SDL_AtomicGet(&this->shutdown)) { /* in case the buffer froze... */ + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; + } + + if (IDirectSoundCaptureBuffer_GetCurrentPosition(h->capturebuf, &junk, &cursor) != DS_OK) { + return -1; + } + if ((cursor / this->spec.size) == h->lastchunk) { + SDL_Delay(1); /* FIXME: find out how much time is left and sleep that long */ + } else { + break; + } + } + + if (IDirectSoundCaptureBuffer_Lock(h->capturebuf, h->lastchunk * this->spec.size, this->spec.size, &ptr1, &ptr1len, &ptr2, &ptr2len, 0) != DS_OK) { + return -1; + } + + SDL_assert(ptr1len == this->spec.size); + SDL_assert(ptr2 == NULL); + SDL_assert(ptr2len == 0); + + SDL_memcpy(buffer, ptr1, ptr1len); - /* Wait for the playing chunk to finish */ - if (stream != NULL) { - SDL_memset(stream, this->spec.silence, this->hidden->mixlen); - DSOUND_PlayDevice(this); + if (IDirectSoundCaptureBuffer_Unlock(h->capturebuf, ptr1, ptr1len, ptr2, ptr2len) != DS_OK) { + return -1; } - DSOUND_WaitDevice(this); - /* Stop the looping sound buffer */ - IDirectSoundBuffer_Stop(this->hidden->mixbuf); + h->lastchunk = (h->lastchunk + 1) % h->num_buffers; + + return ptr1len; } static void -DSOUND_CloseDevice(_THIS) +DSOUND_FlushCapture(_THIS) { - if (this->hidden != NULL) { - if (this->hidden->sound != NULL) { - if (this->hidden->mixbuf != NULL) { - /* Clean up the audio buffer */ - IDirectSoundBuffer_Release(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - } - IDirectSound_Release(this->hidden->sound); - this->hidden->sound = NULL; - } + struct SDL_PrivateAudioData *h = this->hidden; + DWORD junk, cursor; + if (IDirectSoundCaptureBuffer_GetCurrentPosition(h->capturebuf, &junk, &cursor) == DS_OK) { + h->lastchunk = cursor / this->spec.size; + } +} - SDL_free(this->hidden); - this->hidden = NULL; +static void +DSOUND_CloseDevice(_THIS) +{ + if (this->hidden->mixbuf != NULL) { + IDirectSoundBuffer_Stop(this->hidden->mixbuf); + IDirectSoundBuffer_Release(this->hidden->mixbuf); + } + if (this->hidden->sound != NULL) { + IDirectSound_Release(this->hidden->sound); } + if (this->hidden->capturebuf != NULL) { + IDirectSoundCaptureBuffer_Stop(this->hidden->capturebuf); + IDirectSoundCaptureBuffer_Release(this->hidden->capturebuf); + } + if (this->hidden->capture != NULL) { + IDirectSoundCapture_Release(this->hidden->capture); + } + SDL_free(this->hidden); } /* This function tries to create a secondary audio buffer, and returns the - number of audio chunks available in the created buffer. + number of audio chunks available in the created buffer. This is for + playback devices, not capture. */ static int -CreateSecondary(_THIS, HWND focus) +CreateSecondary(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) { LPDIRECTSOUND sndObj = this->hidden->sound; LPDIRECTSOUNDBUFFER *sndbuf = &this->hidden->mixbuf; - Uint32 chunksize = this->spec.size; - const int numchunks = 8; HRESULT result = DS_OK; DSBUFFERDESC format; LPVOID pvAudioPtr1, pvAudioPtr2; DWORD dwAudioBytes1, dwAudioBytes2; - WAVEFORMATEX wfmt; - - SDL_zero(wfmt); - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } else { - wfmt.wFormatTag = WAVE_FORMAT_PCM; - } - - wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - wfmt.nChannels = this->spec.channels; - wfmt.nSamplesPerSec = this->spec.freq; - wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8); - wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign; - - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - - /* Try to set primary mixing privileges */ - if (focus) { - result = IDirectSound_SetCooperativeLevel(sndObj, - focus, DSSCL_PRIORITY); - } else { - result = IDirectSound_SetCooperativeLevel(sndObj, - GetDesktopWindow(), - DSSCL_NORMAL); - } - if (result != DS_OK) { - return SetDSerror("DirectSound SetCooperativeLevel", result); - } /* Try to create the secondary buffer */ SDL_zero(format); format.dwSize = sizeof(format); format.dwFlags = DSBCAPS_GETCURRENTPOSITION2; - if (!focus) { - format.dwFlags |= DSBCAPS_GLOBALFOCUS; - } else { - format.dwFlags |= DSBCAPS_STICKYFOCUS; - } - format.dwBufferBytes = numchunks * chunksize; - if ((format.dwBufferBytes < DSBSIZE_MIN) || - (format.dwBufferBytes > DSBSIZE_MAX)) { - return SDL_SetError("Sound buffer size must be between %d and %d", - DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks); - } - format.dwReserved = 0; - format.lpwfxFormat = &wfmt; + format.dwFlags |= DSBCAPS_GLOBALFOCUS; + format.dwBufferBytes = bufsize; + format.lpwfxFormat = wfmt; result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL); if (result != DS_OK) { return SetDSerror("DirectSound CreateSoundBuffer", result); } - IDirectSoundBuffer_SetFormat(*sndbuf, &wfmt); + IDirectSoundBuffer_SetFormat(*sndbuf, wfmt); /* Silence the initial audio buffer */ result = IDirectSoundBuffer_Lock(*sndbuf, 0, format.dwBufferBytes, @@ -420,17 +421,63 @@ CreateSecondary(_THIS, HWND focus) } /* We're ready to go */ - return (numchunks); + return 0; +} + +/* This function tries to create a capture buffer, and returns the + number of audio chunks available in the created buffer. This is for + capture devices, not playback. +*/ +static int +CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) +{ + LPDIRECTSOUNDCAPTURE capture = this->hidden->capture; + LPDIRECTSOUNDCAPTUREBUFFER *capturebuf = &this->hidden->capturebuf; + DSCBUFFERDESC format; + HRESULT result; + + SDL_zero(format); + format.dwSize = sizeof (format); + format.dwFlags = DSCBCAPS_WAVEMAPPED; + format.dwBufferBytes = bufsize; + format.lpwfxFormat = wfmt; + + result = IDirectSoundCapture_CreateCaptureBuffer(capture, &format, capturebuf, NULL); + if (result != DS_OK) { + return SetDSerror("DirectSound CreateCaptureBuffer", result); + } + + result = IDirectSoundCaptureBuffer_Start(*capturebuf, DSCBSTART_LOOPING); + if (result != DS_OK) { + IDirectSoundCaptureBuffer_Release(*capturebuf); + return SetDSerror("DirectSound Start", result); + } + +#if 0 + /* presumably this starts at zero, but just in case... */ + result = IDirectSoundCaptureBuffer_GetCurrentPosition(*capturebuf, &junk, &cursor); + if (result != DS_OK) { + IDirectSoundCaptureBuffer_Stop(*capturebuf); + IDirectSoundCaptureBuffer_Release(*capturebuf); + return SetDSerror("DirectSound GetCurrentPosition", result); + } + + this->hidden->lastchunk = cursor / this->spec.size; +#endif + + return 0; } static int DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { + const DWORD numchunks = 8; HRESULT result; SDL_bool valid_format = SDL_FALSE; SDL_bool tried_format = SDL_FALSE; SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); LPGUID guid = (LPGUID) handle; + DWORD bufsize; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -438,13 +485,25 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Open the audio device */ - result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL); - if (result != DS_OK) { - DSOUND_CloseDevice(this); - return SetDSerror("DirectSoundCreate", result); + if (iscapture) { + result = pDirectSoundCaptureCreate8(guid, &this->hidden->capture, NULL); + if (result != DS_OK) { + return SetDSerror("DirectSoundCaptureCreate8", result); + } + } else { + result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL); + if (result != DS_OK) { + return SetDSerror("DirectSoundCreate8", result); + } + result = IDirectSound_SetCooperativeLevel(this->hidden->sound, + GetDesktopWindow(), + DSSCL_NORMAL); + if (result != DS_OK) { + return SetDSerror("DirectSound SetCooperativeLevel", result); + } } while ((!valid_format) && (test_format)) { @@ -454,10 +513,38 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) case AUDIO_S32: case AUDIO_F32: tried_format = SDL_TRUE; + this->spec.format = test_format; - this->hidden->num_buffers = CreateSecondary(this, NULL); - if (this->hidden->num_buffers > 0) { - valid_format = SDL_TRUE; + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + bufsize = numchunks * this->spec.size; + if ((bufsize < DSBSIZE_MIN) || (bufsize > DSBSIZE_MAX)) { + SDL_SetError("Sound buffer size must be between %d and %d", + (int) ((DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks), + (int) (DSBSIZE_MAX / numchunks)); + } else { + int rc; + WAVEFORMATEX wfmt; + SDL_zero(wfmt); + if (SDL_AUDIO_ISFLOAT(this->spec.format)) { + wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + } else { + wfmt.wFormatTag = WAVE_FORMAT_PCM; + } + + wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); + wfmt.nChannels = this->spec.channels; + wfmt.nSamplesPerSec = this->spec.freq; + wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8); + wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign; + + rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt); + if (rc == 0) { + this->hidden->num_buffers = numchunks; + valid_format = SDL_TRUE; + } } break; } @@ -465,15 +552,13 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (!valid_format) { - DSOUND_CloseDevice(this); if (tried_format) { return -1; /* CreateSecondary() should have called SDL_SetError(). */ } return SDL_SetError("DirectSound: Unsupported audio format"); } - /* The buffer will auto-start playing in DSOUND_WaitDevice() */ - this->hidden->mixlen = this->spec.size; + /* Playback buffers will auto-start playing in DSOUND_WaitDevice() */ return 0; /* good to go. */ } @@ -498,13 +583,15 @@ DSOUND_Init(SDL_AudioDriverImpl * impl) impl->OpenDevice = DSOUND_OpenDevice; impl->PlayDevice = DSOUND_PlayDevice; impl->WaitDevice = DSOUND_WaitDevice; - impl->WaitDone = DSOUND_WaitDone; impl->GetDeviceBuf = DSOUND_GetDeviceBuf; + impl->CaptureFromDevice = DSOUND_CaptureFromDevice; + impl->FlushCapture = DSOUND_FlushCapture; impl->CloseDevice = DSOUND_CloseDevice; impl->FreeDeviceHandle = DSOUND_FreeDeviceHandle; - impl->Deinitialize = DSOUND_Deinitialize; + impl->HasCaptureSupport = SDL_TRUE; + return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.h b/3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.h rename to 3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.h index 0d5f6bd76c..acb7b6ac1b 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/directsound/SDL_directsound.h +++ b/3rdparty/sdl2-2.0.9/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directsound_h -#define _SDL_directsound_h +#ifndef SDL_directsound_h_ +#define SDL_directsound_h_ #include "../../core/windows/SDL_directx.h" @@ -35,12 +35,13 @@ struct SDL_PrivateAudioData { LPDIRECTSOUND sound; LPDIRECTSOUNDBUFFER mixbuf; + LPDIRECTSOUNDCAPTURE capture; + LPDIRECTSOUNDCAPTUREBUFFER capturebuf; int num_buffers; - int mixlen; DWORD lastchunk; Uint8 *locked_buf; }; -#endif /* _SDL_directsound_h */ +#endif /* SDL_directsound_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.c b/3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.c new file mode 100644 index 0000000000..2250375dae --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.c @@ -0,0 +1,207 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_DISK + +/* Output raw audio data to a file. */ + +#if HAVE_STDIO_H +#include +#endif + +#include "SDL_rwops.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_diskaudio.h" +#include "SDL_log.h" + +/* !!! FIXME: these should be SDL hints, not environment variables. */ +/* environment variables and defaults. */ +#define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" +#define DISKDEFAULT_OUTFILE "sdlaudio.raw" +#define DISKENVR_INFILE "SDL_DISKAUDIOFILEIN" +#define DISKDEFAULT_INFILE "sdlaudio-in.raw" +#define DISKENVR_IODELAY "SDL_DISKAUDIODELAY" + +/* This function waits until it is possible to write a full sound buffer */ +static void +DISKAUDIO_WaitDevice(_THIS) +{ + SDL_Delay(this->hidden->io_delay); +} + +static void +DISKAUDIO_PlayDevice(_THIS) +{ + const size_t written = SDL_RWwrite(this->hidden->io, + this->hidden->mixbuf, + 1, this->spec.size); + + /* If we couldn't write, assume fatal error for now */ + if (written != this->spec.size) { + SDL_OpenedAudioDeviceDisconnected(this); + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 * +DISKAUDIO_GetDeviceBuf(_THIS) +{ + return (this->hidden->mixbuf); +} + +static int +DISKAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + struct SDL_PrivateAudioData *h = this->hidden; + const int origbuflen = buflen; + + SDL_Delay(h->io_delay); + + if (h->io) { + const size_t br = SDL_RWread(h->io, buffer, 1, buflen); + buflen -= (int) br; + buffer = ((Uint8 *) buffer) + br; + if (buflen > 0) { /* EOF (or error, but whatever). */ + SDL_RWclose(h->io); + h->io = NULL; + } + } + + /* if we ran out of file, just write silence. */ + SDL_memset(buffer, this->spec.silence, buflen); + + return origbuflen; +} + +static void +DISKAUDIO_FlushCapture(_THIS) +{ + /* no op...we don't advance the file pointer or anything. */ +} + + +static void +DISKAUDIO_CloseDevice(_THIS) +{ + if (this->hidden->io != NULL) { + SDL_RWclose(this->hidden->io); + } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); +} + + +static const char * +get_filename(const int iscapture, const char *devname) +{ + if (devname == NULL) { + devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE); + if (devname == NULL) { + devname = iscapture ? DISKDEFAULT_INFILE : DISKDEFAULT_OUTFILE; + } + } + return devname; +} + +static int +DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + /* handle != NULL means "user specified the placeholder name on the fake detected device list" */ + const char *fname = get_filename(iscapture, handle ? NULL : devname); + const char *envr = SDL_getenv(DISKENVR_IODELAY); + + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc(sizeof(*this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + if (envr != NULL) { + this->hidden->io_delay = SDL_atoi(envr); + } else { + this->hidden->io_delay = ((this->spec.samples * 1000) / this->spec.freq); + } + + /* Open the audio device */ + this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb"); + if (this->hidden->io == NULL) { + return -1; + } + + /* Allocate mixing buffer */ + if (!iscapture) { + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); + } + + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + "You are using the SDL disk i/o audio driver!\n"); + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + " %s file [%s].\n", iscapture ? "Reading from" : "Writing to", + fname); + + /* We're ready to rock and roll. :-) */ + return 0; +} + +static void +DISKAUDIO_DetectDevices(void) +{ + SDL_AddAudioDevice(SDL_FALSE, DEFAULT_OUTPUT_DEVNAME, (void *) 0x1); + SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, (void *) 0x2); +} + +static int +DISKAUDIO_Init(SDL_AudioDriverImpl * impl) +{ + /* Set the function pointers */ + impl->OpenDevice = DISKAUDIO_OpenDevice; + impl->WaitDevice = DISKAUDIO_WaitDevice; + impl->PlayDevice = DISKAUDIO_PlayDevice; + impl->GetDeviceBuf = DISKAUDIO_GetDeviceBuf; + impl->CaptureFromDevice = DISKAUDIO_CaptureFromDevice; + impl->FlushCapture = DISKAUDIO_FlushCapture; + + impl->CloseDevice = DISKAUDIO_CloseDevice; + impl->DetectDevices = DISKAUDIO_DetectDevices; + + impl->AllowsArbitraryDeviceNames = 1; + impl->HasCaptureSupport = SDL_TRUE; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap DISKAUDIO_bootstrap = { + "disk", "direct-to-disk audio", DISKAUDIO_Init, 1 +}; + +#endif /* SDL_AUDIO_DRIVER_DISK */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.h b/3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.h index b5666f7fcb..7e73ebe531 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_diskaudio_h -#define _SDL_diskaudio_h +#ifndef SDL_diskaudio_h_ +#define SDL_diskaudio_h_ #include "SDL_rwops.h" #include "../SDL_sysaudio.h" @@ -32,11 +32,10 @@ struct SDL_PrivateAudioData { /* The file descriptor for the audio device */ - SDL_RWops *output; + SDL_RWops *io; + Uint32 io_delay; Uint8 *mixbuf; - Uint32 mixlen; - Uint32 write_delay; }; -#endif /* _SDL_diskaudio_h */ +#endif /* SDL_diskaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.c b/3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.c similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.c index 17e029e1d5..77653bede4 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,6 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" #include "SDL_dspaudio.h" @@ -60,16 +59,11 @@ DSP_DetectDevices(void) static void DSP_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->audio_fd >= 0) { + close(this->hidden->audio_fd); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } @@ -106,23 +100,20 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Open the audio device */ this->hidden->audio_fd = open(devname, flags, 0); if (this->hidden->audio_fd < 0) { - DSP_CloseDevice(this); return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } - this->hidden->mixbuf = NULL; - /* Make the file descriptor use blocking writes with fcntl() */ + /* Make the file descriptor use blocking i/o with fcntl() */ { long ctlflags; ctlflags = fcntl(this->hidden->audio_fd, F_GETFL); ctlflags &= ~O_NONBLOCK; if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) { - DSP_CloseDevice(this); return SDL_SetError("Couldn't set audio blocking mode"); } } @@ -130,7 +121,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Get a list of supported hardware formats */ if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) { perror("SNDCTL_DSP_GETFMTS"); - DSP_CloseDevice(this); return SDL_SetError("Couldn't get audio format list"); } @@ -187,7 +177,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } } if (format == 0) { - DSP_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -197,7 +186,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if ((ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || (value != format)) { perror("SNDCTL_DSP_SETFMT"); - DSP_CloseDevice(this); return SDL_SetError("Couldn't set audio format"); } @@ -205,7 +193,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) value = this->spec.channels; if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) { perror("SNDCTL_DSP_CHANNELS"); - DSP_CloseDevice(this); return SDL_SetError("Cannot set the number of channels"); } this->spec.channels = value; @@ -214,7 +201,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) value = this->spec.freq; if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) { perror("SNDCTL_DSP_SPEED"); - DSP_CloseDevice(this); return SDL_SetError("Couldn't set audio frequency"); } this->spec.freq = value; @@ -225,7 +211,6 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Determine the power of two of the fragment size */ for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec); if ((0x01U << frag_spec) != this->spec.size) { - DSP_CloseDevice(this); return SDL_SetError("Fragment size must be a power of two"); } frag_spec |= 0x00020000; /* two fragments, for low latency */ @@ -250,13 +235,14 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) #endif /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - DSP_CloseDevice(this); - return SDL_OutOfMemory(); + if (!iscapture) { + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ return 0; @@ -266,14 +252,13 @@ DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) static void DSP_PlayDevice(_THIS) { - const Uint8 *mixbuf = this->hidden->mixbuf; - const int mixlen = this->hidden->mixlen; - if (write(this->hidden->audio_fd, mixbuf, mixlen) == -1) { + struct SDL_PrivateAudioData *h = this->hidden; + if (write(h->audio_fd, h->mixbuf, h->mixlen) == -1) { perror("Audio write"); SDL_OpenedAudioDeviceDisconnected(this); } #ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen); + fprintf(stderr, "Wrote %d bytes of audio data\n", h->mixlen); #endif } @@ -283,6 +268,30 @@ DSP_GetDeviceBuf(_THIS) return (this->hidden->mixbuf); } +static int +DSP_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + return (int) read(this->hidden->audio_fd, buffer, buflen); +} + +static void +DSP_FlushCapture(_THIS) +{ + struct SDL_PrivateAudioData *h = this->hidden; + audio_buf_info info; + if (ioctl(h->audio_fd, SNDCTL_DSP_GETISPACE, &info) == 0) { + while (info.bytes > 0) { + char buf[512]; + const size_t len = SDL_min(sizeof (buf), info.bytes); + const ssize_t br = read(h->audio_fd, buf, len); + if (br <= 0) { + break; + } + info.bytes -= br; + } + } +} + static int DSP_Init(SDL_AudioDriverImpl * impl) { @@ -292,8 +301,11 @@ DSP_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = DSP_PlayDevice; impl->GetDeviceBuf = DSP_GetDeviceBuf; impl->CloseDevice = DSP_CloseDevice; + impl->CaptureFromDevice = DSP_CaptureFromDevice; + impl->FlushCapture = DSP_FlushCapture; impl->AllowsArbitraryDeviceNames = 1; + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.h b/3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.h index 0e4acfcaba..6bd86d71d2 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/dsp/SDL_dspaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dspaudio_h -#define _SDL_dspaudio_h +#ifndef SDL_dspaudio_h_ +#define SDL_dspaudio_h_ #include "../SDL_sysaudio.h" @@ -39,5 +39,5 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_dspaudio_h */ +#endif /* SDL_dspaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.c b/3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.c similarity index 60% rename from 3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.c index 107f0b073f..f91dea388e 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,27 +22,44 @@ /* Output audio to nowhere... */ +#include "SDL_timer.h" #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_dummyaudio.h" static int -DUMMYAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { return 0; /* always succeeds. */ } static int -DUMMYAUD_Init(SDL_AudioDriverImpl * impl) +DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + /* Delay to make this sort of simulate real audio input. */ + SDL_Delay((this->spec.samples * 1000) / this->spec.freq); + + /* always return a full buffer of silence. */ + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; +} + +static int +DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ - impl->OpenDevice = DUMMYAUD_OpenDevice; + impl->OpenDevice = DUMMYAUDIO_OpenDevice; + impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; + impl->HasCaptureSupport = SDL_TRUE; + return 1; /* this audio target is available. */ } -AudioBootStrap DUMMYAUD_bootstrap = { - "dummy", "SDL dummy audio driver", DUMMYAUD_Init, 1 +AudioBootStrap DUMMYAUDIO_bootstrap = { + "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1 }; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.h b/3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.h index b1f88b1cb3..18241ee542 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dummyaudio_h -#define _SDL_dummyaudio_h +#ifndef SDL_dummyaudio_h_ +#define SDL_dummyaudio_h_ #include "../SDL_sysaudio.h" @@ -37,5 +37,5 @@ struct SDL_PrivateAudioData Uint32 initial_calls; }; -#endif /* _SDL_dummyaudio_h */ +#endif /* SDL_dummyaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.c b/3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.c new file mode 100644 index 0000000000..e519f08348 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.c @@ -0,0 +1,379 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_EMSCRIPTEN + +#include "SDL_audio.h" +#include "SDL_log.h" +#include "../SDL_audio_c.h" +#include "SDL_emscriptenaudio.h" +#include "SDL_assert.h" + +#include + +static void +FeedAudioDevice(_THIS, const void *buf, const int buflen) +{ + const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + EM_ASM_ARGS({ + var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); + if (channelData.length != $1) { + throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; + } + + for (var j = 0; j < $1; ++j) { + channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */ + } + } + }, buf, buflen / framelen); +} + +static void +HandleAudioProcess(_THIS) +{ + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; + + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + if (this->stream) { + SDL_AudioStreamClear(this->stream); + } + return; + } + + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + int got; + while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) { + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(this->stream); + SDL_AtomicSet(&this->enabled, 0); + break; + } + } + + got = SDL_AudioStreamGet(this->stream, this->work_buffer, this->spec.size); + SDL_assert((got < 0) || (got == this->spec.size)); + if (got != this->spec.size) { + SDL_memset(this->work_buffer, this->spec.silence, this->spec.size); + } + } + + FeedAudioDevice(this, this->work_buffer, this->spec.size); +} + +static void +HandleCaptureProcess(_THIS) +{ + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; + + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + SDL_AudioStreamClear(this->stream); + return; + } + + EM_ASM_ARGS({ + var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); + if (channelData.length != $1) { + throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; + } + + if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */ + for (var j = 0; j < $1; ++j) { + setValue($0 + (j * 4), channelData[j], 'float'); + } + } else { + for (var j = 0; j < $1; ++j) { + setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float'); + } + } + } + }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels); + + /* okay, we've got an interleaved float32 array in C now. */ + + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) { + SDL_AtomicSet(&this->enabled, 0); + } + + while (SDL_AudioStreamAvailable(this->stream) >= stream_len) { + const int got = SDL_AudioStreamGet(this->stream, this->work_buffer, stream_len); + SDL_assert((got < 0) || (got == stream_len)); + if (got != stream_len) { + SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len); + } + callback(this->callbackspec.userdata, this->work_buffer, stream_len); /* Send it to the app. */ + } + } +} + + +static void +EMSCRIPTENAUDIO_CloseDevice(_THIS) +{ + EM_ASM_({ + if ($0) { + if (SDL2.capture.silenceTimer !== undefined) { + clearTimeout(SDL2.capture.silenceTimer); + } + if (SDL2.capture.stream !== undefined) { + var tracks = SDL2.capture.stream.getAudioTracks(); + for (var i = 0; i < tracks.length; i++) { + SDL2.capture.stream.removeTrack(tracks[i]); + } + SDL2.capture.stream = undefined; + } + if (SDL2.capture.scriptProcessorNode !== undefined) { + SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; + SDL2.capture.scriptProcessorNode.disconnect(); + SDL2.capture.scriptProcessorNode = undefined; + } + if (SDL2.capture.mediaStreamNode !== undefined) { + SDL2.capture.mediaStreamNode.disconnect(); + SDL2.capture.mediaStreamNode = undefined; + } + if (SDL2.capture.silenceBuffer !== undefined) { + SDL2.capture.silenceBuffer = undefined + } + SDL2.capture = undefined; + } else { + if (SDL2.audio.scriptProcessorNode != undefined) { + SDL2.audio.scriptProcessorNode.disconnect(); + SDL2.audio.scriptProcessorNode = undefined; + } + SDL2.audio = undefined; + } + if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) { + SDL2.audioContext.close(); + SDL2.audioContext = undefined; + } + }, this->iscapture); + +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ + SDL_free(this->hidden); +#endif +} + +static int +EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + SDL_bool valid_format = SDL_FALSE; + SDL_AudioFormat test_format; + int result; + + /* based on parts of library_sdl.js */ + + /* create context (TODO: this puts stuff in the global namespace...)*/ + result = EM_ASM_INT({ + if(typeof(SDL2) === 'undefined') { + SDL2 = {}; + } + if (!$0) { + SDL2.audio = {}; + } else { + SDL2.capture = {}; + } + + if (!SDL2.audioContext) { + if (typeof(AudioContext) !== 'undefined') { + SDL2.audioContext = new AudioContext(); + } else if (typeof(webkitAudioContext) !== 'undefined') { + SDL2.audioContext = new webkitAudioContext(); + } + } + return SDL2.audioContext === undefined ? -1 : 0; + }, iscapture); + if (result < 0) { + return SDL_SetError("Web Audio API is not available!"); + } + + test_format = SDL_FirstAudioFormat(this->spec.format); + while ((!valid_format) && (test_format)) { + switch (test_format) { + case AUDIO_F32: /* web audio only supports floats */ + this->spec.format = test_format; + + valid_format = SDL_TRUE; + break; + } + test_format = SDL_NextAudioFormat(); + } + + if (!valid_format) { + /* Didn't find a compatible format :( */ + return SDL_SetError("No compatible audio format!"); + } + + /* Initialize all variables that we clean on shutdown */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); +#endif + + /* limit to native freq */ + this->spec.freq = EM_ASM_INT_V({ return SDL2.audioContext.sampleRate; }); + + SDL_CalculateAudioSpec(&this->spec); + + if (iscapture) { + /* The idea is to take the capture media stream, hook it up to an + audio graph where we can pass it through a ScriptProcessorNode + to access the raw PCM samples and push them to the SDL app's + callback. From there, we "process" the audio data into silence + and forget about it. */ + + /* This should, strictly speaking, use MediaRecorder for capture, but + this API is cleaner to use and better supported, and fires a + callback whenever there's enough data to fire down into the app. + The downside is that we are spending CPU time silencing a buffer + that the audiocontext uselessly mixes into any output. On the + upside, both of those things are not only run in native code in + the browser, they're probably SIMD code, too. MediaRecorder + feels like it's a pretty inefficient tapdance in similar ways, + to be honest. */ + + EM_ASM_({ + var have_microphone = function(stream) { + //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); + if (SDL2.capture.silenceTimer !== undefined) { + clearTimeout(SDL2.capture.silenceTimer); + SDL2.capture.silenceTimer = undefined; + } + SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); + SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); + SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { + if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } + audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); + SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; + Runtime.dynCall('vi', $2, [$3]); + }; + SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); + SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); + SDL2.capture.stream = stream; + }; + + var no_microphone = function(error) { + //console.log('SDL audio capture: we DO NOT have a microphone! (' + error.name + ')...leaving silence callback running.'); + }; + + /* we write silence to the audio callback until the microphone is available (user approves use, etc). */ + SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); + SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); + var silence_callback = function() { + SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; + Runtime.dynCall('vi', $2, [$3]); + }; + + SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); + + if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { + navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); + } else if (navigator.webkitGetUserMedia !== undefined) { + navigator.webkitGetUserMedia({ audio: true, video: false }, have_microphone, no_microphone); + } + }, this->spec.channels, this->spec.samples, HandleCaptureProcess, this); + } else { + /* setup a ScriptProcessorNode */ + EM_ASM_ARGS({ + SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); + SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { + if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } + SDL2.audio.currentOutputBuffer = e['outputBuffer']; + Runtime.dynCall('vi', $2, [$3]); + }; + SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); + }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); + } + + return 0; +} + +static int +EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) +{ + int available; + int capture_available; + + /* Set the function pointers */ + impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice; + impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice; + + impl->OnlyHasDefaultOutputDevice = 1; + + /* no threads here */ + impl->SkipMixerLock = 1; + impl->ProvidesOwnCallbackThread = 1; + + /* check availability */ + available = EM_ASM_INT_V({ + if (typeof(AudioContext) !== 'undefined') { + return 1; + } else if (typeof(webkitAudioContext) !== 'undefined') { + return 1; + } + return 0; + }); + + if (!available) { + SDL_SetError("No audio context available"); + } + + capture_available = available && EM_ASM_INT_V({ + if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { + return 1; + } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { + return 1; + } + return 0; + }); + + impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE; + impl->OnlyHasDefaultCaptureDevice = capture_available ? SDL_TRUE : SDL_FALSE; + + return available; +} + +AudioBootStrap EMSCRIPTENAUDIO_bootstrap = { + "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.h b/3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.h index cd5377d86c..3c95668df2 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenaudio_h -#define _SDL_emscriptenaudio_h +#ifndef SDL_emscriptenaudio_h_ +#define SDL_emscriptenaudio_h_ #include "../SDL_sysaudio.h" @@ -30,13 +30,9 @@ struct SDL_PrivateAudioData { - Uint8 *mixbuf; - Uint32 mixlen; - - Uint32 conv_in_len; - - Uint32 write_off, read_off; + int unused; }; -#endif /* _SDL_emscriptenaudio_h */ +#endif /* SDL_emscriptenaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.c b/3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.c index 6a7882dcbd..802ea78041 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,6 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_esdaudio.h" @@ -174,17 +173,11 @@ ESD_GetDeviceBuf(_THIS) static void ESD_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - SDL_NAME(esd_close) (this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->audio_fd >= 0) { + SDL_NAME(esd_close) (this->hidden->audio_fd); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } /* Try to get the name of the program */ @@ -227,7 +220,7 @@ ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); this->hidden->audio_fd = -1; /* Convert audio spec to the ESD audio format */ @@ -252,7 +245,6 @@ ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (!found) { - ESD_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } @@ -271,7 +263,6 @@ ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) get_progname()); if (this->hidden->audio_fd < 0) { - ESD_CloseDevice(this); return SDL_SetError("Couldn't open ESD connection"); } @@ -283,9 +274,8 @@ ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { - ESD_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.h b/3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.h index d362b16ce0..9b5c25a702 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/esd/SDL_esdaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_esdaudio_h -#define _SDL_esdaudio_h +#ifndef SDL_esdaudio_h_ +#define SDL_esdaudio_h_ #include "../SDL_sysaudio.h" @@ -46,5 +46,6 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_esdaudio_h */ +#endif /* SDL_esdaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.c b/3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.c index b22a3e9a33..36fa5c5457 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,8 @@ #if SDL_AUDIO_DRIVER_FUSIONSOUND +/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ + /* Allow access to a raw mixing buffer */ #ifdef HAVE_SIGNAL_H @@ -31,7 +33,6 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_fsaudio.h" @@ -150,13 +151,6 @@ SDL_FS_PlayDevice(_THIS) #endif } -static void -SDL_FS_WaitDone(_THIS) -{ - this->hidden->stream->Wait(this->hidden->stream, - this->hidden->mixsamples * FUSION_BUFFERS); -} - static Uint8 * SDL_FS_GetDeviceBuf(_THIS) @@ -168,20 +162,14 @@ SDL_FS_GetDeviceBuf(_THIS) static void SDL_FS_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->stream) { - this->hidden->stream->Release(this->hidden->stream); - this->hidden->stream = NULL; - } - if (this->hidden->fs) { - this->hidden->fs->Release(this->hidden->fs); - this->hidden->fs = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->stream) { + this->hidden->stream->Release(this->hidden->stream); + } + if (this->hidden->fs) { + this->hidden->fs->Release(this->hidden->fs); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } @@ -200,7 +188,7 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Try for a closest match on audio format */ for (test_format = SDL_FirstAudioFormat(this->spec.format); @@ -239,7 +227,6 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (format == 0) { - SDL_FS_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -247,7 +234,6 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Retrieve the main sound interface. */ ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); if (ret) { - SDL_FS_CloseDevice(this); return SDL_SetError("Unable to initialize FusionSound: %d", ret); } @@ -266,7 +252,6 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->fs->CreateStream(this->hidden->fs, &desc, &this->hidden->stream); if (ret) { - SDL_FS_CloseDevice(this); return SDL_SetError("Unable to create FusionSoundStream: %d", ret); } @@ -285,9 +270,8 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { - SDL_FS_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -328,7 +312,6 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl) impl->WaitDevice = SDL_FS_WaitDevice; impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; impl->CloseDevice = SDL_FS_CloseDevice; - impl->WaitDone = SDL_FS_WaitDone; impl->Deinitialize = SDL_FS_Deinitialize; impl->OnlyHasDefaultOutputDevice = 1; diff --git a/3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.h b/3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.h index 5cf8a2009b..27e45ced29 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/fusionsound/SDL_fsaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_fsaudio_h -#define _SDL_fsaudio_h +#ifndef SDL_fsaudio_h_ +#define SDL_fsaudio_h_ #include @@ -45,5 +45,6 @@ struct SDL_PrivateAudioData }; -#endif /* _SDL_fsaudio_h */ +#endif /* SDL_fsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.cc b/3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.cc similarity index 77% rename from 3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.cc rename to 3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.cc index 38f3b96218..52946a5b74 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.cc +++ b/3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern "C" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_haikuaudio.h" +#include "SDL_assert.h" } @@ -47,25 +48,39 @@ FillSound(void *device, void *stream, size_t len, const media_raw_audio_format & format) { SDL_AudioDevice *audio = (SDL_AudioDevice *) device; + SDL_AudioCallback callback = audio->callbackspec.callback; - /* Only do soemthing if audio is enabled */ - if (!audio->enabled) + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) { + if (audio->stream) { + SDL_AudioStreamClear(audio->stream); + } + SDL_memset(stream, audio->spec.silence, len); return; + } + + SDL_assert(audio->spec.size == len); + + if (audio->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(audio->mixer_lock); + callback(audio->callbackspec.userdata, (Uint8 *) stream, len); + SDL_UnlockMutex(audio->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = audio->callbackspec.size; + const int ilen = (int) len; + while (SDL_AudioStreamAvailable(audio->stream) < ilen) { + callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); + if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(audio->stream); + SDL_AtomicSet(&audio->enabled, 0); + break; + } + } - if (!audio->paused) { - if (audio->convert.needed) { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) audio->convert.buf, - audio->convert.len); - SDL_UnlockMutex(audio->mixer_lock); - SDL_ConvertAudio(&audio->convert); - SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt); - } else { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) stream, len); - SDL_UnlockMutex(audio->mixer_lock); + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); + SDL_assert((got < 0) || (got == ilen)); + if (got != ilen) { + SDL_memset(stream, audio->spec.silence, len); } } } @@ -73,16 +88,11 @@ FillSound(void *device, void *stream, size_t len, static void HAIKUAUDIO_CloseDevice(_THIS) { - if (_this->hidden != NULL) { - if (_this->hidden->audio_obj) { - _this->hidden->audio_obj->Stop(); - delete _this->hidden->audio_obj; - _this->hidden->audio_obj = NULL; - } - - delete _this->hidden; - _this->hidden = NULL; + if (_this->hidden->audio_obj) { + _this->hidden->audio_obj->Stop(); + delete _this->hidden->audio_obj; } + delete _this->hidden; } @@ -122,10 +132,10 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (_this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(_this->hidden, 0, (sizeof *_this->hidden)); + SDL_zerop(_this->hidden); /* Parse the audio format and fill the Be raw audio format */ - SDL_memset(&format, '\0', sizeof(media_raw_audio_format)); + SDL_zero(format); format.byte_order = B_MEDIA_LITTLE_ENDIAN; format.frame_rate = (float) _this->spec.freq; format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */ @@ -176,7 +186,6 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (!valid_datatype) { /* shouldn't happen, but just in case... */ - HAIKUAUDIO_CloseDevice(_this); return SDL_SetError("Unsupported audio format"); } @@ -195,7 +204,6 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (_this->hidden->audio_obj->Start() == B_NO_ERROR) { _this->hidden->audio_obj->SetHasData(true); } else { - HAIKUAUDIO_CloseDevice(_this); return SDL_SetError("Unable to start Be audio"); } diff --git a/3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.h b/3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.h index 23e5a7655d..f63ccdb1ad 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/haiku/SDL_haikuaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_beaudio_h -#define _SDL_beaudio_h +#ifndef SDL_haikuaudio_h_ +#define SDL_haikuaudio_h_ #include "../SDL_sysaudio.h" @@ -33,6 +33,6 @@ struct SDL_PrivateAudioData BSoundPlayer *audio_obj; }; -#endif /* _SDL_beaudio_h */ +#endif /* SDL_haikuaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.c b/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.c new file mode 100644 index 0000000000..76ff431c81 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.c @@ -0,0 +1,446 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_JACK + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_jackaudio.h" +#include "SDL_loadso.h" +#include "../../thread/SDL_systhread.h" + + +static jack_client_t * (*JACK_jack_client_open) (const char *, jack_options_t, jack_status_t *, ...); +static int (*JACK_jack_client_close) (jack_client_t *); +static void (*JACK_jack_on_shutdown) (jack_client_t *, JackShutdownCallback, void *); +static int (*JACK_jack_activate) (jack_client_t *); +static int (*JACK_jack_deactivate) (jack_client_t *); +static void * (*JACK_jack_port_get_buffer) (jack_port_t *, jack_nframes_t); +static int (*JACK_jack_port_unregister) (jack_client_t *, jack_port_t *); +static void (*JACK_jack_free) (void *); +static const char ** (*JACK_jack_get_ports) (jack_client_t *, const char *, const char *, unsigned long); +static jack_nframes_t (*JACK_jack_get_sample_rate) (jack_client_t *); +static jack_nframes_t (*JACK_jack_get_buffer_size) (jack_client_t *); +static jack_port_t * (*JACK_jack_port_register) (jack_client_t *, const char *, const char *, unsigned long, unsigned long); +static jack_port_t * (*JACK_jack_port_by_name) (jack_client_t *, const char *); +static const char * (*JACK_jack_port_name) (const jack_port_t *); +static const char * (*JACK_jack_port_type) (const jack_port_t *); +static int (*JACK_jack_connect) (jack_client_t *, const char *, const char *); +static int (*JACK_jack_set_process_callback) (jack_client_t *, JackProcessCallback, void *); + +static int load_jack_syms(void); + + +#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC + +static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC; +static void *jack_handle = NULL; + +/* !!! FIXME: this is copy/pasted in several places now */ +static int +load_jack_sym(const char *fn, void **addr) +{ + *addr = SDL_LoadFunction(jack_handle, fn); + if (*addr == NULL) { + /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ + return 0; + } + + return 1; +} + +/* cast funcs to char* first, to please GCC's strict aliasing rules. */ +#define SDL_JACK_SYM(x) \ + if (!load_jack_sym(#x, (void **) (char *) &JACK_##x)) return -1 + +static void +UnloadJackLibrary(void) +{ + if (jack_handle != NULL) { + SDL_UnloadObject(jack_handle); + jack_handle = NULL; + } +} + +static int +LoadJackLibrary(void) +{ + int retval = 0; + if (jack_handle == NULL) { + jack_handle = SDL_LoadObject(jack_library); + if (jack_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = load_jack_syms(); + if (retval < 0) { + UnloadJackLibrary(); + } + } + } + return retval; +} + +#else + +#define SDL_JACK_SYM(x) JACK_##x = x + +static void +UnloadJackLibrary(void) +{ +} + +static int +LoadJackLibrary(void) +{ + load_jack_syms(); + return 0; +} + +#endif /* SDL_AUDIO_DRIVER_JACK_DYNAMIC */ + + +static int +load_jack_syms(void) +{ + SDL_JACK_SYM(jack_client_open); + SDL_JACK_SYM(jack_client_close); + SDL_JACK_SYM(jack_on_shutdown); + SDL_JACK_SYM(jack_activate); + SDL_JACK_SYM(jack_deactivate); + SDL_JACK_SYM(jack_port_get_buffer); + SDL_JACK_SYM(jack_port_unregister); + SDL_JACK_SYM(jack_free); + SDL_JACK_SYM(jack_get_ports); + SDL_JACK_SYM(jack_get_sample_rate); + SDL_JACK_SYM(jack_get_buffer_size); + SDL_JACK_SYM(jack_port_register); + SDL_JACK_SYM(jack_port_by_name); + SDL_JACK_SYM(jack_port_name); + SDL_JACK_SYM(jack_port_type); + SDL_JACK_SYM(jack_connect); + SDL_JACK_SYM(jack_set_process_callback); + return 0; +} + + +static void +jackShutdownCallback(void *arg) /* JACK went away; device is lost. */ +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + SDL_OpenedAudioDeviceDisconnected(this); + SDL_SemPost(this->hidden->iosem); /* unblock the SDL thread. */ +} + +// !!! FIXME: implement and register these! +//typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg) +//typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg) + +static int +jackProcessPlaybackCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + if (!SDL_AtomicGet(&this->enabled)) { + /* silence the buffer to avoid repeats and corruption. */ + SDL_memset(this->hidden->iobuffer, '\0', this->spec.size); + } + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + float *dst = (float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (dst) { + const float *src = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *(dst++) = *src; + src += total_channels; + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; refill the buffer. */ + return 0; /* success */ +} + + +/* This function waits until it is possible to write a full sound buffer */ +static void +JACK_WaitDevice(_THIS) +{ + if (SDL_AtomicGet(&this->enabled)) { + if (SDL_SemWait(this->hidden->iosem) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static Uint8 * +JACK_GetDeviceBuf(_THIS) +{ + return (Uint8 *) this->hidden->iobuffer; +} + + +static int +jackProcessCaptureCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + if (SDL_AtomicGet(&this->enabled)) { + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + const float *src = (const float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (src) { + float *dst = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *dst = *(src++); + dst += total_channels; + } + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; new buffer is ready! */ + return 0; /* success */ +} + +static int +JACK_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_assert(buflen == this->spec.size); /* we always fill a full buffer. */ + + /* Wait for JACK to fill the iobuffer */ + if (SDL_SemWait(this->hidden->iosem) == -1) { + return -1; + } + + SDL_memcpy(buffer, this->hidden->iobuffer, buflen); + return buflen; +} + +static void +JACK_FlushCapture(_THIS) +{ + SDL_SemWait(this->hidden->iosem); +} + + +static void +JACK_CloseDevice(_THIS) +{ + if (this->hidden->client) { + JACK_jack_deactivate(this->hidden->client); + + if (this->hidden->sdlports) { + const int channels = this->spec.channels; + int i; + for (i = 0; i < channels; i++) { + JACK_jack_port_unregister(this->hidden->client, this->hidden->sdlports[i]); + } + SDL_free(this->hidden->sdlports); + } + + JACK_jack_client_close(this->hidden->client); + } + + if (this->hidden->iosem) { + SDL_DestroySemaphore(this->hidden->iosem); + } + + SDL_free(this->hidden->iobuffer); +} + +static int +JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + /* Note that JACK uses "output" for capture devices (they output audio + data to us) and "input" for playback (we input audio data to them). + Likewise, SDL's playback port will be "output" (we write data out) + and capture will be "input" (we read data in). */ + const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput; + const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput; + const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback; + const char *sdlportstr = iscapture ? "input" : "output"; + const char **devports = NULL; + int *audio_ports; + jack_client_t *client = NULL; + jack_status_t status; + int channels = 0; + int ports = 0; + int i; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof (*this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + /* !!! FIXME: we _still_ need an API to specify an app name */ + client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + this->hidden->client = client; + if (client == NULL) { + return SDL_SetError("Can't open JACK client"); + } + + devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags); + if (!devports || !devports[0]) { + return SDL_SetError("No physical JACK ports available"); + } + + while (devports[++ports]) { + /* spin to count devports */ + } + + /* Filter out non-audio ports */ + audio_ports = SDL_calloc(ports, sizeof *audio_ports); + for (i = 0; i < ports; i++) { + const jack_port_t *dport = JACK_jack_port_by_name(client, devports[i]); + const char *type = JACK_jack_port_type(dport); + const int len = SDL_strlen(type); + /* See if type ends with "audio" */ + if (len >= 5 && !SDL_memcmp(type+len-5, "audio", 5)) { + audio_ports[channels++] = i; + } + } + if (channels == 0) { + return SDL_SetError("No physical JACK ports available"); + } + + + /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */ + + /* Jack pretty much demands what it wants. */ + this->spec.format = AUDIO_F32SYS; + this->spec.freq = JACK_jack_get_sample_rate(client); + this->spec.channels = channels; + this->spec.samples = JACK_jack_get_buffer_size(client); + + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->iosem = SDL_CreateSemaphore(0); + if (!this->hidden->iosem) { + return -1; /* error was set by SDL_CreateSemaphore */ + } + + this->hidden->iobuffer = (float *) SDL_calloc(1, this->spec.size); + if (!this->hidden->iobuffer) { + return SDL_OutOfMemory(); + } + + /* Build SDL's ports, which we will connect to the device ports. */ + this->hidden->sdlports = (jack_port_t **) SDL_calloc(channels, sizeof (jack_port_t *)); + if (this->hidden->sdlports == NULL) { + return SDL_OutOfMemory(); + } + + for (i = 0; i < channels; i++) { + char portname[32]; + SDL_snprintf(portname, sizeof (portname), "sdl_jack_%s_%d", sdlportstr, i); + this->hidden->sdlports[i] = JACK_jack_port_register(client, portname, JACK_DEFAULT_AUDIO_TYPE, sdlportflags, 0); + if (this->hidden->sdlports[i] == NULL) { + return SDL_SetError("jack_port_register failed"); + } + } + + if (JACK_jack_set_process_callback(client, callback, this) != 0) { + return SDL_SetError("JACK: Couldn't set process callback"); + } + + JACK_jack_on_shutdown(client, jackShutdownCallback, this); + + if (JACK_jack_activate(client) != 0) { + return SDL_SetError("Failed to activate JACK client"); + } + + /* once activated, we can connect all the ports. */ + for (i = 0; i < channels; i++) { + const char *sdlport = JACK_jack_port_name(this->hidden->sdlports[i]); + const char *srcport = iscapture ? devports[audio_ports[i]] : sdlport; + const char *dstport = iscapture ? sdlport : devports[audio_ports[i]]; + if (JACK_jack_connect(client, srcport, dstport) != 0) { + return SDL_SetError("Couldn't connect JACK ports: %s => %s", srcport, dstport); + } + } + + /* don't need these anymore. */ + JACK_jack_free(devports); + SDL_free(audio_ports); + + /* We're ready to rock and roll. :-) */ + return 0; +} + +static void +JACK_Deinitialize(void) +{ + UnloadJackLibrary(); +} + +static int +JACK_Init(SDL_AudioDriverImpl * impl) +{ + if (LoadJackLibrary() < 0) { + return 0; + } else { + /* Make sure a JACK server is running and available. */ + jack_status_t status; + jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + if (client == NULL) { + UnloadJackLibrary(); + return 0; + } + JACK_jack_client_close(client); + } + + /* Set the function pointers */ + impl->OpenDevice = JACK_OpenDevice; + impl->WaitDevice = JACK_WaitDevice; + impl->GetDeviceBuf = JACK_GetDeviceBuf; + impl->CloseDevice = JACK_CloseDevice; + impl->Deinitialize = JACK_Deinitialize; + impl->CaptureFromDevice = JACK_CaptureFromDevice; + impl->FlushCapture = JACK_FlushCapture; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->HasCaptureSupport = SDL_TRUE; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap JACK_bootstrap = { + "jack", "JACK Audio Connection Kit", JACK_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_JACK */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.h b/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.h new file mode 100644 index 0000000000..5bc04bd89e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/jack/SDL_jackaudio.h @@ -0,0 +1,41 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_jackaudio_h_ +#define SDL_jackaudio_h_ + +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData +{ + jack_client_t *client; + SDL_sem *iosem; + float *iobuffer; + jack_port_t **sdlports; +}; + +#endif /* SDL_jackaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.c b/3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.c similarity index 58% rename from 3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.c index 2d1ee73e9d..3e3afc02d1 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,6 @@ #include "SDL_audio.h" #include "SDL_mutex.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" @@ -38,43 +37,58 @@ #include "ppapi_simple/ps_event.h" /* The tag name used by NACL audio */ -#define NACLAUD_DRIVER_NAME "nacl" +#define NACLAUDIO_DRIVER_NAME "nacl" #define SAMPLE_FRAME_COUNT 4096 /* Audio driver functions */ -static int NACLAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture); -static void NACLAUD_CloseDevice(_THIS); static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data); /* FIXME: Make use of latency if needed */ -static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data) { +static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) { + const int len = (int) buffer_size; SDL_AudioDevice* _this = (SDL_AudioDevice*) data; + SDL_AudioCallback callback = _this->callbackspec.callback; - SDL_LockMutex(private->mutex); - - if (_this->enabled && !_this->paused) { - if (_this->convert.needed) { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, - (Uint8 *) _this->convert.buf, - _this->convert.len); - SDL_UnlockMutex(_this->mixer_lock); - SDL_ConvertAudio(&_this->convert); - SDL_memcpy(samples, _this->convert.buf, _this->convert.len_cvt); - } else { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, (Uint8 *) samples, buffer_size); - SDL_UnlockMutex(_this->mixer_lock); + SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */ + + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { + if (_this->stream) { + SDL_AudioStreamClear(_this->stream); } - } else { - SDL_memset(samples, 0, buffer_size); + SDL_memset(stream, _this->spec.silence, len); + return; } - - return; + + SDL_assert(_this->spec.size == len); + + if (_this->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(_this->mixer_lock); + callback(_this->callbackspec.userdata, stream, len); + SDL_UnlockMutex(_this->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = _this->callbackspec.size; + while (SDL_AudioStreamAvailable(_this->stream) < len) { + callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); + if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(_this->stream); + SDL_AtomicSet(&_this->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(_this->stream, stream, len); + SDL_assert((got < 0) || (got == len)); + if (got != len) { + SDL_memset(stream, _this->spec.silence, len); + } + } + + SDL_UnlockMutex(private->mutex); } -static void NACLAUD_CloseDevice(SDL_AudioDevice *device) { +static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { const PPB_Core *core = PSInterfaceCore(); const PPB_Audio *ppb_audio = PSInterfaceAudio(); SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden; @@ -85,15 +99,14 @@ static void NACLAUD_CloseDevice(SDL_AudioDevice *device) { } static int -NACLAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { +NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { PP_Instance instance = PSGetInstanceId(); const PPB_Audio *ppb_audio = PSInterfaceAudio(); const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig(); private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private)); if (private == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } private->mutex = SDL_CreateMutex(); @@ -117,34 +130,34 @@ NACLAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { /* Start audio playback while we are still on the main thread. */ ppb_audio->StartPlayback(private->audio); - return 1; + return 0; } static int -NACLAUD_Init(SDL_AudioDriverImpl * impl) +NACLAUDIO_Init(SDL_AudioDriverImpl * impl) { if (PSGetInstanceId() == 0) { return 0; } /* Set the function pointers */ - impl->OpenDevice = NACLAUD_OpenDevice; - impl->CloseDevice = NACLAUD_CloseDevice; + impl->OpenDevice = NACLAUDIO_OpenDevice; + impl->CloseDevice = NACLAUDIO_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; impl->ProvidesOwnCallbackThread = 1; /* - * impl->WaitDevice = NACLAUD_WaitDevice; - * impl->GetDeviceBuf = NACLAUD_GetDeviceBuf; - * impl->PlayDevice = NACLAUD_PlayDevice; - * impl->Deinitialize = NACLAUD_Deinitialize; + * impl->WaitDevice = NACLAUDIO_WaitDevice; + * impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf; + * impl->PlayDevice = NACLAUDIO_PlayDevice; + * impl->Deinitialize = NACLAUDIO_Deinitialize; */ return 1; } -AudioBootStrap NACLAUD_bootstrap = { - NACLAUD_DRIVER_NAME, "SDL NaCl Audio Driver", - NACLAUD_Init, 0 +AudioBootStrap NACLAUDIO_bootstrap = { + NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver", + NACLAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_NACL */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.h b/3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.h index 90ff5448e1..5ec842bac6 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/nacl/SDL_naclaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_naclaudio_h -#define _SDL_naclaudio_h +#ifndef SDL_naclaudio_h_ +#define SDL_naclaudio_h_ #include "SDL_audio.h" #include "../SDL_sysaudio.h" @@ -38,4 +38,6 @@ typedef struct SDL_PrivateAudioData { PP_Resource audio; } SDL_PrivateAudioData; -#endif /* _SDL_naclaudio_h */ +#endif /* SDL_naclaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.c b/3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.c similarity index 66% rename from 3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.c index 9de5ff8b42..5a02a3ba62 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,22 +30,21 @@ #include "SDL_timer.h" #include "SDL_audio.h" #include "SDL_loadso.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_nasaudio.h" -static struct SDL_PrivateAudioData *this2 = NULL; - - static void (*NAS_AuCloseServer) (AuServer *); static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *); static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *); +static void (*NAS_AuHandleEvents) (AuServer *); static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *); static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *); static void (*NAS_AuSetElements) (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *); static void (*NAS_AuWriteElement) (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *); +static AuUint32 (*NAS_AuReadElement) + (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuStatus *); static AuServer *(*NAS_AuOpenServer) (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **); static AuEventHandlerRec *(*NAS_AuRegisterEventHandler) @@ -80,10 +79,12 @@ load_nas_syms(void) SDL_NAS_SYM(AuCloseServer); SDL_NAS_SYM(AuNextEvent); SDL_NAS_SYM(AuDispatchEvent); + SDL_NAS_SYM(AuHandleEvents); SDL_NAS_SYM(AuCreateFlow); SDL_NAS_SYM(AuStartFlow); SDL_NAS_SYM(AuSetElements); SDL_NAS_SYM(AuWriteElement); + SDL_NAS_SYM(AuReadElement); SDL_NAS_SYM(AuOpenServer); SDL_NAS_SYM(AuRegisterEventHandler); return 0; @@ -115,7 +116,7 @@ LoadNASLibrary(void) char *err = (char *) alloca(len); SDL_strlcpy(err, origerr, len); retval = -1; - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s\n", + SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s", nas_library, err); } else { retval = load_nas_syms(); @@ -187,19 +188,53 @@ NAS_GetDeviceBuf(_THIS) return (this->hidden->mixbuf); } +static int +NAS_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + struct SDL_PrivateAudioData *h = this->hidden; + int retval; + + while (SDL_TRUE) { + /* just keep the event queue moving and the server chattering. */ + NAS_AuHandleEvents(h->aud); + + retval = (int) NAS_AuReadElement(h->aud, h->flow, 1, buflen, buffer, NULL); + /*printf("read %d capture bytes\n", (int) retval);*/ + if (retval == 0) { + SDL_Delay(10); /* don't burn the CPU if we're waiting for data. */ + } else { + break; + } + } + + return retval; +} + +static void +NAS_FlushCapture(_THIS) +{ + struct SDL_PrivateAudioData *h = this->hidden; + AuUint32 total = 0; + AuUint32 br; + Uint8 buf[512]; + + do { + /* just keep the event queue moving and the server chattering. */ + NAS_AuHandleEvents(h->aud); + br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof (buf), buf, NULL); + /*printf("flushed %d capture bytes\n", (int) br);*/ + total += br; + } while ((br == sizeof (buf)) && (total < this->spec.size)); +} + static void NAS_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->aud) { - NAS_AuCloseServer(this->hidden->aud); - this->hidden->aud = 0; - } - SDL_free(this->hidden); - this2 = this->hidden = NULL; + if (this->hidden->aud) { + NAS_AuCloseServer(this->hidden->aud); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static unsigned char @@ -225,6 +260,12 @@ sdlformat_to_auformat(unsigned int fmt) static AuBool event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) { + SDL_AudioDevice *this = (SDL_AudioDevice *) hnd->data; + struct SDL_PrivateAudioData *h = this->hidden; + if (this->iscapture) { + return AuTrue; /* we don't (currently) care about any of this for capture devices */ + } + switch (ev->type) { case AuEventTypeElementNotify: { @@ -232,24 +273,24 @@ event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) switch (event->kind) { case AuElementNotifyKindLowWater: - if (this2->buf_free >= 0) { - this2->really += event->num_bytes; - gettimeofday(&this2->last_tv, 0); - this2->buf_free += event->num_bytes; + if (h->buf_free >= 0) { + h->really += event->num_bytes; + gettimeofday(&h->last_tv, 0); + h->buf_free += event->num_bytes; } else { - this2->buf_free = event->num_bytes; + h->buf_free = event->num_bytes; } break; case AuElementNotifyKindState: switch (event->cur_state) { case AuStatePause: if (event->reason != AuReasonUser) { - if (this2->buf_free >= 0) { - this2->really += event->num_bytes; - gettimeofday(&this2->last_tv, 0); - this2->buf_free += event->num_bytes; + if (h->buf_free >= 0) { + h->really += event->num_bytes; + gettimeofday(&h->last_tv, 0); + h->buf_free += event->num_bytes; } else { - this2->buf_free = event->num_bytes; + h->buf_free = event->num_bytes; } } break; @@ -261,15 +302,29 @@ event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) } static AuDeviceID -find_device(_THIS, int nch) +find_device(_THIS) { /* These "Au" things are all macros, not functions... */ + struct SDL_PrivateAudioData *h = this->hidden; + const unsigned int devicekind = this->iscapture ? AuComponentKindPhysicalInput : AuComponentKindPhysicalOutput; + const int numdevs = AuServerNumDevices(h->aud); + const int nch = this->spec.channels; int i; - for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) { - if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) == - AuComponentKindPhysicalOutput) && - AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) { - return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i)); + + /* Try to find exact match on channels first... */ + for (i = 0; i < numdevs; i++) { + const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); + if ((AuDeviceKind(dev) == devicekind) && (AuDeviceNumTracks(dev) == nch)) { + return AuDeviceIdentifier(dev); + } + } + + /* Take anything, then... */ + for (i = 0; i < numdevs; i++) { + const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); + if (AuDeviceKind(dev) == devicekind) { + this->spec.channels = AuDeviceNumTracks(dev); + return AuDeviceIdentifier(dev); } } return AuNone; @@ -288,7 +343,7 @@ NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Try for a closest match on audio format */ format = 0; @@ -300,21 +355,18 @@ NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } } if (format == 0) { - NAS_CloseDevice(this); return SDL_SetError("NAS: Couldn't find any hardware audio formats"); } this->spec.format = test_format; this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); if (this->hidden->aud == 0) { - NAS_CloseDevice(this); return SDL_SetError("NAS: Couldn't open connection to NAS server"); } - this->hidden->dev = find_device(this, this->spec.channels); + this->hidden->dev = find_device(this); if ((this->hidden->dev == AuNone) || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) { - NAS_CloseDevice(this); return SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); } @@ -328,29 +380,38 @@ NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Calculate the final parameters for this audio specification */ SDL_CalculateAudioSpec(&this->spec); - this2 = this->hidden; + if (iscapture) { + AuMakeElementImportDevice(elms, this->spec.freq, this->hidden->dev, + AuUnlimitedSamples, 0, NULL); + AuMakeElementExportClient(elms + 1, 0, this->spec.freq, format, + this->spec.channels, AuTrue, buffer_size, + buffer_size, 0, NULL); + } else { + AuMakeElementImportClient(elms, this->spec.freq, format, + this->spec.channels, AuTrue, buffer_size, + buffer_size / 4, 0, NULL); + AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, + AuUnlimitedSamples, 0, NULL); + } + + NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, + 2, elms, NULL); - AuMakeElementImportClient(elms, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size / 4, 0, NULL); - AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, - AuUnlimitedSamples, 0, NULL); - NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms, - NULL); NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, this->hidden->flow, event_handler, - (AuPointer) NULL); + (AuPointer) this); NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - NAS_CloseDevice(this); - return SDL_OutOfMemory(); + if (!iscapture) { + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ return 0; @@ -381,9 +442,14 @@ NAS_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = NAS_PlayDevice; impl->WaitDevice = NAS_WaitDevice; impl->GetDeviceBuf = NAS_GetDeviceBuf; + impl->CaptureFromDevice = NAS_CaptureFromDevice; + impl->FlushCapture = NAS_FlushCapture; impl->CloseDevice = NAS_CloseDevice; impl->Deinitialize = NAS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: is this true? */ + + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.h b/3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.h index 2f46b0b601..b1a51d1a65 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/nas/SDL_nasaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nasaudio_h -#define _SDL_nasaudio_h +#ifndef SDL_nasaudio_h_ +#define SDL_nasaudio_h_ #ifdef __sgi #include @@ -51,6 +51,6 @@ struct SDL_PrivateAudioData struct timeval last_tv; int buf_free; }; -#endif /* _SDL_nasaudio_h */ +#endif /* SDL_nasaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.c b/3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.c similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.c index eeb257371f..0dc0b25ebf 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_BSD +#if SDL_AUDIO_DRIVER_NETBSD /* - * Driver for native OpenBSD/NetBSD audio(4). + * Driver for native NetBSD audio(4). * vedge@vedge.com.ar. */ @@ -38,10 +38,10 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" -#include "SDL_bsdaudio.h" +#include "SDL_netbsdaudio.h" /* Use timer for synchronization */ /* #define USE_TIMER_SYNC */ @@ -51,25 +51,29 @@ static void -BSDAUDIO_DetectDevices(void) +NETBSDAUDIO_DetectDevices(void) { SDL_EnumUnixAudioDevices(0, NULL); } static void -BSDAUDIO_Status(_THIS) +NETBSDAUDIO_Status(_THIS) { #ifdef DEBUG_AUDIO /* *INDENT-OFF* */ audio_info_t info; + const audio_prinfo *prinfo; if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { fprintf(stderr, "AUDIO_GETINFO failed.\n"); return; } + + prinfo = this->iscapture ? &info.play : &info.record; + fprintf(stderr, "\n" - "[play/record info]\n" + "[%s info]\n" "buffer size : %d bytes\n" "sample rate : %i Hz\n" "channels : %i\n" @@ -83,18 +87,19 @@ BSDAUDIO_Status(_THIS) "waiting : %s\n" "active : %s\n" "", - info.play.buffer_size, - info.play.sample_rate, - info.play.channels, - info.play.precision, - info.play.encoding, - info.play.seek, - info.play.samples, - info.play.eof, - info.play.pause ? "yes" : "no", - info.play.error ? "yes" : "no", - info.play.waiting ? "yes" : "no", - info.play.active ? "yes" : "no"); + this->iscapture ? "record" : "play", + prinfo->buffer_size, + prinfo->sample_rate, + prinfo->channels, + prinfo->precision, + prinfo->encoding, + prinfo->seek, + prinfo->samples, + prinfo->eof, + prinfo->pause ? "yes" : "no", + prinfo->error ? "yes" : "no", + prinfo->waiting ? "yes" : "no", + prinfo->active ? "yes" : "no"); fprintf(stderr, "\n" "[audio info]\n" @@ -117,7 +122,7 @@ BSDAUDIO_Status(_THIS) /* This function waits until it is possible to write a full sound buffer */ static void -BSDAUDIO_WaitDevice(_THIS) +NETBSDAUDIO_WaitDevice(_THIS) { #ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ /* See if we need to use timed audio synchronization */ @@ -130,18 +135,11 @@ BSDAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { - /* Use select() for audio synchronization */ - fd_set fdset; - struct timeval timeout; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - timeout.tv_sec = 10; - timeout.tv_usec = 0; + /* Use SDL_IOReady() for audio synchronization */ #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, 10 * 1000) <= 0) { const char *message = "Audio timeout - buggy audio driver? (disabled)"; @@ -165,7 +163,7 @@ BSDAUDIO_WaitDevice(_THIS) } static void -BSDAUDIO_PlayDevice(_THIS) +NETBSDAUDIO_PlayDevice(_THIS) { int written, p = 0; @@ -182,11 +180,15 @@ BSDAUDIO_PlayDevice(_THIS) break; } - if (p < written +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif + + if (p < this->hidden->mixlen || ((written < 0) && ((errno == 0) || (errno == EAGAIN)))) { SDL_Delay(1); /* Let a little CPU time go by */ } - } while (p < written); + } while (p < this->hidden->mixlen); /* If timer synchronization is enabled, set the next write frame */ if (this->hidden->frame_ticks) { @@ -197,38 +199,82 @@ BSDAUDIO_PlayDevice(_THIS) if (written < 0) { SDL_OpenedAudioDeviceDisconnected(this); } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif } static Uint8 * -BSDAUDIO_GetDeviceBuf(_THIS) +NETBSDAUDIO_GetDeviceBuf(_THIS) { return (this->hidden->mixbuf); } + +static int +NETBSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) +{ + Uint8 *buffer = (Uint8 *) _buffer; + int br, p = 0; + + /* Capture the audio data, checking for EAGAIN on broken audio drivers */ + do { + br = read(this->hidden->audio_fd, buffer + p, buflen - p); + if (br > 0) + p += br; + if (br == -1 && errno != 0 && errno != EAGAIN && errno != EINTR) { + /* Non recoverable error has occurred. It should be reported!!! */ + perror("audio"); + return p ? p : -1; + } + +#ifdef DEBUG_AUDIO + fprintf(stderr, "Captured %d bytes of audio data\n", br); +#endif + + if (p < buflen + || ((br < 0) && ((errno == 0) || (errno == EAGAIN)))) { + SDL_Delay(1); /* Let a little CPU time go by */ + } + } while (p < buflen); +} + static void -BSDAUDIO_CloseDevice(_THIS) +NETBSDAUDIO_FlushCapture(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; + audio_info_t info; + size_t remain; + Uint8 buf[512]; + + if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { + return; /* oh well. */ + } + + remain = (size_t) (info.record.samples * (SDL_AUDIO_BITSIZE(this->spec.format) / 8)); + while (remain > 0) { + const size_t len = SDL_min(sizeof (buf), remain); + const int br = read(this->hidden->audio_fd, buf, len); + if (br <= 0) { + return; /* oh well. */ } - SDL_free(this->hidden); - this->hidden = NULL; + remain -= br; } } +static void +NETBSDAUDIO_CloseDevice(_THIS) +{ + if (this->hidden->audio_fd >= 0) { + close(this->hidden->audio_fd); + } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); +} + static int -BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); + const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT; SDL_AudioFormat format = 0; audio_info_t info; + audio_prinfo *prinfo = iscapture ? &info.play : &info.record; /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ @@ -245,7 +291,7 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Open the audio device */ this->hidden->audio_fd = open(devname, flags, 0); @@ -259,9 +305,8 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_CalculateAudioSpec(&this->spec); /* Set to play mode */ - info.mode = AUMODE_PLAY; + info.mode = iscapture ? AUMODE_RECORD : AUMODE_PLAY; if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) { - BSDAUDIO_CloseDevice(this); return SDL_SetError("Couldn't put device into play mode"); } @@ -270,28 +315,28 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) format; format = SDL_NextAudioFormat()) { switch (format) { case AUDIO_U8: - info.play.encoding = AUDIO_ENCODING_ULINEAR; - info.play.precision = 8; + prinfo->encoding = AUDIO_ENCODING_ULINEAR; + prinfo->precision = 8; break; case AUDIO_S8: - info.play.encoding = AUDIO_ENCODING_SLINEAR; - info.play.precision = 8; + prinfo->encoding = AUDIO_ENCODING_SLINEAR; + prinfo->precision = 8; break; case AUDIO_S16LSB: - info.play.encoding = AUDIO_ENCODING_SLINEAR_LE; - info.play.precision = 16; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE; + prinfo->precision = 16; break; case AUDIO_S16MSB: - info.play.encoding = AUDIO_ENCODING_SLINEAR_BE; - info.play.precision = 16; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE; + prinfo->precision = 16; break; case AUDIO_U16LSB: - info.play.encoding = AUDIO_ENCODING_ULINEAR_LE; - info.play.precision = 16; + prinfo->encoding = AUDIO_ENCODING_ULINEAR_LE; + prinfo->precision = 16; break; case AUDIO_U16MSB: - info.play.encoding = AUDIO_ENCODING_ULINEAR_BE; - info.play.precision = 16; + prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE; + prinfo->precision = 16; break; default: continue; @@ -303,61 +348,65 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (!format) { - BSDAUDIO_CloseDevice(this); return SDL_SetError("No supported encoding for 0x%x", this->spec.format); } this->spec.format = format; AUDIO_INITINFO(&info); - info.play.channels = this->spec.channels; + prinfo->channels = this->spec.channels; if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == -1) { this->spec.channels = 1; } AUDIO_INITINFO(&info); - info.play.sample_rate = this->spec.freq; + prinfo->sample_rate = this->spec.freq; info.blocksize = this->spec.size; info.hiwat = 5; info.lowat = 3; (void) ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info); (void) ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info); - this->spec.freq = info.play.sample_rate; - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - BSDAUDIO_CloseDevice(this); - return SDL_OutOfMemory(); + this->spec.freq = prinfo->sample_rate; + + if (!iscapture) { + /* Allocate mixing buffer */ + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - BSDAUDIO_Status(this); + NETBSDAUDIO_Status(this); /* We're ready to rock and roll. :-) */ return 0; } static int -BSDAUDIO_Init(SDL_AudioDriverImpl * impl) +NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ - impl->DetectDevices = BSDAUDIO_DetectDevices; - impl->OpenDevice = BSDAUDIO_OpenDevice; - impl->PlayDevice = BSDAUDIO_PlayDevice; - impl->WaitDevice = BSDAUDIO_WaitDevice; - impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf; - impl->CloseDevice = BSDAUDIO_CloseDevice; - + impl->DetectDevices = NETBSDAUDIO_DetectDevices; + impl->OpenDevice = NETBSDAUDIO_OpenDevice; + impl->PlayDevice = NETBSDAUDIO_PlayDevice; + impl->WaitDevice = NETBSDAUDIO_WaitDevice; + impl->GetDeviceBuf = NETBSDAUDIO_GetDeviceBuf; + impl->CloseDevice = NETBSDAUDIO_CloseDevice; + impl->CaptureFromDevice = NETBSDAUDIO_CaptureFromDevice; + impl->FlushCapture = NETBSDAUDIO_FlushCapture; + + impl->HasCaptureSupport = SDL_TRUE; impl->AllowsArbitraryDeviceNames = 1; return 1; /* this audio target is available. */ } -AudioBootStrap BSD_AUDIO_bootstrap = { - "bsd", "BSD audio", BSDAUDIO_Init, 0 +AudioBootStrap NETBSDAUDIO_bootstrap = { + "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0 }; -#endif /* SDL_AUDIO_DRIVER_BSD */ +#endif /* SDL_AUDIO_DRIVER_NETBSD */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.h b/3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.h index 7fe141b14e..1c46068ab5 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/bsd/SDL_bsdaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/netbsd/SDL_netbsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_bsdaudio_h -#define _SDL_bsdaudio_h +#ifndef SDL_netbsdaudio_h_ +#define SDL_netbsdaudio_h_ #include "../SDL_sysaudio.h" @@ -32,20 +32,17 @@ struct SDL_PrivateAudioData /* The file descriptor for the audio device */ int audio_fd; - /* The parent process id, to detect when application quits */ - pid_t parent; - /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_bsdaudio_h */ +#endif /* SDL_netbsdaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.c b/3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.c similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.c index 14c9701f46..1e8c124bba 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,11 +35,11 @@ #include "SDL_timer.h" #include "SDL_audio.h" #include "SDL_stdinc.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" +#include "../../core/unix/SDL_poll.h" #include "SDL_paudio.h" -#define DEBUG_AUDIO 0 +/* #define DEBUG_AUDIO */ /* A conflict within AIX 4.3.3 headers and probably others as well. * I guess nobody ever uses audio... Shame over AIX header files. */ @@ -138,44 +138,31 @@ PAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { + int timeoutMS; audio_buffer paud_bufinfo; - /* Use select() for audio synchronization */ - struct timeval timeout; - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) { #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't get audio buffer information\n"); #endif - timeout.tv_sec = 10; - timeout.tv_usec = 0; + timeoutMS = 10 * 1000; } else { - long ms_in_buf = paud_bufinfo.write_buf_time; - timeout.tv_sec = ms_in_buf / 1000; - ms_in_buf = ms_in_buf - timeout.tv_sec * 1000; - timeout.tv_usec = ms_in_buf * 1000; + timeoutMS = paud_bufinfo.write_buf_time; #ifdef DEBUG_AUDIO - fprintf(stderr, - "Waiting for write_buf_time=%ld,%ld\n", - timeout.tv_sec, timeout.tv_usec); + fprintf(stderr, "Waiting for write_buf_time=%d ms\n", timeoutMS); #endif } #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) - <= 0) { - const char *message = - "Audio timeout - buggy audio driver? (disabled)"; + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, timeoutMS) <= 0) { /* * In general we should never print to the screen, * but in this case we have no other way of letting * the user know what happened. */ - fprintf(stderr, "SDL: %s - %s\n", strerror(errno), message); + fprintf(stderr, "SDL: %s - Audio timeout - buggy audio driver? (disabled)\n", strerror(errno)); SDL_OpenedAudioDeviceDisconnected(this); /* Don't try to close - may hang */ this->hidden->audio_fd = -1; @@ -228,16 +215,11 @@ PAUDIO_GetDeviceBuf(_THIS) static void PAUDIO_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->audio_fd >= 0) { + close(this->hidden->audio_fd); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static int @@ -251,7 +233,6 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_AudioFormat test_format; audio_init paud_init; audio_buffer paud_bufinfo; - audio_status paud_status; audio_control paud_control; audio_change paud_change; int fd = -1; @@ -262,13 +243,12 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Open the audio device */ fd = OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); this->hidden->audio_fd = fd; if (fd < 0) { - PAUDIO_CloseDevice(this); return SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); } @@ -277,7 +257,6 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) * that we can have. */ if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) { - PAUDIO_CloseDevice(this); return SDL_SetError("Couldn't get audio buffer information"); } @@ -391,7 +370,6 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't find any hardware audio formats\n"); #endif - PAUDIO_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -449,15 +427,13 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (err != NULL) { - PAUDIO_CloseDevice(this); return SDL_SetError("Paudio: %s", err); } /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { - PAUDIO_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -492,14 +468,13 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) paud_control.ioctl_request = AUDIO_START; paud_control.position = 0; if (ioctl(fd, AUDIO_CONTROL, &paud_control) < 0) { - PAUDIO_CloseDevice(this); #ifdef DEBUG_AUDIO fprintf(stderr, "Can't start audio play\n"); #endif return SDL_SetError("Can't start audio play"); } - /* Check to see if we need to use select() workaround */ + /* Check to see if we need to use SDL_IOReady() workaround */ if (workaround != NULL) { this->hidden->frame_ticks = (float) (this->spec.samples * 1000) / this->spec.freq; @@ -522,11 +497,11 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) close(fd); /* Set the function pointers */ - impl->OpenDevice = DSP_OpenDevice; - impl->PlayDevice = DSP_PlayDevice; - impl->PlayDevice = DSP_WaitDevice; - impl->GetDeviceBuf = DSP_GetDeviceBuf; - impl->CloseDevice = DSP_CloseDevice; + impl->OpenDevice = PAUDIO_OpenDevice; + impl->PlayDevice = PAUDIO_PlayDevice; + impl->PlayDevice = PAUDIO_WaitDevice; + impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; + impl->CloseDevice = PAUDIO_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ return 1; /* this audio target is available. */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.h b/3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.h index ebc8bb5b1b..c295ae4530 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/paudio/SDL_paudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_paudaudio_h -#define _SDL_paudaudio_h +#ifndef SDL_paudio_h_ +#define SDL_paudio_h_ #include "../SDL_sysaudio.h" @@ -37,11 +37,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_paudaudio_h */ +#endif /* SDL_paudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.c b/3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.c similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.c index 18d2947e43..3e7b8e12fc 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,6 @@ #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_timer.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" #include "../SDL_sysaudio.h" @@ -40,10 +39,10 @@ #include /* The tag name used by PSP audio */ -#define PSPAUD_DRIVER_NAME "psp" +#define PSPAUDIO_DRIVER_NAME "psp" static int -PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int format, mixlen, i; this->hidden = (struct SDL_PrivateAudioData *) @@ -51,7 +50,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, sizeof(*this->hidden)); + SDL_zerop(this->hidden); switch (this->spec.format & 0xff) { case 8: case 16: @@ -66,20 +65,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->spec.freq = 44100; /* Update the fragment size as size in bytes. */ -/* SDL_CalculateAudioSpec(this->spec); MOD */ - switch (this->spec.format) { - case AUDIO_U8: - this->spec.silence = 0x80; - break; - default: - this->spec.silence = 0x00; - break; - } - this->spec.size = SDL_AUDIO_BITSIZE(this->spec.format) / 8; - this->spec.size *= this->spec.channels; - this->spec.size *= this->spec.samples; - -/* ========================================== */ + SDL_CalculateAudioSpec(&this->spec); /* Allocate the mixing buffer. Its size and starting address must be a multiple of 64 bytes. Our sample count is already a multiple of @@ -94,6 +80,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->spec.channels == 1) { format = PSP_AUDIO_FORMAT_MONO; } else { + this->spec.channels = 2; format = PSP_AUDIO_FORMAT_STEREO; } this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format); @@ -112,7 +99,7 @@ PSPAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return 0; } -static void PSPAUD_PlayDevice(_THIS) +static void PSPAUDIO_PlayDevice(_THIS) { Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer]; @@ -126,28 +113,25 @@ static void PSPAUD_PlayDevice(_THIS) } /* This function waits until it is possible to write a full sound buffer */ -static void PSPAUD_WaitDevice(_THIS) +static void PSPAUDIO_WaitDevice(_THIS) { /* Because we block when sending audio, there's no need for this function to do anything. */ } -static Uint8 *PSPAUD_GetDeviceBuf(_THIS) +static Uint8 *PSPAUDIO_GetDeviceBuf(_THIS) { return this->hidden->mixbufs[this->hidden->next_buffer]; } -static void PSPAUD_CloseDevice(_THIS) +static void PSPAUDIO_CloseDevice(_THIS) { if (this->hidden->channel >= 0) { sceAudioChRelease(this->hidden->channel); - this->hidden->channel = -1; - } - - if (this->hidden->rawbuf != NULL) { - free(this->hidden->rawbuf); - this->hidden->rawbuf = NULL; } + free(this->hidden->rawbuf); /* this uses memalign(), not SDL_malloc(). */ + SDL_free(this->hidden); } -static void PSPAUD_ThreadInit(_THIS) + +static void PSPAUDIO_ThreadInit(_THIS) { /* Increase the priority of this audio thread by 1 to put it ahead of other SDL threads. */ @@ -162,24 +146,22 @@ static void PSPAUD_ThreadInit(_THIS) static int -PSPAUD_Init(SDL_AudioDriverImpl * impl) +PSPAUDIO_Init(SDL_AudioDriverImpl * impl) { - /* Set the function pointers */ - impl->OpenDevice = PSPAUD_OpenDevice; - impl->PlayDevice = PSPAUD_PlayDevice; - impl->WaitDevice = PSPAUD_WaitDevice; - impl->GetDeviceBuf = PSPAUD_GetDeviceBuf; - impl->WaitDone = PSPAUD_WaitDevice; - impl->CloseDevice = PSPAUD_CloseDevice; - impl->ThreadInit = PSPAUD_ThreadInit; + impl->OpenDevice = PSPAUDIO_OpenDevice; + impl->PlayDevice = PSPAUDIO_PlayDevice; + impl->WaitDevice = PSPAUDIO_WaitDevice; + impl->GetDeviceBuf = PSPAUDIO_GetDeviceBuf; + impl->CloseDevice = PSPAUDIO_CloseDevice; + impl->ThreadInit = PSPAUDIO_ThreadInit; /* PSP audio device */ impl->OnlyHasDefaultOutputDevice = 1; /* impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultInputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; */ /* impl->DetectDevices = DSOUND_DetectDevices; @@ -188,8 +170,8 @@ PSPAUD_Init(SDL_AudioDriverImpl * impl) return 1; /* this audio target is available. */ } -AudioBootStrap PSPAUD_bootstrap = { - "psp", "PSP audio driver", PSPAUD_Init, 0 +AudioBootStrap PSPAUDIO_bootstrap = { + "psp", "PSP audio driver", PSPAUDIO_Init, 0 }; /* SDL_AUDI */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.h b/3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.h index 6b266bd0cc..3f0cdc1ea7 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/psp/SDL_pspaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspaudio_h -#define _SDL_pspaudio_h +#ifndef SDL_pspaudio_h_ +#define SDL_pspaudio_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData { int next_buffer; }; -#endif /* _SDL_pspaudio_h */ -/* vim: ts=4 sw=4 - */ +#endif /* SDL_pspaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.c b/3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.c similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.c index 6b11e066ff..053a1c34af 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,15 +37,14 @@ #endif #include #include -#include #include #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_pulseaudio.h" #include "SDL_loadso.h" +#include "../../thread/SDL_systhread.h" #if (PA_API_VERSION < 12) /** Return non-zero if the passed state is one of the connected states */ @@ -99,12 +98,19 @@ static pa_stream * (*PULSEAUDIO_pa_stream_new) (pa_context *, const char *, const pa_sample_spec *, const pa_channel_map *); static int (*PULSEAUDIO_pa_stream_connect_playback) (pa_stream *, const char *, const pa_buffer_attr *, pa_stream_flags_t, pa_cvolume *, pa_stream *); +static int (*PULSEAUDIO_pa_stream_connect_record) (pa_stream *, const char *, + const pa_buffer_attr *, pa_stream_flags_t); static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (pa_stream *); static size_t (*PULSEAUDIO_pa_stream_writable_size) (pa_stream *); +static size_t (*PULSEAUDIO_pa_stream_readable_size) (pa_stream *); static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t, pa_free_cb_t, int64_t, pa_seek_mode_t); static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *, pa_stream_success_cb_t, void *); +static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *); +static int (*PULSEAUDIO_pa_stream_drop) (pa_stream *); +static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *, + pa_stream_success_cb_t, void *); static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *); static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); @@ -205,11 +211,16 @@ load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_context_unref); SDL_PULSEAUDIO_SYM(pa_stream_new); SDL_PULSEAUDIO_SYM(pa_stream_connect_playback); + SDL_PULSEAUDIO_SYM(pa_stream_connect_record); SDL_PULSEAUDIO_SYM(pa_stream_get_state); SDL_PULSEAUDIO_SYM(pa_stream_writable_size); + SDL_PULSEAUDIO_SYM(pa_stream_readable_size); SDL_PULSEAUDIO_SYM(pa_stream_write); SDL_PULSEAUDIO_SYM(pa_stream_drain); SDL_PULSEAUDIO_SYM(pa_stream_disconnect); + SDL_PULSEAUDIO_SYM(pa_stream_peek); + SDL_PULSEAUDIO_SYM(pa_stream_drop); + SDL_PULSEAUDIO_SYM(pa_stream_flush); SDL_PULSEAUDIO_SYM(pa_stream_unref); SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto); SDL_PULSEAUDIO_SYM(pa_strerror); @@ -325,7 +336,7 @@ PULSEAUDIO_WaitDevice(_THIS) { struct SDL_PrivateAudioData *h = this->hidden; - while (this->enabled) { + while (SDL_AtomicGet(&this->enabled)) { if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { @@ -343,66 +354,127 @@ PULSEAUDIO_PlayDevice(_THIS) { /* Write the audio data */ struct SDL_PrivateAudioData *h = this->hidden; - if (this->enabled) { + if (SDL_AtomicGet(&this->enabled)) { if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf, h->mixlen, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { SDL_OpenedAudioDeviceDisconnected(this); } } } -static void -stream_drain_complete(pa_stream *s, int success, void *userdata) +static Uint8 * +PULSEAUDIO_GetDeviceBuf(_THIS) { - /* no-op for pa_stream_drain() to use for callback. */ + return (this->hidden->mixbuf); } -static void -PULSEAUDIO_WaitDone(_THIS) + +static int +PULSEAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) { - if (this->enabled) { - struct SDL_PrivateAudioData *h = this->hidden; - pa_operation *o = PULSEAUDIO_pa_stream_drain(h->stream, stream_drain_complete, NULL); - if (o) { - while (PULSEAUDIO_pa_operation_get_state(o) != PA_OPERATION_DONE) { - if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || - PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || - PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - PULSEAUDIO_pa_operation_cancel(o); - break; - } + struct SDL_PrivateAudioData *h = this->hidden; + const void *data = NULL; + size_t nbytes = 0; + + while (SDL_AtomicGet(&this->enabled)) { + if (h->capturebuf != NULL) { + const int cpy = SDL_min(buflen, h->capturelen); + SDL_memcpy(buffer, h->capturebuf, cpy); + /*printf("PULSEAUDIO: fed %d captured bytes\n", cpy);*/ + h->capturebuf += cpy; + h->capturelen -= cpy; + if (h->capturelen == 0) { + h->capturebuf = NULL; + PULSEAUDIO_pa_stream_drop(h->stream); /* done with this fragment. */ } - PULSEAUDIO_pa_operation_unref(o); + return cpy; /* new data, return it. */ + } + + if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || + PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || + PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + return -1; /* uhoh, pulse failed! */ + } + + if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { + continue; /* no data available yet. */ + } + + /* a new fragment is available! */ + PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); + SDL_assert(nbytes > 0); + if (data == NULL) { /* NULL==buffer had a hole. Ignore that. */ + PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ + } else { + /* store this fragment's data, start feeding it to SDL. */ + /*printf("PULSEAUDIO: captured %d new bytes\n", (int) nbytes);*/ + h->capturebuf = (const Uint8 *) data; + h->capturelen = nbytes; } } + + return -1; /* not enabled? */ } +static void +PULSEAUDIO_FlushCapture(_THIS) +{ + struct SDL_PrivateAudioData *h = this->hidden; + const void *data = NULL; + size_t nbytes = 0; + if (h->capturebuf != NULL) { + PULSEAUDIO_pa_stream_drop(h->stream); + h->capturebuf = NULL; + h->capturelen = 0; + } -static Uint8 * -PULSEAUDIO_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} + while (SDL_TRUE) { + if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || + PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || + PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + return; /* uhoh, pulse failed! */ + } + if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { + break; /* no data available, so we're done. */ + } + + /* a new fragment is available! Just dump it. */ + PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); + PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ + } +} static void PULSEAUDIO_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - SDL_free(this->hidden->device_name); - if (this->hidden->stream) { - PULSEAUDIO_pa_stream_disconnect(this->hidden->stream); - PULSEAUDIO_pa_stream_unref(this->hidden->stream); + if (this->hidden->stream) { + if (this->hidden->capturebuf != NULL) { + PULSEAUDIO_pa_stream_drop(this->hidden->stream); } - DisconnectFromPulseServer(this->hidden->mainloop, this->hidden->context); - SDL_free(this->hidden); - this->hidden = NULL; + PULSEAUDIO_pa_stream_disconnect(this->hidden->stream); + PULSEAUDIO_pa_stream_unref(this->hidden->stream); } + + DisconnectFromPulseServer(this->hidden->mainloop, this->hidden->context); + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden->device_name); + SDL_free(this->hidden); } static void -DeviceNameCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data) +SinkDeviceNameCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data) +{ + if (i) { + char **devname = (char **) data; + *devname = SDL_strdup(i->name); + } +} + +static void +SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int is_last, void *data) { if (i) { char **devname = (char **) data; @@ -411,7 +483,7 @@ DeviceNameCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data } static SDL_bool -FindDeviceName(struct SDL_PrivateAudioData *h, void *handle) +FindDeviceName(struct SDL_PrivateAudioData *h, const int iscapture, void *handle) { const uint32_t idx = ((uint32_t) ((size_t) handle)) - 1; @@ -419,7 +491,16 @@ FindDeviceName(struct SDL_PrivateAudioData *h, void *handle) return SDL_TRUE; } - WaitForPulseOperation(h->mainloop, PULSEAUDIO_pa_context_get_sink_info_by_index(h->context, idx, DeviceNameCallback, &h->device_name)); + if (iscapture) { + WaitForPulseOperation(h->mainloop, + PULSEAUDIO_pa_context_get_source_info_by_index(h->context, idx, + SourceDeviceNameCallback, &h->device_name)); + } else { + WaitForPulseOperation(h->mainloop, + PULSEAUDIO_pa_context_get_sink_info_by_index(h->context, idx, + SinkDeviceNameCallback, &h->device_name)); + } + return (h->device_name != NULL); } @@ -433,15 +514,15 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) pa_channel_map pacmap; pa_stream_flags_t flags = 0; int state = 0; + int rc = 0; /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) + h = this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - h = this->hidden; + SDL_zerop(this->hidden); paspec.format = PA_SAMPLE_INVALID; @@ -482,7 +563,6 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } } if (paspec.format == PA_SAMPLE_INVALID) { - PULSEAUDIO_CloseDevice(this); return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -494,13 +574,14 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_CalculateAudioSpec(&this->spec); /* Allocate mixing buffer */ - h->mixlen = this->spec.size; - h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen); - if (h->mixbuf == NULL) { - PULSEAUDIO_CloseDevice(this); - return SDL_OutOfMemory(); + if (!iscapture) { + h->mixlen = this->spec.size; + h->mixbuf = (Uint8 *) SDL_malloc(h->mixlen); + if (h->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + SDL_memset(h->mixbuf, this->spec.silence, this->spec.size); } - SDL_memset(h->mixbuf, this->spec.silence, this->spec.size); paspec.channels = this->spec.channels; paspec.rate = this->spec.freq; @@ -522,13 +603,11 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) #endif if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { - PULSEAUDIO_CloseDevice(this); return SDL_SetError("Could not connect to PulseAudio server"); } - if (!FindDeviceName(h, handle)) { - PULSEAUDIO_CloseDevice(this); - return SDL_SetError("Requested PulseAudio sink missing?"); + if (!FindDeviceName(h, iscapture, handle)) { + return SDL_SetError("Requested PulseAudio sink/source missing?"); } /* The SDL ALSA output hints us that we use Windows' channel mapping */ @@ -544,7 +623,6 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) ); if (h->stream == NULL) { - PULSEAUDIO_CloseDevice(this); return SDL_SetError("Could not set up PulseAudio stream"); } @@ -554,20 +632,22 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) flags |= PA_STREAM_DONT_MOVE; } - if (PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, - NULL, NULL) < 0) { - PULSEAUDIO_CloseDevice(this); + if (iscapture) { + rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags); + } else { + rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL); + } + + if (rc < 0) { return SDL_SetError("Could not connect PulseAudio stream"); } do { if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - PULSEAUDIO_CloseDevice(this); return SDL_SetError("pa_mainloop_iterate() failed"); } state = PULSEAUDIO_pa_stream_get_state(h->stream); if (!PA_STREAM_IS_GOOD(state)) { - PULSEAUDIO_CloseDevice(this); return SDL_SetError("Could not connect PulseAudio stream"); } } while (state != PA_STREAM_READY); @@ -646,7 +726,7 @@ PULSEAUDIO_DetectDevices() WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_source_info_list(hotplug_context, SourceInfoCallback, NULL)); /* ok, we have a sane list, let's set up hotplug notifications now... */ - hotplug_thread = SDL_CreateThread(HotplugThread, "PulseHotplug", NULL); + hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, NULL); } static void @@ -684,8 +764,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) impl->WaitDevice = PULSEAUDIO_WaitDevice; impl->GetDeviceBuf = PULSEAUDIO_GetDeviceBuf; impl->CloseDevice = PULSEAUDIO_CloseDevice; - impl->WaitDone = PULSEAUDIO_WaitDone; impl->Deinitialize = PULSEAUDIO_Deinitialize; + impl->CaptureFromDevice = PULSEAUDIO_CaptureFromDevice; + impl->FlushCapture = PULSEAUDIO_FlushCapture; + + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.h b/3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.h index c57ab71329..61da70be42 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_pulseaudio_h -#define _SDL_pulseaudio_h +#ifndef SDL_pulseaudio_h_ +#define SDL_pulseaudio_h_ #include @@ -42,8 +42,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + const Uint8 *capturebuf; + int capturelen; }; -#endif /* _SDL_pulseaudio_h */ +#endif /* SDL_pulseaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.c b/3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.c similarity index 76% rename from 3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.c rename to 3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.c index 1899ca6d94..957ac2d4eb 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "SDL_qsa_audio.h" @@ -57,24 +57,6 @@ #define DEFAULT_CPARAMS_FRAGS_MIN 1 #define DEFAULT_CPARAMS_FRAGS_MAX 1 -#define QSA_NO_WORKAROUNDS 0x00000000 -#define QSA_MMAP_WORKAROUND 0x00000001 - -struct BuggyCards -{ - char *cardname; - unsigned long bugtype; -}; - -#define QSA_WA_CARDS 3 -#define QSA_MAX_CARD_NAME_LENGTH 33 - -struct BuggyCards buggycards[QSA_WA_CARDS] = { - {"Sound Blaster Live!", QSA_MMAP_WORKAROUND}, - {"Vortex 8820", QSA_MMAP_WORKAROUND}, - {"Vortex 8830", QSA_MMAP_WORKAROUND}, -}; - /* List of found devices */ #define QSA_MAX_DEVICES 32 #define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */ @@ -98,48 +80,23 @@ QSA_SetError(const char *fn, int status) return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); } -/* card names check to apply the workarounds */ -static int -QSA_CheckBuggyCards(_THIS, unsigned long checkfor) -{ - char scardname[QSA_MAX_CARD_NAME_LENGTH]; - int it; - - if (snd_card_get_name - (this->hidden->cardno, scardname, QSA_MAX_CARD_NAME_LENGTH - 1) < 0) { - return 0; - } - - for (it = 0; it < QSA_WA_CARDS; it++) { - if (SDL_strcmp(buggycards[it].cardname, scardname) == 0) { - if (buggycards[it].bugtype == checkfor) { - return 1; - } - } - } - - return 0; -} - /* !!! FIXME: does this need to be here? Does the SDL version not work? */ static void QSA_ThreadInit(_THIS) { - struct sched_param param; - int status; - /* Increase default 10 priority to 25 to avoid jerky sound */ - status = SchedGet(0, 0, ¶m); - param.sched_priority = param.sched_curpriority + 15; - status = SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + struct sched_param param; + if (SchedGet(0, 0, ¶m) != -1) { + param.sched_priority = param.sched_curpriority + 15; + SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + } } /* PCM channel parameters initialize function */ static void QSA_InitAudioParams(snd_pcm_channel_params_t * cpars) { - SDL_memset(cpars, 0, sizeof(snd_pcm_channel_params_t)); - + SDL_zerop(cpars); cpars->channel = SND_PCM_CHANNEL_PLAYBACK; cpars->mode = SND_PCM_MODE_BLOCK; cpars->start_mode = SND_PCM_START_DATA; @@ -157,67 +114,25 @@ QSA_InitAudioParams(snd_pcm_channel_params_t * cpars) static void QSA_WaitDevice(_THIS) { - fd_set wfds; - fd_set rfds; - int selectret; - struct timeval timeout; - - if (!this->hidden->iscapture) { - FD_ZERO(&wfds); - FD_SET(this->hidden->audio_fd, &wfds); - } else { - FD_ZERO(&rfds); - FD_SET(this->hidden->audio_fd, &rfds); - } - - do { - /* Setup timeout for playing one fragment equal to 2 seconds */ - /* If timeout occured than something wrong with hardware or driver */ - /* For example, Vortex 8820 audio driver stucks on second DAC because */ - /* it doesn't exist ! */ - timeout.tv_sec = 2; - timeout.tv_usec = 0; + int result; + + /* Setup timeout for playing one fragment equal to 2 seconds */ + /* If timeout occured than something wrong with hardware or driver */ + /* For example, Vortex 8820 audio driver stucks on second DAC because */ + /* it doesn't exist ! */ + result = SDL_IOReady(this->hidden->audio_fd, !this->hidden->iscapture, 2 * 1000); + switch (result) { + case -1: + SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno)); + break; + case 0: + SDL_SetError("QSA: timeout on buffer waiting occured"); + this->hidden->timeout_on_wait = 1; + break; + default: this->hidden->timeout_on_wait = 0; - - if (!this->hidden->iscapture) { - selectret = - select(this->hidden->audio_fd + 1, NULL, &wfds, NULL, - &timeout); - } else { - selectret = - select(this->hidden->audio_fd + 1, &rfds, NULL, NULL, - &timeout); - } - - switch (selectret) { - case -1: - { - SDL_SetError("QSA: select() failed: %s", strerror(errno)); - return; - } - break; - case 0: - { - SDL_SetError("QSA: timeout on buffer waiting occured"); - this->hidden->timeout_on_wait = 1; - return; - } - break; - default: - { - if (!this->hidden->iscapture) { - if (FD_ISSET(this->hidden->audio_fd, &wfds)) { - return; - } - } else { - if (FD_ISSET(this->hidden->audio_fd, &rfds)) { - return; - } - } - } - break; - } - } while (1); + break; + } } static void @@ -229,7 +144,7 @@ QSA_PlayDevice(_THIS) int towrite; void *pcmbuffer; - if ((!this->enabled) || (!this->hidden)) { + if (!SDL_AtomicGet(&this->enabled) || !this->hidden) { return; } @@ -262,7 +177,7 @@ QSA_PlayDevice(_THIS) continue; } else { if ((errno == EINVAL) || (errno == EIO)) { - SDL_memset(&cstatus, 0, sizeof(cstatus)); + SDL_zero(cstatus); if (!this->hidden->iscapture) { cstatus.channel = SND_PCM_CHANNEL_PLAYBACK; } else { @@ -305,7 +220,7 @@ QSA_PlayDevice(_THIS) towrite -= written; pcmbuffer += written * this->spec.channels; } - } while ((towrite > 0) && (this->enabled)); + } while ((towrite > 0) && SDL_AtomicGet(&this->enabled)); /* If we couldn't write, assume fatal error for now */ if (towrite != 0) { @@ -322,27 +237,21 @@ QSA_GetDeviceBuf(_THIS) static void QSA_CloseDevice(_THIS) { - if (this->hidden != NULL) { - if (this->hidden->audio_handle != NULL) { - if (!this->hidden->iscapture) { - /* Finish playing available samples */ - snd_pcm_plugin_flush(this->hidden->audio_handle, - SND_PCM_CHANNEL_PLAYBACK); - } else { - /* Cancel unread samples during capture */ - snd_pcm_plugin_flush(this->hidden->audio_handle, - SND_PCM_CHANNEL_CAPTURE); - } - snd_pcm_close(this->hidden->audio_handle); - this->hidden->audio_handle = NULL; + if (this->hidden->audio_handle != NULL) { + if (!this->hidden->iscapture) { + /* Finish playing available samples */ + snd_pcm_plugin_flush(this->hidden->audio_handle, + SND_PCM_CHANNEL_PLAYBACK); + } else { + /* Cancel unread samples during capture */ + snd_pcm_plugin_flush(this->hidden->audio_handle, + SND_PCM_CHANNEL_CAPTURE); } - - SDL_FreeAudioMem(this->hidden->pcm_buf); - this->hidden->pcm_buf = NULL; - - SDL_free(this->hidden); - this->hidden = NULL; + snd_pcm_close(this->hidden->audio_handle); } + + SDL_free(this->hidden->pcm_buf); + SDL_free(this->hidden); } static int @@ -365,13 +274,12 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData)); /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); /* Initialize channel direction: capture or playback */ - this->hidden->iscapture = iscapture; + this->hidden->iscapture = iscapture ? SDL_TRUE : SDL_FALSE; if (device != NULL) { /* Open requested audio device */ @@ -379,33 +287,21 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->cardno = device->cardno; status = snd_pcm_open(&this->hidden->audio_handle, device->cardno, device->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } else { /* Open system default audio device */ status = snd_pcm_open_preferred(&this->hidden->audio_handle, &this->hidden->cardno, &this->hidden->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } /* Check if requested device is opened */ if (status < 0) { this->hidden->audio_handle = NULL; - QSA_CloseDevice(this); return QSA_SetError("snd_pcm_open", status); } - if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) { - /* Disable QSA MMAP plugin for buggy audio drivers */ - status = - snd_pcm_plugin_set_disable(this->hidden->audio_handle, - PLUGIN_DISABLE_MMAP); - if (status < 0) { - QSA_CloseDevice(this); - return QSA_SetError("snd_pcm_plugin_set_disable", status); - } - } - /* Try for a closest match on audio format */ format = 0; /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ @@ -487,7 +383,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* assumes test_format not 0 on success */ if (test_format == 0) { - QSA_CloseDevice(this); return SDL_SetError("QSA: Couldn't find any hardware audio formats"); } @@ -505,12 +400,11 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Setup the transfer parameters according to cparams */ status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams); if (status < 0) { - QSA_CloseDevice(this); - return QSA_SetError("snd_pcm_channel_params", status); + return QSA_SetError("snd_pcm_plugin_params", status); } /* Make sure channel is setup right one last time */ - SDL_memset(&csetup, 0, sizeof(csetup)); + SDL_zero(csetup); if (!this->hidden->iscapture) { csetup.channel = SND_PCM_CHANNEL_PLAYBACK; } else { @@ -519,7 +413,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Setup an audio channel */ if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) { - QSA_CloseDevice(this); return SDL_SetError("QSA: Unable to setup channel"); } @@ -540,9 +433,8 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) * closest multiple) */ this->hidden->pcm_buf = - (Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len); + (Uint8 *) SDL_malloc(this->hidden->pcm_len); if (this->hidden->pcm_buf == NULL) { - QSA_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->pcm_buf, this->spec.silence, @@ -560,7 +452,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (this->hidden->audio_fd < 0) { - QSA_CloseDevice(this); return QSA_SetError("snd_pcm_file_descriptor", status); } @@ -578,7 +469,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (status < 0) { - QSA_CloseDevice(this); return QSA_SetError("snd_pcm_plugin_prepare", status); } @@ -724,32 +614,13 @@ QSA_DetectDevices(void) } } -static void -QSA_WaitDone(_THIS) -{ - if (!this->hidden->iscapture) { - if (this->hidden->audio_handle != NULL) { - /* Wait till last fragment is played and stop channel */ - snd_pcm_plugin_flush(this->hidden->audio_handle, - SND_PCM_CHANNEL_PLAYBACK); - } - } else { - if (this->hidden->audio_handle != NULL) { - /* Discard all unread data and stop channel */ - snd_pcm_plugin_flush(this->hidden->audio_handle, - SND_PCM_CHANNEL_CAPTURE); - } - } -} - static void QSA_Deinitialize(void) { /* Clear devices array on shutdown */ - SDL_memset(qsa_playback_device, 0x00, - sizeof(QSA_Device) * QSA_MAX_DEVICES); - SDL_memset(qsa_capture_device, 0x00, - sizeof(QSA_Device) * QSA_MAX_DEVICES); + /* !!! FIXME: we zero these on init...any reason to do it here? */ + SDL_zero(qsa_playback_device); + SDL_zero(qsa_capture_device); qsa_playback_devices = 0; qsa_capture_devices = 0; } @@ -757,14 +628,9 @@ QSA_Deinitialize(void) static int QSA_Init(SDL_AudioDriverImpl * impl) { - snd_pcm_t *handle = NULL; - int32_t status = 0; - /* Clear devices array */ - SDL_memset(qsa_playback_device, 0x00, - sizeof(QSA_Device) * QSA_MAX_DEVICES); - SDL_memset(qsa_capture_device, 0x00, - sizeof(QSA_Device) * QSA_MAX_DEVICES); + SDL_zero(qsa_playback_device); + SDL_zero(qsa_capture_device); qsa_playback_devices = 0; qsa_capture_devices = 0; @@ -778,24 +644,15 @@ QSA_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = QSA_PlayDevice; impl->GetDeviceBuf = QSA_GetDeviceBuf; impl->CloseDevice = QSA_CloseDevice; - impl->WaitDone = QSA_WaitDone; impl->Deinitialize = QSA_Deinitialize; impl->LockDevice = NULL; impl->UnlockDevice = NULL; - impl->OnlyHasDefaultOutputDevice = 0; impl->ProvidesOwnCallbackThread = 0; impl->SkipMixerLock = 0; impl->HasCaptureSupport = 1; impl->OnlyHasDefaultOutputDevice = 0; - impl->OnlyHasDefaultInputDevice = 0; - - /* Check if io-audio manager is running or not */ - status = snd_cards(); - if (status == 0) { - /* if no, return immediately */ - return 1; - } + impl->OnlyHasDefaultCaptureDevice = 0; return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.h b/3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.h rename to 3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.h index 53d37e96fd..a6300c1a9f 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/qsa/SDL_qsa_audio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ struct SDL_PrivateAudioData { /* SDL capture state */ - int iscapture; + SDL_bool iscapture; /* The audio device handle */ int cardno; diff --git a/3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.c b/3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.c similarity index 76% rename from 3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.c index 64565ae886..4a49171849 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,10 +33,10 @@ #include #endif +#include #include #include "SDL_audio.h" -#include "../SDL_audiomem.h" #include "../SDL_audio_c.h" #include "SDL_sndioaudio.h" @@ -44,6 +44,14 @@ #include "SDL_loadso.h" #endif +#ifndef INFTIM +#define INFTIM -1 +#endif + +#ifndef SIO_DEVANY +#define SIO_DEVANY "default" +#endif + static struct sio_hdl * (*SNDIO_sio_open)(const char *, unsigned int, int); static void (*SNDIO_sio_close)(struct sio_hdl *); static int (*SNDIO_sio_setpar)(struct sio_hdl *, struct sio_par *); @@ -52,6 +60,10 @@ static int (*SNDIO_sio_start)(struct sio_hdl *); static int (*SNDIO_sio_stop)(struct sio_hdl *); static size_t (*SNDIO_sio_read)(struct sio_hdl *, void *, size_t); static size_t (*SNDIO_sio_write)(struct sio_hdl *, const void *, size_t); +static int (*SNDIO_sio_nfds)(struct sio_hdl *); +static int (*SNDIO_sio_pollfd)(struct sio_hdl *, struct pollfd *, int); +static int (*SNDIO_sio_revents)(struct sio_hdl *, struct pollfd *); +static int (*SNDIO_sio_eof)(struct sio_hdl *); static void (*SNDIO_sio_initpar)(struct sio_par *); #ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @@ -88,6 +100,10 @@ load_sndio_syms(void) SDL_SNDIO_SYM(sio_stop); SDL_SNDIO_SYM(sio_read); SDL_SNDIO_SYM(sio_write); + SDL_SNDIO_SYM(sio_nfds); + SDL_SNDIO_SYM(sio_pollfd); + SDL_SNDIO_SYM(sio_revents); + SDL_SNDIO_SYM(sio_eof); SDL_SNDIO_SYM(sio_initpar); return 0; } @@ -165,31 +181,59 @@ SNDIO_PlayDevice(_THIS) #endif } -static Uint8 * -SNDIO_GetDeviceBuf(_THIS) +static int +SNDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) { - return this->hidden->mixbuf; + size_t r; + int revents; + int nfds; + + /* Emulate a blocking read */ + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + while (r == 0 && !SNDIO_sio_eof(this->hidden->dev)) { + if ((nfds = SNDIO_sio_pollfd(this->hidden->dev, this->hidden->pfd, POLLIN)) <= 0 + || poll(this->hidden->pfd, nfds, INFTIM) < 0) { + return -1; + } + revents = SNDIO_sio_revents(this->hidden->dev, this->hidden->pfd); + if (revents & POLLIN) { + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + } + if (revents & POLLHUP) { + break; + } + } + return (int) r; } static void -SNDIO_WaitDone(_THIS) +SNDIO_FlushCapture(_THIS) +{ + char buf[512]; + + while (SNDIO_sio_read(this->hidden->dev, buf, sizeof(buf)) != 0) { + /* do nothing */; + } +} + +static Uint8 * +SNDIO_GetDeviceBuf(_THIS) { - SNDIO_sio_stop(this->hidden->dev); + return this->hidden->mixbuf; } static void SNDIO_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - if ( this->hidden->dev != NULL ) { - SNDIO_sio_close(this->hidden->dev); - this->hidden->dev = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; + if ( this->hidden->pfd != NULL ) { + SDL_free(this->hidden->pfd); + } + if ( this->hidden->dev != NULL ) { + SNDIO_sio_stop(this->hidden->dev); + SNDIO_sio_close(this->hidden->dev); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static int @@ -204,16 +248,23 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, sizeof(*this->hidden)); + SDL_zerop(this->hidden); this->hidden->mixlen = this->spec.size; - /* !!! FIXME: SIO_DEVANY can be a specific device... */ - if ((this->hidden->dev = SNDIO_sio_open(SIO_DEVANY, SIO_PLAY, 0)) == NULL) { - SNDIO_CloseDevice(this); + /* Capture devices must be non-blocking for SNDIO_FlushCapture */ + if ((this->hidden->dev = + SNDIO_sio_open(devname != NULL ? devname : SIO_DEVANY, + iscapture ? SIO_REC : SIO_PLAY, iscapture)) == NULL) { return SDL_SetError("sio_open() failed"); } + /* Allocate the pollfd array for capture devices */ + if (iscapture && (this->hidden->pfd = + SDL_malloc(sizeof(struct pollfd) * SNDIO_sio_nfds(this->hidden->dev))) == NULL) { + return SDL_OutOfMemory(); + } + SNDIO_sio_initpar(&par); par.rate = this->spec.freq; @@ -233,7 +284,6 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) continue; } if (SNDIO_sio_getpar(this->hidden->dev, &par) == 0) { - SNDIO_CloseDevice(this); return SDL_SetError("sio_getpar() failed"); } if (par.bps != SIO_BPS(par.bits)) { @@ -248,7 +298,6 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (status < 0) { - SNDIO_CloseDevice(this); return SDL_SetError("sndio: Couldn't find any hardware audio formats"); } @@ -269,7 +318,6 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) else if ((par.bps == 1) && (!par.sig)) this->spec.format = AUDIO_U8; else { - SNDIO_CloseDevice(this); return SDL_SetError("sndio: Got unsupported hardware audio format."); } @@ -282,9 +330,8 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { - SNDIO_CloseDevice(this); return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); @@ -315,10 +362,13 @@ SNDIO_Init(SDL_AudioDriverImpl * impl) impl->WaitDevice = SNDIO_WaitDevice; impl->PlayDevice = SNDIO_PlayDevice; impl->GetDeviceBuf = SNDIO_GetDeviceBuf; - impl->WaitDone = SNDIO_WaitDone; impl->CloseDevice = SNDIO_CloseDevice; + impl->CaptureFromDevice = SNDIO_CaptureFromDevice; + impl->FlushCapture = SNDIO_FlushCapture; impl->Deinitialize = SNDIO_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: sndio can handle multiple devices. */ + + impl->AllowsArbitraryDeviceNames = 1; + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.h b/3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.h index 1e748ac93f..144bbc22b2 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/sndio/SDL_sndioaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,10 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sndioaudio_h -#define _SDL_sndioaudio_h +#ifndef SDL_sndioaudio_h_ +#define SDL_sndioaudio_h_ +#include #include #include "../SDL_sysaudio.h" @@ -38,8 +39,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* Polling structures for non-blocking sndio devices */ + struct pollfd *pfd; }; -#endif /* _SDL_sndioaudio_h */ +#endif /* SDL_sndioaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.c b/3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.c rename to 3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.c index 71029d21fe..ddf94b3a3c 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.c +++ b/3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" -#include "../SDL_audiomem.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" #include "SDL_sunaudio.h" @@ -98,11 +98,7 @@ SUNAUDIO_WaitDevice(_THIS) } } #else - fd_set fdset; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, NULL); + SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, -1); #endif } @@ -183,23 +179,21 @@ SUNAUDIO_GetDeviceBuf(_THIS) static void SUNAUDIO_CloseDevice(_THIS) { - if (this->hidden != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; - SDL_free(this->hidden->ulaw_buf); - this->hidden->ulaw_buf = NULL; - if (this->hidden->audio_fd >= 0) { - close(this->hidden->audio_fd); - this->hidden->audio_fd = -1; - } - SDL_free(this->hidden); - this->hidden = NULL; + SDL_free(this->hidden->ulaw_buf); + if (this->hidden->audio_fd >= 0) { + close(this->hidden->audio_fd); } + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static int SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { +#ifdef AUDIO_SETINFO + int enc; +#endif + int desired_freq = 0; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; audio_info_t info; @@ -219,7 +213,7 @@ SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Open the audio device */ this->hidden->audio_fd = open(devname, flags, 0); @@ -227,10 +221,7 @@ SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } -#ifdef AUDIO_SETINFO - int enc; -#endif - int desired_freq = this->spec.freq; + desired_freq = this->spec.freq; /* Determine the audio parameters from the AudioSpec */ switch (SDL_AUDIO_BITSIZE(this->spec.format)) { @@ -340,7 +331,7 @@ SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_CalculateAudioSpec(&this->spec); /* Allocate mixing buffer */ - this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size); + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); if (this->hidden->mixbuf == NULL) { return SDL_OutOfMemory(); } diff --git a/3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.h b/3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.h rename to 3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.h index ecced0f510..2b7d57bde4 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/sun/SDL_sunaudio.h +++ b/3rdparty/sdl2-2.0.9/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sunaudio_h -#define _SDL_sunaudio_h +#ifndef SDL_sunaudio_h_ +#define SDL_sunaudio_h_ #include "../SDL_sysaudio.h" @@ -42,6 +42,6 @@ struct SDL_PrivateAudioData int frequency; /* The audio frequency in KHz */ }; -#endif /* _SDL_sunaudio_h */ +#endif /* SDL_sunaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.c b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.c new file mode 100644 index 0000000000..f517539657 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.c @@ -0,0 +1,785 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_WASAPI + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +/* This constant isn't available on MinGW-w64 */ +#ifndef AUDCLNT_STREAMFLAGS_RATEADJUST +#define AUDCLNT_STREAMFLAGS_RATEADJUST 0x00100000 +#endif + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ +typedef struct DevIdList +{ + WCHAR *str; + struct DevIdList *next; +} DevIdList; + +static DevIdList *deviceid_list = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,{ 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } }; +static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + +static SDL_bool +WStrEqual(const WCHAR *a, const WCHAR *b) +{ + while (*a) { + if (*a != *b) { + return SDL_FALSE; + } + a++; + b++; + } + return *b == 0; +} + +static size_t +WStrLen(const WCHAR *wstr) +{ + size_t retval = 0; + if (wstr) { + while (*(wstr++)) { + retval++; + } + } + return retval; +} + +static WCHAR * +WStrDupe(const WCHAR *wstr) +{ + const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR); + WCHAR *retval = (WCHAR *) SDL_malloc(len); + if (retval) { + SDL_memcpy(retval, wstr, len); + } + return retval; +} + + +void +WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid) +{ + DevIdList *i; + DevIdList *next; + DevIdList *prev = NULL; + for (i = deviceid_list; i; i = next) { + next = i->next; + if (WStrEqual(i->str, devid)) { + if (prev) { + prev->next = next; + } else { + deviceid_list = next; + } + SDL_RemoveAudioDevice(iscapture, i->str); + SDL_free(i->str); + SDL_free(i); + } + prev = i; + } +} + +void +WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid) +{ + DevIdList *devidlist; + + /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). + In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for + phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be + available and switch automatically. (!!! FIXME...?) */ + + /* see if we already have this one. */ + for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { + if (WStrEqual(devidlist->str, devid)) { + return; /* we already have this. */ + } + } + + devidlist = (DevIdList *) SDL_malloc(sizeof (*devidlist)); + if (!devidlist) { + return; /* oh well. */ + } + + devid = WStrDupe(devid); + if (!devid) { + SDL_free(devidlist); + return; /* oh well. */ + } + + devidlist->str = (WCHAR *) devid; + devidlist->next = deviceid_list; + deviceid_list = devidlist; + + SDL_AddAudioDevice(iscapture, devname, (void *) devid); +} + +static void +WASAPI_DetectDevices(void) +{ + WASAPI_EnumerateEndpoints(); +} + +static int +WASAPI_GetPendingBytes(_THIS) +{ + UINT32 frames = 0; + + /* it's okay to fail here; we'll deal with failures in the audio thread. */ + /* FIXME: need a lock around checking this->hidden->client */ + if (this->hidden->client != NULL) { /* definitely activated? */ + if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { + return 0; /* oh well. */ + } + } + return ((int) frames) * this->hidden->framesize; +} + +static SDL_INLINE SDL_bool +WasapiFailed(_THIS, const HRESULT err) +{ + if (err == S_OK) { + return SDL_FALSE; + } + + if (err == AUDCLNT_E_DEVICE_INVALIDATED) { + this->hidden->device_lost = SDL_TRUE; + } else if (SDL_AtomicGet(&this->enabled)) { + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + SDL_assert(!SDL_AtomicGet(&this->enabled)); + } + + return SDL_TRUE; +} + +static int +UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) +{ + /* Since WASAPI requires us to handle all audio conversion, and our + device format might have changed, we might have to add/remove/change + the audio stream that the higher level uses to convert data, so + SDL keeps firing the callback as if nothing happened here. */ + + if ( (this->callbackspec.channels == this->spec.channels) && + (this->callbackspec.format == this->spec.format) && + (this->callbackspec.freq == this->spec.freq) && + (this->callbackspec.samples == this->spec.samples) ) { + /* no need to buffer/convert in an AudioStream! */ + SDL_FreeAudioStream(this->stream); + this->stream = NULL; + } else if ( (oldspec->channels == this->spec.channels) && + (oldspec->format == this->spec.format) && + (oldspec->freq == this->spec.freq) ) { + /* The existing audio stream is okay to keep using. */ + } else { + /* replace the audiostream for new format */ + SDL_FreeAudioStream(this->stream); + if (this->iscapture) { + this->stream = SDL_NewAudioStream(this->spec.format, + this->spec.channels, this->spec.freq, + this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq); + } else { + this->stream = SDL_NewAudioStream(this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq, this->spec.format, + this->spec.channels, this->spec.freq); + } + + if (!this->stream) { + return -1; + } + } + + /* make sure our scratch buffer can cover the new device spec. */ + if (this->spec.size > this->work_buffer_len) { + Uint8 *ptr = (Uint8 *) SDL_realloc(this->work_buffer, this->spec.size); + if (ptr == NULL) { + return SDL_OutOfMemory(); + } + this->work_buffer = ptr; + this->work_buffer_len = this->spec.size; + } + + return 0; +} + + +static void ReleaseWasapiDevice(_THIS); + +static SDL_bool +RecoverWasapiDevice(_THIS) +{ + ReleaseWasapiDevice(this); /* dump the lost device's handles. */ + + if (this->hidden->default_device_generation) { + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } + + /* this can fail for lots of reasons, but the most likely is we had a + non-default device that was disconnected, so we can't recover. Default + devices try to reinitialize whatever the new default is, so it's more + likely to carry on here, but this handles a non-default device that + simply had its format changed in the Windows Control Panel. */ + if (WASAPI_ActivateDevice(this, SDL_TRUE) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + return SDL_FALSE; + } + + this->hidden->device_lost = SDL_FALSE; + + return SDL_TRUE; /* okay, carry on with new device details! */ +} + +static SDL_bool +RecoverWasapiIfLost(_THIS) +{ + const int generation = this->hidden->default_device_generation; + SDL_bool lost = this->hidden->device_lost; + + if (!SDL_AtomicGet(&this->enabled)) { + return SDL_FALSE; /* already failed. */ + } + + if (!this->hidden->client) { + return SDL_TRUE; /* still waiting for activation. */ + } + + if (!lost && (generation > 0)) { /* is a default device? */ + const int newgen = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + if (generation != newgen) { /* the desired default device was changed, jump over to it. */ + lost = SDL_TRUE; + } + } + + return lost ? RecoverWasapiDevice(this) : SDL_TRUE; +} + +static Uint8 * +WASAPI_GetDeviceBuf(_THIS) +{ + /* get an endpoint buffer from WASAPI. */ + BYTE *buffer = NULL; + + while (RecoverWasapiIfLost(this) && this->hidden->render) { + if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) { + return (Uint8 *) buffer; + } + SDL_assert(buffer == NULL); + } + + return (Uint8 *) buffer; +} + +static void +WASAPI_PlayDevice(_THIS) +{ + if (this->hidden->render != NULL) { /* definitely activated? */ + /* WasapiFailed() will mark the device for reacquisition or removal elsewhere. */ + WasapiFailed(this, IAudioRenderClient_ReleaseBuffer(this->hidden->render, this->spec.samples, 0)); + } +} + +static void +WASAPI_WaitDevice(_THIS) +{ + while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) { + /*SDL_Log("WAITDEVICE");*/ + if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) { + const UINT32 maxpadding = this->spec.samples; + UINT32 padding = 0; + if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) { + /*SDL_Log("WASAPI EVENT! padding=%u maxpadding=%u", (unsigned int)padding, (unsigned int)maxpadding);*/ + if (padding <= maxpadding) { + break; + } + } + } else { + /*SDL_Log("WASAPI FAILED EVENT!");*/ + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static int +WASAPI_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_AudioStream *stream = this->hidden->capturestream; + const int avail = SDL_AudioStreamAvailable(stream); + if (avail > 0) { + const int cpy = SDL_min(buflen, avail); + SDL_AudioStreamGet(stream, buffer, cpy); + return cpy; + } + + while (RecoverWasapiIfLost(this)) { + HRESULT ret; + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + /* uhoh, client isn't activated yet, just return silence. */ + if (!this->hidden->capture) { + /* Delay so we run at about the speed that audio would be arriving. */ + SDL_Delay(((this->spec.samples * 1000) / this->spec.freq)); + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; + } + + ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret != AUDCLNT_S_BUFFER_EMPTY) { + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + } + + if ((ret == AUDCLNT_S_BUFFER_EMPTY) || !frames) { + WASAPI_WaitDevice(this); + } else if (ret == S_OK) { + const int total = ((int) frames) * this->hidden->framesize; + const int cpy = SDL_min(buflen, total); + const int leftover = total - cpy; + const SDL_bool silent = (flags & AUDCLNT_BUFFERFLAGS_SILENT) ? SDL_TRUE : SDL_FALSE; + + if (silent) { + SDL_memset(buffer, this->spec.silence, cpy); + } else { + SDL_memcpy(buffer, ptr, cpy); + } + + if (leftover > 0) { + ptr += cpy; + if (silent) { + SDL_memset(ptr, this->spec.silence, leftover); /* I guess this is safe? */ + } + + if (SDL_AudioStreamPut(stream, ptr, leftover) == -1) { + return -1; /* uhoh, out of memory, etc. Kill device. :( */ + } + } + + ret = IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames); + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + + return cpy; + } + } + + return -1; /* unrecoverable error. */ +} + +static void +WASAPI_FlushCapture(_THIS) +{ + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + if (!this->hidden->capture) { + return; /* not activated yet? */ + } + + /* just read until we stop getting packets, throwing them away. */ + while (SDL_TRUE) { + const HRESULT ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret == AUDCLNT_S_BUFFER_EMPTY) { + break; /* no more buffered data; we're done. */ + } else if (WasapiFailed(this, ret)) { + break; /* failed for some other reason, abort. */ + } else if (WasapiFailed(this, IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames))) { + break; /* something broke. */ + } + } + SDL_AudioStreamClear(this->hidden->capturestream); +} + +static void +ReleaseWasapiDevice(_THIS) +{ + if (this->hidden->client) { + IAudioClient_Stop(this->hidden->client); + IAudioClient_SetEventHandle(this->hidden->client, NULL); + IAudioClient_Release(this->hidden->client); + this->hidden->client = NULL; + } + + if (this->hidden->render) { + IAudioRenderClient_Release(this->hidden->render); + this->hidden->render = NULL; + } + + if (this->hidden->capture) { + IAudioCaptureClient_Release(this->hidden->capture); + this->hidden->capture = NULL; + } + + if (this->hidden->waveformat) { + CoTaskMemFree(this->hidden->waveformat); + this->hidden->waveformat = NULL; + } + + if (this->hidden->capturestream) { + SDL_FreeAudioStream(this->hidden->capturestream); + this->hidden->capturestream = NULL; + } + + if (this->hidden->activation_handler) { + WASAPI_PlatformDeleteActivationHandler(this->hidden->activation_handler); + this->hidden->activation_handler = NULL; + } + + if (this->hidden->event) { + CloseHandle(this->hidden->event); + this->hidden->event = NULL; + } +} + +static void +WASAPI_CloseDevice(_THIS) +{ + WASAPI_UnrefDevice(this); +} + +void +WASAPI_RefDevice(_THIS) +{ + SDL_AtomicIncRef(&this->hidden->refcount); +} + +void +WASAPI_UnrefDevice(_THIS) +{ + if (!SDL_AtomicDecRef(&this->hidden->refcount)) { + return; + } + + /* actual closing happens here. */ + + /* don't touch this->hidden->task in here; it has to be reverted from + our callback thread. We do that in WASAPI_ThreadDeinit(). + (likewise for this->hidden->coinitialized). */ + ReleaseWasapiDevice(this); + SDL_free(this->hidden->devid); + SDL_free(this->hidden); +} + +/* This is called once a device is activated, possibly asynchronously. */ +int +WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) +{ + /* !!! FIXME: we could request an exclusive mode stream, which is lower latency; + !!! it will write into the kernel's audio buffer directly instead of + !!! shared memory that a user-mode mixer then writes to the kernel with + !!! everything else. Doing this means any other sound using this device will + !!! stop playing, including the user's MP3 player and system notification + !!! sounds. You'd probably need to release the device when the app isn't in + !!! the foreground, to be a good citizen of the system. It's doable, but it's + !!! more work and causes some annoyances, and I don't know what the latency + !!! wins actually look like. Maybe add a hint to force exclusive mode at + !!! some point. To be sure, defaulting to shared mode is the right thing to + !!! do in any case. */ + const SDL_AudioSpec oldspec = this->spec; + const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED; + UINT32 bufsize = 0; /* this is in sample frames, not samples, not bytes. */ + REFERENCE_TIME duration = 0; + IAudioClient *client = this->hidden->client; + IAudioRenderClient *render = NULL; + IAudioCaptureClient *capture = NULL; + WAVEFORMATEX *waveformat = NULL; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + SDL_AudioFormat wasapi_format = 0; + SDL_bool valid_format = SDL_FALSE; + HRESULT ret = S_OK; + DWORD streamflags = 0; + + SDL_assert(client != NULL); + +#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ + this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); +#else + this->hidden->event = CreateEventW(NULL, 0, 0, NULL); +#endif + + if (this->hidden->event == NULL) { + return WIN_SetError("WASAPI can't create an event handle"); + } + + ret = IAudioClient_GetMixFormat(client, &waveformat); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret); + } + + SDL_assert(waveformat != NULL); + this->hidden->waveformat = waveformat; + + this->spec.channels = (Uint8) waveformat->nChannels; + + /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */ + if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *) waveformat; + if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } + } + + while ((!valid_format) && (test_format)) { + if (test_format == wasapi_format) { + this->spec.format = test_format; + valid_format = SDL_TRUE; + break; + } + test_format = SDL_NextAudioFormat(); + } + + if (!valid_format) { + return SDL_SetError("WASAPI: Unsupported audio format"); + } + + ret = IAudioClient_GetDevicePeriod(client, NULL, &duration); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); + } + + /* favor WASAPI's resampler over our own, in Win7+. */ + if (this->spec.freq != waveformat->nSamplesPerSec) { + /* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/ + if (WIN_IsWindows7OrGreater() && !this->iscapture && (sharemode == AUDCLNT_SHAREMODE_SHARED)) { + streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST; + waveformat->nSamplesPerSec = this->spec.freq; + waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); + } + else { + this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */ + } + } + + streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + ret = IAudioClient_Initialize(client, sharemode, streamflags, duration, sharemode == AUDCLNT_SHAREMODE_SHARED ? 0 : duration, waveformat, NULL); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't initialize audio client", ret); + } + + ret = IAudioClient_SetEventHandle(client, this->hidden->event); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't set event handle", ret); + } + + ret = IAudioClient_GetBufferSize(client, &bufsize); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine buffer size", ret); + } + + this->spec.samples = (Uint16) bufsize; + if (!this->iscapture) { + this->spec.samples /= 2; /* fill half of the DMA buffer on each run. */ + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->framesize = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + + if (this->iscapture) { + this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq); + if (!this->hidden->capturestream) { + return -1; /* already set SDL_Error */ + } + + ret = IAudioClient_GetService(client, &SDL_IID_IAudioCaptureClient, (void**) &capture); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret); + } + + SDL_assert(capture != NULL); + this->hidden->capture = capture; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start capture", ret); + } + + WASAPI_FlushCapture(this); /* MSDN says you should flush capture endpoint right after startup. */ + } else { + ret = IAudioClient_GetService(client, &SDL_IID_IAudioRenderClient, (void**) &render); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret); + } + + SDL_assert(render != NULL); + this->hidden->render = render; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start playback", ret); + } + } + + if (updatestream) { + if (UpdateAudioStream(this, &oldspec) == -1) { + return -1; + } + } + + return 0; /* good to go. */ +} + + +static int +WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + LPCWSTR devid = (LPCWSTR) handle; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ + + if (!devid) { /* is default device? */ + this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } else { + this->hidden->devid = WStrDupe(devid); + if (!this->hidden->devid) { + return SDL_OutOfMemory(); + } + } + + if (WASAPI_ActivateDevice(this, SDL_FALSE) == -1) { + return -1; /* already set error. */ + } + + /* Ready, but waiting for async device activation. + Until activation is successful, we will report silence from capture + devices and ignore data on playback devices. + Also, since we don't know the _actual_ device format until after + activation, we let the app have whatever it asks for. We set up + an SDL_AudioStream to convert, if necessary, once the activation + completes. */ + + return 0; +} + +static void +WASAPI_ThreadInit(_THIS) +{ + WASAPI_PlatformThreadInit(this); +} + +static void +WASAPI_ThreadDeinit(_THIS) +{ + WASAPI_PlatformThreadDeinit(this); +} + +void +WASAPI_BeginLoopIteration(_THIS) +{ + /* no-op. */ +} + +static void +WASAPI_Deinitialize(void) +{ + DevIdList *devidlist; + DevIdList *next; + + WASAPI_PlatformDeinit(); + + for (devidlist = deviceid_list; devidlist; devidlist = next) { + next = devidlist->next; + SDL_free(devidlist->str); + SDL_free(devidlist); + } + deviceid_list = NULL; +} + +static int +WASAPI_Init(SDL_AudioDriverImpl * impl) +{ + SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); + + if (WASAPI_PlatformInit() == -1) { + return 0; + } + + /* Set the function pointers */ + impl->DetectDevices = WASAPI_DetectDevices; + impl->ThreadInit = WASAPI_ThreadInit; + impl->ThreadDeinit = WASAPI_ThreadDeinit; + impl->BeginLoopIteration = WASAPI_BeginLoopIteration; + impl->OpenDevice = WASAPI_OpenDevice; + impl->PlayDevice = WASAPI_PlayDevice; + impl->WaitDevice = WASAPI_WaitDevice; + impl->GetPendingBytes = WASAPI_GetPendingBytes; + impl->GetDeviceBuf = WASAPI_GetDeviceBuf; + impl->CaptureFromDevice = WASAPI_CaptureFromDevice; + impl->FlushCapture = WASAPI_FlushCapture; + impl->CloseDevice = WASAPI_CloseDevice; + impl->Deinitialize = WASAPI_Deinitialize; + impl->HasCaptureSupport = 1; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap WASAPI_bootstrap = { + "wasapi", "WASAPI", WASAPI_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_WASAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.h b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.h new file mode 100644 index 0000000000..142c0e586c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi.h @@ -0,0 +1,85 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_wasapi_h_ +#define SDL_wasapi_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#ifdef __cplusplus +#define _THIS SDL_AudioDevice *_this +#else +#define _THIS SDL_AudioDevice *this +#endif + +struct SDL_PrivateAudioData +{ + SDL_atomic_t refcount; + WCHAR *devid; + WAVEFORMATEX *waveformat; + IAudioClient *client; + IAudioRenderClient *render; + IAudioCaptureClient *capture; + SDL_AudioStream *capturestream; + HANDLE event; + HANDLE task; + SDL_bool coinitialized; + int framesize; + int default_device_generation; + SDL_bool device_lost; + void *activation_handler; + SDL_atomic_t just_activated; +}; + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +extern SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +extern SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* win32 and winrt implementations call into these. */ +int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream); +void WASAPI_RefDevice(_THIS); +void WASAPI_UnrefDevice(_THIS); +void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid); +void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid); + +/* These are functions that are implemented differently for Windows vs WinRT. */ +int WASAPI_PlatformInit(void); +void WASAPI_PlatformDeinit(void); +void WASAPI_EnumerateEndpoints(void); +int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); +void WASAPI_PlatformThreadInit(_THIS); +void WASAPI_PlatformThreadDeinit(_THIS); +void WASAPI_PlatformDeleteActivationHandler(void *handler); +void WASAPI_BeginLoopIteration(_THIS); + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_wasapi_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_win32.c b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_win32.c new file mode 100644 index 0000000000..9d7c1591b3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_win32.c @@ -0,0 +1,457 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +/* This is code that Windows uses to talk to WASAPI-related system APIs. + This is for non-WinRT desktop apps. The C++/CX implementation of these + functions, exclusive to WinRT, are in SDL_wasapi_winrt.cpp. + The code in SDL_wasapi.c is used by both standard Windows and WinRT builds + to deal with audio and calls into these functions. */ + +#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +static const ERole SDL_WASAPI_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */ + +/* This is global to the WASAPI target, to handle hotplug and default device lookup. */ +static IMMDeviceEnumerator *enumerator = NULL; + +/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */ +#ifdef PropVariantInit +#undef PropVariantInit +#endif +#define PropVariantInit(p) SDL_zerop(p) + +/* handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency). */ +static HMODULE libavrt = NULL; +typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPWSTR, LPDWORD); +typedef BOOL(WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE); +static pfnAvSetMmThreadCharacteristicsW pAvSetMmThreadCharacteristicsW = NULL; +static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; +static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; +static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; +static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; +static const IID SDL_IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,{ 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2 } }; +static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; + + +static char * +GetWasapiDeviceName(IMMDevice *device) +{ + /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be + "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in + its own UIs, like Volume Control, etc. */ + char *utf8dev = NULL; + IPropertyStore *props = NULL; + if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { + PROPVARIANT var; + PropVariantInit(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { + utf8dev = WIN_StringToUTF8(var.pwszVal); + } + PropVariantClear(&var); + IPropertyStore_Release(props); + } + return utf8dev; +} + + +/* We need a COM subclass of IMMNotificationClient for hotplug support, which is + easy in C++, but we have to tapdance more to make work in C. + Thanks to this page for coaching on how to make this work: + https://www.codeproject.com/Articles/13601/COM-in-plain-C */ + +typedef struct SDLMMNotificationClient +{ + const IMMNotificationClientVtbl *lpVtbl; + SDL_atomic_t refcount; +} SDLMMNotificationClient; + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv) +{ + if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) + { + *ppv = this; + this->lpVtbl->AddRef(this); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis) +{ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + return (ULONG) (SDL_AtomicIncRef(&this->refcount) + 1); +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_Release(IMMNotificationClient *ithis) +{ + /* this is a static object; we don't ever free it. */ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + const ULONG retval = SDL_AtomicDecRef(&this->refcount); + if (retval == 0) { + SDL_AtomicSet(&this->refcount, 0); /* uhh... */ + return 0; + } + return retval - 1; +} + +/* These are the entry points called when WASAPI device endpoints change. */ +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) +{ + if (role != SDL_WASAPI_role) { + return S_OK; /* ignore it. */ + } + + /* Increment the "generation," so opened devices will pick this up in their threads. */ + switch (flow) { + case eRender: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + break; + + case eCapture: + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + case eAll: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + default: + SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!"); + break; + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in + OnDeviceStateChange, making that a better place to deal with device adds. More + importantly: the first time you plug in a USB audio device, this callback will + fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). + Plugging it back in won't fire this callback again. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* See notes in OnDeviceAdded handler about why we ignore this. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState) +{ + IMMDevice *device = NULL; + + if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { + IMMEndpoint *endpoint = NULL; + if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **) &endpoint))) { + EDataFlow flow; + if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { + const SDL_bool iscapture = (flow == eCapture); + if (dwNewState == DEVICE_STATE_ACTIVE) { + char *utf8dev = GetWasapiDeviceName(device); + if (utf8dev) { + WASAPI_AddDevice(iscapture, utf8dev, pwstrDeviceId); + SDL_free(utf8dev); + } + } else { + WASAPI_RemoveDevice(iscapture, pwstrDeviceId); + } + } + IMMEndpoint_Release(endpoint); + } + IMMDevice_Release(device); + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) +{ + return S_OK; /* we don't care about these. */ +} + +static const IMMNotificationClientVtbl notification_client_vtbl = { + SDLMMNotificationClient_QueryInterface, + SDLMMNotificationClient_AddRef, + SDLMMNotificationClient_Release, + SDLMMNotificationClient_OnDeviceStateChanged, + SDLMMNotificationClient_OnDeviceAdded, + SDLMMNotificationClient_OnDeviceRemoved, + SDLMMNotificationClient_OnDefaultDeviceChanged, + SDLMMNotificationClient_OnPropertyValueChanged +}; + +static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; + + +int +WASAPI_PlatformInit(void) +{ + HRESULT ret; + + /* just skip the discussion with COM here. */ + if (!WIN_IsWindowsVistaOrGreater()) { + return SDL_SetError("WASAPI support requires Windows Vista or later"); + } + + if (FAILED(WIN_CoInitialize())) { + return SDL_SetError("WASAPI: CoInitialize() failed"); + } + + ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID) &enumerator); + if (FAILED(ret)) { + WIN_CoUninitialize(); + return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret); + } + + libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */ + if (libavrt) { + pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW"); + pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics"); + } + + return 0; +} + +void +WASAPI_PlatformDeinit(void) +{ + if (enumerator) { + IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); + IMMDeviceEnumerator_Release(enumerator); + enumerator = NULL; + } + + if (libavrt) { + FreeLibrary(libavrt); + libavrt = NULL; + } + + pAvSetMmThreadCharacteristicsW = NULL; + pAvRevertMmThreadCharacteristics = NULL; + + WIN_CoUninitialize(); +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + /* this thread uses COM. */ + if (SUCCEEDED(WIN_CoInitialize())) { /* can't report errors, hope it worked! */ + this->hidden->coinitialized = SDL_TRUE; + } + + /* Set this thread to very high "Pro Audio" priority. */ + if (pAvSetMmThreadCharacteristicsW) { + DWORD idx = 0; + this->hidden->task = pAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &idx); + } +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + /* Set this thread back to normal priority. */ + if (this->hidden->task && pAvRevertMmThreadCharacteristics) { + pAvRevertMmThreadCharacteristics(this->hidden->task); + this->hidden->task = NULL; + } + + if (this->hidden->coinitialized) { + WIN_CoUninitialize(); + this->hidden->coinitialized = SDL_FALSE; + } +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = this->hidden->devid; + IMMDevice *device = NULL; + HRESULT ret; + + if (devid == NULL) { + const EDataFlow dataflow = this->iscapture ? eCapture : eRender; + ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_WASAPI_role, &device); + } else { + ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, &device); + } + + if (FAILED(ret)) { + SDL_assert(device == NULL); + this->hidden->client = NULL; + return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); + } + + /* this is not async in standard win32, yay! */ + ret = IMMDevice_Activate(device, &SDL_IID_IAudioClient, CLSCTX_ALL, NULL, (void **) &this->hidden->client); + IMMDevice_Release(device); + + if (FAILED(ret)) { + SDL_assert(this->hidden->client == NULL); + return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret); + } + + SDL_assert(this->hidden->client != NULL); + if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */ + return -1; + } + + return 0; /* good to go. */ +} + + +typedef struct +{ + LPWSTR devid; + char *devname; +} EndpointItem; + +static int sort_endpoints(const void *_a, const void *_b) +{ + LPWSTR a = ((const EndpointItem *) _a)->devid; + LPWSTR b = ((const EndpointItem *) _b)->devid; + if (!a && b) { + return -1; + } else if (a && !b) { + return 1; + } + + while (SDL_TRUE) { + if (*a < *b) { + return -1; + } else if (*a > *b) { + return 1; + } else if (*a == 0) { + break; + } + a++; + b++; + } + + return 0; +} + +static void +WASAPI_EnumerateEndpointsForFlow(const SDL_bool iscapture) +{ + IMMDeviceCollection *collection = NULL; + EndpointItem *items; + UINT i, total; + + /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" + ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ + + if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { + return; + } + + if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { + IMMDeviceCollection_Release(collection); + return; + } + + items = (EndpointItem *) SDL_calloc(total, sizeof (EndpointItem)); + if (!items) { + return; /* oh well. */ + } + + for (i = 0; i < total; i++) { + EndpointItem *item = items + i; + IMMDevice *device = NULL; + if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) { + if (SUCCEEDED(IMMDevice_GetId(device, &item->devid))) { + item->devname = GetWasapiDeviceName(device); + } + IMMDevice_Release(device); + } + } + + /* sort the list of devices by their guid so list is consistent between runs */ + SDL_qsort(items, total, sizeof (*items), sort_endpoints); + + /* Send the sorted list on to the SDL's higher level. */ + for (i = 0; i < total; i++) { + EndpointItem *item = items + i; + if ((item->devid) && (item->devname)) { + WASAPI_AddDevice(iscapture, item->devname, item->devid); + } + SDL_free(item->devname); + CoTaskMemFree(item->devid); + } + + SDL_free(items); + IMMDeviceCollection_Release(collection); +} + +void +WASAPI_EnumerateEndpoints(void) +{ + WASAPI_EnumerateEndpointsForFlow(SDL_FALSE); /* playback */ + WASAPI_EnumerateEndpointsForFlow(SDL_TRUE); /* capture */ + + /* if this fails, we just won't get hotplug events. Carry on anyhow. */ + IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + /* not asynchronous. */ + SDL_assert(!"This function should have only been called on WinRT."); +} + +#endif /* SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_winrt.cpp b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_winrt.cpp new file mode 100644 index 0000000000..2ca09de863 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +// This is C++/CX code that the WinRT port uses to talk to WASAPI-related +// system APIs. The C implementation of these functions, for non-WinRT apps, +// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard +// Windows and WinRT builds to deal with audio and calls into these functions. + +#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +#include +#include +#include +#include +#include + +extern "C" { +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" +} + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +using namespace Windows::Devices::Enumeration; +using namespace Windows::Media::Devices; +using namespace Windows::Foundation; +using namespace Microsoft::WRL; + +class SDL_WasapiDeviceEventHandler +{ +public: + SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture); + ~SDL_WasapiDeviceEventHandler(); + void OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ args); + void OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args); + void OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args); + +private: + const SDL_bool iscapture; + DeviceWatcher^ watcher; + Windows::Foundation::EventRegistrationToken added_handler; + Windows::Foundation::EventRegistrationToken removed_handler; + Windows::Foundation::EventRegistrationToken updated_handler; + Windows::Foundation::EventRegistrationToken default_changed_handler; +}; + +SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture) + : iscapture(_iscapture) + , watcher(DeviceInformation::CreateWatcher(_iscapture ? DeviceClass::AudioCapture : DeviceClass::AudioRender)) +{ + if (!watcher) + return; // uhoh. + + // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan. + added_handler = watcher->Added += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformation^ args) { OnDeviceAdded(sender, args); } ); + removed_handler = watcher->Removed += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceRemoved(sender, args); } ); + updated_handler = watcher->Updated += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceUpdated(sender, args); } ); + if (iscapture) { + default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { OnDefaultCaptureDeviceChanged(sender, args); } ); + } else { + default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { OnDefaultRenderDeviceChanged(sender, args); } ); + } + watcher->Start(); +} + +SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler() +{ + if (watcher) { + watcher->Added -= added_handler; + watcher->Removed -= removed_handler; + watcher->Updated -= updated_handler; + watcher->Stop(); + watcher = nullptr; + } + + if (iscapture) { + MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler; + } else { + MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler; + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ info) +{ + SDL_assert(sender == this->watcher); + char *utf8dev = WIN_StringToUTF8(info->Name->Data()); + if (utf8dev) { + WASAPI_AddDevice(this->iscapture, utf8dev, info->Id->Data()); + SDL_free(utf8dev); + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ info) +{ + SDL_assert(sender == this->watcher); + WASAPI_RemoveDevice(this->iscapture, info->Id->Data()); +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args) +{ + SDL_assert(sender == this->watcher); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) +{ + SDL_assert(this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) +{ + SDL_assert(!this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); +} + + +static SDL_WasapiDeviceEventHandler *playback_device_event_handler; +static SDL_WasapiDeviceEventHandler *capture_device_event_handler; + +int WASAPI_PlatformInit(void) +{ + return 0; +} + +void WASAPI_PlatformDeinit(void) +{ + delete playback_device_event_handler; + playback_device_event_handler = nullptr; + delete capture_device_event_handler; + capture_device_event_handler = nullptr; +} + +void WASAPI_EnumerateEndpoints(void) +{ + // DeviceWatchers will fire an Added event for each existing device at + // startup, so we don't need to enumerate them separately before + // listening for updates. + playback_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_FALSE); + capture_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_TRUE); +} + +struct SDL_WasapiActivationHandler : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler > +{ + SDL_WasapiActivationHandler() : device(nullptr) {} + STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation); + SDL_AudioDevice *device; +}; + +HRESULT +SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) +{ + // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races. + SDL_AtomicSet(&device->hidden->just_activated, 1); + WASAPI_UnrefDevice(device); + return S_OK; +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + ((SDL_WasapiActivationHandler *) handler)->Release(); +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = _this->hidden->devid; + Platform::String^ defdevid; + + if (devid == nullptr) { + defdevid = _this->iscapture ? MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default) : MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default); + if (defdevid) { + devid = defdevid->Data(); + } + } + + SDL_AtomicSet(&_this->hidden->just_activated, 0); + + ComPtr handler = Make(); + if (handler == nullptr) { + return SDL_SetError("Failed to allocate WASAPI activation handler"); + } + + handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc. + handler.Get()->device = _this; + _this->hidden->activation_handler = handler.Get(); + + WASAPI_RefDevice(_this); /* completion handler will unref it. */ + IActivateAudioInterfaceAsyncOperation *async = nullptr; + const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async); + + if (FAILED(ret) || async == nullptr) { + if (async != nullptr) { + async->Release(); + } + handler.Get()->Release(); + WASAPI_UnrefDevice(_this); + return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret); + } + + /* Spin until the async operation is complete. + * If we don't PrepDevice before leaving this function, the bug list gets LONG: + * - device.spec is not filled with the correct information + * - The 'obtained' spec will be wrong for ALLOW_CHANGE properties + * - SDL_AudioStreams will/will not be allocated at the right time + * - SDL_assert(device->callbackspec.size == device->spec.size) will fail + * - When the assert is ignored, skipping or a buffer overflow will occur + */ + while (!SDL_AtomicCAS(&_this->hidden->just_activated, 1, 0)) { + SDL_Delay(1); + } + + HRESULT activateRes = S_OK; + IUnknown *iunknown = nullptr; + const HRESULT getActivateRes = async->GetActivateResult(&activateRes, &iunknown); + async->Release(); + if (FAILED(getActivateRes)) { + return WIN_SetErrorFromHRESULT("Failed to get WASAPI activate result", getActivateRes); + } else if (FAILED(activateRes)) { + return WIN_SetErrorFromHRESULT("Failed to activate WASAPI device", activateRes); + } + + iunknown->QueryInterface(IID_PPV_ARGS(&_this->hidden->client)); + if (!_this->hidden->client) { + return SDL_SetError("Failed to query WASAPI client interface"); + } + + if (WASAPI_PrepDevice(_this, isrecovery) == -1) { + return -1; + } + + return 0; +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +#endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.c b/3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.c similarity index 60% rename from 3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.c rename to 3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.c index 6d05a65ef5..20426f13ac 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.c +++ b/3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,11 +27,46 @@ #include "../../core/windows/SDL_windows.h" #include +#include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_winmm.h" +/* MinGW32 mmsystem.h doesn't include these structures */ +#if defined(__MINGW32__) && defined(_MMSYSTEM_H) + +typedef struct tagWAVEINCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W; + +typedef struct tagWAVEOUTCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + DWORD dwSupport; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W; + +#endif /* defined(__MINGW32__) && defined(_MMSYSTEM_H) */ + #ifndef WAVE_FORMAT_IEEE_FLOAT #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif @@ -40,11 +75,11 @@ static void DetectWave##typ##Devs(void) { \ const UINT iscapture = iscap ? 1 : 0; \ const UINT devcount = wave##typ##GetNumDevs(); \ - capstyp caps; \ + capstyp##2W caps; \ UINT i; \ for (i = 0; i < devcount; i++) { \ - if (wave##typ##GetDevCaps(i,&caps,sizeof(caps))==MMSYSERR_NOERROR) { \ - char *name = WIN_StringToUTF8(caps.szPname); \ + if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \ + char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \ if (name != NULL) { \ SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \ SDL_free(name); \ @@ -134,63 +169,87 @@ WINMM_PlayDevice(_THIS) this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; } -static void -WINMM_WaitDone(_THIS) +static int +WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen) { - int i, left; + const int nextbuf = this->hidden->next_buffer; + MMRESULT result; - do { - left = NUM_BUFFERS; - for (i = 0; i < NUM_BUFFERS; ++i) { - if (this->hidden->wavebuf[i].dwFlags & WHDR_DONE) { - --left; - } - } - if (left > 0) { - SDL_Delay(100); - } - } while (left > 0); + SDL_assert(buflen == this->spec.size); + + /* Wait for an audio chunk to finish */ + WaitForSingleObject(this->hidden->audio_sem, INFINITE); + + /* Copy it to caller's buffer... */ + SDL_memcpy(buffer, this->hidden->wavebuf[nextbuf].lpData, this->spec.size); + + /* requeue the buffer that just finished. */ + result = waveInAddBuffer(this->hidden->hin, + &this->hidden->wavebuf[nextbuf], + sizeof (this->hidden->wavebuf[nextbuf])); + if (result != MMSYSERR_NOERROR) { + return -1; /* uhoh! Disable the device. */ + } + + /* queue the next buffer in sequence, next time. */ + this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; + return this->spec.size; +} + +static void +WINMM_FlushCapture(_THIS) +{ + /* Wait for an audio chunk to finish */ + if (WaitForSingleObject(this->hidden->audio_sem, 0) == WAIT_OBJECT_0) { + const int nextbuf = this->hidden->next_buffer; + /* requeue the buffer that just finished without reading from it. */ + waveInAddBuffer(this->hidden->hin, + &this->hidden->wavebuf[nextbuf], + sizeof (this->hidden->wavebuf[nextbuf])); + this->hidden->next_buffer = (nextbuf + 1) % NUM_BUFFERS; + } } static void WINMM_CloseDevice(_THIS) { - /* Close up audio */ - if (this->hidden != NULL) { - int i; + int i; - if (this->hidden->audio_sem) { - CloseHandle(this->hidden->audio_sem); - this->hidden->audio_sem = 0; - } + if (this->hidden->hout) { + waveOutReset(this->hidden->hout); /* Clean up mixing buffers */ for (i = 0; i < NUM_BUFFERS; ++i) { if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { waveOutUnprepareHeader(this->hidden->hout, &this->hidden->wavebuf[i], - sizeof(this->hidden->wavebuf[i])); - this->hidden->wavebuf[i].dwUser = 0xFFFF; + sizeof (this->hidden->wavebuf[i])); } } - /* Free raw mixing buffer */ - SDL_free(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; + waveOutClose(this->hidden->hout); + } - if (this->hidden->hin) { - waveInClose(this->hidden->hin); - this->hidden->hin = 0; - } + if (this->hidden->hin) { + waveInReset(this->hidden->hin); - if (this->hidden->hout) { - waveOutClose(this->hidden->hout); - this->hidden->hout = 0; + /* Clean up mixing buffers */ + for (i = 0; i < NUM_BUFFERS; ++i) { + if (this->hidden->wavebuf[i].dwUser != 0xFFFF) { + waveInUnprepareHeader(this->hidden->hin, + &this->hidden->wavebuf[i], + sizeof (this->hidden->wavebuf[i])); + } } + waveInClose(this->hidden->hin); + } - SDL_free(this->hidden); - this->hidden = NULL; + if (this->hidden->audio_sem) { + CloseHandle(this->hidden->audio_sem); } + + SDL_free(this->hidden->mixbuf); + SDL_free(this->hidden); } static SDL_bool @@ -239,7 +298,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + SDL_zerop(this->hidden); /* Initialize the wavebuf structures for closing */ for (i = 0; i < NUM_BUFFERS; ++i) @@ -269,7 +328,6 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } if (!valid_datatype) { - WINMM_CloseDevice(this); return SDL_SetError("Unsupported audio format"); } @@ -281,36 +339,44 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) result = waveInOpen(&this->hidden->hin, devId, &waveformat, (DWORD_PTR) CaptureSound, (DWORD_PTR) this, CALLBACK_FUNCTION); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveInOpen()", result); + } } else { result = waveOutOpen(&this->hidden->hout, devId, &waveformat, (DWORD_PTR) FillSound, (DWORD_PTR) this, CALLBACK_FUNCTION); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveOutOpen()", result); + } } - if (result != MMSYSERR_NOERROR) { - WINMM_CloseDevice(this); - return SetMMerror("waveOutOpen()", result); - } #ifdef SOUND_DEBUG /* Check the sound device we retrieved */ { - WAVEOUTCAPS caps; - - result = waveOutGetDevCaps((UINT) this->hidden->hout, - &caps, sizeof(caps)); - if (result != MMSYSERR_NOERROR) { - WINMM_CloseDevice(this); - return SetMMerror("waveOutGetDevCaps()", result); + if (iscapture) { + WAVEINCAPS caps; + result = waveInGetDevCaps((UINT) this->hidden->hout, + &caps, sizeof (caps)); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveInGetDevCaps()", result); + } + printf("Audio device: %s\n", caps.szPname); + } else { + WAVEOUTCAPS caps; + result = waveOutGetDevCaps((UINT) this->hidden->hout, + &caps, sizeof(caps)); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveOutGetDevCaps()", result); + } + printf("Audio device: %s\n", caps.szPname); } - printf("Audio device: %s\n", caps.szPname); } #endif /* Create the audio buffer semaphore */ - this->hidden->audio_sem = - CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL); + this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL); if (this->hidden->audio_sem == NULL) { - WINMM_CloseDevice(this); return SDL_SetError("Couldn't create semaphore"); } @@ -318,22 +384,44 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); if (this->hidden->mixbuf == NULL) { - WINMM_CloseDevice(this); return SDL_OutOfMemory(); } + + SDL_zero(this->hidden->wavebuf); for (i = 0; i < NUM_BUFFERS; ++i) { - SDL_memset(&this->hidden->wavebuf[i], 0, - sizeof(this->hidden->wavebuf[i])); this->hidden->wavebuf[i].dwBufferLength = this->spec.size; this->hidden->wavebuf[i].dwFlags = WHDR_DONE; this->hidden->wavebuf[i].lpData = (LPSTR) & this->hidden->mixbuf[i * this->spec.size]; - result = waveOutPrepareHeader(this->hidden->hout, - &this->hidden->wavebuf[i], - sizeof(this->hidden->wavebuf[i])); + + if (iscapture) { + result = waveInPrepareHeader(this->hidden->hin, + &this->hidden->wavebuf[i], + sizeof(this->hidden->wavebuf[i])); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveInPrepareHeader()", result); + } + + result = waveInAddBuffer(this->hidden->hin, + &this->hidden->wavebuf[i], + sizeof(this->hidden->wavebuf[i])); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveInAddBuffer()", result); + } + } else { + result = waveOutPrepareHeader(this->hidden->hout, + &this->hidden->wavebuf[i], + sizeof(this->hidden->wavebuf[i])); + if (result != MMSYSERR_NOERROR) { + return SetMMerror("waveOutPrepareHeader()", result); + } + } + } + + if (iscapture) { + result = waveInStart(this->hidden->hin); if (result != MMSYSERR_NOERROR) { - WINMM_CloseDevice(this); - return SetMMerror("waveOutPrepareHeader()", result); + return SetMMerror("waveInStart()", result); } } @@ -349,10 +437,13 @@ WINMM_Init(SDL_AudioDriverImpl * impl) impl->OpenDevice = WINMM_OpenDevice; impl->PlayDevice = WINMM_PlayDevice; impl->WaitDevice = WINMM_WaitDevice; - impl->WaitDone = WINMM_WaitDone; impl->GetDeviceBuf = WINMM_GetDeviceBuf; + impl->CaptureFromDevice = WINMM_CaptureFromDevice; + impl->FlushCapture = WINMM_FlushCapture; impl->CloseDevice = WINMM_CloseDevice; + impl->HasCaptureSupport = SDL_TRUE; + return 1; /* this audio target is available. */ } diff --git a/3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.h b/3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.h rename to 3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.h index 401db398b6..9342bb9f12 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/winmm/SDL_winmm.h +++ b/3rdparty/sdl2-2.0.9/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winmm_h -#define _SDL_winmm_h +#ifndef SDL_winmm_h_ +#define SDL_winmm_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData int next_buffer; }; -#endif /* _SDL_winmm_h */ +#endif /* SDL_winmm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/android/SDL_android.c b/3rdparty/sdl2-2.0.9/src/core/android/SDL_android.c similarity index 50% rename from 3rdparty/sdl2-2.0.4/src/core/android/SDL_android.c rename to 3rdparty/sdl2-2.0.9/src/core/android/SDL_android.c index f6e0a833c6..a56575e09d 100644 --- a/3rdparty/sdl2-2.0.4/src/core/android/SDL_android.c +++ b/3rdparty/sdl2-2.0.9/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,14 @@ #include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_log.h" +#include "SDL_main.h" #ifdef __ANDROID__ #include "SDL_system.h" #include "SDL_android.h" -#include + +#include "keyinfotable.h" #include "../../events/SDL_events_c.h" #include "../../video/android/SDL_androidkeyboard.h" @@ -37,27 +39,176 @@ #include "../../video/android/SDL_androidvideo.h" #include "../../video/android/SDL_androidwindow.h" #include "../../joystick/android/SDL_sysjoystick_c.h" +#include "../../haptic/android/SDL_syshaptic_c.h" #include #include #include #include -#define LOG_TAG "SDL_android" +#include +/* #define LOG_TAG "SDL_android" */ /* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */ /* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */ #define LOGI(...) do {} while (0) #define LOGE(...) do {} while (0) + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) +#define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function) +#define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function) +#define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) + +/* Audio encoding definitions */ +#define ENCODING_PCM_8BIT 3 +#define ENCODING_PCM_16BIT 2 +#define ENCODING_PCM_FLOAT 4 + +/* Java class SDLActivity */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( + JNIEnv* mEnv, jclass cls); + +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( + JNIEnv* env, jclass cls, + jstring library, jstring function, jobject array); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( + JNIEnv* env, jclass jcls, + jstring filename); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv* env, jclass jcls, + jint surfaceWidth, jint surfaceHeight, + jint deviceWidth, jint deviceHeight, jint format, jfloat rate); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( + JNIEnv* env, jclass jcls, + jint touch_device_id_in, jint pointer_finger_id_in, + jint action, jfloat x, jfloat y, jfloat p); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( + JNIEnv* env, jclass jcls, + jint button, jint action, jfloat x, jfloat y, jboolean relative); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( + JNIEnv* env, jclass jcls, + jfloat x, jfloat y, jfloat z); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( + JNIEnv* env, jclass cls); + +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( + JNIEnv* env, jclass cls, + jint orientation); + +/* Java class SDLInputConnection */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( + JNIEnv* env, jclass cls, + jchar chUnicode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +/* Java class SDLAudioManager */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +/* Java class SDLControllerManager */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( + JNIEnv* env, jclass jcls, + jint device_id, jint axis, jfloat value); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( + JNIEnv* env, jclass jcls, + jint device_id, jint hat_id, jint x, jint y); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, jint vendor_id, jint product_id, + jboolean is_accelerometer, jint button_mask, jint naxes, jint nhats, jint nballs); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, + jint device_id); + + + /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ static void Android_JNI_ThreadDestroyed(void*); +static void checkJNIReady(void); /******************************************************************************* This file links the Java side of Android with libsdl *******************************************************************************/ #include -#include /******************************************************************************* @@ -71,16 +222,64 @@ static jclass mActivityClass; /* method signatures */ static jmethodID midGetNativeSurface; -static jmethodID midAudioInit; -static jmethodID midAudioWriteShortBuffer; +static jmethodID midSetActivityTitle; +static jmethodID midSetWindowStyle; +static jmethodID midSetOrientation; +static jmethodID midGetContext; +static jmethodID midIsTablet; +static jmethodID midIsAndroidTV; +static jmethodID midIsChromebook; +static jmethodID midIsDeXMode; +static jmethodID midManualBackButton; +static jmethodID midInputGetInputDeviceIds; +static jmethodID midSendMessage; +static jmethodID midShowTextInput; +static jmethodID midIsScreenKeyboardShown; +static jmethodID midClipboardSetText; +static jmethodID midClipboardGetText; +static jmethodID midClipboardHasText; +static jmethodID midOpenAPKExpansionInputStream; +static jmethodID midGetManifestEnvironmentVariables; +static jmethodID midGetDisplayDPI; +static jmethodID midCreateCustomCursor; +static jmethodID midSetCustomCursor; +static jmethodID midSetSystemCursor; +static jmethodID midSupportsRelativeMouse; +static jmethodID midSetRelativeMouseEnabled; + +/* audio manager */ +static jclass mAudioManagerClass; + +/* method signatures */ +static jmethodID midAudioOpen; static jmethodID midAudioWriteByteBuffer; -static jmethodID midAudioQuit; +static jmethodID midAudioWriteShortBuffer; +static jmethodID midAudioWriteFloatBuffer; +static jmethodID midAudioClose; +static jmethodID midCaptureOpen; +static jmethodID midCaptureReadByteBuffer; +static jmethodID midCaptureReadShortBuffer; +static jmethodID midCaptureReadFloatBuffer; +static jmethodID midCaptureClose; + +/* controller manager */ +static jclass mControllerManagerClass; + +/* method signatures */ static jmethodID midPollInputDevices; +static jmethodID midPollHapticDevices; +static jmethodID midHapticRun; +static jmethodID midHapticStop; + +/* static fields */ +static jfieldID fidSeparateMouseAndTouch; /* Accelerometer data storage */ static float fLastAccelerometer[3]; static SDL_bool bHasNewData; +static SDL_bool bHasEnvironmentVariables = SDL_FALSE; + /******************************************************************************* Functions called by JNI *******************************************************************************/ @@ -107,10 +306,20 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) return JNI_VERSION_1_4; } -/* Called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) +void checkJNIReady() +{ + if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { + // We aren't fully initialized, let's just return. + return; + } + + SDL_SetMainReady(); +} + +/* Activity initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init()"); + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); Android_JNI_SetupThread(); @@ -118,46 +327,246 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getNativeSurface","()Landroid/view/Surface;"); - midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioInit", "(IZZI)I"); - midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioWriteShortBuffer", "([S)V"); - midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midSetActivityTitle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setActivityTitle","(Ljava/lang/String;)Z"); + midSetWindowStyle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setWindowStyle","(Z)V"); + midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setOrientation","(IIZLjava/lang/String;)V"); + midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getContext","()Landroid/content/Context;"); + midIsTablet = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isTablet", "()Z"); + midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isAndroidTV","()Z"); + midIsChromebook = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isChromebook", "()Z"); + midIsDeXMode = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isDeXMode", "()Z"); + midManualBackButton = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "manualBackButton", "()V"); + midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "inputGetInputDeviceIds", "(I)[I"); + midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "sendMessage", "(II)Z"); + midShowTextInput = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "showTextInput", "(IIII)Z"); + midIsScreenKeyboardShown = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isScreenKeyboardShown","()Z"); + midClipboardSetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardSetText", "(Ljava/lang/String;)V"); + midClipboardGetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardGetText", "()Ljava/lang/String;"); + midClipboardHasText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardHasText", "()Z"); + midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); + + midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getManifestEnvironmentVariables", "()Z"); + + midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); + midCreateCustomCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "createCustomCursor", "([IIIII)I"); + midSetCustomCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setCustomCursor", "(I)Z"); + midSetSystemCursor = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setSystemCursor", "(I)Z"); + + midSupportsRelativeMouse = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "supportsRelativeMouse", "()Z"); + midSetRelativeMouseEnabled = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "setRelativeMouseEnabled", "(Z)Z"); + + + if (!midGetNativeSurface || + !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midGetContext || !midIsTablet || !midIsAndroidTV || !midInputGetInputDeviceIds || + !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown || + !midClipboardSetText || !midClipboardGetText || !midClipboardHasText || + !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables || !midGetDisplayDPI || + !midCreateCustomCursor || !midSetCustomCursor || !midSetSystemCursor || !midSupportsRelativeMouse || !midSetRelativeMouseEnabled || + !midIsChromebook || !midIsDeXMode || !midManualBackButton) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); + } + + fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z"); + + if (!fidSeparateMouseAndTouch) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java static fields, do you have the latest version of SDLActivity.java?"); + } + + checkJNIReady(); +} + +/* Audio initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mAudioManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioOpen", "(IIII)[I"); + midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, "audioWriteByteBuffer", "([B)V"); - midAudioQuit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioQuit", "()V"); - midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteShortBuffer", "([S)V"); + midAudioWriteFloatBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteFloatBuffer", "([F)V"); + midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioClose", "()V"); + midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureOpen", "(IIII)[I"); + midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadByteBuffer", "([BZ)I"); + midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadShortBuffer", "([SZ)I"); + midCaptureReadFloatBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadFloatBuffer", "([FZ)I"); + midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureClose", "()V"); + + if (!midAudioOpen || !midAudioWriteByteBuffer || !midAudioWriteShortBuffer || !midAudioWriteFloatBuffer || !midAudioClose || + !midCaptureOpen || !midCaptureReadByteBuffer || !midCaptureReadShortBuffer || !midCaptureReadFloatBuffer || !midCaptureClose) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); + } + + checkJNIReady(); +} + +/* Controller initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mControllerManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, "pollInputDevices", "()V"); + midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "pollHapticDevices", "()V"); + midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "hapticRun", "(IFI)V"); + midHapticStop = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "hapticStop", "(I)V"); + + if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun || !midHapticStop) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?"); + } - bHasNewData = SDL_FALSE; + checkJNIReady(); +} + +/* SDL main function prototype */ +typedef int (*SDL_main_func)(int argc, char *argv[]); + +/* Start up the SDL app */ +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, jstring library, jstring function, jobject array) +{ + int status = -1; + const char *library_file; + void *library_handle; - if (!midGetNativeSurface || !midAudioInit || - !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioQuit || !midPollInputDevices) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly"); + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()"); + + library_file = (*env)->GetStringUTFChars(env, library, NULL); + library_handle = dlopen(library_file, RTLD_GLOBAL); + if (library_handle) { + const char *function_name; + SDL_main_func SDL_main; + + function_name = (*env)->GetStringUTFChars(env, function, NULL); + SDL_main = (SDL_main_func)dlsym(library_handle, function_name); + if (SDL_main) { + int i; + int argc; + int len; + char **argv; + + /* Prepare the arguments. */ + len = (*env)->GetArrayLength(env, array); + argv = SDL_stack_alloc(char*, 1 + len + 1); + argc = 0; + /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. + https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start + */ + argv[argc++] = SDL_strdup("app_process"); + for (i = 0; i < len; ++i) { + const char* utf; + char* arg = NULL; + jstring string = (*env)->GetObjectArrayElement(env, array, i); + if (string) { + utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + arg = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); + } + (*env)->DeleteLocalRef(env, string); + } + if (!arg) { + arg = SDL_strdup(""); + } + argv[argc++] = arg; + } + argv[argc] = NULL; + + + /* Run the application. */ + status = SDL_main(argc, argv); + + /* Release the arguments. */ + for (i = 0; i < argc; ++i) { + SDL_free(argv[i]); + } + SDL_stack_free(argv); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file); + } + (*env)->ReleaseStringUTFChars(env, function, function_name); + + dlclose(library_handle); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file); } - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!"); + (*env)->ReleaseStringUTFChars(env, library, library_file); + + /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ + /* exit(status); */ + + return status; } /* Drop file */ -void Java_org_libsdl_app_SDLActivity_onNativeDropFile( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv* env, jclass jcls, jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); - SDL_SendDropFile(path); + SDL_SendDropFile(NULL, path); (*env)->ReleaseStringUTFChars(env, filename, path); + SDL_SendDropComplete(NULL); } /* Resize */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv* env, jclass jcls, - jint width, jint height, jint format, jfloat rate) + jint surfaceWidth, jint surfaceHeight, + jint deviceWidth, jint deviceHeight, jint format, jfloat rate) { - Android_SetScreenResolution(width, height, format, rate); + Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate); +} + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( + JNIEnv *env, jclass jcls, + jint orientation) +{ + SDL_VideoDisplay *display = SDL_GetDisplay(0); + SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); } /* Paddown */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( JNIEnv* env, jclass jcls, jint device_id, jint keycode) { @@ -165,15 +574,15 @@ JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( } /* Padup */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp( - JNIEnv* env, jclass jcls, - jint device_id, jint keycode) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); } /* Joy */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( JNIEnv* env, jclass jcls, jint device_id, jint axis, jfloat value) { @@ -181,7 +590,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( } /* POV Hat */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEnv* env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { @@ -189,30 +598,53 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick( - JNIEnv* env, jclass jcls, - jint device_id, jstring device_name, jint is_accelerometer, - jint nbuttons, jint naxes, jint nhats, jint nballs) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, + jint vendor_id, jint product_id, jboolean is_accelerometer, + jint button_mask, jint naxes, jint nhats, jint nballs) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL); - retval = Android_AddJoystick(device_id, name, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs); + retval = Android_AddJoystick(device_id, name, desc, vendor_id, product_id, is_accelerometer ? SDL_TRUE : SDL_FALSE, button_mask, naxes, nhats, nballs); (*env)->ReleaseStringUTFChars(env, device_name, name); - + (*env)->ReleaseStringUTFChars(env, device_desc, desc); + return retval; } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick( - JNIEnv* env, jclass jcls, jint device_id) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id) { return Android_RemoveJoystick(device_id); } +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, jint device_id, jstring device_name) +{ + int retval; + const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + + retval = Android_AddHaptic(device_id, name); + + (*env)->ReleaseStringUTFChars(env, device_name, name); + + return retval; +} + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, jint device_id) +{ + return Android_RemoveHaptic(device_id); +} + /* Surface Created */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls) { SDL_WindowData *data; SDL_VideoDevice *_this; @@ -220,10 +652,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_surface == EGL_NO_SURFACE) { if(data->native_window) { @@ -232,13 +664,13 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN data->native_window = Android_JNI_GetNativeWindow(); data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ - + } /* Surface Destroyed */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls) { /* We have to clear the current context and destroy the egl surface here * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume @@ -246,40 +678,42 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed( */ SDL_WindowData *data; SDL_VideoDevice *_this; - + if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_MakeCurrent(_this, NULL, NULL); SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ } /* Keydown */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyDown( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyDown(keycode); } /* Keyup */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyUp( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyUp(keycode); } /* Keyboard Focus Lost */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv* env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ @@ -288,7 +722,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost /* Touch */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv* env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) @@ -297,15 +731,15 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( } /* Mouse */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv* env, jclass jcls, - jint button, jint action, jfloat x, jfloat y) + jint button, jint action, jfloat x, jfloat y, jboolean relative) { - Android_OnMouse(button, action, x, y); + Android_OnMouse(button, action, x, y, relative); } /* Accelerometer */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv* env, jclass jcls, jfloat x, jfloat y, jfloat z) { @@ -315,15 +749,22 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( bHasNewData = SDL_TRUE; } +/* Clipboard */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls) +{ + SDL_SendClipboardUpdate(); +} + /* Low memory */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeLowMemory( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv* env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } /* Quit */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv* env, jclass cls) { /* Discard previous events. The user should have handled state storage @@ -339,24 +780,25 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( } /* Pause */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativePause( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); + if (Android_Window) { SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); - - /* *After* sending the relevant events, signal the pause semaphore + + /* *After* sending the relevant events, signal the pause semaphore * so the event loop knows to pause and (optionally) block itself */ if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem); } } /* Resume */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); @@ -374,7 +816,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( } } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -385,7 +827,37 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposingText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( + JNIEnv* env, jclass cls, + jchar chUnicode) +{ + SDL_Scancode code = SDL_SCANCODE_UNKNOWN; + uint16_t mod = 0; + + // We do not care about bigger than 127. + if (chUnicode < 127) { + AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode]; + code = info.code; + mod = info.mod; + } + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift down */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); + } + + /* send a keydown and keyup even for the character */ + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift back up */ + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); + } +} + + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -396,7 +868,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposing (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* env, jclass cls, jstring name) { +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name) +{ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *hint = SDL_GetHint(utfname); @@ -406,6 +881,20 @@ JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* return result; } +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value) +{ + const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); + const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); + + SDL_setenv(utfname, utfvalue, 1); + + (*env)->ReleaseStringUTFChars(env, name, utfname); + (*env)->ReleaseStringUTFChars(env, value, utfvalue); + +} + /******************************************************************************* Functions called by SDL into Java *******************************************************************************/ @@ -466,20 +955,32 @@ ANativeWindow* Android_JNI_GetNativeWindow(void) s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface); anw = ANativeWindow_fromSurface(env, s); (*env)->DeleteLocalRef(env, s); - + return anw; } void Android_JNI_SetActivityTitle(const char *title) { - jmethodID mid; JNIEnv *mEnv = Android_JNI_GetEnv(); - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,"setActivityTitle","(Ljava/lang/String;)Z"); - if (mid) { - jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); - (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, mid, jtitle); - (*mEnv)->DeleteLocalRef(mEnv, jtitle); - } + + jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); + (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetActivityTitle, jtitle); + (*mEnv)->DeleteLocalRef(mEnv, jtitle); +} + +void Android_JNI_SetWindowStyle(SDL_bool fullscreen) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); +} + +void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + + jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : ""))); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); + (*mEnv)->DeleteLocalRef(mEnv, jhint); } SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) @@ -552,14 +1053,20 @@ int Android_JNI_SetupThread(void) /* * Audio support */ -static jboolean audioBuffer16Bit = JNI_FALSE; +static int audioBufferFormat = 0; static jobject audioBuffer = NULL; static void* audioBufferPinned = NULL; +static int captureBufferFormat = 0; +static jobject captureBuffer = NULL; -int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames) +int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec) { - jboolean audioBufferStereo; - int audioBufferFrames; + int audioformat; + int numBufferFrames; + jobject jbufobj = NULL; + jobject result; + int *resultElements; + jboolean isCopy; JNIEnv *env = Android_JNI_GetEnv(); @@ -568,52 +1075,155 @@ int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, i } Android_JNI_SetupThread(); - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device"); - audioBuffer16Bit = is16Bit; - audioBufferStereo = channelCount > 1; + switch (spec->format) { + case AUDIO_U8: + audioformat = ENCODING_PCM_8BIT; + break; + case AUDIO_S16: + audioformat = ENCODING_PCM_16BIT; + break; + case AUDIO_F32: + audioformat = ENCODING_PCM_FLOAT; + break; + default: + return SDL_SetError("Unsupported audio format: 0x%x", spec->format); + } - if ((*env)->CallStaticIntMethod(env, mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { - /* Error during audio initialization */ - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!"); - return 0; + if (iscapture) { + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for capture"); + result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midCaptureOpen, spec->freq, audioformat, spec->channels, spec->samples); + } else { + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output"); + result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midAudioOpen, spec->freq, audioformat, spec->channels, spec->samples); + } + if (result == NULL) { + /* Error during audio initialization, error printed from Java */ + return SDL_SetError("Java-side initialization failed"); } + if ((*env)->GetArrayLength(env, (jintArray)result) != 4) { + return SDL_SetError("Unexpected results from Java, expected 4, got %d", (*env)->GetArrayLength(env, (jintArray)result)); + } + isCopy = JNI_FALSE; + resultElements = (*env)->GetIntArrayElements(env, (jintArray)result, &isCopy); + spec->freq = resultElements[0]; + audioformat = resultElements[1]; + switch (audioformat) { + case ENCODING_PCM_8BIT: + spec->format = AUDIO_U8; + break; + case ENCODING_PCM_16BIT: + spec->format = AUDIO_S16; + break; + case ENCODING_PCM_FLOAT: + spec->format = AUDIO_F32; + break; + default: + return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); + } + spec->channels = resultElements[2]; + spec->samples = resultElements[3]; + (*env)->ReleaseIntArrayElements(env, (jintArray)result, resultElements, JNI_ABORT); + (*env)->DeleteLocalRef(env, result); + /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */ - - if (is16Bit) { - jshortArray audioBufferLocal = (*env)->NewShortArray(env, desiredBufferFrames * (audioBufferStereo ? 2 : 1)); - if (audioBufferLocal) { - audioBuffer = (*env)->NewGlobalRef(env, audioBufferLocal); - (*env)->DeleteLocalRef(env, audioBufferLocal); + switch (audioformat) { + case ENCODING_PCM_8BIT: + { + jbyteArray audioBufferLocal = (*env)->NewByteArray(env, spec->samples * spec->channels); + if (audioBufferLocal) { + jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); + (*env)->DeleteLocalRef(env, audioBufferLocal); + } } - } - else { - jbyteArray audioBufferLocal = (*env)->NewByteArray(env, desiredBufferFrames * (audioBufferStereo ? 2 : 1)); - if (audioBufferLocal) { - audioBuffer = (*env)->NewGlobalRef(env, audioBufferLocal); - (*env)->DeleteLocalRef(env, audioBufferLocal); + break; + case ENCODING_PCM_16BIT: + { + jshortArray audioBufferLocal = (*env)->NewShortArray(env, spec->samples * spec->channels); + if (audioBufferLocal) { + jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); + (*env)->DeleteLocalRef(env, audioBufferLocal); + } + } + break; + case ENCODING_PCM_FLOAT: + { + jfloatArray audioBufferLocal = (*env)->NewFloatArray(env, spec->samples * spec->channels); + if (audioBufferLocal) { + jbufobj = (*env)->NewGlobalRef(env, audioBufferLocal); + (*env)->DeleteLocalRef(env, audioBufferLocal); + } } + break; + default: + return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); } - if (audioBuffer == NULL) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer!"); - return 0; + if (jbufobj == NULL) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer"); + return SDL_OutOfMemory(); } - jboolean isCopy = JNI_FALSE; - if (audioBuffer16Bit) { - audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); - audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer); + if (iscapture) { + captureBufferFormat = audioformat; + captureBuffer = jbufobj; } else { - audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); - audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer); + audioBufferFormat = audioformat; + audioBuffer = jbufobj; + } + numBufferFrames = (*env)->GetArrayLength(env, (jarray)jbufobj); + + if (!iscapture) { + isCopy = JNI_FALSE; + + switch (audioformat) { + case ENCODING_PCM_8BIT: + audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); + break; + case ENCODING_PCM_16BIT: + audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); + break; + case ENCODING_PCM_FLOAT: + audioBufferPinned = (*env)->GetFloatArrayElements(env, (jfloatArray)audioBuffer, &isCopy); + break; + default: + return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); + } + } + return 0; +} + +int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi) +{ + JNIEnv *env = Android_JNI_GetEnv(); + + jobject jDisplayObj = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetDisplayDPI); + jclass jDisplayClass = (*env)->GetObjectClass(env, jDisplayObj); + + jfieldID fidXdpi = (*env)->GetFieldID(env, jDisplayClass, "xdpi", "F"); + jfieldID fidYdpi = (*env)->GetFieldID(env, jDisplayClass, "ydpi", "F"); + jfieldID fidDdpi = (*env)->GetFieldID(env, jDisplayClass, "densityDpi", "I"); + + float nativeXdpi = (*env)->GetFloatField(env, jDisplayObj, fidXdpi); + float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi); + int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi); + + + (*env)->DeleteLocalRef(env, jDisplayObj); + (*env)->DeleteLocalRef(env, jDisplayClass); + + if (ddpi) { + *ddpi = (float)nativeDdpi; } - if (audioBufferStereo) { - audioBufferFrames /= 2; + if (xdpi) { + *xdpi = nativeXdpi; + } + if (ydpi) { + *ydpi = nativeYdpi; } - return audioBufferFrames; + return 0; } void * Android_JNI_GetAudioBuffer(void) @@ -625,27 +1235,132 @@ void Android_JNI_WriteAudioBuffer(void) { JNIEnv *mAudioEnv = Android_JNI_GetEnv(); - if (audioBuffer16Bit) { - (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); - } else { + switch (audioBufferFormat) { + case ENCODING_PCM_8BIT: (*mAudioEnv)->ReleaseByteArrayElements(mAudioEnv, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); + break; + case ENCODING_PCM_16BIT: + (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); + break; + case ENCODING_PCM_FLOAT: + (*mAudioEnv)->ReleaseFloatArrayElements(mAudioEnv, (jfloatArray)audioBuffer, (jfloat *)audioBufferPinned, JNI_COMMIT); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteFloatBuffer, (jfloatArray)audioBuffer); + break; + default: + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled audio buffer format"); + break; } /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */ } -void Android_JNI_CloseAudioDevice(void) +int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) { JNIEnv *env = Android_JNI_GetEnv(); + jboolean isCopy = JNI_FALSE; + jint br; + + switch (captureBufferFormat) { + case ENCODING_PCM_8BIT: + SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == buflen); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); + if (br > 0) { + jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy); + SDL_memcpy(buffer, ptr, br); + (*env)->ReleaseByteArrayElements(env, (jbyteArray)captureBuffer, (jbyte *)ptr, JNI_ABORT); + } + break; + case ENCODING_PCM_16BIT: + SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == (buflen / sizeof(Sint16))); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); + if (br > 0) { + jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy); + br *= sizeof(Sint16); + SDL_memcpy(buffer, ptr, br); + (*env)->ReleaseShortArrayElements(env, (jshortArray)captureBuffer, (jshort *)ptr, JNI_ABORT); + } + break; + case ENCODING_PCM_FLOAT: + SDL_assert((*env)->GetArrayLength(env, (jfloatArray)captureBuffer) == (buflen / sizeof(float))); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_TRUE); + if (br > 0) { + jfloat *ptr = (*env)->GetFloatArrayElements(env, (jfloatArray)captureBuffer, &isCopy); + br *= sizeof(float); + SDL_memcpy(buffer, ptr, br); + (*env)->ReleaseFloatArrayElements(env, (jfloatArray)captureBuffer, (jfloat *)ptr, JNI_ABORT); + } + break; + default: + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: unhandled capture buffer format"); + break; + } + return br; +} - (*env)->CallStaticVoidMethod(env, mActivityClass, midAudioQuit); +void Android_JNI_FlushCapturedAudio(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); +#if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ + switch (captureBufferFormat) { + case ENCODING_PCM_8BIT: + { + const jint len = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer); + while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } + } + break; + case ENCODING_PCM_16BIT: + { + const jint len = (*env)->GetArrayLength(env, (jshortArray)captureBuffer); + while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } + } + break; + case ENCODING_PCM_FLOAT: + { + const jint len = (*env)->GetArrayLength(env, (jfloatArray)captureBuffer); + while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } + } + break; + default: + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled capture buffer format"); + break; + } +#else + switch (captureBufferFormat) { + case ENCODING_PCM_8BIT: + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); + break; + case ENCODING_PCM_16BIT: + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); + break; + case ENCODING_PCM_FLOAT: + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadFloatBuffer, (jfloatArray)captureBuffer, JNI_FALSE); + break; + default: + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: flushing unhandled capture buffer format"); + break; + } +#endif +} - if (audioBuffer) { - (*env)->DeleteGlobalRef(env, audioBuffer); - audioBuffer = NULL; - audioBufferPinned = NULL; +void Android_JNI_CloseAudioDevice(const int iscapture) +{ + JNIEnv *env = Android_JNI_GetEnv(); + + if (iscapture) { + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midCaptureClose); + if (captureBuffer) { + (*env)->DeleteGlobalRef(env, captureBuffer); + captureBuffer = NULL; + } + } else { + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose); + if (audioBuffer) { + (*env)->DeleteGlobalRef(env, audioBuffer); + audioBuffer = NULL; + audioBufferPinned = NULL; + } } } @@ -653,10 +1368,12 @@ void Android_JNI_CloseAudioDevice(void) /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { - SDL_assert(LocalReferenceHolder_IsActive()); JNIEnv *mEnv = Android_JNI_GetEnv(); + jthrowable exception; + + SDL_assert(LocalReferenceHolder_IsActive()); - jthrowable exception = (*mEnv)->ExceptionOccurred(mEnv); + exception = (*mEnv)->ExceptionOccurred(mEnv); if (exception != NULL) { jmethodID mid; @@ -666,13 +1383,16 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) if (!silent) { jclass exceptionClass = (*mEnv)->GetObjectClass(mEnv, exception); jclass classClass = (*mEnv)->FindClass(mEnv, "java/lang/Class"); + jstring exceptionName; + const char* exceptionNameUTF8; + jstring exceptionMessage; mid = (*mEnv)->GetMethodID(mEnv, classClass, "getName", "()Ljava/lang/String;"); - jstring exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); - const char* exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); + exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); + exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); mid = (*mEnv)->GetMethodID(mEnv, exceptionClass, "getMessage", "()Ljava/lang/String;"); - jstring exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); + exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); if (exceptionMessage != NULL) { const char* exceptionMessageUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionMessage, 0); @@ -717,10 +1437,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) ctx->hidden.androidio.position = 0; /* context = SDLActivity.getContext(); */ - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, mid); - + context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midGetContext); /* assetManager = context.getAssets(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), @@ -772,13 +1489,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { /* Try fallback to APK expansion files */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), - "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - if (!mid) { - SDL_SetError("No openAPKExpansionInputStream() in Java class"); - goto failure; /* Java class is missing the required method */ - } - inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString); + inputStream = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); /* Exception is checked first because it always needs to be cleared. * If no exception occurred then the last SDL error message is kept. @@ -796,7 +1507,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) * android/apis/content/ReadAsset.java imply that Android's * AssetInputStream.available() /will/ always return the total file size */ - + /* size = inputStream.available(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "available", "()I"); @@ -844,7 +1555,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) } } - + LocalReferenceHolder_Cleanup(&refs); return result; } @@ -855,9 +1566,10 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *mEnv = Android_JNI_GetEnv(); int retval; + jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return -1; } @@ -866,7 +1578,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, return -1; } - jstring fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); + fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); ctx->hidden.androidio.fileNameRef = (*mEnv)->NewGlobalRef(mEnv, fileNameJString); ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; @@ -885,10 +1597,11 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, if (ctx->hidden.androidio.assetFileDescriptorRef) { size_t bytesMax = size * maxnum; + size_t result; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) { bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position; } - size_t result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); + result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); if (result > 0) { ctx->hidden.androidio.position += result; LocalReferenceHolder_Cleanup(&refs); @@ -900,26 +1613,30 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, jlong bytesRemaining = (jlong) (size * maxnum); jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); int bytesRead = 0; + JNIEnv *mEnv; + jobject readableByteChannel; + jmethodID readMethod; + jobject byteBuffer; /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; - JNIEnv *mEnv = Android_JNI_GetEnv(); + mEnv = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } - jobject readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; - jmethodID readMethod = (jmethodID)ctx->hidden.androidio.readMethod; - jobject byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); + readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; + readMethod = (jmethodID)ctx->hidden.androidio.readMethod; + byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); while (bytesRemaining > 0) { /* result = readableByteChannel.read(...); */ int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } @@ -931,7 +1648,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, bytesRead += result; ctx->hidden.androidio.position += result; } - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return bytesRead / size; } } @@ -1002,6 +1719,7 @@ Sint64 Android_JNI_FileSize(SDL_RWops* ctx) Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { + off_t ret; switch (whence) { case RW_SEEK_SET: if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; @@ -1020,11 +1738,12 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) } whence = SEEK_SET; - off_t ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); + ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); if (ret == -1) return -1; ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset; } else { Sint64 newPosition; + Sint64 movement; switch (whence) { case RW_SEEK_SET: @@ -1048,17 +1767,18 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) newPosition = ctx->hidden.androidio.size; } - Sint64 movement = newPosition - ctx->hidden.androidio.position; + movement = newPosition - ctx->hidden.androidio.position; if (movement > 0) { unsigned char buffer[4096]; /* The easy case where we're seeking forwards */ while (movement > 0) { Sint64 amount = sizeof (buffer); + size_t result; if (amount > movement) { amount = movement; } - size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount); + result = Android_JNI_FileRead(ctx, buffer, 1, amount); if (result <= 0) { /* Failed to read/skip the required amount, so fail */ return -1; @@ -1085,106 +1805,41 @@ int Android_JNI_FileClose(SDL_RWops* ctx) return Internal_Android_JNI_FileClose(ctx, SDL_TRUE); } -/* returns a new global reference which needs to be released later */ -static jobject Android_JNI_GetSystemServiceObject(const char* name) -{ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); - JNIEnv* env = Android_JNI_GetEnv(); - jobject retval = NULL; - - if (!LocalReferenceHolder_Init(&refs, env)) { - LocalReferenceHolder_Cleanup(&refs); - return NULL; - } - - jstring service = (*env)->NewStringUTF(env, name); - - jmethodID mid; - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - jobject context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); - - mid = (*env)->GetMethodID(env, mActivityClass, "getSystemServiceFromUiThread", "(Ljava/lang/String;)Ljava/lang/Object;"); - jobject manager = (*env)->CallObjectMethod(env, context, mid, service); - - (*env)->DeleteLocalRef(env, service); - - retval = manager ? (*env)->NewGlobalRef(env, manager) : NULL; - LocalReferenceHolder_Cleanup(&refs); - return retval; -} - -#define SETUP_CLIPBOARD(error) \ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); \ - JNIEnv* env = Android_JNI_GetEnv(); \ - if (!LocalReferenceHolder_Init(&refs, env)) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } \ - jobject clipboard = Android_JNI_GetSystemServiceObject("clipboard"); \ - if (!clipboard) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } - -#define CLEANUP_CLIPBOARD() \ - LocalReferenceHolder_Cleanup(&refs); - int Android_JNI_SetClipboardText(const char* text) { - SETUP_CLIPBOARD(-1) - - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "setText", "(Ljava/lang/CharSequence;)V"); + JNIEnv* env = Android_JNI_GetEnv(); jstring string = (*env)->NewStringUTF(env, text); - (*env)->CallVoidMethod(env, clipboard, mid, string); - (*env)->DeleteGlobalRef(env, clipboard); + (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); (*env)->DeleteLocalRef(env, string); - - CLEANUP_CLIPBOARD(); - return 0; } char* Android_JNI_GetClipboardText(void) { - SETUP_CLIPBOARD(SDL_strdup("")) - - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "getText", "()Ljava/lang/CharSequence;"); - jobject sequence = (*env)->CallObjectMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - if (sequence) { - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, sequence), "toString", "()Ljava/lang/String;"); - jstring string = (jstring)((*env)->CallObjectMethod(env, sequence, mid)); + JNIEnv* env = Android_JNI_GetEnv(); + char* text = NULL; + jstring string; + + string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); + if (string) { const char* utf = (*env)->GetStringUTFChars(env, string, 0); if (utf) { - char* text = SDL_strdup(utf); + text = SDL_strdup(utf); (*env)->ReleaseStringUTFChars(env, string, utf); - - CLEANUP_CLIPBOARD(); - - return text; } + (*env)->DeleteLocalRef(env, string); } - - CLEANUP_CLIPBOARD(); - - return SDL_strdup(""); + + return (text == NULL) ? SDL_strdup("") : text; } SDL_bool Android_JNI_HasClipboardText(void) { - SETUP_CLIPBOARD(SDL_FALSE) - - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "hasText", "()Z"); - jboolean has = (*env)->CallBooleanMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - - CLEANUP_CLIPBOARD(); - - return has ? SDL_TRUE : SDL_FALSE; + JNIEnv* env = Android_JNI_GetEnv(); + jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); + return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE; } - /* returns 0 on success or -1 on error (others undefined then) * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available @@ -1193,49 +1848,61 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv* env = Android_JNI_GetEnv(); + jmethodID mid; + jobject context; + jstring action; + jclass cls; + jobject filter; + jobject intent; + jstring iname; + jmethodID imid; + jstring bname; + jmethodID bmid; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } - jmethodID mid; - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - jobject context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); - jstring action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); + action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); - jclass cls = (*env)->FindClass(env, "android/content/IntentFilter"); + cls = (*env)->FindClass(env, "android/content/IntentFilter"); mid = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V"); - jobject filter = (*env)->NewObject(env, cls, mid, action); + filter = (*env)->NewObject(env, cls, mid, action); (*env)->DeleteLocalRef(env, action); mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;"); - jobject intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); + intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); (*env)->DeleteLocalRef(env, filter); cls = (*env)->GetObjectClass(env, intent); - jstring iname; - jmethodID imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); + imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); + /* Watch out for C89 scoping rules because of the macro */ #define GET_INT_EXTRA(var, key) \ + int var; \ iname = (*env)->NewStringUTF(env, key); \ - int var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ + var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ (*env)->DeleteLocalRef(env, iname); - jstring bname; - jmethodID bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); + bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); + /* Watch out for C89 scoping rules because of the macro */ #define GET_BOOL_EXTRA(var, key) \ + int var; \ bname = (*env)->NewStringUTF(env, key); \ - int var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ + var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ (*env)->DeleteLocalRef(env, bname); if (plugged) { + /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */ if (plug == -1) { LocalReferenceHolder_Cleanup(&refs); @@ -1247,6 +1914,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } if (charged) { + /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */ if (status == -1) { LocalReferenceHolder_Cleanup(&refs); @@ -1266,8 +1934,20 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } if (percent) { - GET_INT_EXTRA(level, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ - GET_INT_EXTRA(scale, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ + int level; + int scale; + + /* Watch out for C89 scoping rules because of the macro */ + { + GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ + level = level_temp; + } + /* Watch out for C89 scoping rules because of the macro */ + { + GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ + scale = scale_temp; + } + if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; @@ -1285,8 +1965,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco int Android_JNI_GetTouchDeviceIds(int **ids) { JNIEnv *env = Android_JNI_GetEnv(); jint sources = 4098; /* == InputDevice.SOURCE_TOUCHSCREEN */ - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "inputGetInputDeviceIds", "(I)[I"); - jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, mid, sources); + jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, midInputGetInputDeviceIds, sources); int number = 0; *ids = NULL; if (array) { @@ -1307,10 +1986,35 @@ int Android_JNI_GetTouchDeviceIds(int **ids) { return number; } +/* sets the mSeparateMouseAndTouch field */ +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE); +} + void Android_JNI_PollInputDevices(void) { JNIEnv *env = Android_JNI_GetEnv(); - (*env)->CallStaticVoidMethod(env, mActivityClass, midPollInputDevices); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices); +} + +void Android_JNI_PollHapticDevices(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices); +} + +void Android_JNI_HapticRun(int device_id, float intensity, int length) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, intensity, length); +} + +void Android_JNI_HapticStop(int device_id) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticStop, device_id); } /* See SDLActivity.java for constants. */ @@ -1320,14 +2024,8 @@ void Android_JNI_PollInputDevices(void) int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); - if (!env) { - return -1; - } - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); - if (!mid) { - return -1; - } - jboolean success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); + jboolean success; + success = (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param); return success ? 0 : -1; } @@ -1339,15 +2037,7 @@ void Android_JNI_SuspendScreenSaver(SDL_bool suspend) void Android_JNI_ShowTextInput(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); - if (!env) { - return; - } - - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); - if (!mid) { - return; - } - (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, + (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, inputRect->x, inputRect->y, inputRect->w, @@ -1361,6 +2051,15 @@ void Android_JNI_HideTextInput(void) Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); } +SDL_bool Android_JNI_IsScreenKeyboardShown() +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + jboolean is_shown = 0; + is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midIsScreenKeyboardShown); + return is_shown; +} + + int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { JNIEnv *env; @@ -1415,11 +2114,8 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu (*env)->DeleteLocalRef(env, clazz); - /* call function */ - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;"); - - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); clazz = (*env)->GetObjectClass(env, context); @@ -1456,31 +2152,55 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu ////////////////////////////////////////////////////////////////////////////// */ -void *SDL_AndroidGetJNIEnv() +void *SDL_AndroidGetJNIEnv(void) { return Android_JNI_GetEnv(); } - - -void *SDL_AndroidGetActivity() +void *SDL_AndroidGetActivity(void) { /* See SDL_system.h for caveats on using this function. */ - jmethodID mid; - JNIEnv *env = Android_JNI_GetEnv(); if (!env) { return NULL; } /* return SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - return (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); +} + +SDL_bool SDL_IsAndroidTablet(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsTablet); } -const char * SDL_AndroidGetInternalStoragePath() +SDL_bool SDL_IsAndroidTV(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); +} + +SDL_bool SDL_IsChromebook(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsChromebook); +} + +SDL_bool SDL_IsDeXMode(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode); +} + +void SDL_AndroidBackButton(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton); +} + +const char * SDL_AndroidGetInternalStoragePath(void) { static char *s_AndroidInternalFilesPath = NULL; @@ -1499,9 +2219,12 @@ const char * SDL_AndroidGetInternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); + if (!context) { + SDL_SetError("Couldn't get Android context!"); + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } /* fileObj = context.getFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1513,10 +2236,14 @@ const char * SDL_AndroidGetInternalStoragePath() return NULL; } - /* path = fileObject.getAbsolutePath(); */ + /* path = fileObject.getCanonicalPath(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), - "getAbsolutePath", "()Ljava/lang/String;"); + "getCanonicalPath", "()Ljava/lang/String;"); pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); + if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } path = (*env)->GetStringUTFChars(env, pathString, NULL); s_AndroidInternalFilesPath = SDL_strdup(path); @@ -1527,7 +2254,7 @@ const char * SDL_AndroidGetInternalStoragePath() return s_AndroidInternalFilesPath; } -int SDL_AndroidGetExternalStorageState() +int SDL_AndroidGetExternalStorageState(void) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; @@ -1566,7 +2293,7 @@ int SDL_AndroidGetExternalStorageState() return stateFlags; } -const char * SDL_AndroidGetExternalStoragePath() +const char * SDL_AndroidGetExternalStoragePath(void) { static char *s_AndroidExternalFilesPath = NULL; @@ -1585,9 +2312,7 @@ const char * SDL_AndroidGetExternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* fileObj = context.getExternalFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1613,12 +2338,64 @@ const char * SDL_AndroidGetExternalStoragePath() return s_AndroidExternalFilesPath; } -jclass Android_JNI_GetActivityClass(void) +void Android_JNI_GetManifestEnvironmentVariables(void) +{ + if (!mActivityClass || !midGetManifestEnvironmentVariables) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready"); + return; + } + + if (!bHasEnvironmentVariables) { + JNIEnv *env = Android_JNI_GetEnv(); + SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables); + if (ret) { + bHasEnvironmentVariables = SDL_TRUE; + } + } +} + +int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y) { - return mActivityClass; + JNIEnv *mEnv = Android_JNI_GetEnv(); + int custom_cursor = 0; + jintArray pixels; + pixels = (*mEnv)->NewIntArray(mEnv, surface->w * surface->h); + if (pixels) { + (*mEnv)->SetIntArrayRegion(mEnv, pixels, 0, surface->w * surface->h, (int *)surface->pixels); + custom_cursor = (*mEnv)->CallStaticIntMethod(mEnv, mActivityClass, midCreateCustomCursor, pixels, surface->w, surface->h, hot_x, hot_y); + (*mEnv)->DeleteLocalRef(mEnv, pixels); + } else { + SDL_OutOfMemory(); + } + return custom_cursor; } + +SDL_bool Android_JNI_SetCustomCursor(int cursorID) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetCustomCursor, cursorID); +} + +SDL_bool Android_JNI_SetSystemCursor(int cursorID) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetSystemCursor, cursorID); +} + +SDL_bool Android_JNI_SupportsRelativeMouse() +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSupportsRelativeMouse); +} + +SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + return (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetRelativeMouseEnabled, (enabled == 1)); +} + + #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/core/android/SDL_android.h b/3rdparty/sdl2-2.0.9/src/core/android/SDL_android.h similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/core/android/SDL_android.h rename to 3rdparty/sdl2-2.0.9/src/core/android/SDL_android.h index 8e2ab93c3e..b2ff32ea65 100644 --- a/3rdparty/sdl2-2.0.4/src/core/android/SDL_android.h +++ b/3rdparty/sdl2-2.0.9/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "SDL_system.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -30,20 +31,33 @@ extern "C" { #include #include +#include "SDL_audio.h" #include "SDL_rect.h" /* Interface from the SDL library into the Android Java activity */ extern void Android_JNI_SetActivityTitle(const char *title); +extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen); +extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); + extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); extern void Android_JNI_HideTextInput(void); +extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow* Android_JNI_GetNativeWindow(void); +extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi); + /* Audio support */ -extern int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames); +extern int Android_JNI_OpenAudioDevice(int iscapture, SDL_AudioSpec *spec); extern void* Android_JNI_GetAudioBuffer(void); extern void Android_JNI_WriteAudioBuffer(void); -extern void Android_JNI_CloseAudioDevice(void); +extern int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen); +extern void Android_JNI_FlushCapturedAudio(void); +extern void Android_JNI_CloseAudioDevice(const int iscapture); + +/* Detecting device type */ +extern SDL_bool Android_IsDeXMode(); +extern SDL_bool Android_IsChromebook(); #include "SDL_rwops.h" @@ -54,6 +68,9 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t ma size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num); int Android_JNI_FileClose(SDL_RWops* ctx); +/* Environment support */ +void Android_JNI_GetManifestEnvironmentVariables(void); + /* Clipboard support */ int Android_JNI_SetClipboardText(const char* text); char* Android_JNI_GetClipboardText(void); @@ -65,21 +82,49 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco /* Joystick support */ void Android_JNI_PollInputDevices(void); +/* Haptic support */ +void Android_JNI_PollHapticDevices(void); +void Android_JNI_HapticRun(int device_id, float intensity, int length); +void Android_JNI_HapticStop(int device_id); + /* Video */ void Android_JNI_SuspendScreenSaver(SDL_bool suspend); /* Touch support */ +int Android_JNI_InitTouch(void); +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value); int Android_JNI_GetTouchDeviceIds(int **ids); /* Threads */ #include JNIEnv *Android_JNI_GetEnv(void); int Android_JNI_SetupThread(void); -jclass Android_JNI_GetActivityClass(void); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); +/* Init */ +JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls); + +/* MessageBox */ +#include "SDL_messagebox.h" +int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +/* Cursor support */ +int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y); +SDL_bool Android_JNI_SetCustomCursor(int cursorID); +SDL_bool Android_JNI_SetSystemCursor(int cursorID); + +/* Relative mouse support */ +SDL_bool Android_JNI_SupportsRelativeMouse(void); +SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled); + + +SDL_bool SDL_IsAndroidTablet(void); +SDL_bool SDL_IsAndroidTV(void); +SDL_bool SDL_IsChromebook(void); +SDL_bool SDL_IsDeXMode(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/3rdparty/sdl2-2.0.9/src/core/android/keyinfotable.h b/3rdparty/sdl2-2.0.9/src/core/android/keyinfotable.h new file mode 100644 index 0000000000..4437121e85 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/android/keyinfotable.h @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _ANDROID_KeyInfo +#define _ANDROID_KeyInfo + +#include "SDL_scancode.h" +#include "SDL_keycode.h" + +/* + This file is used by the keyboard code in SDL_uikitview.m to convert between characters + passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. + For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower + case a. +*/ + +typedef struct +{ + SDL_Scancode code; + uint16_t mod; +} AndroidKeyInfo; + +/* So far only ASCII characters here */ +static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = { +/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 13 */ { SDL_SCANCODE_RETURN, 0 }, +/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 32 */ { SDL_SCANCODE_SPACE, 0 }, +/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ +/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ +/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ +/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ +/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ +/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ +/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ +/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ +/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ +/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ +/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ +/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ +/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ +/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ +/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ +/* 48 */ { SDL_SCANCODE_0, 0 }, +/* 49 */ { SDL_SCANCODE_1, 0 }, +/* 50 */ { SDL_SCANCODE_2, 0 }, +/* 51 */ { SDL_SCANCODE_3, 0 }, +/* 52 */ { SDL_SCANCODE_4, 0 }, +/* 53 */ { SDL_SCANCODE_5, 0 }, +/* 54 */ { SDL_SCANCODE_6, 0 }, +/* 55 */ { SDL_SCANCODE_7, 0 }, +/* 56 */ { SDL_SCANCODE_8, 0 }, +/* 57 */ { SDL_SCANCODE_9, 0 }, +/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ +/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, +/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ +/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, +/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ +/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ +/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ +/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ +/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, +/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, +/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, +/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, +/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, +/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, +/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, +/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, +/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, +/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, +/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, +/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, +/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, +/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, +/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, +/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, +/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, +/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, +/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, +/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, +/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, +/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, +/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, +/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, +/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, +/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, +/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, +/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, +/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ +/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ +/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ +/* 97 */ { SDL_SCANCODE_A, 0 }, +/* 98 */ { SDL_SCANCODE_B, 0 }, +/* 99 */ { SDL_SCANCODE_C, 0 }, +/* 100 */{ SDL_SCANCODE_D, 0 }, +/* 101 */{ SDL_SCANCODE_E, 0 }, +/* 102 */{ SDL_SCANCODE_F, 0 }, +/* 103 */{ SDL_SCANCODE_G, 0 }, +/* 104 */{ SDL_SCANCODE_H, 0 }, +/* 105 */{ SDL_SCANCODE_I, 0 }, +/* 106 */{ SDL_SCANCODE_J, 0 }, +/* 107 */{ SDL_SCANCODE_K, 0 }, +/* 108 */{ SDL_SCANCODE_L, 0 }, +/* 109 */{ SDL_SCANCODE_M, 0 }, +/* 110 */{ SDL_SCANCODE_N, 0 }, +/* 111 */{ SDL_SCANCODE_O, 0 }, +/* 112 */{ SDL_SCANCODE_P, 0 }, +/* 113 */{ SDL_SCANCODE_Q, 0 }, +/* 114 */{ SDL_SCANCODE_R, 0 }, +/* 115 */{ SDL_SCANCODE_S, 0 }, +/* 116 */{ SDL_SCANCODE_T, 0 }, +/* 117 */{ SDL_SCANCODE_U, 0 }, +/* 118 */{ SDL_SCANCODE_V, 0 }, +/* 119 */{ SDL_SCANCODE_W, 0 }, +/* 120 */{ SDL_SCANCODE_X, 0 }, +/* 121 */{ SDL_SCANCODE_Y, 0 }, +/* 122 */{ SDL_SCANCODE_Z, 0 }, +/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ +/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ +/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ +/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ +/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } +}; + +#endif /* _ANDROID_KeyInfo */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.c new file mode 100644 index 0000000000..e0d99725df --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.c @@ -0,0 +1,347 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" +#include "SDL_dbus.h" + +#if SDL_USE_LIBDBUS +/* we never link directly to libdbus. */ +#include "SDL_loadso.h" +static const char *dbus_library = "libdbus-1.so.3"; +static void *dbus_handle = NULL; +static unsigned int screensaver_cookie = 0; +static SDL_DBusContext dbus; + +static int +LoadDBUSSyms(void) +{ + #define SDL_DBUS_SYM2(x, y) \ + if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1 + + #define SDL_DBUS_SYM(x) \ + SDL_DBUS_SYM2(x, dbus_##x) + + SDL_DBUS_SYM(bus_get_private); + SDL_DBUS_SYM(bus_register); + SDL_DBUS_SYM(bus_add_match); + SDL_DBUS_SYM(connection_open_private); + SDL_DBUS_SYM(connection_set_exit_on_disconnect); + SDL_DBUS_SYM(connection_get_is_connected); + SDL_DBUS_SYM(connection_add_filter); + SDL_DBUS_SYM(connection_try_register_object_path); + SDL_DBUS_SYM(connection_send); + SDL_DBUS_SYM(connection_send_with_reply_and_block); + SDL_DBUS_SYM(connection_close); + SDL_DBUS_SYM(connection_unref); + SDL_DBUS_SYM(connection_flush); + SDL_DBUS_SYM(connection_read_write); + SDL_DBUS_SYM(connection_dispatch); + SDL_DBUS_SYM(message_is_signal); + SDL_DBUS_SYM(message_new_method_call); + SDL_DBUS_SYM(message_append_args); + SDL_DBUS_SYM(message_append_args_valist); + SDL_DBUS_SYM(message_get_args); + SDL_DBUS_SYM(message_get_args_valist); + SDL_DBUS_SYM(message_iter_init); + SDL_DBUS_SYM(message_iter_next); + SDL_DBUS_SYM(message_iter_get_basic); + SDL_DBUS_SYM(message_iter_get_arg_type); + SDL_DBUS_SYM(message_iter_recurse); + SDL_DBUS_SYM(message_unref); + SDL_DBUS_SYM(error_init); + SDL_DBUS_SYM(error_is_set); + SDL_DBUS_SYM(error_free); + SDL_DBUS_SYM(get_local_machine_id); + SDL_DBUS_SYM(free); + SDL_DBUS_SYM(free_string_array); + SDL_DBUS_SYM(shutdown); + + #undef SDL_DBUS_SYM + #undef SDL_DBUS_SYM2 + + return 0; +} + +static void +UnloadDBUSLibrary(void) +{ + if (dbus_handle != NULL) { + SDL_UnloadObject(dbus_handle); + dbus_handle = NULL; + } +} + +static int +LoadDBUSLibrary(void) +{ + int retval = 0; + if (dbus_handle == NULL) { + dbus_handle = SDL_LoadObject(dbus_library); + if (dbus_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = LoadDBUSSyms(); + if (retval < 0) { + UnloadDBUSLibrary(); + } + } + } + + return retval; +} + +void +SDL_DBus_Init(void) +{ + if (!dbus.session_conn && LoadDBUSLibrary() != -1) { + DBusError err; + dbus.error_init(&err); + dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); + if (!dbus.error_is_set(&err)) { + dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); + } + if (dbus.error_is_set(&err)) { + dbus.error_free(&err); + SDL_DBus_Quit(); + return; /* oh well */ + } + dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); + dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); + } +} + +void +SDL_DBus_Quit(void) +{ + if (dbus.system_conn) { + dbus.connection_close(dbus.system_conn); + dbus.connection_unref(dbus.system_conn); + } + if (dbus.session_conn) { + dbus.connection_close(dbus.session_conn); + dbus.connection_unref(dbus.session_conn); + } +/* Don't do this - bug 3950 + dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. +*/ +#if 0 + if (dbus.shutdown) { + dbus.shutdown(); + } +#endif + SDL_zero(dbus); + UnloadDBUSLibrary(); +} + +SDL_DBusContext * +SDL_DBus_GetContext(void) +{ + if(!dbus_handle || !dbus.session_conn){ + SDL_DBus_Init(); + } + + if(dbus_handle && dbus.session_conn){ + return &dbus; + } else { + return NULL; + } +} + +static SDL_bool +SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg; + va_list ap_reply; + va_copy(ap_reply, ap); /* copy the arg list so we don't compete with D-Bus for it */ + firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + /* skip any input args, get to output args. */ + while ((firstarg = va_arg(ap_reply, int)) != DBUS_TYPE_INVALID) { + /* we assume D-Bus already validated all this. */ + { void *dumpptr = va_arg(ap_reply, void*); (void) dumpptr; } + if (firstarg == DBUS_TYPE_ARRAY) { + { const int dumpint = va_arg(ap_reply, int); (void) dumpint; } + } + } + firstarg = va_arg(ap_reply, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap_reply)) { + retval = SDL_TRUE; + } + dbus.message_unref(reply); + } + } + va_end(ap_reply); + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +static SDL_bool +SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + if (dbus.connection_send(conn, msg, NULL)) { + dbus.connection_flush(conn); + retval = SDL_TRUE; + } + } + + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get"); + if (msg) { + if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + DBusMessageIter iter, sub; + dbus.message_iter_init(reply, &iter); + if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { + dbus.message_iter_recurse(&iter, &sub); + if (dbus.message_iter_get_arg_type(&sub) == expectedtype) { + dbus.message_iter_get_basic(&sub, result); + retval = SDL_TRUE; + } + } + dbus.message_unref(reply); + } + } + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); +} + + +void +SDL_DBus_ScreensaverTickle(void) +{ + SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); +} + +SDL_bool +SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) +{ + if ( (inhibit && (screensaver_cookie != 0)) || (!inhibit && (screensaver_cookie == 0)) ) { + return SDL_TRUE; + } else { + const char *node = "org.freedesktop.ScreenSaver"; + const char *path = "/org/freedesktop/ScreenSaver"; + const char *interface = "org.freedesktop.ScreenSaver"; + + if (inhibit) { + const char *app = "My SDL application"; + const char *reason = "Playing a game"; + if (!SDL_DBus_CallMethod(node, path, interface, "Inhibit", + DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + return (screensaver_cookie != 0) ? SDL_TRUE : SDL_FALSE; + } else { + if (!SDL_DBus_CallVoidMethod(node, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + screensaver_cookie = 0; + } + } + + return SDL_TRUE; +} +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.h similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.h rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.h index c064381a0c..aa787f223c 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_dbus.h +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_dbus_h -#define _SDL_dbus_h +#ifndef SDL_dbus_h_ +#define SDL_dbus_h_ #ifdef HAVE_DBUS_DBUS_H #define SDL_USE_LIBDBUS 1 @@ -32,15 +32,15 @@ typedef struct SDL_DBusContext { DBusConnection *session_conn; + DBusConnection *system_conn; DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); void (*bus_add_match)(DBusConnection *, const char *, DBusError *); DBusConnection * (*connection_open_private)(const char *, DBusError *); void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); - dbus_bool_t (*connection_get_is_connected)(DBusConnection *); - dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, - void *, DBusFreeFunction); + dbus_bool_t (*connection_get_is_connected)(DBusConnection *); + dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction); dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *, const DBusObjectPathVTable *, void *, DBusError *); dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *); @@ -50,21 +50,24 @@ typedef struct SDL_DBusContext { void (*connection_flush)(DBusConnection *); dbus_bool_t (*connection_read_write)(DBusConnection *, int); DBusDispatchStatus (*connection_dispatch)(DBusConnection *); - dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); + dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); + dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); + dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); dbus_bool_t (*message_iter_next)(DBusMessageIter *); void (*message_iter_get_basic)(DBusMessageIter *, void *); int (*message_iter_get_arg_type)(DBusMessageIter *); - void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); + void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); void (*message_unref)(DBusMessage *); void (*error_init)(DBusError *); dbus_bool_t (*error_is_set)(const DBusError *); void (*error_free)(DBusError *); char *(*get_local_machine_id)(void); void (*free)(void *); + void (*free_string_array)(char **); void (*shutdown)(void); } SDL_DBusContext; @@ -72,11 +75,22 @@ typedef struct SDL_DBusContext { extern void SDL_DBus_Init(void); extern void SDL_DBus_Quit(void); extern SDL_DBusContext * SDL_DBus_GetContext(void); + +/* These use the built-in Session connection. */ +extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + +/* These use whatever connection you like. */ +extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + extern void SDL_DBus_ScreensaverTickle(void); extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit); #endif /* HAVE_DBUS_DBUS_H */ -#endif /* _SDL_dbus_h */ +#endif /* SDL_dbus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.c new file mode 100644 index 0000000000..5443c21985 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.c @@ -0,0 +1,699 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_INPUT_LINUXEV + +/* This is based on the linux joystick driver */ +/* References: https://www.kernel.org/doc/Documentation/input/input.txt + * https://www.kernel.org/doc/Documentation/input/event-codes.txt + * /usr/include/linux/input.h + * The evtest application is also useful to debug the protocol + */ + +#include "SDL_evdev.h" +#include "SDL_evdev_kbd.h" + +#include +#include +#include +#include +#include + +#include "SDL.h" +#include "SDL_assert.h" +#include "SDL_endian.h" +#include "SDL_scancode.h" +#include "../../events/SDL_events_c.h" +#include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ +#include "../../core/linux/SDL_udev.h" + +/* These are not defined in older Linux kernel headers */ +#ifndef SYN_DROPPED +#define SYN_DROPPED 3 +#endif +#ifndef ABS_MT_SLOT +#define ABS_MT_SLOT 0x2f +#define ABS_MT_POSITION_X 0x35 +#define ABS_MT_POSITION_Y 0x36 +#define ABS_MT_TRACKING_ID 0x39 +#endif + +typedef struct SDL_evdevlist_item +{ + char *path; + int fd; + + /* TODO: use this for every device, not just touchscreen */ + int out_of_sync; + + /* TODO: expand on this to have data for every possible class (mouse, + keyboard, touchpad, etc.). Also there's probably some things in here we + can pull out to the SDL_evdevlist_item i.e. name */ + int is_touchscreen; + struct { + char* name; + + int min_x, max_x, range_x; + int min_y, max_y, range_y; + + int max_slots; + int current_slot; + struct { + enum { + EVDEV_TOUCH_SLOTDELTA_NONE = 0, + EVDEV_TOUCH_SLOTDELTA_DOWN, + EVDEV_TOUCH_SLOTDELTA_UP, + EVDEV_TOUCH_SLOTDELTA_MOVE + } delta; + int tracking_id; + int x, y; + } * slots; + } * touchscreen_data; + + struct SDL_evdevlist_item *next; +} SDL_evdevlist_item; + +typedef struct SDL_EVDEV_PrivateData +{ + int ref_count; + int num_devices; + SDL_evdevlist_item *first; + SDL_evdevlist_item *last; + SDL_EVDEV_keyboard_state *kbd; +} SDL_EVDEV_PrivateData; + +#undef _THIS +#define _THIS SDL_EVDEV_PrivateData *_this +static _THIS = NULL; + +static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode); +static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); +static int SDL_EVDEV_device_removed(const char *dev_path); + +#if SDL_USE_LIBUDEV +static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, + const char *dev_path); +#endif /* SDL_USE_LIBUDEV */ + +static Uint8 EVDEV_MouseButtons[] = { + SDL_BUTTON_LEFT, /* BTN_LEFT 0x110 */ + SDL_BUTTON_RIGHT, /* BTN_RIGHT 0x111 */ + SDL_BUTTON_MIDDLE, /* BTN_MIDDLE 0x112 */ + SDL_BUTTON_X1, /* BTN_SIDE 0x113 */ + SDL_BUTTON_X2, /* BTN_EXTRA 0x114 */ + SDL_BUTTON_X2 + 1, /* BTN_FORWARD 0x115 */ + SDL_BUTTON_X2 + 2, /* BTN_BACK 0x116 */ + SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ +}; + +int +SDL_EVDEV_Init(void) +{ + if (_this == NULL) { + _this = (SDL_EVDEV_PrivateData*)SDL_calloc(1, sizeof(*_this)); + if (_this == NULL) { + return SDL_OutOfMemory(); + } + +#if SDL_USE_LIBUDEV + if (SDL_UDEV_Init() < 0) { + SDL_free(_this); + _this = NULL; + return -1; + } + + /* Set up the udev callback */ + if (SDL_UDEV_AddCallback(SDL_EVDEV_udev_callback) < 0) { + SDL_UDEV_Quit(); + SDL_free(_this); + _this = NULL; + return -1; + } + + /* Force a scan to build the initial device list */ + SDL_UDEV_Scan(); +#else + /* TODO: Scan the devices manually, like a caveman */ +#endif /* SDL_USE_LIBUDEV */ + + _this->kbd = SDL_EVDEV_kbd_init(); + } + + _this->ref_count += 1; + + return 0; +} + +void +SDL_EVDEV_Quit(void) +{ + if (_this == NULL) { + return; + } + + _this->ref_count -= 1; + + if (_this->ref_count < 1) { +#if SDL_USE_LIBUDEV + SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); + SDL_UDEV_Quit(); +#endif /* SDL_USE_LIBUDEV */ + + SDL_EVDEV_kbd_quit(_this->kbd); + + /* Remove existing devices */ + while(_this->first != NULL) { + SDL_EVDEV_device_removed(_this->first->path); + } + + SDL_assert(_this->first == NULL); + SDL_assert(_this->last == NULL); + SDL_assert(_this->num_devices == 0); + + SDL_free(_this); + _this = NULL; + } +} + +#if SDL_USE_LIBUDEV +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, + const char* dev_path) +{ + if (dev_path == NULL) { + return; + } + + switch(udev_event) { + case SDL_UDEV_DEVICEADDED: + if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | + SDL_UDEV_DEVICE_TOUCHSCREEN))) + return; + + SDL_EVDEV_device_added(dev_path, udev_class); + break; + case SDL_UDEV_DEVICEREMOVED: + SDL_EVDEV_device_removed(dev_path); + break; + default: + break; + } +} +#endif /* SDL_USE_LIBUDEV */ + +void +SDL_EVDEV_Poll(void) +{ + struct input_event events[32]; + int i, j, len; + SDL_evdevlist_item *item; + SDL_Scancode scan_code; + int mouse_button; + SDL_Mouse *mouse; + float norm_x, norm_y; + + if (!_this) { + return; + } + +#if SDL_USE_LIBUDEV + SDL_UDEV_Poll(); +#endif + + mouse = SDL_GetMouse(); + + for (item = _this->first; item != NULL; item = item->next) { + while ((len = read(item->fd, events, (sizeof events))) > 0) { + len /= sizeof(events[0]); + for (i = 0; i < len; ++i) { + /* special handling for touchscreen, that should eventually be + used for all devices */ + if (item->out_of_sync && item->is_touchscreen && + events[i].type == EV_SYN && events[i].code != SYN_REPORT) { + break; + } + + switch (events[i].type) { + case EV_KEY: + if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { + mouse_button = events[i].code - BTN_MOUSE; + if (events[i].value == 0) { + SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); + } else if (events[i].value == 1) { + SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); + } + break; + } + + /* Probably keyboard */ + scan_code = SDL_EVDEV_translate_keycode(events[i].code); + if (scan_code != SDL_SCANCODE_UNKNOWN) { + if (events[i].value == 0) { + SDL_SendKeyboardKey(SDL_RELEASED, scan_code); + } else if (events[i].value == 1 || events[i].value == 2 /* key repeated */) { + SDL_SendKeyboardKey(SDL_PRESSED, scan_code); + } + } + SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value); + break; + case EV_ABS: + switch(events[i].code) { + case ABS_MT_SLOT: + if (!item->is_touchscreen) /* FIXME: temp hack */ + break; + item->touchscreen_data->current_slot = events[i].value; + break; + case ABS_MT_TRACKING_ID: + if (!item->is_touchscreen) /* FIXME: temp hack */ + break; + if (events[i].value >= 0) { + item->touchscreen_data->slots[item->touchscreen_data->current_slot].tracking_id = events[i].value; + item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; + } else { + item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_UP; + } + break; + case ABS_MT_POSITION_X: + if (!item->is_touchscreen) /* FIXME: temp hack */ + break; + item->touchscreen_data->slots[item->touchscreen_data->current_slot].x = events[i].value; + if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; + } + break; + case ABS_MT_POSITION_Y: + if (!item->is_touchscreen) /* FIXME: temp hack */ + break; + item->touchscreen_data->slots[item->touchscreen_data->current_slot].y = events[i].value; + if (item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta == EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[item->touchscreen_data->current_slot].delta = EVDEV_TOUCH_SLOTDELTA_MOVE; + } + break; + case ABS_X: + if (item->is_touchscreen) /* FIXME: temp hack */ + break; + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); + break; + case ABS_Y: + if (item->is_touchscreen) /* FIXME: temp hack */ + break; + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); + break; + default: + break; + } + break; + case EV_REL: + switch(events[i].code) { + case REL_X: + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0); + break; + case REL_Y: + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value); + break; + case REL_WHEEL: + SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value, SDL_MOUSEWHEEL_NORMAL); + break; + case REL_HWHEEL: + SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL); + break; + default: + break; + } + break; + case EV_SYN: + switch (events[i].code) { + case SYN_REPORT: + if (!item->is_touchscreen) /* FIXME: temp hack */ + break; + + for(j = 0; j < item->touchscreen_data->max_slots; j++) { + norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) / + (float)item->touchscreen_data->range_x; + norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / + (float)item->touchscreen_data->range_y; + + switch(item->touchscreen_data->slots[j].delta) { + case EVDEV_TOUCH_SLOTDELTA_DOWN: + SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, 1.0f); + item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; + break; + case EVDEV_TOUCH_SLOTDELTA_UP: + SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, 1.0f); + item->touchscreen_data->slots[j].tracking_id = -1; + item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; + break; + case EVDEV_TOUCH_SLOTDELTA_MOVE: + SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, 1.0f); + item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE; + break; + default: + break; + } + } + + if (item->out_of_sync) + item->out_of_sync = 0; + break; + case SYN_DROPPED: + if (item->is_touchscreen) + item->out_of_sync = 1; + SDL_EVDEV_sync_device(item); + break; + default: + break; + } + break; + } + } + } + } +} + +static SDL_Scancode +SDL_EVDEV_translate_keycode(int keycode) +{ + SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; + + if (keycode < SDL_arraysize(linux_scancode_table)) + scancode = linux_scancode_table[keycode]; + + if (scancode == SDL_SCANCODE_UNKNOWN) { + SDL_Log("The key you just pressed is not recognized by SDL. To help " + "get this fixed, please report this to the SDL forums/mailing list " + " EVDEV KeyCode %d", keycode); + } + + return scancode; +} + +#ifdef SDL_USE_LIBUDEV +static int +SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) +{ + int ret, i; + char name[64]; + struct input_absinfo abs_info; + + if (!item->is_touchscreen) + return 0; + + item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); + if (item->touchscreen_data == NULL) + return SDL_OutOfMemory(); + + ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); + if (ret < 0) { + SDL_free(item->touchscreen_data); + return SDL_SetError("Failed to get evdev touchscreen name"); + } + + item->touchscreen_data->name = SDL_strdup(name); + if (item->touchscreen_data->name == NULL) { + SDL_free(item->touchscreen_data); + return SDL_OutOfMemory(); + } + + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_X), &abs_info); + if (ret < 0) { + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return SDL_SetError("Failed to get evdev touchscreen limits"); + } + item->touchscreen_data->min_x = abs_info.minimum; + item->touchscreen_data->max_x = abs_info.maximum; + item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; + + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_Y), &abs_info); + if (ret < 0) { + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return SDL_SetError("Failed to get evdev touchscreen limits"); + } + item->touchscreen_data->min_y = abs_info.minimum; + item->touchscreen_data->max_y = abs_info.maximum; + item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; + + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); + if (ret < 0) { + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return SDL_SetError("Failed to get evdev touchscreen limits"); + } + item->touchscreen_data->max_slots = abs_info.maximum + 1; + + item->touchscreen_data->slots = SDL_calloc( + item->touchscreen_data->max_slots, + sizeof(*item->touchscreen_data->slots)); + if (item->touchscreen_data->slots == NULL) { + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return SDL_OutOfMemory(); + } + + for(i = 0; i < item->touchscreen_data->max_slots; i++) { + item->touchscreen_data->slots[i].tracking_id = -1; + } + + ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ + item->touchscreen_data->name); + if (ret < 0) { + SDL_free(item->touchscreen_data->slots); + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); + return ret; + } + + return 0; +} +#endif /* SDL_USE_LIBUDEV */ + +static void +SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) { + if (!item->is_touchscreen) + return; + + SDL_DelTouch(item->fd); + SDL_free(item->touchscreen_data->slots); + SDL_free(item->touchscreen_data->name); + SDL_free(item->touchscreen_data); +} + +static void +SDL_EVDEV_sync_device(SDL_evdevlist_item *item) +{ +#ifdef EVIOCGMTSLOTS + int i, ret; + struct input_absinfo abs_info; + /* + * struct input_mt_request_layout { + * __u32 code; + * __s32 values[num_slots]; + * }; + * + * this is the structure we're trying to emulate + */ + __u32* mt_req_code; + __s32* mt_req_values; + size_t mt_req_size; + + /* TODO: sync devices other than touchscreen */ + if (!item->is_touchscreen) + return; + + mt_req_size = sizeof(*mt_req_code) + + sizeof(*mt_req_values) * item->touchscreen_data->max_slots; + + mt_req_code = SDL_calloc(1, mt_req_size); + if (mt_req_code == NULL) { + return; + } + + mt_req_values = (__s32*)mt_req_code + 1; + + *mt_req_code = ABS_MT_TRACKING_ID; + ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); + if (ret < 0) { + SDL_free(mt_req_code); + return; + } + for(i = 0; i < item->touchscreen_data->max_slots; i++) { + /* + * This doesn't account for the very edge case of the user removing their + * finger and replacing it on the screen during the time we're out of sync, + * which'll mean that we're not going from down -> up or up -> down, we're + * going from down -> down but with a different tracking id, meaning we'd + * have to tell SDL of the two events, but since we wait till SYN_REPORT in + * SDL_EVDEV_Poll to tell SDL, the current structure of this code doesn't + * allow it. Lets just pray to God it doesn't happen. + */ + if (item->touchscreen_data->slots[i].tracking_id < 0 && + mt_req_values[i] >= 0) { + item->touchscreen_data->slots[i].tracking_id = mt_req_values[i]; + item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_DOWN; + } else if (item->touchscreen_data->slots[i].tracking_id >= 0 && + mt_req_values[i] < 0) { + item->touchscreen_data->slots[i].tracking_id = -1; + item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP; + } + } + + *mt_req_code = ABS_MT_POSITION_X; + ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); + if (ret < 0) { + SDL_free(mt_req_code); + return; + } + for(i = 0; i < item->touchscreen_data->max_slots; i++) { + if (item->touchscreen_data->slots[i].tracking_id >= 0 && + item->touchscreen_data->slots[i].x != mt_req_values[i]) { + item->touchscreen_data->slots[i].x = mt_req_values[i]; + if (item->touchscreen_data->slots[i].delta == + EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[i].delta = + EVDEV_TOUCH_SLOTDELTA_MOVE; + } + } + } + + *mt_req_code = ABS_MT_POSITION_Y; + ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); + if (ret < 0) { + SDL_free(mt_req_code); + return; + } + for(i = 0; i < item->touchscreen_data->max_slots; i++) { + if (item->touchscreen_data->slots[i].tracking_id >= 0 && + item->touchscreen_data->slots[i].y != mt_req_values[i]) { + item->touchscreen_data->slots[i].y = mt_req_values[i]; + if (item->touchscreen_data->slots[i].delta == + EVDEV_TOUCH_SLOTDELTA_NONE) { + item->touchscreen_data->slots[i].delta = + EVDEV_TOUCH_SLOTDELTA_MOVE; + } + } + } + + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); + if (ret < 0) { + SDL_free(mt_req_code); + return; + } + item->touchscreen_data->current_slot = abs_info.value; + + SDL_free(mt_req_code); + +#endif /* EVIOCGMTSLOTS */ +} + +#if SDL_USE_LIBUDEV +static int +SDL_EVDEV_device_added(const char *dev_path, int udev_class) +{ + int ret; + SDL_evdevlist_item *item; + + /* Check to make sure it's not already in list. */ + for (item = _this->first; item != NULL; item = item->next) { + if (SDL_strcmp(dev_path, item->path) == 0) { + return -1; /* already have this one */ + } + } + + item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); + if (item == NULL) { + return SDL_OutOfMemory(); + } + + item->fd = open(dev_path, O_RDONLY | O_NONBLOCK); + if (item->fd < 0) { + SDL_free(item); + return SDL_SetError("Unable to open %s", dev_path); + } + + item->path = SDL_strdup(dev_path); + if (item->path == NULL) { + close(item->fd); + SDL_free(item); + return SDL_OutOfMemory(); + } + + if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { + item->is_touchscreen = 1; + + if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { + close(item->fd); + SDL_free(item); + return ret; + } + } + + if (_this->last == NULL) { + _this->first = _this->last = item; + } else { + _this->last->next = item; + _this->last = item; + } + + SDL_EVDEV_sync_device(item); + + return _this->num_devices++; +} +#endif /* SDL_USE_LIBUDEV */ + +static int +SDL_EVDEV_device_removed(const char *dev_path) +{ + SDL_evdevlist_item *item; + SDL_evdevlist_item *prev = NULL; + + for (item = _this->first; item != NULL; item = item->next) { + /* found it, remove it. */ + if (SDL_strcmp(dev_path, item->path) == 0) { + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(_this->first == item); + _this->first = item->next; + } + if (item == _this->last) { + _this->last = prev; + } + if (item->is_touchscreen) { + SDL_EVDEV_destroy_touchscreen(item); + } + close(item->fd); + SDL_free(item->path); + SDL_free(item); + _this->num_devices--; + return 0; + } + prev = item; + } + + return -1; +} + + +#endif /* SDL_INPUT_LINUXEV */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.h new file mode 100644 index 0000000000..8d6d683e6c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev.h @@ -0,0 +1,39 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_evdev_h_ +#define SDL_evdev_h_ + +#ifdef SDL_INPUT_LINUXEV + +#include "SDL_events.h" + +extern int SDL_EVDEV_Init(void); +extern void SDL_EVDEV_Quit(void); +extern void SDL_EVDEV_Poll(void); + +#endif /* SDL_INPUT_LINUXEV */ + +#endif /* SDL_evdev_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.c new file mode 100644 index 0000000000..00a3a54d61 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.c @@ -0,0 +1,840 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_evdev_kbd.h" +#include "SDL_hints.h" + +#ifdef SDL_INPUT_LINUXKD + +/* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source */ + +#include +#include +#include +#include +#include +#include +#include /* for TIOCL_GETSHIFTSTATE */ + +#include + +#include "../../events/SDL_events_c.h" +#include "SDL_evdev_kbd_default_accents.h" +#include "SDL_evdev_kbd_default_keymap.h" + +/* These are not defined in older Linux kernel headers */ +#ifndef K_UNICODE +#define K_UNICODE 0x03 +#endif +#ifndef K_OFF +#define K_OFF 0x04 +#endif + +/* + * Handler Tables. + */ + +#define K_HANDLERS\ + k_self, k_fn, k_spec, k_pad,\ + k_dead, k_cons, k_cur, k_shift,\ + k_meta, k_ascii, k_lock, k_lowercase,\ + k_slock, k_dead2, k_brl, k_ignore + +typedef void (k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag); +static k_handler_fn K_HANDLERS; +static k_handler_fn *k_handler[16] = { K_HANDLERS }; + +typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); +static void fn_enter(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd); +static void fn_num(SDL_EVDEV_keyboard_state *kbd); +static void fn_compose(SDL_EVDEV_keyboard_state *kbd); + +static fn_handler_fn *fn_handler[] = +{ + NULL, fn_enter, NULL, NULL, + NULL, NULL, NULL, fn_caps_toggle, + fn_num, NULL, NULL, NULL, + NULL, fn_caps_on, fn_compose, NULL, + NULL, NULL, NULL, fn_num +}; + + +/* + * Keyboard State + */ + +struct SDL_EVDEV_keyboard_state +{ + int console_fd; + int old_kbd_mode; + unsigned short **key_maps; + unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ + SDL_bool dead_key_next; + int npadch; /* -1 or number assembled on pad */ + struct kbdiacrs *accents; + unsigned int diacr; + SDL_bool rep; /* flag telling character repeat */ + unsigned char lockstate; + unsigned char slockstate; + unsigned char ledflagstate; + char shift_state; + char text[128]; + unsigned int text_len; +}; + +#ifdef DUMP_ACCENTS +static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd) +{ + unsigned int i; + + printf("static struct kbdiacrs default_accents = {\n"); + printf(" %d,\n", kbd->accents->kb_cnt); + printf(" {\n"); + for (i = 0; i < kbd->accents->kb_cnt; ++i) { + struct kbdiacr *diacr = &kbd->accents->kbdiacr[i]; + printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n", + diacr->diacr, diacr->base, diacr->result); + } + while (i < 256) { + printf(" { 0x00, 0x00, 0x00 },\n"); + ++i; + } + printf(" }\n"); + printf("};\n"); +} +#endif /* DUMP_ACCENTS */ + +#ifdef DUMP_KEYMAP +static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i); + for (j = 0; j < NR_KEYS; ++j) { + if ((j%8) == 0) { + printf("\n "); + } + printf("0x%.4x, ", kbd->key_maps[i][j]); + } + printf("\n};\n"); + } + } + printf("\n"); + printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n"); + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf(" default_key_map_%d,\n", i); + } else { + printf(" NULL,\n"); + } + } + printf("};\n"); +} +#endif /* DUMP_KEYMAP */ + +static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + kbd->key_maps = (unsigned short **)SDL_calloc(MAX_NR_KEYMAPS, sizeof(unsigned short *)); + if (!kbd->key_maps) { + return -1; + } + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + struct kbentry kbe; + + kbe.kb_table = i; + kbe.kb_index = 0; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + + if (kbe.kb_value == K_NOSUCHMAP) { + continue; + } + + kbd->key_maps[i] = (unsigned short *)SDL_malloc(NR_KEYS * sizeof(unsigned short)); + if (!kbd->key_maps[i]) { + return -1; + } + + for (j = 0; j < NR_KEYS; ++j) { + kbe.kb_table = i; + kbe.kb_index = j; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + kbd->key_maps[i][j] = (kbe.kb_value ^ 0xf000); + } + } + return 0; +} + +static SDL_EVDEV_keyboard_state * kbd_cleanup_state = NULL; +static int kbd_cleanup_sigactions_installed = 0; +static int kbd_cleanup_atexit_installed = 0; + +static struct sigaction old_sigaction[NSIG]; + +static int fatal_signals[] = +{ + /* Handlers for SIGTERM and SIGINT are installed in SDL_QuitInit. */ + SIGHUP, SIGQUIT, SIGILL, SIGABRT, + SIGFPE, SIGSEGV, SIGPIPE, SIGBUS, + SIGSYS +}; + +static void kbd_cleanup(void) +{ + SDL_EVDEV_keyboard_state* kbd = kbd_cleanup_state; + if (kbd == NULL) { + return; + } + kbd_cleanup_state = NULL; + + fprintf(stderr, "(SDL restoring keyboard) "); + ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); +} + +void +SDL_EVDEV_kbd_reraise_signal(int sig) +{ + raise(sig); +} + +siginfo_t* SDL_EVDEV_kdb_cleanup_siginfo = NULL; +void* SDL_EVDEV_kdb_cleanup_ucontext = NULL; + +static void kbd_cleanup_signal_action(int signum, siginfo_t* info, void* ucontext) +{ + struct sigaction* old_action_p = &(old_sigaction[signum]); + sigset_t sigset; + + /* Restore original signal handler before going any further. */ + sigaction(signum, old_action_p, NULL); + + /* Unmask current signal. */ + sigemptyset(&sigset); + sigaddset(&sigset, signum); + sigprocmask(SIG_UNBLOCK, &sigset, NULL); + + /* Save original signal info and context for archeologists. */ + SDL_EVDEV_kdb_cleanup_siginfo = info; + SDL_EVDEV_kdb_cleanup_ucontext = ucontext; + + /* Restore keyboard. */ + kbd_cleanup(); + + /* Reraise signal. */ + SDL_EVDEV_kbd_reraise_signal(signum); +} + +static void kbd_unregister_emerg_cleanup() +{ + int tabidx, signum; + + kbd_cleanup_state = NULL; + + if (!kbd_cleanup_sigactions_installed) { + return; + } + kbd_cleanup_sigactions_installed = 0; + + for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { + struct sigaction* old_action_p; + struct sigaction cur_action; + signum = fatal_signals[tabidx]; + old_action_p = &(old_sigaction[signum]); + + /* Examine current signal action */ + if (sigaction(signum, NULL, &cur_action)) + continue; + + /* Check if action installed and not modifed */ + if (!(cur_action.sa_flags & SA_SIGINFO) + || cur_action.sa_sigaction != &kbd_cleanup_signal_action) + continue; + + /* Restore original action */ + sigaction(signum, old_action_p, NULL); + } +} + +static void kbd_cleanup_atexit(void) +{ + /* Restore keyboard. */ + kbd_cleanup(); + + /* Try to restore signal handlers in case shared library is being unloaded */ + kbd_unregister_emerg_cleanup(); +} + +static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd) +{ + int tabidx, signum; + + if (kbd_cleanup_state != NULL) { + return; + } + kbd_cleanup_state = kbd; + + if (!kbd_cleanup_atexit_installed) { + /* Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a shared library to establish + * functions that are called when the shared library is unloaded. + * -- man atexit(3) + */ + atexit(kbd_cleanup_atexit); + kbd_cleanup_atexit_installed = 1; + } + + if (kbd_cleanup_sigactions_installed) { + return; + } + kbd_cleanup_sigactions_installed = 1; + + for (tabidx = 0; tabidx < sizeof(fatal_signals) / sizeof(fatal_signals[0]); ++tabidx) { + struct sigaction* old_action_p; + struct sigaction new_action; + signum = fatal_signals[tabidx]; + old_action_p = &(old_sigaction[signum]); + if (sigaction(signum, NULL, old_action_p)) + continue; + + /* Skip SIGHUP and SIGPIPE if handler is already installed + * - assume the handler will do the cleanup + */ + if ((signum == SIGHUP || signum == SIGPIPE) + && (old_action_p->sa_handler != SIG_DFL + || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL)) + continue; + + new_action = *old_action_p; + new_action.sa_flags |= SA_SIGINFO; + new_action.sa_sigaction = &kbd_cleanup_signal_action; + sigaction(signum, &new_action, NULL); + } +} + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + SDL_EVDEV_keyboard_state *kbd; + int i; + char flag_state; + char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0}; + + kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); + if (!kbd) { + return NULL; + } + + kbd->npadch = -1; + + /* This might fail if we're not connected to a tty (e.g. on the Steam Link) */ + kbd->console_fd = open("/dev/tty", O_RDONLY); + + if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) { + kbd->shift_state = *shift_state; + } + + if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) { + kbd->ledflagstate = flag_state; + } + + kbd->accents = &default_accents; + if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) { + /* No worries, we'll use the default accent table */ + } + + kbd->key_maps = default_key_maps; + if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { + /* Set the keyboard in UNICODE mode and load the keymaps */ + ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); + + if (SDL_EVDEV_kbd_load_keymaps(kbd) < 0) { + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + + kbd->key_maps = default_key_maps; + } + + /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ + if (getenv("SDL_INPUT_LINUX_KEEP_KBD") == NULL) { + /* Mute the keyboard so keystrokes only generate evdev events + * and do not leak through to the console + */ + ioctl(kbd->console_fd, KDSKBMODE, K_OFF); + + /* Make sure to restore keyboard if application fails to call + * SDL_Quit before exit or fatal signal is raised. + */ + if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { + kbd_register_emerg_cleanup(kbd); + } + } + } + +#ifdef DUMP_ACCENTS + SDL_EVDEV_dump_accents(kbd); +#endif +#ifdef DUMP_KEYMAP + SDL_EVDEV_dump_keymap(kbd); +#endif + return kbd; +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd) { + return; + } + + kbd_unregister_emerg_cleanup(); + + if (kbd->console_fd >= 0) { + /* Restore the original keyboard mode */ + ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); + + close(kbd->console_fd); + kbd->console_fd = -1; + } + + if (kbd->key_maps && kbd->key_maps != default_key_maps) { + int i; + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + } + + SDL_free(kbd); +} + +/* + * Helper Functions. + */ +static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + /* c is already part of a UTF-8 sequence and safe to add as a character */ + if (kbd->text_len < (sizeof(kbd->text)-1)) { + kbd->text[kbd->text_len++] = (char)c; + } +} + +static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + if (c < 0x80) + /* 0******* */ + put_queue(kbd, c); + else if (c < 0x800) { + /* 110***** 10****** */ + put_queue(kbd, 0xc0 | (c >> 6)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x10000) { + if (c >= 0xD800 && c < 0xE000) + return; + if (c == 0xFFFF) + return; + /* 1110**** 10****** 10****** */ + put_queue(kbd, 0xe0 | (c >> 12)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x110000) { + /* 11110*** 10****** 10****** 10****** */ + put_queue(kbd, 0xf0 | (c >> 18)); + put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } +} + +/* + * We have a combining character DIACR here, followed by the character CH. + * If the combination occurs in the table, return the corresponding value. + * Otherwise, if CH is a space or equals DIACR, return DIACR. + * Otherwise, conclude that DIACR was not combining after all, + * queue it and return CH. + */ +static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) +{ + unsigned int d = kbd->diacr; + unsigned int i; + + kbd->diacr = 0; + + for (i = 0; i < kbd->accents->kb_cnt; i++) { + if (kbd->accents->kbdiacr[i].diacr == d && + kbd->accents->kbdiacr[i].base == ch) { + return kbd->accents->kbdiacr[i].result; + } + } + + if (ch == ' ' || ch == d) + return d; + + put_utf8(kbd, d); + + return ch; +} + +static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + return ((kbd->ledflagstate >> flag) & 1); +} + +static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate |= 1 << flag; +} + +static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate &= ~(1 << flag); +} + +static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->lockstate ^= 1 << flag; +} + +static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->slockstate ^= 1 << flag; +} + +static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate ^= 1 << flag; +} + +/* + * Special function handlers + */ + +static void fn_enter(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->diacr) { + put_utf8(kbd, kbd->diacr); + kbd->diacr = 0; + } +} + +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + chg_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + set_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_num(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd->rep) + chg_vc_kbd_led(kbd, K_NUMLOCK); +} + +static void fn_compose(SDL_EVDEV_keyboard_state *kbd) +{ + kbd->dead_key_next = SDL_TRUE; +} + +/* + * Special key handlers + */ + +static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; + if (value >= SDL_arraysize(fn_handler)) + return; + if (fn_handler[value]) + fn_handler[value](kbd); +} + +static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; /* no action, if this is a key release */ + + if (kbd->diacr) + value = handle_diacr(kbd, value); + + if (kbd->dead_key_next) { + kbd->dead_key_next = SDL_FALSE; + kbd->diacr = value; + return; + } + put_utf8(kbd, value); +} + +static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) +{ + if (up_flag) + return; + + kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); +} + +static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; + + k_deadunicode(kbd, ret_diacr[value], up_flag); +} + +static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_deadunicode(kbd, value, up_flag); +} + +static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + static const char pad_chars[] = "0123456789+-*/\015,.?()#"; + + if (up_flag) + return; /* no action, if this is a key release */ + + if (!vc_kbd_led(kbd, K_NUMLOCK)) { + /* unprintable action */ + return; + } + + put_queue(kbd, pad_chars[value]); +} + +static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int old_state = kbd->shift_state; + + if (kbd->rep) + return; + /* + * Mimic typewriter: + * a CapsShift key acts like Shift but undoes CapsLock + */ + if (value == KVAL(K_CAPSSHIFT)) { + value = KVAL(K_SHIFT); + if (!up_flag) + clr_vc_kbd_led(kbd, K_CAPSLOCK); + } + + if (up_flag) { + /* + * handle the case that two shift or control + * keys are depressed simultaneously + */ + if (kbd->shift_down[value]) + kbd->shift_down[value]--; + } else + kbd->shift_down[value]++; + + if (kbd->shift_down[value]) + kbd->shift_state |= (1 << value); + else + kbd->shift_state &= ~(1 << value); + + /* kludge */ + if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { + put_utf8(kbd, kbd->npadch); + kbd->npadch = -1; + } +} + +static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int base; + + if (up_flag) + return; + + if (value < 10) { + /* decimal input of code, while Alt depressed */ + base = 10; + } else { + /* hexadecimal input of code, while AltGr depressed */ + value -= 10; + base = 16; + } + + if (kbd->npadch == -1) + kbd->npadch = value; + else + kbd->npadch = kbd->npadch * base + value; +} + +static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_lock(kbd, value); +} + +static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_shift(kbd, value, up_flag); + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_slock(kbd, value); + /* try to make Alt, oops, AltGr and such work */ + if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) { + kbd->slockstate = 0; + chg_vc_kbd_slock(kbd, value); + } +} + +static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down) +{ + unsigned char shift_final; + unsigned char type; + unsigned short *key_map; + unsigned short keysym; + + if (!kbd) { + return; + } + + kbd->rep = (down == 2); + + shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate; + key_map = kbd->key_maps[shift_final]; + if (!key_map) { + /* Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state */ + kbd->shift_state = 0; + kbd->slockstate = 0; + kbd->lockstate = 0; + return; + } + + if (keycode < NR_KEYS) { + keysym = key_map[keycode]; + } else { + return; + } + + type = KTYP(keysym); + + if (type < 0xf0) { + if (down) { + put_utf8(kbd, keysym); + } + } else { + type -= 0xf0; + + /* if type is KT_LETTER then it can be affected by Caps Lock */ + if (type == KT_LETTER) { + type = KT_LATIN; + + if (vc_kbd_led(kbd, K_CAPSLOCK)) { + key_map = kbd->key_maps[shift_final ^ (1 << KG_SHIFT)]; + if (key_map) { + keysym = key_map[keycode]; + } + } + } + + (*k_handler[type])(kbd, keysym & 0xff, !down); + + if (type != KT_SLOCK) { + kbd->slockstate = 0; + } + } + + if (kbd->text_len > 0) { + kbd->text[kbd->text_len] = '\0'; + SDL_SendKeyboardText(kbd->text); + kbd->text_len = 0; + } +} + +#else /* !SDL_INPUT_LINUXKD */ + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + return NULL; +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) +{ +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) +{ +} + +#endif /* SDL_INPUT_LINUXKD */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.h new file mode 100644 index 0000000000..5e51cdd177 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_evdev_kbd_h_ +#define SDL_evdev_kbd_h_ + +struct SDL_EVDEV_keyboard_state; +typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; + +extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); +extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); +extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); + +#endif /* SDL_evdev_kbd_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_accents.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_accents.h new file mode 100644 index 0000000000..2fb52544c6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_accents.h @@ -0,0 +1,284 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static struct kbdiacrs default_accents = { + 68, + { + { 0x60, 0x41, 0xc0 }, + { 0x60, 0x61, 0xe0 }, + { 0x27, 0x41, 0xc1 }, + { 0x27, 0x61, 0xe1 }, + { 0x5e, 0x41, 0xc2 }, + { 0x5e, 0x61, 0xe2 }, + { 0x7e, 0x41, 0xc3 }, + { 0x7e, 0x61, 0xe3 }, + { 0x22, 0x41, 0xc4 }, + { 0x22, 0x61, 0xe4 }, + { 0x4f, 0x41, 0xc5 }, + { 0x6f, 0x61, 0xe5 }, + { 0x30, 0x41, 0xc5 }, + { 0x30, 0x61, 0xe5 }, + { 0x41, 0x41, 0xc5 }, + { 0x61, 0x61, 0xe5 }, + { 0x41, 0x45, 0xc6 }, + { 0x61, 0x65, 0xe6 }, + { 0x2c, 0x43, 0xc7 }, + { 0x2c, 0x63, 0xe7 }, + { 0x60, 0x45, 0xc8 }, + { 0x60, 0x65, 0xe8 }, + { 0x27, 0x45, 0xc9 }, + { 0x27, 0x65, 0xe9 }, + { 0x5e, 0x45, 0xca }, + { 0x5e, 0x65, 0xea }, + { 0x22, 0x45, 0xcb }, + { 0x22, 0x65, 0xeb }, + { 0x60, 0x49, 0xcc }, + { 0x60, 0x69, 0xec }, + { 0x27, 0x49, 0xcd }, + { 0x27, 0x69, 0xed }, + { 0x5e, 0x49, 0xce }, + { 0x5e, 0x69, 0xee }, + { 0x22, 0x49, 0xcf }, + { 0x22, 0x69, 0xef }, + { 0x2d, 0x44, 0xd0 }, + { 0x2d, 0x64, 0xf0 }, + { 0x7e, 0x4e, 0xd1 }, + { 0x7e, 0x6e, 0xf1 }, + { 0x60, 0x4f, 0xd2 }, + { 0x60, 0x6f, 0xf2 }, + { 0x27, 0x4f, 0xd3 }, + { 0x27, 0x6f, 0xf3 }, + { 0x5e, 0x4f, 0xd4 }, + { 0x5e, 0x6f, 0xf4 }, + { 0x7e, 0x4f, 0xd5 }, + { 0x7e, 0x6f, 0xf5 }, + { 0x22, 0x4f, 0xd6 }, + { 0x22, 0x6f, 0xf6 }, + { 0x2f, 0x4f, 0xd8 }, + { 0x2f, 0x6f, 0xf8 }, + { 0x60, 0x55, 0xd9 }, + { 0x60, 0x75, 0xf9 }, + { 0x27, 0x55, 0xda }, + { 0x27, 0x75, 0xfa }, + { 0x5e, 0x55, 0xdb }, + { 0x5e, 0x75, 0xfb }, + { 0x22, 0x55, 0xdc }, + { 0x22, 0x75, 0xfc }, + { 0x27, 0x59, 0xdd }, + { 0x27, 0x79, 0xfd }, + { 0x54, 0x48, 0xde }, + { 0x74, 0x68, 0xfe }, + { 0x73, 0x73, 0xdf }, + { 0x22, 0x79, 0xff }, + { 0x73, 0x7a, 0xdf }, + { 0x69, 0x6a, 0xff }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + } +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_keymap.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_keymap.h new file mode 100644 index 0000000000..0ed3050208 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_evdev_kbd_default_keymap.h @@ -0,0 +1,4763 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static unsigned short default_key_map_0[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_1[NR_KEYS] = { + 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_2[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_3[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#ifdef INCLUDE_EXTENDED_KEYMAP +static unsigned short default_key_map_4[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_5[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_6[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_7[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_8[NR_KEYS] = { + 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_9[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_10[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_11[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_12[NR_KEYS] = { + 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_13[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_14[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_15[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_16[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_17[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_18[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_19[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_20[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_21[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_22[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_23[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_24[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_25[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_26[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_27[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_28[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_29[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_30[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_31[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_32[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_33[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_34[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_35[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_36[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_37[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_38[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_39[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_40[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_41[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_42[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_43[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_44[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_45[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_46[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_47[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_48[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_49[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_50[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_51[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_52[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_53[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_54[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_55[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_56[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_57[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_58[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_59[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_60[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_61[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_62[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_63[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_64[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_65[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_66[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_67[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_68[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_69[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_70[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_71[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_72[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_73[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_74[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_75[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_76[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_77[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_78[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_79[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_80[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_81[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_82[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_83[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_84[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_85[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_86[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_87[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_88[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_89[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_90[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_91[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_92[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_93[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_94[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_95[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_96[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_97[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_98[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_99[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_100[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_101[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_102[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_103[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_104[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_105[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_106[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_107[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_108[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_109[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_110[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_111[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_112[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_113[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_114[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_115[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_116[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_117[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_118[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_119[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_120[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_121[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_122[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_123[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_124[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_125[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_126[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_127[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#endif /* INCLUDE_EXTENDED_KEYMAP */ + +static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = { + default_key_map_0, + default_key_map_1, + default_key_map_2, + default_key_map_3, +#ifdef INCLUDE_EXTENDED_KEYMAP + default_key_map_4, + default_key_map_5, + default_key_map_6, + default_key_map_7, + default_key_map_8, + default_key_map_9, + default_key_map_10, + default_key_map_11, + default_key_map_12, + default_key_map_13, + default_key_map_14, + default_key_map_15, + default_key_map_16, + default_key_map_17, + default_key_map_18, + default_key_map_19, + default_key_map_20, + default_key_map_21, + default_key_map_22, + default_key_map_23, + default_key_map_24, + default_key_map_25, + default_key_map_26, + default_key_map_27, + default_key_map_28, + default_key_map_29, + default_key_map_30, + default_key_map_31, + default_key_map_32, + default_key_map_33, + default_key_map_34, + default_key_map_35, + default_key_map_36, + default_key_map_37, + default_key_map_38, + default_key_map_39, + default_key_map_40, + default_key_map_41, + default_key_map_42, + default_key_map_43, + default_key_map_44, + default_key_map_45, + default_key_map_46, + default_key_map_47, + default_key_map_48, + default_key_map_49, + default_key_map_50, + default_key_map_51, + default_key_map_52, + default_key_map_53, + default_key_map_54, + default_key_map_55, + default_key_map_56, + default_key_map_57, + default_key_map_58, + default_key_map_59, + default_key_map_60, + default_key_map_61, + default_key_map_62, + default_key_map_63, + default_key_map_64, + default_key_map_65, + default_key_map_66, + default_key_map_67, + default_key_map_68, + default_key_map_69, + default_key_map_70, + default_key_map_71, + default_key_map_72, + default_key_map_73, + default_key_map_74, + default_key_map_75, + default_key_map_76, + default_key_map_77, + default_key_map_78, + default_key_map_79, + default_key_map_80, + default_key_map_81, + default_key_map_82, + default_key_map_83, + default_key_map_84, + default_key_map_85, + default_key_map_86, + default_key_map_87, + default_key_map_88, + default_key_map_89, + default_key_map_90, + default_key_map_91, + default_key_map_92, + default_key_map_93, + default_key_map_94, + default_key_map_95, + default_key_map_96, + default_key_map_97, + default_key_map_98, + default_key_map_99, + default_key_map_100, + default_key_map_101, + default_key_map_102, + default_key_map_103, + default_key_map_104, + default_key_map_105, + default_key_map_106, + default_key_map_107, + default_key_map_108, + default_key_map_109, + default_key_map_110, + default_key_map_111, + default_key_map_112, + default_key_map_113, + default_key_map_114, + default_key_map_115, + default_key_map_116, + default_key_map_117, + default_key_map_118, + default_key_map_119, + default_key_map_120, + default_key_map_121, + default_key_map_122, + default_key_map_123, + default_key_map_124, + default_key_map_125, + default_key_map_126, + default_key_map_127, +#else /* !INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +#endif /* INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.c new file mode 100644 index 0000000000..41954e92dd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.c @@ -0,0 +1,373 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef HAVE_FCITX_FRONTEND_H + +#include +#include + +#include "SDL_fcitx.h" +#include "SDL_keycode.h" +#include "SDL_keyboard.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_dbus.h" +#include "SDL_syswm.h" +#if SDL_VIDEO_DRIVER_X11 +# include "../../video/x11/SDL_x11video.h" +#endif +#include "SDL_hints.h" + +#define FCITX_DBUS_SERVICE "org.fcitx.Fcitx" + +#define FCITX_IM_DBUS_PATH "/inputmethod" +#define FCITX_IC_DBUS_PATH "/inputcontext_%d" + +#define FCITX_IM_DBUS_INTERFACE "org.fcitx.Fcitx.InputMethod" +#define FCITX_IC_DBUS_INTERFACE "org.fcitx.Fcitx.InputContext" + +#define IC_NAME_MAX 64 +#define DBUS_TIMEOUT 500 + +typedef struct _FcitxClient +{ + SDL_DBusContext *dbus; + + char servicename[IC_NAME_MAX]; + char icname[IC_NAME_MAX]; + + int id; + + SDL_Rect cursor_rect; +} FcitxClient; + +static FcitxClient fcitx_client; + +static int +GetDisplayNumber() +{ + const char *display = SDL_getenv("DISPLAY"); + const char *p = NULL; + int number = 0; + + if (display == NULL) + return 0; + + display = SDL_strchr(display, ':'); + if (display == NULL) + return 0; + + display++; + p = SDL_strchr(display, '.'); + if (p == NULL && display != NULL) { + number = SDL_strtod(display, NULL); + } else { + char *buffer = SDL_strdup(display); + buffer[p - display] = '\0'; + number = SDL_strtod(buffer, NULL); + SDL_free(buffer); + } + + return number; +} + +static char* +GetAppName() +{ +#if defined(__LINUX__) || defined(__FREEBSD__) + char *spot; + char procfile[1024]; + char linkfile[1024]; + int linksize; + +#if defined(__LINUX__) + SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/exe", getpid()); +#elif defined(__FREEBSD__) + SDL_snprintf(procfile, sizeof(procfile), "/proc/%d/file", getpid()); +#endif + linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1); + if (linksize > 0) { + linkfile[linksize] = '\0'; + spot = SDL_strrchr(linkfile, '/'); + if (spot) { + return SDL_strdup(spot + 1); + } else { + return SDL_strdup(linkfile); + } + } +#endif /* __LINUX__ || __FREEBSD__ */ + + return SDL_strdup("SDL_App"); +} + +static DBusHandlerResult +DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) +{ + SDL_DBusContext *dbus = (SDL_DBusContext *)data; + + if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "CommitString")) { + DBusMessageIter iter; + const char *text = NULL; + + dbus->message_iter_init(msg, &iter); + dbus->message_iter_get_basic(&iter, &text); + + if (text) + SDL_SendKeyboardText(text); + + return DBUS_HANDLER_RESULT_HANDLED; + } + + if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdatePreedit")) { + DBusMessageIter iter; + const char *text; + + dbus->message_iter_init(msg, &iter); + dbus->message_iter_get_basic(&iter, &text); + + if (text && *text) { + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + size_t text_bytes = SDL_strlen(text), i = 0; + size_t cursor = 0; + + while (i < text_bytes) { + const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); + + SDL_SendEditingText(buf, cursor, chars); + + i += sz; + cursor += chars; + } + } + + SDL_Fcitx_UpdateTextRect(NULL); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + +static void +FcitxClientICCallMethod(FcitxClient *client, const char *method) +{ + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID); +} + +static void SDLCALL +Fcitx_SetCapabilities(void *data, + const char *name, + const char *old_val, + const char *internal_editing) +{ + FcitxClient *client = (FcitxClient *)data; + Uint32 caps = CAPACITY_NONE; + + if (!(internal_editing && *internal_editing == '1')) { + caps |= CAPACITY_PREEDIT; + } + + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, "SetCapacity", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); +} + +static SDL_bool +FcitxClientCreateIC(FcitxClient *client) +{ + char *appname = GetAppName(); + pid_t pid = getpid(); + int id = -1; + Uint32 enable, arg1, arg2, arg3, arg4; + + if (!SDL_DBus_CallMethod(client->servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateICv3", + DBUS_TYPE_STRING, &appname, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &id, DBUS_TYPE_BOOLEAN, &enable, DBUS_TYPE_UINT32, &arg1, DBUS_TYPE_UINT32, &arg2, DBUS_TYPE_UINT32, &arg3, DBUS_TYPE_UINT32, &arg4, DBUS_TYPE_INVALID)) { + id = -1; /* just in case. */ + } + + SDL_free(appname); + + if (id >= 0) { + SDL_DBusContext *dbus = client->dbus; + + client->id = id; + + SDL_snprintf(client->icname, IC_NAME_MAX, FCITX_IC_DBUS_PATH, client->id); + + dbus->bus_add_match(dbus->session_conn, + "type='signal', interface='org.fcitx.Fcitx.InputContext'", + NULL); + dbus->connection_add_filter(dbus->session_conn, + &DBus_MessageFilter, dbus, + NULL); + dbus->connection_flush(dbus->session_conn); + + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client); + return SDL_TRUE; + } + + return SDL_FALSE; +} + +static Uint32 +Fcitx_ModState(void) +{ + Uint32 fcitx_mods = 0; + SDL_Keymod sdl_mods = SDL_GetModState(); + + if (sdl_mods & KMOD_SHIFT) fcitx_mods |= FcitxKeyState_Shift; + if (sdl_mods & KMOD_CAPS) fcitx_mods |= FcitxKeyState_CapsLock; + if (sdl_mods & KMOD_CTRL) fcitx_mods |= FcitxKeyState_Ctrl; + if (sdl_mods & KMOD_ALT) fcitx_mods |= FcitxKeyState_Alt; + if (sdl_mods & KMOD_NUM) fcitx_mods |= FcitxKeyState_NumLock; + if (sdl_mods & KMOD_LGUI) fcitx_mods |= FcitxKeyState_Super; + if (sdl_mods & KMOD_RGUI) fcitx_mods |= FcitxKeyState_Meta; + + return fcitx_mods; +} + +SDL_bool +SDL_Fcitx_Init() +{ + fcitx_client.dbus = SDL_DBus_GetContext(); + + fcitx_client.cursor_rect.x = -1; + fcitx_client.cursor_rect.y = -1; + fcitx_client.cursor_rect.w = 0; + fcitx_client.cursor_rect.h = 0; + + SDL_snprintf(fcitx_client.servicename, IC_NAME_MAX, + "%s-%d", + FCITX_DBUS_SERVICE, GetDisplayNumber()); + + return FcitxClientCreateIC(&fcitx_client); +} + +void +SDL_Fcitx_Quit() +{ + FcitxClientICCallMethod(&fcitx_client, "DestroyIC"); +} + +void +SDL_Fcitx_SetFocus(SDL_bool focused) +{ + if (focused) { + FcitxClientICCallMethod(&fcitx_client, "FocusIn"); + } else { + FcitxClientICCallMethod(&fcitx_client, "FocusOut"); + } +} + +void +SDL_Fcitx_Reset(void) +{ + FcitxClientICCallMethod(&fcitx_client, "Reset"); + FcitxClientICCallMethod(&fcitx_client, "CloseIC"); +} + +SDL_bool +SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) +{ + Uint32 state = Fcitx_ModState(); + Uint32 handled = SDL_FALSE; + int type = FCITX_PRESS_KEY; + Uint32 event_time = 0; + + if (SDL_DBus_CallMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INT32, &type, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) { + if (handled) { + SDL_Fcitx_UpdateTextRect(NULL); + return SDL_TRUE; + } + } + + return SDL_FALSE; +} + +void +SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) +{ + SDL_Window *focused_win = NULL; + SDL_SysWMinfo info; + int x = 0, y = 0; + SDL_Rect *cursor = &fcitx_client.cursor_rect; + + if (rect) { + SDL_memcpy(cursor, rect, sizeof(SDL_Rect)); + } + + focused_win = SDL_GetKeyboardFocus(); + if (!focused_win) { + return ; + } + + SDL_VERSION(&info.version); + if (!SDL_GetWindowWMInfo(focused_win, &info)) { + return; + } + + SDL_GetWindowPosition(focused_win, &x, &y); + +#if SDL_VIDEO_DRIVER_X11 + if (info.subsystem == SDL_SYSWM_X11) { + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; + + Display *x_disp = info.info.x11.display; + Window x_win = info.info.x11.window; + int x_screen = displaydata->screen; + Window unused; + X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused); + } +#endif + + if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) { + /* move to bottom left */ + int w = 0, h = 0; + SDL_GetWindowSize(focused_win, &w, &h); + cursor->x = 0; + cursor->y = h; + } + + x += cursor->x; + y += cursor->y; + + SDL_DBus_CallVoidMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "SetCursorRect", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID); +} + +void +SDL_Fcitx_PumpEvents(void) +{ + SDL_DBusContext *dbus = fcitx_client.dbus; + DBusConnection *conn = dbus->session_conn; + + dbus->connection_read_write(conn, 0); + + while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) { + /* Do nothing, actual work happens in DBus_MessageFilter */ + usleep(10); + } +} + +#endif /* HAVE_FCITX_FRONTEND_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.h similarity index 65% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.c rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.h index 0881dbde88..9407cd93d2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.c +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_fcitx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,25 +18,23 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL -#include "SDL_rpivideo.h" -#include "SDL_rpiopengles.h" +#ifndef SDL_fcitx_h_ +#define SDL_fcitx_h_ -/* EGL implementation of SDL OpenGL support */ +#include "../../SDL_internal.h" -int -RPI_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY); -} +#include "SDL_stdinc.h" +#include "SDL_rect.h" -SDL_EGL_CreateContext_impl(RPI) -SDL_EGL_SwapWindow_impl(RPI) -SDL_EGL_MakeCurrent_impl(RPI) +extern SDL_bool SDL_Fcitx_Init(void); +extern void SDL_Fcitx_Quit(void); +extern void SDL_Fcitx_SetFocus(SDL_bool focused); +extern void SDL_Fcitx_Reset(void); +extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); +extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); +extern void SDL_Fcitx_PumpEvents(void); -#endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_fcitx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.c similarity index 73% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.c rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.c index c9804c90af..a9c3197163 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.c +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,10 +42,10 @@ static const char IBUS_INTERFACE[] = "org.freedesktop.IBus"; static const char IBUS_INPUT_INTERFACE[] = "org.freedesktop.IBus.InputContext"; static char *input_ctx_path = NULL; -static SDL_Rect ibus_cursor_rect = {0}; +static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; static DBusConnection *ibus_conn = NULL; static char *ibus_addr_file = NULL; -int inotify_fd = -1, inotify_wd = -1; +static int inotify_fd = -1, inotify_wd = -1; static Uint32 IBus_ModState(void) @@ -107,21 +107,6 @@ IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext return text; } -static size_t -IBus_utf8_strlen(const char *str) -{ - size_t utf8_len = 0; - const char *p; - - for (p = str; *p; ++p) { - if (!((*p & 0x80) && !(*p & 0x40))) { - ++utf8_len; - } - } - - return utf8_len; -} - static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -135,7 +120,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) text = IBus_GetVariantText(conn, &iter, dbus); if (text && *text) { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; while (i < text_bytes) { @@ -162,8 +147,8 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) size_t cursor = 0; do { - size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - size_t chars = IBus_utf8_strlen(buf); + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); @@ -302,35 +287,20 @@ IBus_GetDBusAddressFilename(void) static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus); -static void +static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCapabilities"); - if (msg) { - Uint32 caps = IBUS_CAP_FOCUS; - if (!(internal_editing && *internal_editing == '1')) { - caps |= IBUS_CAP_PREEDIT_TEXT; - } - - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &caps, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); + Uint32 caps = IBUS_CAP_FOCUS; + if (!(internal_editing && *internal_editing == '1')) { + caps |= IBUS_CAP_PREEDIT_TEXT; } + + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", + DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } } @@ -338,10 +308,12 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { + const char *client_name = "SDL2_Application"; const char *path = NULL; SDL_bool result = SDL_FALSE; - DBusMessage *msg; - DBusObjectPathVTable ibus_vtable = {0}; + DBusObjectPathVTable ibus_vtable; + + SDL_zero(ibus_vtable); ibus_vtable.message_function = &IBus_MessageHandler; ibus_conn = dbus->connection_open_private(addr, NULL); @@ -359,39 +331,17 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) dbus->connection_flush(ibus_conn); - msg = dbus->message_new_method_call(IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext"); - if (msg) { - const char *client_name = "SDL2_Application"; - dbus->message_append_args(msg, - DBUS_TYPE_STRING, &client_name, - DBUS_TYPE_INVALID); - } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 1000, NULL); - if (reply) { - if (dbus->message_get_args(reply, NULL, - DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID)) { - if (input_ctx_path) { - SDL_free(input_ctx_path); - } - input_ctx_path = SDL_strdup(path); - result = SDL_TRUE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); - } - - if (result) { - SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext", + DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, + DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { + SDL_free(input_ctx_path); + input_ctx_path = SDL_strdup(path); + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); dbus->connection_flush(ibus_conn); + result = SDL_TRUE; } SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); @@ -519,7 +469,7 @@ SDL_IBus_Quit(void) inotify_wd = -1; } - SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); } @@ -530,16 +480,7 @@ IBus_SimpleMessage(const char *method) SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - method); - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID); } } @@ -559,43 +500,21 @@ SDL_IBus_Reset(void) SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - SDL_bool result = SDL_FALSE; + Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "ProcessKeyEvent"); - if (msg) { - Uint32 mods = IBus_ModState(); - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &keysym, - DBUS_TYPE_UINT32, &keycode, - DBUS_TYPE_UINT32, &mods, - DBUS_TYPE_INVALID); - } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 300, NULL); - if (reply) { - if (!dbus->message_get_args(reply, NULL, - DBUS_TYPE_BOOLEAN, &result, - DBUS_TYPE_INVALID)) { - result = SDL_FALSE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); + Uint32 mods = IBus_ModState(); + if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, + DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { + result = 0; } - } SDL_IBus_UpdateTextRect(NULL); - return result; + return result ? SDL_TRUE : SDL_FALSE; } void @@ -641,25 +560,8 @@ SDL_IBus_UpdateTextRect(SDL_Rect *rect) dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCursorLocation"); - if (msg) { - dbus->message_append_args(msg, - DBUS_TYPE_INT32, &x, - DBUS_TYPE_INT32, &y, - DBUS_TYPE_INT32, &ibus_cursor_rect.w, - DBUS_TYPE_INT32, &ibus_cursor_rect.h, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); } } @@ -678,3 +580,5 @@ SDL_IBus_PumpEvents(void) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.h rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.h index 5ee7a8e407..d533ff72c3 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_ibus.h +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_ibus_h -#define _SDL_ibus_h +#ifndef SDL_ibus_h_ +#define SDL_ibus_h_ #ifdef HAVE_IBUS_IBUS_H #define SDL_USE_IBUS 1 @@ -49,10 +49,10 @@ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect); /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / SDL_SendEditingText for each event it finds */ -extern void SDL_IBus_PumpEvents(); +extern void SDL_IBus_PumpEvents(void); #endif /* HAVE_IBUS_IBUS_H */ -#endif /* _SDL_ibus_h */ +#endif /* SDL_ibus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.c new file mode 100644 index 0000000000..29b0182f38 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.c @@ -0,0 +1,152 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_ime.h" +#include "SDL_ibus.h" +#include "SDL_fcitx.h" + +typedef SDL_bool (*_SDL_IME_Init)(); +typedef void (*_SDL_IME_Quit)(); +typedef void (*_SDL_IME_SetFocus)(SDL_bool); +typedef void (*_SDL_IME_Reset)(); +typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32); +typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *); +typedef void (*_SDL_IME_PumpEvents)(); + +static _SDL_IME_Init SDL_IME_Init_Real = NULL; +static _SDL_IME_Quit SDL_IME_Quit_Real = NULL; +static _SDL_IME_SetFocus SDL_IME_SetFocus_Real = NULL; +static _SDL_IME_Reset SDL_IME_Reset_Real = NULL; +static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL; +static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL; +static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL; + +static void +InitIME() +{ + static SDL_bool inited = SDL_FALSE; +#ifdef HAVE_FCITX_FRONTEND_H + const char *im_module = SDL_getenv("SDL_IM_MODULE"); + const char *xmodifiers = SDL_getenv("XMODIFIERS"); +#endif + + if (inited == SDL_TRUE) + return; + + inited = SDL_TRUE; + + /* See if fcitx IME support is being requested */ +#ifdef HAVE_FCITX_FRONTEND_H + if (!SDL_IME_Init_Real && + ((im_module && SDL_strcmp(im_module, "fcitx") == 0) || + (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) { + SDL_IME_Init_Real = SDL_Fcitx_Init; + SDL_IME_Quit_Real = SDL_Fcitx_Quit; + SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus; + SDL_IME_Reset_Real = SDL_Fcitx_Reset; + SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent; + SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect; + SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents; + } +#endif /* HAVE_FCITX_FRONTEND_H */ + + /* default to IBus */ +#ifdef HAVE_IBUS_IBUS_H + if (!SDL_IME_Init_Real) { + SDL_IME_Init_Real = SDL_IBus_Init; + SDL_IME_Quit_Real = SDL_IBus_Quit; + SDL_IME_SetFocus_Real = SDL_IBus_SetFocus; + SDL_IME_Reset_Real = SDL_IBus_Reset; + SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent; + SDL_IME_UpdateTextRect_Real = SDL_IBus_UpdateTextRect; + SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents; + } +#endif /* HAVE_IBUS_IBUS_H */ +} + +SDL_bool +SDL_IME_Init(void) +{ + InitIME(); + + if (SDL_IME_Init_Real) { + if (SDL_IME_Init_Real()) { + return SDL_TRUE; + } + + /* uhoh, the IME implementation's init failed! Disable IME support. */ + SDL_IME_Init_Real = NULL; + SDL_IME_Quit_Real = NULL; + SDL_IME_SetFocus_Real = NULL; + SDL_IME_Reset_Real = NULL; + SDL_IME_ProcessKeyEvent_Real = NULL; + SDL_IME_UpdateTextRect_Real = NULL; + SDL_IME_PumpEvents_Real = NULL; + } + + return SDL_FALSE; +} + +void +SDL_IME_Quit(void) +{ + if (SDL_IME_Quit_Real) + SDL_IME_Quit_Real(); +} + +void +SDL_IME_SetFocus(SDL_bool focused) +{ + if (SDL_IME_SetFocus_Real) + SDL_IME_SetFocus_Real(focused); +} + +void +SDL_IME_Reset(void) +{ + if (SDL_IME_Reset_Real) + SDL_IME_Reset_Real(); +} + +SDL_bool +SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) +{ + if (SDL_IME_ProcessKeyEvent_Real) + return SDL_IME_ProcessKeyEvent_Real(keysym, keycode); + + return SDL_FALSE; +} + +void +SDL_IME_UpdateTextRect(SDL_Rect *rect) +{ + if (SDL_IME_UpdateTextRect_Real) + SDL_IME_UpdateTextRect_Real(rect); +} + +void +SDL_IME_PumpEvents() +{ + if (SDL_IME_PumpEvents_Real) + SDL_IME_PumpEvents_Real(); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.h new file mode 100644 index 0000000000..e39839c62b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_ime.h @@ -0,0 +1,40 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_ime_h_ +#define SDL_ime_h_ + +#include "../../SDL_internal.h" + +#include "SDL_stdinc.h" +#include "SDL_rect.h" + +extern SDL_bool SDL_IME_Init(void); +extern void SDL_IME_Quit(void); +extern void SDL_IME_SetFocus(SDL_bool focused); +extern void SDL_IME_Reset(void); +extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); +extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); +extern void SDL_IME_PumpEvents(void); + +#endif /* SDL_ime_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.c b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.c similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.c rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.c index 099cc435e2..751e2cabbb 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.c +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,12 @@ #include -#include "SDL.h" +#include "SDL_assert.h" +#include "SDL_loadso.h" +#include "SDL_timer.h" +#include "../unix/SDL_poll.h" -static const char* SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; +static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; #define _THIS SDL_UDEV_PrivateData *_this static _THIS = NULL; @@ -60,7 +63,7 @@ SDL_UDEV_load_syms(void) { /* cast funcs to char* first, to please GCC's strict aliasing rules. */ #define SDL_UDEV_SYM(x) \ - if (!SDL_UDEV_load_sym(#x, (void **) (char *) & _this->x)) return -1 + if (!SDL_UDEV_load_sym(#x, (void **) (char *) & _this->syms.x)) return -1 SDL_UDEV_SYM(udev_device_get_action); SDL_UDEV_SYM(udev_device_get_devnode); @@ -97,15 +100,8 @@ static SDL_bool SDL_UDEV_hotplug_update_available(void) { if (_this->udev_mon != NULL) { - const int fd = _this->udev_monitor_get_fd(_this->udev_mon); - fd_set fds; - struct timeval tv; - - FD_ZERO(&fds); - FD_SET(fd, &fds); - tv.tv_sec = 0; - tv.tv_usec = 0; - if ((select(fd+1, &fds, NULL, NULL, &tv) > 0) && (FD_ISSET(fd, &fds))) { + const int fd = _this->syms.udev_monitor_get_fd(_this->udev_mon); + if (SDL_IOReady(fd, SDL_FALSE, 0)) { return SDL_TRUE; } } @@ -134,21 +130,21 @@ SDL_UDEV_Init(void) * Listen for input devices (mouse, keyboard, joystick, etc) and sound devices */ - _this->udev = _this->udev_new(); + _this->udev = _this->syms.udev_new(); if (_this->udev == NULL) { SDL_UDEV_Quit(); return SDL_SetError("udev_new() failed"); } - _this->udev_mon = _this->udev_monitor_new_from_netlink(_this->udev, "udev"); + _this->udev_mon = _this->syms.udev_monitor_new_from_netlink(_this->udev, "udev"); if (_this->udev_mon == NULL) { SDL_UDEV_Quit(); return SDL_SetError("udev_monitor_new_from_netlink() failed"); } - _this->udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "input", NULL); - _this->udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "sound", NULL); - _this->udev_monitor_enable_receiving(_this->udev_mon); + _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "input", NULL); + _this->syms.udev_monitor_filter_add_match_subsystem_devtype(_this->udev_mon, "sound", NULL); + _this->syms.udev_monitor_enable_receiving(_this->udev_mon); /* Do an initial scan of existing devices */ SDL_UDEV_Scan(); @@ -174,11 +170,11 @@ SDL_UDEV_Quit(void) if (_this->ref_count < 1) { if (_this->udev_mon != NULL) { - _this->udev_monitor_unref(_this->udev_mon); + _this->syms.udev_monitor_unref(_this->udev_mon); _this->udev_mon = NULL; } if (_this->udev != NULL) { - _this->udev_unref(_this->udev); + _this->syms.udev_unref(_this->udev); _this->udev = NULL; } @@ -206,28 +202,28 @@ SDL_UDEV_Scan(void) return; } - enumerate = _this->udev_enumerate_new(_this->udev); + enumerate = _this->syms.udev_enumerate_new(_this->udev); if (enumerate == NULL) { SDL_UDEV_Quit(); - SDL_SetError("udev_monitor_new_from_netlink() failed"); + SDL_SetError("udev_enumerate_new() failed"); return; } - _this->udev_enumerate_add_match_subsystem(enumerate, "input"); - _this->udev_enumerate_add_match_subsystem(enumerate, "sound"); + _this->syms.udev_enumerate_add_match_subsystem(enumerate, "input"); + _this->syms.udev_enumerate_add_match_subsystem(enumerate, "sound"); - _this->udev_enumerate_scan_devices(enumerate); - devs = _this->udev_enumerate_get_list_entry(enumerate); - for (item = devs; item; item = _this->udev_list_entry_get_next(item)) { - const char *path = _this->udev_list_entry_get_name(item); - struct udev_device *dev = _this->udev_device_new_from_syspath(_this->udev, path); + _this->syms.udev_enumerate_scan_devices(enumerate); + devs = _this->syms.udev_enumerate_get_list_entry(enumerate); + for (item = devs; item; item = _this->syms.udev_list_entry_get_next(item)) { + const char *path = _this->syms.udev_list_entry_get_name(item); + struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path); if (dev != NULL) { device_event(SDL_UDEV_DEVICEADDED, dev); - _this->udev_device_unref(dev); + _this->syms.udev_device_unref(dev); } } - _this->udev_enumerate_unref(enumerate); + _this->syms.udev_enumerate_unref(enumerate); } @@ -252,8 +248,25 @@ SDL_UDEV_LoadLibrary(void) if (_this == NULL) { return SDL_SetError("UDEV not initialized"); } - - + + /* See if there is a udev library already loaded */ + if (SDL_UDEV_load_syms() == 0) { + return 0; + } + +#ifdef SDL_UDEV_DYNAMIC + /* Check for the build environment's libudev first */ + if (_this->udev_handle == NULL) { + _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); + if (_this->udev_handle != NULL) { + retval = SDL_UDEV_load_syms(); + if (retval < 0) { + SDL_UDEV_UnloadLibrary(); + } + } + } +#endif + if (_this->udev_handle == NULL) { for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); @@ -280,7 +293,6 @@ SDL_UDEV_LoadLibrary(void) #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) @@ -293,7 +305,7 @@ static void get_caps(struct udev_device *dev, struct udev_device *pdev, const ch unsigned long v; SDL_memset(bitmask, 0, bitmask_len*sizeof(*bitmask)); - value = _this->udev_device_get_sysattr_value(pdev, attr); + value = _this->syms.udev_device_get_sysattr_value(pdev, attr); if (!value) { return; } @@ -328,8 +340,8 @@ guess_device_class(struct udev_device *dev) /* walk up the parental chain until we find the real input device; the * argument is very likely a subdevice of this, like eventN */ pdev = dev; - while (pdev && !_this->udev_device_get_sysattr_value(pdev, "capabilities/ev")) { - pdev = _this->udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); + while (pdev && !_this->syms.udev_device_get_sysattr_value(pdev, "capabilities/ev")) { + pdev = _this->syms.udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); } if (!pdev) { return 0; @@ -349,7 +361,9 @@ guess_device_class(struct udev_device *dev) } else if (test_bit(BTN_MOUSE, bitmask_key)) { devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */ } else if (test_bit(BTN_TOUCH, bitmask_key)) { - ; /* ID_INPUT_TOUCHSCREEN */ + /* TODO: better determining between touchscreen and multitouch touchpad, + see https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-input_id.c */ + devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; /* ID_INPUT_TOUCHSCREEN */ } if (test_bit(BTN_TRIGGER, bitmask_key) || @@ -391,26 +405,31 @@ device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) const char *path; SDL_UDEV_CallbackList *item; - path = _this->udev_device_get_devnode(dev); + path = _this->syms.udev_device_get_devnode(dev); if (path == NULL) { return; } - subsystem = _this->udev_device_get_subsystem(dev); + subsystem = _this->syms.udev_device_get_subsystem(dev); if (SDL_strcmp(subsystem, "sound") == 0) { devclass = SDL_UDEV_DEVICE_SOUND; } else if (SDL_strcmp(subsystem, "input") == 0) { /* udev rules reference: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c */ - val = _this->udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); + val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; } - val = _this->udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); + val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_MOUSE; } + + val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); + if (val != NULL && SDL_strcmp(val, "1") == 0 ) { + devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; + } /* The undocumented rule is: - All devices with keys get ID_INPUT_KEY @@ -418,14 +437,14 @@ device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) Ref: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c#n183 */ - val = _this->udev_device_get_property_value(dev, "ID_INPUT_KEY"); + val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_KEY"); if (val != NULL && SDL_strcmp(val, "1") == 0 ) { devclass |= SDL_UDEV_DEVICE_KEYBOARD; } if (devclass == 0) { /* Fall back to old style input classes */ - val = _this->udev_device_get_property_value(dev, "ID_CLASS"); + val = _this->syms.udev_device_get_property_value(dev, "ID_CLASS"); if (val != NULL) { if (SDL_strcmp(val, "joystick") == 0) { devclass = SDL_UDEV_DEVICE_JOYSTICK; @@ -462,11 +481,11 @@ SDL_UDEV_Poll(void) } while (SDL_UDEV_hotplug_update_available()) { - dev = _this->udev_monitor_receive_device(_this->udev_mon); + dev = _this->syms.udev_monitor_receive_device(_this->udev_mon); if (dev == NULL) { break; } - action = _this->udev_device_get_action(dev); + action = _this->syms.udev_device_get_action(dev); if (SDL_strcmp(action, "add") == 0) { /* Wait for the device to finish initialization */ @@ -477,7 +496,7 @@ SDL_UDEV_Poll(void) device_event(SDL_UDEV_DEVICEREMOVED, dev); } - _this->udev_device_unref(dev); + _this->syms.udev_device_unref(dev); } } @@ -528,5 +547,23 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) } +const SDL_UDEV_Symbols * +SDL_UDEV_GetUdevSyms(void) +{ + if (SDL_UDEV_Init() < 0) { + SDL_SetError("Could not initialize UDEV"); + return NULL; + } + + return &_this->syms; +} + +void +SDL_UDEV_ReleaseUdevSyms(void) +{ + SDL_UDEV_Quit(); +} #endif /* SDL_USE_LIBUDEV */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.h b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.h rename to 3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.h index 2e4434e627..8be74340a8 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_udev.h +++ b/3rdparty/sdl2-2.0.9/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_udev_h -#define _SDL_udev_h +#ifndef SDL_udev_h_ +#define SDL_udev_h_ #if HAVE_LIBUDEV_H @@ -42,17 +42,19 @@ typedef enum { - SDL_UDEV_DEVICEADDED = 0x0001, + SDL_UDEV_DEVICEADDED = 1, SDL_UDEV_DEVICEREMOVED } SDL_UDEV_deviceevent; /* A device can be any combination of these classes */ typedef enum { + SDL_UDEV_DEVICE_UNKNOWN = 0x0000, SDL_UDEV_DEVICE_MOUSE = 0x0001, SDL_UDEV_DEVICE_KEYBOARD = 0x0002, SDL_UDEV_DEVICE_JOYSTICK = 0x0004, - SDL_UDEV_DEVICE_SOUND = 0x0008 + SDL_UDEV_DEVICE_SOUND = 0x0008, + SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010 } SDL_UDEV_deviceclass; typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); @@ -62,22 +64,13 @@ typedef struct SDL_UDEV_CallbackList { struct SDL_UDEV_CallbackList *next; } SDL_UDEV_CallbackList; -typedef struct SDL_UDEV_PrivateData -{ - const char *udev_library; - void *udev_handle; - struct udev *udev; - struct udev_monitor *udev_mon; - int ref_count; - SDL_UDEV_CallbackList *first, *last; - - /* Function pointers */ +typedef struct SDL_UDEV_Symbols { const char *(*udev_device_get_action)(struct udev_device *); const char *(*udev_device_get_devnode)(struct udev_device *); const char *(*udev_device_get_subsystem)(struct udev_device *); - struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype); + struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype); const char *(*udev_device_get_property_value)(struct udev_device *, const char *); - const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr); + const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr); struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *); void (*udev_device_unref)(struct udev_device *); int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *); @@ -98,6 +91,19 @@ typedef struct SDL_UDEV_PrivateData void (*udev_unref)(struct udev *); struct udev_device * (*udev_device_new_from_devnum)(struct udev *udev, char type, dev_t devnum); dev_t (*udev_device_get_devnum) (struct udev_device *udev_device); +} SDL_UDEV_Symbols; + +typedef struct SDL_UDEV_PrivateData +{ + const char *udev_library; + void *udev_handle; + struct udev *udev; + struct udev_monitor *udev_mon; + int ref_count; + SDL_UDEV_CallbackList *first, *last; + + /* Function pointers */ + SDL_UDEV_Symbols syms; } SDL_UDEV_PrivateData; extern int SDL_UDEV_Init(void); @@ -108,10 +114,12 @@ extern void SDL_UDEV_Poll(void); extern void SDL_UDEV_Scan(void); extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb); extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); - - +extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void); +extern void SDL_UDEV_ReleaseUdevSyms(void); #endif /* HAVE_LIBUDEV_H */ -#endif /* _SDL_udev_h */ +#endif /* SDL_udev_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.c b/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.c new file mode 100644 index 0000000000..5ac6d0b607 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.c @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#include "SDL_assert.h" +#include "SDL_poll.h" + +#ifdef HAVE_POLL +#include +#else +#include +#include +#include +#endif +#include + + +int +SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS) +{ + int result; + + /* Note: We don't bother to account for elapsed time if we get EINTR */ + do + { +#ifdef HAVE_POLL + struct pollfd info; + + info.fd = fd; + if (forWrite) { + info.events = POLLOUT; + } else { + info.events = POLLIN | POLLPRI; + } + result = poll(&info, 1, timeoutMS); +#else + fd_set rfdset, *rfdp = NULL; + fd_set wfdset, *wfdp = NULL; + struct timeval tv, *tvp = NULL; + + /* If this assert triggers we'll corrupt memory here */ + SDL_assert(fd >= 0 && fd < FD_SETSIZE); + + if (forWrite) { + FD_ZERO(&wfdset); + FD_SET(fd, &wfdset); + wfdp = &wfdset; + } else { + FD_ZERO(&rfdset); + FD_SET(fd, &rfdset); + rfdp = &rfdset; + } + + if (timeoutMS >= 0) { + tv.tv_sec = timeoutMS / 1000; + tv.tv_usec = (timeoutMS % 1000) * 1000; + tvp = &tv; + } + + result = select(fd + 1, rfdp, wfdp, NULL, tvp); +#endif /* HAVE_POLL */ + + } while ( result < 0 && errno == EINTR ); + + return result; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.h b/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.h new file mode 100644 index 0000000000..bf20e23d93 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/core/unix/SDL_poll.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_poll_h_ +#define SDL_poll_h_ + +#include "SDL_stdinc.h" + + +extern int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS); + +#endif /* SDL_poll_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_directx.h b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_directx.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/core/windows/SDL_directx.h rename to 3rdparty/sdl2-2.0.9/src/core/windows/SDL_directx.h index 0533f61eda..7fe826fabf 100644 --- a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_directx.h +++ b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directx_h -#define _SDL_directx_h +#ifndef SDL_directx_h_ +#define SDL_directx_h_ /* Include all of the DirectX 8.0 headers and adds any necessary tweaks */ @@ -106,6 +106,6 @@ typedef struct { int unused; } DIDEVICEINSTANCE; #endif -#endif /* _SDL_directx_h */ +#endif /* SDL_directx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.c b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.c similarity index 51% rename from 3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.c rename to 3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.c index bc4afe0aa6..4da7d07754 100644 --- a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.c +++ b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,12 @@ #ifndef _WIN32_WINNT_VISTA #define _WIN32_WINNT_VISTA 0x0600 #endif +#ifndef _WIN32_WINNT_WIN7 +#define _WIN32_WINNT_WIN7 0x0601 +#endif -/* Sets an error message based on GetLastError() */ +/* Sets an error message based on an HRESULT */ int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr) { @@ -115,7 +118,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP } #endif -BOOL WIN_IsWindowsVistaOrGreater() +BOOL WIN_IsWindowsVistaOrGreater(void) { #ifdef __WINRT__ return TRUE; @@ -124,6 +127,107 @@ BOOL WIN_IsWindowsVistaOrGreater() #endif } +BOOL WIN_IsWindows7OrGreater(void) +{ +#ifdef __WINRT__ + return TRUE; +#else + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); +#endif +} + +/* +WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's +longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which +will give you a name GUID. The full name is in the Windows Registry under +that GUID, located here: HKLM\System\CurrentControlSet\Control\MediaCategories + +Note that drivers can report GUID_NULL for the name GUID, in which case, +Windows makes a best effort to fill in those 31 bytes in the usual place. +This info summarized from MSDN: + +http://web.archive.org/web/20131027093034/http://msdn.microsoft.com/en-us/library/windows/hardware/ff536382(v=vs.85).aspx + +Always look this up in the registry if possible, because the strings are +different! At least on Win10, I see "Yeti Stereo Microphone" in the +Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh. + +(Also, DirectSound shouldn't be limited to 32 chars, but its device enum +has the same problem.) + +WASAPI doesn't need this. This is just for DirectSound/WinMM. +*/ +char * +WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) +{ +#if __WINRT__ + return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP, go with what we've got. */ +#else + static const GUID nullguid = { 0 }; + const unsigned char *ptr; + char keystr[128]; + WCHAR *strw = NULL; + SDL_bool rc; + HKEY hkey; + DWORD len = 0; + char *retval = NULL; + + if (WIN_IsEqualGUID(guid, &nullguid)) { + return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */ + } + + ptr = (const unsigned char *) guid; + SDL_snprintf(keystr, sizeof (keystr), + "System\\CurrentControlSet\\Control\\MediaCategories\\{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + ptr[3], ptr[2], ptr[1], ptr[0], ptr[5], ptr[4], ptr[7], ptr[6], + ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15]); + + strw = WIN_UTF8ToString(keystr); + rc = (RegOpenKeyExW(HKEY_LOCAL_MACHINE, strw, 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS); + SDL_free(strw); + if (!rc) { + return WIN_StringToUTF8(name); /* oh well. */ + } + + rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, NULL, &len) == ERROR_SUCCESS); + if (!rc) { + RegCloseKey(hkey); + return WIN_StringToUTF8(name); /* oh well. */ + } + + strw = (WCHAR *) SDL_malloc(len + sizeof (WCHAR)); + if (!strw) { + RegCloseKey(hkey); + return WIN_StringToUTF8(name); /* oh well. */ + } + + rc = (RegQueryValueExW(hkey, L"Name", NULL, NULL, (LPBYTE) strw, &len) == ERROR_SUCCESS); + RegCloseKey(hkey); + if (!rc) { + SDL_free(strw); + return WIN_StringToUTF8(name); /* oh well. */ + } + + strw[len / 2] = 0; /* make sure it's null-terminated. */ + + retval = WIN_StringToUTF8(strw); + SDL_free(strw); + return retval ? retval : WIN_StringToUTF8(name); +#endif /* if __WINRT__ / else */ +} + +BOOL +WIN_IsEqualGUID(const GUID * a, const GUID * b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + +BOOL +WIN_IsEqualIID(REFIID a, REFIID b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + #endif /* __WIN32__ || __WINRT__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.h b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.h similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.h rename to 3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.h index 0c99b03d42..4a3336ad8e 100644 --- a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_windows.h +++ b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,7 @@ #endif #include +#include /* for REFIID with broken mingw.org headers */ /* Routines to convert from UTF8 to native Windows text */ #if UNICODE @@ -57,7 +58,17 @@ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); /* Returns SDL_TRUE if we're running on Windows Vista and newer */ -extern BOOL WIN_IsWindowsVistaOrGreater(); +extern BOOL WIN_IsWindowsVistaOrGreater(void); + +/* Returns SDL_TRUE if we're running on Windows 7 and newer */ +extern BOOL WIN_IsWindows7OrGreater(void); + +/* You need to SDL_free() the result of this call. */ +extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); + +/* Checks to see if two GUID are the same. */ +extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b); +extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); #endif /* _INCLUDED_WINDOWS_H */ diff --git a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.c b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.c rename to 3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.c index 355cd83436..75bf60003c 100644 --- a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.c +++ b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.h b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.h rename to 3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.h index 67f8fdc1f8..6106c2b052 100644 --- a/3rdparty/sdl2-2.0.4/src/core/windows/SDL_xinput.h +++ b/3rdparty/sdl2-2.0.9/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_xinput_h -#define _SDL_xinput_h +#ifndef SDL_xinput_h_ +#define SDL_xinput_h_ #ifdef HAVE_XINPUT_H @@ -100,6 +100,8 @@ #endif /* typedef's for XInput structs we use */ + +#ifndef HAVE_XINPUT_GAMEPAD_EX typedef struct { WORD wButtons; @@ -111,12 +113,15 @@ typedef struct SHORT sThumbRY; DWORD dwPaddingReserved; } XINPUT_GAMEPAD_EX; +#endif +#ifndef HAVE_XINPUT_STATE_EX typedef struct { DWORD dwPacketNumber; XINPUT_GAMEPAD_EX Gamepad; } XINPUT_STATE_EX; +#endif typedef struct { @@ -167,6 +172,6 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #endif /* HAVE_XINPUT_H */ -#endif /* _SDL_xinput_h */ +#endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.cpp b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.cpp similarity index 58% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.cpp rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.cpp index 265aa942e0..887b47eaa3 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.cpp +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ #include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_xaml.h" +#include + int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; extern "C" DECLSPEC int @@ -32,6 +34,33 @@ SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel) if (xamlBackgroundPanel) { return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel); } else { + if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { + return 1; + } return SDL_WinRTInitNonXAMLApp(mainFunction); } } + + +extern "C" DECLSPEC SDL_WinRT_DeviceFamily +SDL_WinRTGetDeviceFamily() +{ +#if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */ + Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily; + + if (deviceFamily->Equals("Windows.Desktop")) + { + return SDL_WINRT_DEVICEFAMILY_DESKTOP; + } + else if (deviceFamily->Equals("Windows.Mobile")) + { + return SDL_WINRT_DEVICEFAMILY_MOBILE; + } + else if (deviceFamily->Equals("Windows.Xbox")) + { + return SDL_WINRT_DEVICEFAMILY_XBOX; + } +#endif + + return SDL_WINRT_DEVICEFAMILY_UNKNOWN; +} \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.h b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.h rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.h index e87a0b6b63..d68704c06e 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_common.h +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_common_h -#define _SDL_winrtapp_common_h +#ifndef SDL_winrtapp_common_h_ +#define SDL_winrtapp_common_h_ /* A pointer to the app's C-style main() function (which is a different function than the WinRT app's actual entry point). */ extern int (*WINRT_SDLAppEntryPoint)(int, char **); -#endif // ifndef _SDL_winrtapp_common_h +#endif // SDL_winrtapp_common_h_ diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.cpp b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.cpp similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.cpp rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.cpp index 5ab2ef9a2e..6fa0bea794 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,6 @@ using namespace Windows::Phone::UI::Input; /* SDL includes */ extern "C" { -#include "../../SDL_internal.h" #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_hints.h" @@ -122,7 +121,8 @@ int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)) return 0; } -static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) { SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0); @@ -254,6 +254,18 @@ void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView) CoreApplication::Exiting += ref new EventHandler(this, &SDL_WinRTApp::OnExiting); + +#if NTDDI_VERSION >= NTDDI_WIN10 + /* HACK ALERT! Xbox One doesn't seem to detect gamepads unless something + gets registered to receive Win10's Windows.Gaming.Input.Gamepad.GamepadAdded + events. We'll register an event handler for these events here, to make + sure that gamepad detection works later on, if requested. + */ + Windows::Gaming::Input::Gamepad::GamepadAdded += + ref new Windows::Foundation::EventHandler( + this, &SDL_WinRTApp::OnGamepadAdded + ); +#endif } #if NTDDI_VERSION > NTDDI_WIN8 @@ -810,15 +822,12 @@ static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK); - const char *hint = SDL_GetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON); - if (hint) { - if (*hint == '1') { - args->Handled = true; - } + if (SDL_GetHintBoolean(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, SDL_FALSE)) { + args->Handled = true; } } -#if NTDDI_VERSION == NTDDI_WIN10 +#if NTDDI_VERSION >= NTDDI_WIN10 void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) { @@ -832,3 +841,15 @@ void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone: } #endif +#if NTDDI_VERSION >= NTDDI_WIN10 +void SDL_WinRTApp::OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad) +{ + /* HACK ALERT: Nothing needs to be done here, as this method currently + only exists to allow something to be registered with Win10's + GamepadAdded event, an operation that seems to be necessary to get + Xinput-based detection to work on Xbox One. + */ +} +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.h b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.h rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.h index 0b69c2bb98..7f52592689 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,6 +80,10 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); #endif +#if NTDDI_VERSION >= NTDDI_WIN10 + void OnGamepadAdded(Platform::Object ^sender, Windows::Gaming::Input::Gamepad ^gamepad); +#endif + private: bool m_windowClosed; bool m_windowVisible; diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.cpp b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.cpp similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.cpp rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.cpp index 201e3b6c2a..7e2aac8a7b 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,7 @@ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE; #if WINAPI_FAMILY == WINAPI_FAMILY_APP extern "C" ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL; -static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; +static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; #endif diff --git a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.h b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.h rename to 3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.h index a08b67c40b..85b4305878 100644 --- a/3rdparty/sdl2-2.0.4/src/core/winrt/SDL_winrtapp_xaml.h +++ b/3rdparty/sdl2-2.0.9/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_xaml_h -#define _SDL_winrtapp_xaml_h +#ifndef SDL_winrtapp_xaml_h_ +#define SDL_winrtapp_xaml_h_ #include "SDL_stdinc.h" @@ -30,4 +30,4 @@ extern SDL_bool WINRT_XAMLWasEnabled; extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable); #endif // ifdef __cplusplus -#endif // ifndef _SDL_winrtapp_xaml_h +#endif // SDL_winrtapp_xaml_h_ diff --git a/3rdparty/sdl2-2.0.4/src/cpuinfo/SDL_cpuinfo.c b/3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_cpuinfo.c similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/cpuinfo/SDL_cpuinfo.c rename to 3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_cpuinfo.c index c4c55be399..441035883e 100644 --- a/3rdparty/sdl2-2.0.4/src/cpuinfo/SDL_cpuinfo.c +++ b/3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,15 +22,24 @@ #include "SDL_config.h" #else #include "../SDL_internal.h" +#include "SDL_simd.h" #endif #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#if defined(__OS2__) +#define INCL_DOS +#include +#ifndef QSV_NUMPROCESSORS +#define QSV_NUMPROCESSORS 26 +#endif +#endif /* CPU feature detection for SDL */ #include "SDL_cpuinfo.h" +#include "SDL_assert.h" #ifdef HAVE_SYSCONF #include @@ -50,17 +59,38 @@ #include #endif -#define CPU_HAS_RDTSC 0x00000001 -#define CPU_HAS_ALTIVEC 0x00000002 -#define CPU_HAS_MMX 0x00000004 -#define CPU_HAS_3DNOW 0x00000008 -#define CPU_HAS_SSE 0x00000010 -#define CPU_HAS_SSE2 0x00000020 -#define CPU_HAS_SSE3 0x00000040 -#define CPU_HAS_SSE41 0x00000100 -#define CPU_HAS_SSE42 0x00000200 -#define CPU_HAS_AVX 0x00000400 -#define CPU_HAS_AVX2 0x00000800 +#if defined(__QNXNTO__) +#include +#endif + +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) +/*#include */ +#ifndef AT_HWCAP +#define AT_HWCAP 16 +#endif +#ifndef HWCAP_NEON +#define HWCAP_NEON (1 << 12) +#endif +#if defined HAVE_GETAUXVAL +#include +#else +#include +#endif +#endif + +#define CPU_HAS_RDTSC (1 << 0) +#define CPU_HAS_ALTIVEC (1 << 1) +#define CPU_HAS_MMX (1 << 2) +#define CPU_HAS_3DNOW (1 << 3) +#define CPU_HAS_SSE (1 << 4) +#define CPU_HAS_SSE2 (1 << 5) +#define CPU_HAS_SSE3 (1 << 6) +#define CPU_HAS_SSE41 (1 << 7) +#define CPU_HAS_SSE42 (1 << 8) +#define CPU_HAS_AVX (1 << 9) +#define CPU_HAS_AVX2 (1 << 10) +#define CPU_HAS_NEON (1 << 11) +#define CPU_HAS_AVX512F (1 << 12) #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ /* This is the brute force way of detecting instruction sets... @@ -78,6 +108,7 @@ static int CPU_haveCPUID(void) { int has_CPUID = 0; + /* *INDENT-OFF* */ #ifndef SDL_CPUINFO_DISABLED #if defined(__GNUC__) && defined(i386) @@ -212,62 +243,52 @@ CPU_haveCPUID(void) } #else #define cpuid(func, a, b, c, d) \ - a = b = c = d = 0 + do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) #endif -static int -CPU_getCPUIDFeatures(void) -{ - int features = 0; - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - features = d; - } - return features; -} +static int CPU_CPUIDFeatures[4]; +static int CPU_CPUIDMaxFunction = 0; +static SDL_bool CPU_OSSavesYMM = SDL_FALSE; +static SDL_bool CPU_OSSavesZMM = SDL_FALSE; -static SDL_bool -CPU_OSSavesYMM(void) +static void +CPU_calcCPUIDFeatures(void) { - int a, b, c, d; - - /* Check to make sure we can call xgetbv */ - cpuid(0, a, b, c, d); - if (a < 1) { - return SDL_FALSE; - } - cpuid(1, a, b, c, d); - if (!(c & 0x08000000)) { - return SDL_FALSE; - } - - /* Call xgetbv to see if YMM register state is saved */ - a = 0; + static SDL_bool checked = SDL_FALSE; + if (!checked) { + checked = SDL_TRUE; + if (CPU_haveCPUID()) { + int a, b, c, d; + cpuid(0, a, b, c, d); + CPU_CPUIDMaxFunction = a; + if (CPU_CPUIDMaxFunction >= 1) { + cpuid(1, a, b, c, d); + CPU_CPUIDFeatures[0] = a; + CPU_CPUIDFeatures[1] = b; + CPU_CPUIDFeatures[2] = c; + CPU_CPUIDFeatures[3] = d; + + /* Check to make sure we can call xgetbv */ + if (c & 0x08000000) { + /* Call xgetbv to see if YMM (etc) register state is saved */ #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) - asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); + __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */ - a = (int)_xgetbv(0); + a = (int)_xgetbv(0); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) - __asm - { - xor ecx, ecx - _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 - mov a, eax - } + __asm + { + xor ecx, ecx + _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 + mov a, eax + } #endif - return ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; -} - -static int -CPU_haveRDTSC(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00000010); + CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; + CPU_OSSavesZMM = (CPU_OSSavesYMM && ((a & 0xe0) == 0xe0)) ? SDL_TRUE : SDL_FALSE; + } + } + } } - return 0; } static int @@ -299,119 +320,99 @@ CPU_haveAltiVec(void) return altivec; } +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) static int -CPU_haveMMX(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00800000); - } - return 0; -} - -static int -CPU_have3DNow(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0x80000000, a, b, c, d); - if (a >= 0x80000001) { - cpuid(0x80000001, a, b, c, d); - return (d & 0x80000000); +readProcAuxvForNeon(void) +{ + int neon = 0; + int kv[2]; + const int fd = open("/proc/self/auxv", O_RDONLY); + if (fd != -1) { + while (read(fd, kv, sizeof (kv)) == sizeof (kv)) { + if (kv[0] == AT_HWCAP) { + neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON); + break; + } } + close(fd); } - return 0; -} - -static int -CPU_haveSSE(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x02000000); - } - return 0; + return neon; } +#endif -static int -CPU_haveSSE2(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x04000000); - } - return 0; -} static int -CPU_haveSSE3(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00000001); - } - } +CPU_haveNEON(void) +{ +/* The way you detect NEON is a privileged instruction on ARM, so you have + query the OS kernel in a platform-specific way. :/ */ +#if defined(SDL_CPUINFO_DISABLED) || !defined(__ARM_ARCH) + return 0; /* disabled or not an ARM CPU at all. */ +#elif __ARM_ARCH >= 8 + return 1; /* ARMv8 always has non-optional NEON support. */ +#elif defined(__APPLE__) && (__ARM_ARCH >= 7) + /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ + return 1; /* all Apple ARMv7 chips and later have NEON. */ +#elif defined(__APPLE__) + return 0; /* assume anything else from Apple doesn't have NEON. */ +#elif defined(__QNXNTO__) + return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON; +#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) + return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON); +#elif (defined(__LINUX__) || defined(__ANDROID__)) + return readProcAuxvForNeon(); /* Android offers a static library for this, but it just parses /proc/self/auxv */ +#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) + /* All WinRT ARM devices are required to support NEON, but just in case. */ + return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; +#else +#warning SDL_HasNEON is not implemented for this ARM platform. Write me. return 0; +#endif } static int -CPU_haveSSE41(void) +CPU_have3DNow(void) { - if (CPU_haveCPUID()) { + if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */ int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00080000); + cpuid(0x80000000, a, b, c, d); + if (a >= 0x80000001) { + cpuid(0x80000001, a, b, c, d); + return (d & 0x80000000); } } return 0; } -static int -CPU_haveSSE42(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00100000); - } - } - return 0; -} +#define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010) +#define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000) +#define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000) +#define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000) +#define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001) +#define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000) +#define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000) +#define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) static int -CPU_haveAVX(void) +CPU_haveAVX2(void) { - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { + if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x10000000); - } + (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ + cpuid(7, a, b, c, d); + return (b & 0x00000020); } return 0; } static int -CPU_haveAVX2(void) +CPU_haveAVX512F(void) { - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { + if (CPU_OSSavesZMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 7) { - cpuid(7, a, b, c, d); - return (b & 0x00000020); - } + (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ + cpuid(7, a, b, c, d); + return (b & 0x00010000); } return 0; } @@ -441,6 +442,12 @@ SDL_GetCPUCount(void) SDL_CPUCount = info.dwNumberOfProcessors; } #endif +#ifdef __OS2__ + if (SDL_CPUCount <= 0) { + DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, + &SDL_CPUCount, sizeof(SDL_CPUCount) ); + } +#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -459,7 +466,8 @@ SDL_GetCPUType(void) if (!SDL_CPUType[0]) { int i = 0; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ int a, b, c, d; cpuid(0x00000000, a, b, c, d); (void) a; @@ -496,7 +504,8 @@ SDL_GetCPUName(void) int i = 0; int a, b, c, d; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ cpuid(0x80000000, a, b, c, d); if (a >= 0x80000004) { cpuid(0x80000002, a, b, c, d); @@ -579,146 +588,147 @@ SDL_GetCPUCacheLineSize(void) } static Uint32 SDL_CPUFeatures = 0xFFFFFFFF; +static Uint32 SDL_SIMDAlignment = 0xFFFFFFFF; static Uint32 SDL_GetCPUFeatures(void) { if (SDL_CPUFeatures == 0xFFFFFFFF) { + CPU_calcCPUIDFeatures(); SDL_CPUFeatures = 0; + SDL_SIMDAlignment = 4; /* a good safe base value */ if (CPU_haveRDTSC()) { SDL_CPUFeatures |= CPU_HAS_RDTSC; } if (CPU_haveAltiVec()) { SDL_CPUFeatures |= CPU_HAS_ALTIVEC; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveMMX()) { SDL_CPUFeatures |= CPU_HAS_MMX; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8); } if (CPU_have3DNow()) { SDL_CPUFeatures |= CPU_HAS_3DNOW; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 8); } if (CPU_haveSSE()) { SDL_CPUFeatures |= CPU_HAS_SSE; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE2()) { SDL_CPUFeatures |= CPU_HAS_SSE2; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE3()) { SDL_CPUFeatures |= CPU_HAS_SSE3; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE41()) { SDL_CPUFeatures |= CPU_HAS_SSE41; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveSSE42()) { SDL_CPUFeatures |= CPU_HAS_SSE42; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } if (CPU_haveAVX()) { SDL_CPUFeatures |= CPU_HAS_AVX; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); } if (CPU_haveAVX2()) { SDL_CPUFeatures |= CPU_HAS_AVX2; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); + } + if (CPU_haveAVX512F()) { + SDL_CPUFeatures |= CPU_HAS_AVX512F; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 64); + } + if (CPU_haveNEON()) { + SDL_CPUFeatures |= CPU_HAS_NEON; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } } return SDL_CPUFeatures; } -SDL_bool -SDL_HasRDTSC(void) +#define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) + +SDL_bool SDL_HasRDTSC(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_RDTSC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC); } SDL_bool SDL_HasAltiVec(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); } SDL_bool SDL_HasMMX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_MMX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); } SDL_bool SDL_Has3DNow(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_3DNOW) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW); } SDL_bool SDL_HasSSE(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); } SDL_bool SDL_HasSSE2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); } SDL_bool SDL_HasSSE3(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE3) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); } SDL_bool SDL_HasSSE41(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE41) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); } SDL_bool SDL_HasSSE42(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE42) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); } SDL_bool SDL_HasAVX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); } SDL_bool SDL_HasAVX2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); +} + +SDL_bool +SDL_HasAVX512F(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F); +} + +SDL_bool +SDL_HasNEON(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } static int SDL_SystemRAM = 0; @@ -762,12 +772,57 @@ SDL_GetSystemRAM(void) } } #endif +#ifdef __OS2__ + if (SDL_SystemRAM <= 0) { + Uint32 sysram = 0; + DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); + SDL_SystemRAM = (int) (sysram / 0x100000U); + } +#endif #endif } return SDL_SystemRAM; } +size_t +SDL_SIMDGetAlignment(void) +{ + if (SDL_SIMDAlignment == 0xFFFFFFFF) { + SDL_GetCPUFeatures(); /* make sure this has been calculated */ + } + SDL_assert(SDL_SIMDAlignment != 0); + return SDL_SIMDAlignment; +} + +void * +SDL_SIMDAlloc(const size_t len) +{ + const size_t alignment = SDL_SIMDGetAlignment(); + const size_t padding = alignment - (len % alignment); + const size_t padded = (padding != alignment) ? (len + padding) : len; + Uint8 *retval = NULL; + Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *)); + if (ptr) { + /* store the actual malloc pointer right before our aligned pointer. */ + retval = ptr + sizeof (void *); + retval += alignment - (((size_t) retval) % alignment); + *(((void **) retval) - 1) = ptr; + } + return retval; +} + +void +SDL_SIMDFree(void *ptr) +{ + if (ptr) { + void **realptr = (void **) ptr; + realptr--; + SDL_free(*(((void **) ptr) - 1)); + } +} + + #ifdef TEST_MAIN #include @@ -790,6 +845,8 @@ main() printf("SSE4.2: %d\n", SDL_HasSSE42()); printf("AVX: %d\n", SDL_HasAVX()); printf("AVX2: %d\n", SDL_HasAVX2()); + printf("AVX-512F: %d\n", SDL_HasAVX512F()); + printf("NEON: %d\n", SDL_HasNEON()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } diff --git a/3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_simd.h b/3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_simd.h new file mode 100644 index 0000000000..e2b28bc8cd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_simd.h @@ -0,0 +1,88 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL.h" +#include "../SDL_internal.h" + +/** + * \brief Report the alignment this system needs for SIMD allocations. + * + * This will return the minimum number of bytes to which a pointer must be + * aligned to be compatible with SIMD instructions on the current machine. + * For example, if the machine supports SSE only, it will return 16, but if + * it supports AVX-512F, it'll return 64 (etc). This only reports values for + * instruction sets SDL knows about, so if your SDL build doesn't have + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + * Plan accordingly. + */ +extern size_t SDL_SIMDGetAlignment(void); + +/** + * \brief Allocate memory in a SIMD-friendly way. + * + * This will allocate a block of memory that is suitable for use with SIMD + * instructions. Specifically, it will be properly aligned and padded for + * the system's supported vector instructions. + * + * The memory returned will be padded such that it is safe to read or write + * an incomplete vector at the end of the memory block. This can be useful + * so you don't have to drop back to a scalar fallback at the end of your + * SIMD processing loop to deal with the final elements without overflowing + * the allocated buffer. + * + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() + * or delete[], etc. + * + * Note that SDL will only deal with SIMD instruction sets it is aware of; + * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors + * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't + * know that AVX-512 wants 64. To be clear: if you can't decide to use an + * instruction set with an SDL_Has*() function, don't use that instruction + * set with memory allocated through here. + * + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't + * out of memory. + * + * \param len The length, in bytes, of the block to allocated. The actual + * allocated block might be larger due to padding, etc. + * \return Pointer to newly-allocated block, NULL if out of memory. + * + * \sa SDL_SIMDAlignment + * \sa SDL_SIMDFree + */ +extern void * SDL_SIMDAlloc(const size_t len); + +/** + * \brief Deallocate memory obtained from SDL_SIMDAlloc + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, + * SDL_malloc, memalign, new[], etc. + * + * However, SDL_SIMDFree(NULL) is a legal no-op. + * + * \sa SDL_SIMDAlloc + */ +extern void SDL_SIMDFree(void *ptr); + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.c b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.c rename to 3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.c index 1411f8c93b..97bc218462 100644 --- a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.c +++ b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,11 +24,18 @@ #if SDL_DYNAMIC_API +#if defined(__OS2__) +#define INCL_DOS +#define INCL_DOSERRORS +#include +#include +#endif + #include "SDL.h" -/* !!! FIXME: Shouldn't these be included in SDL.h? */ -#include "SDL_shape.h" +/* These headers have system specific definitions, so aren't included above */ #include "SDL_syswm.h" +#include "SDL_vulkan.h" /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. @@ -56,38 +63,38 @@ static void SDL_InitDynamicAPI(void); #if DISABLE_JUMP_MAGIC /* Can't use the macro for varargs nonsense. This is atrocious. */ #define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \ - _static void SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ - _static int SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ char buf[512]; /* !!! FIXME: dynamic allocation */ \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \ va_end(ap); \ return jump_table.SDL_SetError("%s", buf); \ } \ - _static int SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsscanf(buf, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static int SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static void SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ va_end(ap); \ } \ - _static void SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, priority, fmt, ap); \ va_end(ap); \ @@ -105,9 +112,9 @@ static void SDL_InitDynamicAPI(void); /* The DEFAULT funcs will init jump table and then call real function. */ /* The REAL funcs are the actual functions, name-mangled to not clash. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - typedef rc (*SDL_DYNAPIFN_##fn) params; \ - static rc fn##_DEFAULT params; \ - extern rc fn##_REAL params; + typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \ + static rc SDLCALL fn##_DEFAULT params; \ + extern rc SDLCALL fn##_REAL params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -119,7 +126,7 @@ typedef struct { } SDL_DYNAPI_jump_table; /* Predeclare the default functions for initializing the jump table. */ -#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc fn##_DEFAULT params; +#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -133,7 +140,7 @@ static SDL_DYNAPI_jump_table jump_table = { /* Default functions init the function table then call right thing. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - static rc fn##_DEFAULT params { \ + static rc SDLCALL fn##_DEFAULT params { \ SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } @@ -150,7 +157,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) /* Public API functions to jump into the jump table. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - rc fn params { ret jump_table.fn args; } + rc SDLCALL fn params { ret jump_table.fn args; } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -161,15 +168,10 @@ SDL_DYNAPI_VARARGS(,,) #error Write me. #endif - - -/* Here's the exported entry point that fills in the jump table. */ -/* Use specific types when an "int" might suffice to keep this sane. */ -typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize); -extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32); - -Sint32 -SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize) +/* we make this a static function so we can call the correct one without the + system's dynamic linker resolving to the wrong version of this. */ +static Sint32 +initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize) { SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *) table; @@ -196,6 +198,18 @@ SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize) } +/* Here's the exported entry point that fills in the jump table. */ +/* Use specific types when an "int" might suffice to keep this sane. */ +typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize); +extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32); + +Sint32 +SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize) +{ + return initialize_jumptable(apiver, table, tablesize); +} + + /* Obviously we can't use SDL_LoadObject() to load SDL. :) */ /* Also obviously, we never close the loaded library. */ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) @@ -216,21 +230,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) return retval; } -#elif defined(__HAIKU__) -#include -static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) -{ - image_id lib = load_add_on(fname); - void *retval = NULL; - if (lib >= 0) { - if (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR) { - unload_add_on(lib); - retval = NULL; - } - } - return retval; -} -#elif defined(unix) || defined(__unix__) || defined(__APPLE__) +#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__) #include static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { @@ -244,6 +244,21 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) } return retval; } + +#elif defined(__OS2__) +static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) +{ + HMODULE hmodule; + PFN retval = NULL; + char error[256]; + if (DosLoadModule(&error, sizeof(error), fname, &hmodule) == NO_ERROR) { + if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { + DosFreeModule(hmodule); + } + } + return (void *) retval; +} + #else #error Please define your platform. #endif @@ -253,7 +268,7 @@ static void SDL_InitDynamicAPILocked(void) { const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API"); - SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry; /* funcs from here by default. */ + SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */ if (libname) { entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry"); @@ -261,16 +276,15 @@ SDL_InitDynamicAPILocked(void) /* !!! FIXME: fail to startup here instead? */ /* !!! FIXME: definitely warn user. */ /* Just fill in the function pointers from this library. */ - entry = SDL_DYNAPI_entry; } } - if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) { + if (!entry || (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0)) { /* !!! FIXME: fail to startup here instead? */ /* !!! FIXME: definitely warn user. */ /* Just fill in the function pointers from this library. */ - if (entry != SDL_DYNAPI_entry) { - if (!SDL_DYNAPI_entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) { + if (!entry) { + if (!initialize_jumptable(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) { /* !!! FIXME: now we're screwed. Should definitely abort now. */ } } @@ -293,7 +307,7 @@ SDL_InitDynamicAPI(void) * SDL_CreateThread() would also call this function before building the * new thread). */ - static volatile SDL_bool already_initialized = SDL_FALSE; + static SDL_bool already_initialized = SDL_FALSE; /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a @@ -316,4 +330,3 @@ SDL_InitDynamicAPI(void) #endif /* SDL_DYNAMIC_API */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.4/include-moai/SDL_dynapi.h b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.h similarity index 78% rename from 3rdparty/sdl2-2.0.4/include-moai/SDL_dynapi.h rename to 3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.h index 7ebcac0ece..73316f1f88 100644 --- a/3rdparty/sdl2-2.0.4/include-moai/SDL_dynapi.h +++ b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_dynapi_h -#define _SDL_dynapi_h +#ifndef SDL_dynapi_h_ +#define SDL_dynapi_h_ /* IMPORTANT: This is the master switch to disabling the dynamic API. We made it so you @@ -43,9 +43,15 @@ #include "TargetConditionals.h" #endif -#if TARGET_OS_IPHONE || __native_client__ || __EMSCRIPTEN__ /* probably not useful on iOS, NACL or Emscripten. */ +#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* probably not useful on iOS. */ #define SDL_DYNAMIC_API 0 -#elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */ +#elif defined(__native_client__) && __native_client__ /* probably not useful on NACL. */ +#define SDL_DYNAMIC_API 0 +#elif defined(__EMSCRIPTEN__) && __EMSCRIPTEN__ /* probably not useful on Emscripten. */ +#define SDL_DYNAMIC_API 0 +#elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ +#define SDL_DYNAMIC_API 0 +#elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 #elif defined(__clang_analyzer__) #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ @@ -53,7 +59,7 @@ /* everyone else. This is where we turn on the API if nothing forced it off. */ #ifndef SDL_DYNAMIC_API -#define SDL_DYNAMIC_API 0 +#define SDL_DYNAMIC_API 1 #endif #endif diff --git a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_overrides.h b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_overrides.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_overrides.h rename to 3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_overrides.h index c9ebfffe22..745421382c 100644 --- a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_overrides.h +++ b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,6 @@ #error You should not be here. #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -#define SDL_MemoryBarrierRelease SDL_MemoryBarrierRelease_REAL -#define SDL_MemoryBarrierAcquire SDL_MemoryBarrierAcquire_REAL -#endif - #define SDL_SetError SDL_SetError_REAL #define SDL_Log SDL_Log_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL @@ -445,6 +439,8 @@ #define SDL_iconv_close SDL_iconv_close_REAL #define SDL_iconv SDL_iconv_REAL #define SDL_iconv_string SDL_iconv_string_REAL +#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL +#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_CreateRGBSurface SDL_CreateRGBSurface_REAL #define SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom_REAL #define SDL_FreeSurface SDL_FreeSurface_REAL @@ -597,3 +593,111 @@ #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL +#define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL +#define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL +#define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL +#define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL +#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL +#define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL +#define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_REAL +#define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_REAL +#define SDL_DequeueAudio SDL_DequeueAudio_REAL +#define SDL_SetWindowResizable SDL_SetWindowResizable_REAL +#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL +#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL +#define SDL_GetHintBoolean SDL_GetHintBoolean_REAL +#define SDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor_REAL +#define SDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct_REAL +#define SDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion_REAL +#define SDL_JoystickGetVendor SDL_JoystickGetVendor_REAL +#define SDL_JoystickGetProduct SDL_JoystickGetProduct_REAL +#define SDL_JoystickGetProductVersion SDL_JoystickGetProductVersion_REAL +#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL +#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL +#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL +#define SDL_HasNEON SDL_HasNEON_REAL +#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL +#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL +#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL +#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL +#define SDL_JoystickGetType SDL_JoystickGetType_REAL +#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL +#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL +#define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL +#define SDL_utf8strlen SDL_utf8strlen_REAL +#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL +#define SDL_wcscmp SDL_wcscmp_REAL +#define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL +#define SDL_DuplicateSurface SDL_DuplicateSurface_REAL +#define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL +#define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL +#define SDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary_REAL +#define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL +#define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL +#define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL +#define SDL_LockJoysticks SDL_LockJoysticks_REAL +#define SDL_UnlockJoysticks SDL_UnlockJoysticks_REAL +#define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL +#define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL +#define SDL_GetNumAllocations SDL_GetNumAllocations_REAL +#define SDL_NewAudioStream SDL_NewAudioStream_REAL +#define SDL_AudioStreamPut SDL_AudioStreamPut_REAL +#define SDL_AudioStreamGet SDL_AudioStreamGet_REAL +#define SDL_AudioStreamClear SDL_AudioStreamClear_REAL +#define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_REAL +#define SDL_FreeAudioStream SDL_FreeAudioStream_REAL +#define SDL_AudioStreamFlush SDL_AudioStreamFlush_REAL +#define SDL_acosf SDL_acosf_REAL +#define SDL_asinf SDL_asinf_REAL +#define SDL_atanf SDL_atanf_REAL +#define SDL_atan2f SDL_atan2f_REAL +#define SDL_ceilf SDL_ceilf_REAL +#define SDL_copysignf SDL_copysignf_REAL +#define SDL_fabsf SDL_fabsf_REAL +#define SDL_floorf SDL_floorf_REAL +#define SDL_logf SDL_logf_REAL +#define SDL_powf SDL_powf_REAL +#define SDL_scalbnf SDL_scalbnf_REAL +#define SDL_fmod SDL_fmod_REAL +#define SDL_fmodf SDL_fmodf_REAL +#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL +#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL +#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL +#define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_REAL +#define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_REAL +#define SDL_IsAndroidTV SDL_IsAndroidTV_REAL +#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL +#define SDL_log10 SDL_log10_REAL +#define SDL_log10f SDL_log10f_REAL +#define SDL_GameControllerMappingForDeviceIndex SDL_GameControllerMappingForDeviceIndex_REAL +#define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_REAL +#define SDL_HasAVX512F SDL_HasAVX512F_REAL +#define SDL_IsChromebook SDL_IsChromebook_REAL +#define SDL_IsDeXMode SDL_IsDeXMode_REAL +#define SDL_AndroidBackButton SDL_AndroidBackButton_REAL +#define SDL_exp SDL_exp_REAL +#define SDL_expf SDL_expf_REAL +#define SDL_wcsdup SDL_wcsdup_REAL +#define SDL_GameControllerRumble SDL_GameControllerRumble_REAL +#define SDL_JoystickRumble SDL_JoystickRumble_REAL +#define SDL_NumSensors SDL_NumSensors_REAL +#define SDL_SensorGetDeviceName SDL_SensorGetDeviceName_REAL +#define SDL_SensorGetDeviceType SDL_SensorGetDeviceType_REAL +#define SDL_SensorGetDeviceNonPortableType SDL_SensorGetDeviceNonPortableType_REAL +#define SDL_SensorGetDeviceInstanceID SDL_SensorGetDeviceInstanceID_REAL +#define SDL_SensorOpen SDL_SensorOpen_REAL +#define SDL_SensorFromInstanceID SDL_SensorFromInstanceID_REAL +#define SDL_SensorGetName SDL_SensorGetName_REAL +#define SDL_SensorGetType SDL_SensorGetType_REAL +#define SDL_SensorGetNonPortableType SDL_SensorGetNonPortableType_REAL +#define SDL_SensorGetInstanceID SDL_SensorGetInstanceID_REAL +#define SDL_SensorGetData SDL_SensorGetData_REAL +#define SDL_SensorClose SDL_SensorClose_REAL +#define SDL_SensorUpdate SDL_SensorUpdate_REAL +#define SDL_IsTablet SDL_IsTablet_REAL +#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_REAL +#define SDL_HasColorKey SDL_HasColorKey_REAL +#define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL +#define SDL_JoystickGetDevicePlayerIndex SDL_JoystickGetDevicePlayerIndex_REAL +#define SDL_JoystickGetPlayerIndex SDL_JoystickGetPlayerIndex_REAL +#define SDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex_REAL diff --git a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_procs.h b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_procs.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_procs.h rename to 3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_procs.h index 3f11a25f97..0a1f3aefa5 100644 --- a/3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_procs.h +++ b/3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,8 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #if defined(__WIN32__) && !defined(HAVE_LIBC) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) +#elif defined(__OS2__) +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif @@ -60,12 +62,6 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return) #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierRelease,(void),(),) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquire,(void),(),) -#endif - #ifdef __WIN32__ SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) @@ -73,12 +69,12 @@ SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return) #endif -#if defined(__IPHONEOS__) && __IPHONEOS__ +#ifdef __IPHONEOS__ SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif -#if defined(__ANDROID__) && __ANDROID__ +#ifdef __ANDROID__ SDL_DYNAPI_PROC(void*,SDL_AndroidGetJNIEnv,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_AndroidGetActivity,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_AndroidGetInternalStoragePath,(void),(),return) @@ -631,3 +627,131 @@ SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(int a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProductVersion,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetVendor,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProduct,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProductVersion,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetVendor,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProduct,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProductVersion,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GameControllerNumMappings,(void),(),return) +SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),) +SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return) +SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) +SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return) +SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_NewAudioStream,(const SDL_AudioFormat a, const Uint8 b, const int c, const SDL_AudioFormat d, const Uint8 e, const int f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamPut,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamGet,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_AudioStreamClear,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamAvailable,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_FreeAudioStream,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamFlush,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_asinf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atanf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atan2f,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_ceilf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_copysignf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fabsf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_logf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return) +SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalLayer,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalCommandEncoder,(SDL_Renderer *a),(a),return) +#ifdef __WINRT__ +SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return) +#endif +#ifdef __ANDROID__ +SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return) +#endif +SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return) +SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return) +SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForDeviceIndex,(int a),(a),return) +#ifdef __LINUX__ +SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriority,(Sint64 a, int b),(a,b),return) +#endif +SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return) +#ifdef __ANDROID__ +SDL_DYNAPI_PROC(SDL_bool,SDL_IsChromebook,(void),(),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_IsDeXMode,(void),(),return) +SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),return) +#endif +SDL_DYNAPI_PROC(double,SDL_exp,(double a),(a),return) +SDL_DYNAPI_PROC(float,SDL_expf,(float a),(a),return) +SDL_DYNAPI_PROC(wchar_t*,SDL_wcsdup,(const wchar_t *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GameControllerRumble,(SDL_GameController *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_JoystickRumble,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_NumSensors,(void),(),return) +SDL_DYNAPI_PROC(const char*,SDL_SensorGetDeviceName,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetDeviceType,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_SensorGetDeviceNonPortableType,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetDeviceInstanceID,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorOpen,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorFromInstanceID,(SDL_SensorID a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_SensorGetName,(SDL_Sensor *a),(a),return) +SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetType,(SDL_Sensor *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_SensorGetNonPortableType,(SDL_Sensor *a),(a),return) +SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetInstanceID,(SDL_Sensor *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_SensorGetData,(SDL_Sensor *a, float *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SensorClose,(SDL_Sensor *a),(a),) +SDL_DYNAPI_PROC(void,SDL_SensorUpdate,(void),(),) +SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return) +SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetDisplayOrientation,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return) + +#ifdef SDL_CreateThreadWithStackSize +#undef SDL_CreateThreadWithStackSize +#endif + +#if defined(__WIN32__) && !defined(HAVE_LIBC) +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) +#elif defined(__OS2__) +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) +#else +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return) +#endif + +SDL_DYNAPI_PROC(int,SDL_JoystickGetDevicePlayerIndex,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_JoystickGetPlayerIndex,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GameControllerGetPlayerIndex,(SDL_GameController *a),(a),return) diff --git a/3rdparty/sdl2-2.0.4/src/dynapi/gendynapi.pl b/3rdparty/sdl2-2.0.9/src/dynapi/gendynapi.pl similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/dynapi/gendynapi.pl rename to 3rdparty/sdl2-2.0.9/src/dynapi/gendynapi.pl index 5c3d79608d..721241be6d 100755 --- a/3rdparty/sdl2-2.0.4/src/dynapi/gendynapi.pl +++ b/3rdparty/sdl2-2.0.9/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2016 Sam Lantinga +# Copyright (C) 1997-2018 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents.c b/3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents.c index 9b2209bdfe..5c45853b72 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents_c.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents_c.h index 98e6a38bd4..24c450bab6 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_clipboardevents_c_h -#define _SDL_clipboardevents_c_h +#ifndef SDL_clipboardevents_c_h_ +#define SDL_clipboardevents_c_h_ extern int SDL_SendClipboardUpdate(void); -#endif /* _SDL_clipboardevents_c_h */ +#endif /* SDL_clipboardevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_dropevents.c b/3rdparty/sdl2-2.0.9/src/events/SDL_displayevents.c similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_dropevents.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_displayevents.c index 8f4405efa4..6c696af17b 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_dropevents.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_displayevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,26 +20,40 @@ */ #include "../SDL_internal.h" -/* Drag and drop event handling code for SDL */ +/* Display event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" -#include "SDL_dropevents_c.h" int -SDL_SendDropFile(const char *file) +SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1) { int posted; + if (!display) { + return 0; + } + switch (displayevent) { + case SDL_DISPLAYEVENT_ORIENTATION: + if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) { + return 0; + } + display->orientation = (SDL_DisplayOrientation)data1; + break; + } + /* Post the event, if desired */ posted = 0; - if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) { + if (SDL_GetEventState(SDL_DISPLAYEVENT) == SDL_ENABLE) { SDL_Event event; - event.type = SDL_DROPFILE; - event.drop.file = SDL_strdup(file); + event.type = SDL_DISPLAYEVENT; + event.display.event = displayevent; + event.display.display = SDL_GetIndexOfDisplay(display); + event.display.data1 = data1; posted = (SDL_PushEvent(&event) > 0); } + return (posted); } diff --git a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiomem.h b/3rdparty/sdl2-2.0.9/src/events/SDL_displayevents_c.h similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/audio/SDL_audiomem.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_displayevents_c.h index 091d15c298..41def7b923 100644 --- a/3rdparty/sdl2-2.0.4/src/audio/SDL_audiomem.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_displayevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,11 @@ */ #include "../SDL_internal.h" -#define SDL_AllocAudioMem SDL_malloc -#define SDL_FreeAudioMem SDL_free +#ifndef SDL_displayevents_c_h_ +#define SDL_displayevents_c_h_ + +extern int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1); + +#endif /* SDL_displayevents_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents.c b/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents.c new file mode 100644 index 0000000000..39c5120083 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents.c @@ -0,0 +1,98 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* Drag and drop event handling code for SDL */ + +#include "SDL_events.h" +#include "SDL_events_c.h" +#include "SDL_dropevents_c.h" + +#include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */ + + +static int +SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data) +{ + static SDL_bool app_is_dropping = SDL_FALSE; + int posted = 0; + + /* Post the event, if desired */ + if (SDL_GetEventState(evtype) == SDL_ENABLE) { + const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping; + SDL_Event event; + + if (need_begin) { + SDL_zero(event); + event.type = SDL_DROPBEGIN; + + if (window) { + event.drop.windowID = window->id; + } + + posted = (SDL_PushEvent(&event) > 0); + if (!posted) { + return 0; + } + if (window) { + window->is_dropping = SDL_TRUE; + } else { + app_is_dropping = SDL_TRUE; + } + } + + SDL_zero(event); + event.type = evtype; + event.drop.file = data ? SDL_strdup(data) : NULL; + event.drop.windowID = window ? window->id : 0; + posted = (SDL_PushEvent(&event) > 0); + + if (posted && (evtype == SDL_DROPCOMPLETE)) { + if (window) { + window->is_dropping = SDL_FALSE; + } else { + app_is_dropping = SDL_FALSE; + } + } + } + return posted; +} + +int +SDL_SendDropFile(SDL_Window *window, const char *file) +{ + return SDL_SendDrop(window, SDL_DROPFILE, file); +} + +int +SDL_SendDropText(SDL_Window *window, const char *text) +{ + return SDL_SendDrop(window, SDL_DROPTEXT, text); +} + +int +SDL_SendDropComplete(SDL_Window *window) +{ + return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL); +} + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents_c.h new file mode 100644 index 0000000000..79f37cc165 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_dropevents_c.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#ifndef SDL_dropevents_c_h_ +#define SDL_dropevents_c_h_ + +extern int SDL_SendDropFile(SDL_Window *window, const char *file); +extern int SDL_SendDropText(SDL_Window *window, const char *text); +extern int SDL_SendDropComplete(SDL_Window *window); + +#endif /* SDL_dropevents_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/events/SDL_events.c b/3rdparty/sdl2-2.0.9/src/events/SDL_events.c new file mode 100644 index 0000000000..25e8ac49c0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_events.c @@ -0,0 +1,978 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* General event handling code for SDL */ + +#include "SDL.h" +#include "SDL_events.h" +#include "SDL_thread.h" +#include "SDL_events_c.h" +#include "../timer/SDL_timer_c.h" +#if !SDL_JOYSTICK_DISABLED +#include "../joystick/SDL_joystick_c.h" +#endif +#include "../video/SDL_sysvideo.h" +#include "SDL_syswm.h" + +/*#define SDL_DEBUG_EVENTS 1*/ + +/* An arbitrary limit so we don't have unbounded growth */ +#define SDL_MAX_QUEUED_EVENTS 65535 + +typedef struct SDL_EventWatcher { + SDL_EventFilter callback; + void *userdata; + SDL_bool removed; +} SDL_EventWatcher; + +static SDL_mutex *SDL_event_watchers_lock; +static SDL_EventWatcher SDL_EventOK; +static SDL_EventWatcher *SDL_event_watchers = NULL; +static int SDL_event_watchers_count = 0; +static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE; +static SDL_bool SDL_event_watchers_removed = SDL_FALSE; + +typedef struct { + Uint32 bits[8]; +} SDL_DisabledEventBlock; + +static SDL_DisabledEventBlock *SDL_disabled_events[256]; +static Uint32 SDL_userevents = SDL_USEREVENT; + +/* Private data -- event queue */ +typedef struct _SDL_EventEntry +{ + SDL_Event event; + SDL_SysWMmsg msg; + struct _SDL_EventEntry *prev; + struct _SDL_EventEntry *next; +} SDL_EventEntry; + +typedef struct _SDL_SysWMEntry +{ + SDL_SysWMmsg msg; + struct _SDL_SysWMEntry *next; +} SDL_SysWMEntry; + +static struct +{ + SDL_mutex *lock; + SDL_atomic_t active; + SDL_atomic_t count; + int max_events_seen; + SDL_EventEntry *head; + SDL_EventEntry *tail; + SDL_EventEntry *free; + SDL_SysWMEntry *wmmsg_used; + SDL_SysWMEntry *wmmsg_free; +} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; + + +#ifdef SDL_DEBUG_EVENTS + +/* this is to make printf() calls cleaner. */ +#define uint unsigned int + +static void +SDL_DebugPrintEvent(const SDL_Event *event) +{ + /* !!! FIXME: This code is kinda ugly, sorry. */ + printf("SDL EVENT: "); + + if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { + printf("SDL_USEREVENT"); + if (event->type > SDL_USEREVENT) { + printf("+%u", ((uint) event->type) - SDL_USEREVENT); + } + printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", + (uint) event->user.timestamp, (uint) event->user.windowID, + (int) event->user.code, event->user.data1, event->user.data2); + return; + } + + switch (event->type) { + #define SDL_EVENT_CASE(x) case x: printf("%s", #x); + SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break; + SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break; + SDL_EVENT_CASE(SDL_APP_TERMINATING) break; + SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; + SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; + SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; + SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; + #undef SDL_EVENT_CASE + + #define SDL_EVENT_CASE(x) case x: printf("%s ", #x); + + SDL_EVENT_CASE(SDL_WINDOWEVENT) + printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID); + switch(event->window.event) { + case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break; + #define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); + #undef SDL_WINDOWEVENT_CASE + default: printf("UNKNOWN(bug? fixme?)"); break; + } + printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2); + break; + + SDL_EVENT_CASE(SDL_SYSWMEVENT) + printf("(timestamp=%u)", (uint) event->syswm.timestamp); + /* !!! FIXME: we don't delve further at the moment. */ + break; + + #define PRINT_KEY_EVENT(event) \ + printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ + (uint) event->key.timestamp, (uint) event->key.windowID, \ + event->key.state == SDL_PRESSED ? "pressed" : "released", \ + event->key.repeat ? "true" : "false", \ + (uint) event->key.keysym.scancode, \ + (uint) event->key.keysym.sym, \ + (uint) event->key.keysym.mod) + SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break; + SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break; + #undef PRINT_KEY_EVENT + + SDL_EVENT_CASE(SDL_TEXTEDITING) + printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)", + (uint) event->edit.timestamp, (uint) event->edit.windowID, + event->edit.text, (int) event->edit.start, (int) event->edit.length); + break; + + SDL_EVENT_CASE(SDL_TEXTINPUT) + printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); + break; + + + SDL_EVENT_CASE(SDL_MOUSEMOTION) + printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", + (uint) event->motion.timestamp, (uint) event->motion.windowID, + (uint) event->motion.which, (uint) event->motion.state, + (int) event->motion.x, (int) event->motion.y, + (int) event->motion.xrel, (int) event->motion.yrel); + break; + + #define PRINT_MBUTTON_EVENT(event) \ + printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ + (uint) event->button.timestamp, (uint) event->button.windowID, \ + (uint) event->button.which, (uint) event->button.button, \ + event->button.state == SDL_PRESSED ? "pressed" : "released", \ + (uint) event->button.clicks, (int) event->button.x, (int) event->button.y) + SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break; + #undef PRINT_MBUTTON_EVENT + + + SDL_EVENT_CASE(SDL_MOUSEWHEEL) + printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", + (uint) event->wheel.timestamp, (uint) event->wheel.windowID, + (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y, + event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped"); + break; + + SDL_EVENT_CASE(SDL_JOYAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->jaxis.timestamp, (int) event->jaxis.which, + (uint) event->jaxis.axis, (int) event->jaxis.value); + break; + + SDL_EVENT_CASE(SDL_JOYBALLMOTION) + printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", + (uint) event->jball.timestamp, (int) event->jball.which, + (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel); + break; + + SDL_EVENT_CASE(SDL_JOYHATMOTION) + printf("(timestamp=%u which=%d hat=%u value=%u)", + (uint) event->jhat.timestamp, (int) event->jhat.which, + (uint) event->jhat.hat, (uint) event->jhat.value); + break; + + #define PRINT_JBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->jbutton.timestamp, (int) event->jbutton.which, \ + (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break; + #undef PRINT_JBUTTON_EVENT + + #define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) + SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break; + #undef PRINT_JOYDEV_EVENT + + SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->caxis.timestamp, (int) event->caxis.which, + (uint) event->caxis.axis, (int) event->caxis.value); + break; + + #define PRINT_CBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->cbutton.timestamp, (int) event->cbutton.which, \ + (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break; + #undef PRINT_CBUTTON_EVENT + + #define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; + #undef PRINT_CONTROLLERDEV_EVENT + + #define PRINT_FINGER_EVENT(event) \ + printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \ + (uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \ + (long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) + SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; + #undef PRINT_FINGER_EVENT + + #define PRINT_DOLLAR_EVENT(event) \ + printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \ + (uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \ + (long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ + event->dgesture.error, event->dgesture.x, event->dgesture.y); + SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; + SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; + #undef PRINT_DOLLAR_EVENT + + SDL_EVENT_CASE(SDL_MULTIGESTURE) + printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", + (uint) event->mgesture.timestamp, (long long) event->mgesture.touchId, + event->mgesture.dTheta, event->mgesture.dDist, + event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers); + break; + + #define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) + SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; + #undef PRINT_DROP_EVENT + + #define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); + SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; + #undef PRINT_AUDIODEV_EVENT + + #undef SDL_EVENT_CASE + + default: + printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type); + break; + } + + printf("\n"); +} +#undef uint +#endif + + + +/* Public functions */ + +void +SDL_StopEventLoop(void) +{ + const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS"); + int i; + SDL_EventEntry *entry; + SDL_SysWMEntry *wmmsg; + + if (SDL_EventQ.lock) { + SDL_LockMutex(SDL_EventQ.lock); + } + + SDL_AtomicSet(&SDL_EventQ.active, 0); + + if (report && SDL_atoi(report)) { + SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", + SDL_EventQ.max_events_seen); + } + + /* Clean out EventQ */ + for (entry = SDL_EventQ.head; entry; ) { + SDL_EventEntry *next = entry->next; + SDL_free(entry); + entry = next; + } + for (entry = SDL_EventQ.free; entry; ) { + SDL_EventEntry *next = entry->next; + SDL_free(entry); + entry = next; + } + for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; ) { + SDL_SysWMEntry *next = wmmsg->next; + SDL_free(wmmsg); + wmmsg = next; + } + for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) { + SDL_SysWMEntry *next = wmmsg->next; + SDL_free(wmmsg); + wmmsg = next; + } + + SDL_AtomicSet(&SDL_EventQ.count, 0); + SDL_EventQ.max_events_seen = 0; + SDL_EventQ.head = NULL; + SDL_EventQ.tail = NULL; + SDL_EventQ.free = NULL; + SDL_EventQ.wmmsg_used = NULL; + SDL_EventQ.wmmsg_free = NULL; + + /* Clear disabled event state */ + for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) { + SDL_free(SDL_disabled_events[i]); + SDL_disabled_events[i] = NULL; + } + + if (SDL_event_watchers_lock) { + SDL_DestroyMutex(SDL_event_watchers_lock); + SDL_event_watchers_lock = NULL; + } + if (SDL_event_watchers) { + SDL_free(SDL_event_watchers); + SDL_event_watchers = NULL; + SDL_event_watchers_count = 0; + } + SDL_zero(SDL_EventOK); + + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + SDL_DestroyMutex(SDL_EventQ.lock); + SDL_EventQ.lock = NULL; + } +} + +/* This function (and associated calls) may be called more than once */ +int +SDL_StartEventLoop(void) +{ + /* We'll leave the event queue alone, since we might have gotten + some important events at launch (like SDL_DROPFILE) + + FIXME: Does this introduce any other bugs with events at startup? + */ + + /* Create the lock and set ourselves active */ +#if !SDL_THREADS_DISABLED + if (!SDL_EventQ.lock) { + SDL_EventQ.lock = SDL_CreateMutex(); + if (SDL_EventQ.lock == NULL) { + return -1; + } + } + + if (!SDL_event_watchers_lock) { + SDL_event_watchers_lock = SDL_CreateMutex(); + if (SDL_event_watchers_lock == NULL) { + return -1; + } + } +#endif /* !SDL_THREADS_DISABLED */ + + /* Process most event types */ + SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); + SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); + SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); +#if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */ + SDL_EventState(SDL_DROPFILE, SDL_DISABLE); + SDL_EventState(SDL_DROPTEXT, SDL_DISABLE); +#endif + + SDL_AtomicSet(&SDL_EventQ.active, 1); + + return 0; +} + + +/* Add an event to the event queue -- called with the queue locked */ +static int +SDL_AddEvent(SDL_Event * event) +{ + SDL_EventEntry *entry; + const int initial_count = SDL_AtomicGet(&SDL_EventQ.count); + int final_count; + + if (initial_count >= SDL_MAX_QUEUED_EVENTS) { + SDL_SetError("Event queue is full (%d events)", initial_count); + return 0; + } + + if (SDL_EventQ.free == NULL) { + entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry)); + if (!entry) { + return 0; + } + } else { + entry = SDL_EventQ.free; + SDL_EventQ.free = entry->next; + } + + #ifdef SDL_DEBUG_EVENTS + SDL_DebugPrintEvent(event); + #endif + + entry->event = *event; + if (event->type == SDL_SYSWMEVENT) { + entry->msg = *event->syswm.msg; + entry->event.syswm.msg = &entry->msg; + } + + if (SDL_EventQ.tail) { + SDL_EventQ.tail->next = entry; + entry->prev = SDL_EventQ.tail; + SDL_EventQ.tail = entry; + entry->next = NULL; + } else { + SDL_assert(!SDL_EventQ.head); + SDL_EventQ.head = entry; + SDL_EventQ.tail = entry; + entry->prev = NULL; + entry->next = NULL; + } + + final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1; + if (final_count > SDL_EventQ.max_events_seen) { + SDL_EventQ.max_events_seen = final_count; + } + + return 1; +} + +/* Remove an event from the queue -- called with the queue locked */ +static void +SDL_CutEvent(SDL_EventEntry *entry) +{ + if (entry->prev) { + entry->prev->next = entry->next; + } + if (entry->next) { + entry->next->prev = entry->prev; + } + + if (entry == SDL_EventQ.head) { + SDL_assert(entry->prev == NULL); + SDL_EventQ.head = entry->next; + } + if (entry == SDL_EventQ.tail) { + SDL_assert(entry->next == NULL); + SDL_EventQ.tail = entry->prev; + } + + entry->next = SDL_EventQ.free; + SDL_EventQ.free = entry; + SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0); + SDL_AtomicAdd(&SDL_EventQ.count, -1); +} + +/* Lock the event queue, take a peep at it, and unlock it */ +int +SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, + Uint32 minType, Uint32 maxType) +{ + int i, used; + + /* Don't look after we've quit */ + if (!SDL_AtomicGet(&SDL_EventQ.active)) { + /* We get a few spurious events at shutdown, so don't warn then */ + if (action != SDL_ADDEVENT) { + SDL_SetError("The event system has been shut down"); + } + return (-1); + } + /* Lock the event queue */ + used = 0; + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { + if (action == SDL_ADDEVENT) { + for (i = 0; i < numevents; ++i) { + used += SDL_AddEvent(&events[i]); + } + } else { + SDL_EventEntry *entry, *next; + SDL_SysWMEntry *wmmsg, *wmmsg_next; + Uint32 type; + + if (action == SDL_GETEVENT) { + /* Clean out any used wmmsg data + FIXME: Do we want to retain the data for some period of time? + */ + for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { + wmmsg_next = wmmsg->next; + wmmsg->next = SDL_EventQ.wmmsg_free; + SDL_EventQ.wmmsg_free = wmmsg; + } + SDL_EventQ.wmmsg_used = NULL; + } + + for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) { + next = entry->next; + type = entry->event.type; + if (minType <= type && type <= maxType) { + if (events) { + events[used] = entry->event; + if (entry->event.type == SDL_SYSWMEVENT) { + /* We need to copy the wmmsg somewhere safe. + For now we'll guarantee it's valid at least until + the next call to SDL_PeepEvents() + */ + if (SDL_EventQ.wmmsg_free) { + wmmsg = SDL_EventQ.wmmsg_free; + SDL_EventQ.wmmsg_free = wmmsg->next; + } else { + wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); + } + wmmsg->msg = *entry->event.syswm.msg; + wmmsg->next = SDL_EventQ.wmmsg_used; + SDL_EventQ.wmmsg_used = wmmsg; + events[used].syswm.msg = &wmmsg->msg; + } + + if (action == SDL_GETEVENT) { + SDL_CutEvent(entry); + } + } + ++used; + } + } + } + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } + } else { + return SDL_SetError("Couldn't lock event queue"); + } + return (used); +} + +SDL_bool +SDL_HasEvent(Uint32 type) +{ + return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0); +} + +SDL_bool +SDL_HasEvents(Uint32 minType, Uint32 maxType) +{ + return (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0); +} + +void +SDL_FlushEvent(Uint32 type) +{ + SDL_FlushEvents(type, type); +} + +void +SDL_FlushEvents(Uint32 minType, Uint32 maxType) +{ + /* !!! FIXME: we need to manually SDL_free() the strings in TEXTINPUT and + drag'n'drop events if we're flushing them without passing them to the + app, but I don't know if this is the right place to do that. */ + + /* Don't look after we've quit */ + if (!SDL_AtomicGet(&SDL_EventQ.active)) { + return; + } + + /* Make sure the events are current */ +#if 0 + /* Actually, we can't do this since we might be flushing while processing + a resize event, and calling this might trigger further resize events. + */ + SDL_PumpEvents(); +#endif + + /* Lock the event queue */ + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { + SDL_EventEntry *entry, *next; + Uint32 type; + for (entry = SDL_EventQ.head; entry; entry = next) { + next = entry->next; + type = entry->event.type; + if (minType <= type && type <= maxType) { + SDL_CutEvent(entry); + } + } + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } + } +} + +/* Run the system dependent event loops */ +void +SDL_PumpEvents(void) +{ + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + /* Get events from the video subsystem */ + if (_this) { + _this->PumpEvents(_this); + } +#if !SDL_JOYSTICK_DISABLED + /* Check for joystick state change */ + if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) { + SDL_JoystickUpdate(); + } +#endif + +#if !SDL_SENSOR_DISABLED + /* Check for sensor state change */ + if (!SDL_disabled_events[SDL_SENSORUPDATE >> 8]) { + SDL_SensorUpdate(); + } +#endif + + SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */ +} + +/* Public functions */ + +int +SDL_PollEvent(SDL_Event * event) +{ + return SDL_WaitEventTimeout(event, 0); +} + +int +SDL_WaitEvent(SDL_Event * event) +{ + return SDL_WaitEventTimeout(event, -1); +} + +int +SDL_WaitEventTimeout(SDL_Event * event, int timeout) +{ + Uint32 expiration = 0; + + if (timeout > 0) + expiration = SDL_GetTicks() + timeout; + + for (;;) { + SDL_PumpEvents(); + switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) { + case -1: + return 0; + case 0: + if (timeout == 0) { + /* Polling and no events, just return */ + return 0; + } + if (timeout > 0 && SDL_TICKS_PASSED(SDL_GetTicks(), expiration)) { + /* Timeout expired and no events */ + return 0; + } + SDL_Delay(10); + break; + default: + /* Has events */ + return 1; + } + } +} + +int +SDL_PushEvent(SDL_Event * event) +{ + event->common.timestamp = SDL_GetTicks(); + + if (SDL_EventOK.callback || SDL_event_watchers_count > 0) { + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) { + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + return 0; + } + + if (SDL_event_watchers_count > 0) { + /* Make sure we only dispatch the current watcher list */ + int i, event_watchers_count = SDL_event_watchers_count; + + SDL_event_watchers_dispatching = SDL_TRUE; + for (i = 0; i < event_watchers_count; ++i) { + if (!SDL_event_watchers[i].removed) { + SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event); + } + } + SDL_event_watchers_dispatching = SDL_FALSE; + + if (SDL_event_watchers_removed) { + for (i = SDL_event_watchers_count; i--; ) { + if (SDL_event_watchers[i].removed) { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + } + SDL_event_watchers_removed = SDL_FALSE; + } + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } + } + + if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) { + return -1; + } + + SDL_GestureProcessEvent(event); + + return 1; +} + +void +SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) +{ + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + /* Set filter and discard pending events */ + SDL_EventOK.callback = filter; + SDL_EventOK.userdata = userdata; + SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } +} + +SDL_bool +SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata) +{ + SDL_EventWatcher event_ok; + + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + event_ok = SDL_EventOK; + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } else { + SDL_zero(event_ok); + } + + if (filter) { + *filter = event_ok.callback; + } + if (userdata) { + *userdata = event_ok.userdata; + } + return event_ok.callback ? SDL_TRUE : SDL_FALSE; +} + +void +SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) +{ + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + SDL_EventWatcher *event_watchers; + + event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers)); + if (event_watchers) { + SDL_EventWatcher *watcher; + + SDL_event_watchers = event_watchers; + watcher = &SDL_event_watchers[SDL_event_watchers_count]; + watcher->callback = filter; + watcher->userdata = userdata; + watcher->removed = SDL_FALSE; + ++SDL_event_watchers_count; + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } +} + +void +SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) +{ + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + int i; + + for (i = 0; i < SDL_event_watchers_count; ++i) { + if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) { + if (SDL_event_watchers_dispatching) { + SDL_event_watchers[i].removed = SDL_TRUE; + SDL_event_watchers_removed = SDL_TRUE; + } else { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + break; + } + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } +} + +void +SDL_FilterEvents(SDL_EventFilter filter, void *userdata) +{ + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { + SDL_EventEntry *entry, *next; + for (entry = SDL_EventQ.head; entry; entry = next) { + next = entry->next; + if (!filter(userdata, &entry->event)) { + SDL_CutEvent(entry); + } + } + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } + } +} + +Uint8 +SDL_EventState(Uint32 type, int state) +{ + const SDL_bool isdnd = ((state == SDL_DISABLE) || (state == SDL_ENABLE)) && + ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT)); + Uint8 current_state; + Uint8 hi = ((type >> 8) & 0xff); + Uint8 lo = (type & 0xff); + + if (SDL_disabled_events[hi] && + (SDL_disabled_events[hi]->bits[lo/32] & (1 << (lo&31)))) { + current_state = SDL_DISABLE; + } else { + current_state = SDL_ENABLE; + } + + if (state != current_state) + { + switch (state) { + case SDL_DISABLE: + /* Disable this event type and discard pending events */ + if (!SDL_disabled_events[hi]) { + SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock)); + if (!SDL_disabled_events[hi]) { + /* Out of memory, nothing we can do... */ + break; + } + } + SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); + SDL_FlushEvent(type); + break; + case SDL_ENABLE: + SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31)); + break; + default: + /* Querying state... */ + break; + } + } + + /* turn off drag'n'drop support if we've disabled the events. + This might change some UI details at the OS level. */ + if (isdnd) { + SDL_ToggleDragAndDropSupport(); + } + + return current_state; +} + +Uint32 +SDL_RegisterEvents(int numevents) +{ + Uint32 event_base; + + if ((numevents > 0) && (SDL_userevents+numevents <= SDL_LASTEVENT)) { + event_base = SDL_userevents; + SDL_userevents += numevents; + } else { + event_base = (Uint32)-1; + } + return event_base; +} + +int +SDL_SendAppEvent(SDL_EventType eventType) +{ + int posted; + + posted = 0; + if (SDL_GetEventState(eventType) == SDL_ENABLE) { + SDL_Event event; + event.type = eventType; + posted = (SDL_PushEvent(&event) > 0); + } + return (posted); +} + +int +SDL_SendSysWMEvent(SDL_SysWMmsg * message) +{ + int posted; + + posted = 0; + if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { + SDL_Event event; + SDL_memset(&event, 0, sizeof(event)); + event.type = SDL_SYSWMEVENT; + event.syswm.msg = message; + posted = (SDL_PushEvent(&event) > 0); + } + /* Update internal event state */ + return (posted); +} + +int +SDL_SendKeymapChangedEvent(void) +{ + return SDL_SendAppEvent(SDL_KEYMAPCHANGED); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_events_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_events_c.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_events_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_events_c.h index 2e33190479..d9684b5fa9 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_events_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,12 +18,19 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_events_c_h_ +#define SDL_events_c_h_ + #include "../SDL_internal.h" /* Useful functions and variables from SDL_events.c */ #include "SDL_events.h" #include "SDL_thread.h" +#include "../video/SDL_sysvideo.h" + #include "SDL_clipboardevents_c.h" +#include "SDL_displayevents_c.h" #include "SDL_dropevents_c.h" #include "SDL_gesture_c.h" #include "SDL_keyboard_c.h" @@ -46,8 +53,6 @@ extern void SDL_QuitQuit(void); extern void SDL_SendPendingQuit(void); -/* The event filter function */ -extern SDL_EventFilter SDL_EventOK; -extern void *SDL_EventOKParam; +#endif /* SDL_events_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_gesture.c b/3rdparty/sdl2-2.0.9/src/events/SDL_gesture.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_gesture.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_gesture.c index 66def44294..c3b73e022f 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_gesture.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../SDL_internal.h" -/* General mouse handling code for SDL */ +/* General gesture handling code for SDL */ #include "SDL_events.h" #include "SDL_endian.h" @@ -71,9 +71,9 @@ typedef struct { SDL_bool recording; } SDL_GestureTouch; -SDL_GestureTouch *SDL_gestureTouch; -int SDL_numGestureTouches = 0; -SDL_bool recordAll; +static SDL_GestureTouch *SDL_gestureTouch; +static int SDL_numGestureTouches = 0; +static SDL_bool recordAll; #if 0 static void PrintPath(SDL_FloatPoint *path) @@ -101,6 +101,12 @@ int SDL_RecordGesture(SDL_TouchID touchId) return (touchId < 0); } +void SDL_GestureQuit() +{ + SDL_free(SDL_gestureTouch); + SDL_gestureTouch = NULL; +} + static unsigned long SDL_HashDollar(SDL_FloatPoint* points) { unsigned long hash = 5381; @@ -374,7 +380,7 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) dist += d; } if (numPoints < DOLLARNPOINTS-1) { - SDL_SetError("ERROR: NumPoints = %i\n",numPoints); + SDL_SetError("ERROR: NumPoints = %i", numPoints); return 0; } /* copy the last point */ @@ -457,6 +463,28 @@ int SDL_GestureAddTouch(SDL_TouchID touchId) return 0; } +int SDL_GestureDelTouch(SDL_TouchID touchId) +{ + int i; + for (i = 0; i < SDL_numGestureTouches; i++) { + if (SDL_gestureTouch[i].id == touchId) { + break; + } + } + + if (i == SDL_numGestureTouches) { + /* not found */ + return -1; + } + + SDL_free(SDL_gestureTouch[i].dollarTemplate); + SDL_zero(SDL_gestureTouch[i]); + + SDL_numGestureTouches--; + SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); + return 0; +} + static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { int i; @@ -468,7 +496,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) return NULL; } -int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) +static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { SDL_Event event; event.mgesture.type = SDL_MULTIGESTURE; diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_gesture_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_gesture_c.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_gesture_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_gesture_c.h index 3ff542cbb2..b8e4427f0c 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_gesture_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,16 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_gesture_c_h -#define _SDL_gesture_c_h +#ifndef SDL_gesture_c_h_ +#define SDL_gesture_c_h_ extern int SDL_GestureAddTouch(SDL_TouchID touchId); +extern int SDL_GestureDelTouch(SDL_TouchID touchId); extern void SDL_GestureProcessEvent(SDL_Event* event); -extern int SDL_RecordGesture(SDL_TouchID touchId); +extern void SDL_GestureQuit(void); -#endif /* _SDL_gesture_c_h */ +#endif /* SDL_gesture_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_keyboard.c b/3rdparty/sdl2-2.0.9/src/events/SDL_keyboard.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_keyboard.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_keyboard.c index 15726545c6..e1295764ea 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_keyboard.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -273,6 +273,10 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { SDLK_KBDILLUMUP, SDLK_EJECT, SDLK_SLEEP, + SDLK_APP1, + SDLK_APP2, + SDLK_AUDIOREWIND, + SDLK_AUDIOFASTFORWARD, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { @@ -505,6 +509,10 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { "KBDIllumUp", "Eject", "Sleep", + "App1", + "App2", + "AudioRewind", + "AudioFastForward", }; /* Taken from SDL_iconv() */ @@ -569,7 +577,7 @@ SDL_ResetKeyboard(void) #ifdef DEBUG_KEYBOARD printf("Resetting keyboard\n"); #endif - for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { + for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keystate[scancode] == SDL_PRESSED) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } @@ -586,12 +594,22 @@ void SDL_SetKeymap(int start, SDL_Keycode * keys, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; + SDL_Scancode scancode; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; } SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length); + + /* The number key scancodes always map to the number key keycodes. + * On AZERTY layouts these technically are symbols, but users (and games) + * always think of them and view them in UI as number keys. + */ + keyboard->keymap[SDL_SCANCODE_0] = SDLK_0; + for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) { + keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); + } } void @@ -664,7 +682,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) int posted; SDL_Keymod modifier; SDL_Keycode keycode; - Uint16 modstate; Uint32 type; Uint8 repeat; @@ -737,7 +754,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) break; } if (SDL_KEYDOWN == type) { - modstate = keyboard->modstate; switch (keycode) { case SDLK_NUMLOCKCLEAR: keyboard->modstate ^= KMOD_NUM; @@ -751,7 +767,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) } } else { keyboard->modstate &= ~modifier; - modstate = keyboard->modstate; } /* Post the event, if desired */ @@ -763,7 +778,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) event.key.repeat = repeat; event.key.keysym.scancode = scancode; event.key.keysym.sym = keycode; - event.key.keysym.mod = modstate; + event.key.keysym.mod = keyboard->modstate; event.key.windowID = keyboard->focus ? keyboard->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } @@ -834,7 +849,7 @@ SDL_GetModState(void) { SDL_Keyboard *keyboard = &SDL_keyboard; - return keyboard->modstate; + return (SDL_Keymod) keyboard->modstate; } void @@ -863,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return 0; } @@ -890,7 +905,7 @@ const char * SDL_GetScancodeName(SDL_Scancode scancode) { const char *name; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return ""; } @@ -968,8 +983,10 @@ SDL_GetKeyFromName(const char *name) { SDL_Keycode key; - /* Check input */ - if (name == NULL) return SDLK_UNKNOWN; + /* Check input */ + if (name == NULL) { + return SDLK_UNKNOWN; + } /* If it's a single UTF-8 character, then that's the keycode itself */ key = *(const unsigned char *)name; diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_keyboard_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_keyboard_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_keyboard_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_keyboard_c.h index b4d1c0739b..7f12a382a0 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_keyboard_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_keyboard_c_h -#define _SDL_keyboard_c_h +#ifndef SDL_keyboard_c_h_ +#define SDL_keyboard_c_h_ #include "SDL_keycode.h" #include "SDL_events.h" @@ -65,6 +65,6 @@ extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst); /* Toggle on or off pieces of the keyboard mod state. */ extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle); -#endif /* _SDL_keyboard_c_h */ +#endif /* SDL_keyboard_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_mouse.c b/3rdparty/sdl2-2.0.9/src/events/SDL_mouse.c similarity index 74% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_mouse.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_mouse.c index 7793de870b..ff23c5ea46 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_mouse.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,25 +27,103 @@ #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_events_c.h" -#include "default_cursor.h" #include "../video/SDL_sysvideo.h" /* #define DEBUG_MOUSE */ /* The mouse state */ static SDL_Mouse SDL_mouse; -static Uint32 SDL_double_click_time = 500; -static int SDL_double_click_radius = 1; static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); +static void SDLCALL +SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->double_click_time = SDL_atoi(hint); + } else { +#ifdef __WIN32__ + mouse->double_click_time = GetDoubleClickTime(); +#else + mouse->double_click_time = 500; +#endif + } +} + +static void SDLCALL +SDL_MouseDoubleClickRadiusChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->double_click_radius = SDL_atoi(hint); + } else { + mouse->double_click_radius = 32; /* 32 pixels seems about right for touch interfaces */ + } +} + +static void SDLCALL +SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->normal_speed_scale = (float)SDL_atof(hint); + } else { + mouse->normal_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->relative_speed_scale = (float)SDL_atof(hint); + } else { + mouse->relative_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) { + mouse->touch_mouse_events = SDL_FALSE; + } else { + mouse->touch_mouse_events = SDL_TRUE; + } +} + /* Public functions */ int SDL_MouseInit(void) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_zerop(mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, + SDL_MouseDoubleClickTimeChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, + SDL_MouseDoubleClickRadiusChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, + SDL_TouchMouseEventsChanged, mouse); + mouse->cursor_shown = SDL_TRUE; return (0); @@ -68,12 +146,6 @@ SDL_GetMouse(void) return &SDL_mouse; } -void -SDL_SetDoubleClickTime(Uint32 interval) -{ - SDL_double_click_time = interval; -} - SDL_Window * SDL_GetMouseFocus(void) { @@ -82,6 +154,7 @@ SDL_GetMouseFocus(void) return mouse->focus; } +#if 0 void SDL_ResetMouse(void) { @@ -98,6 +171,7 @@ SDL_ResetMouse(void) } SDL_assert(mouse->buttonstate == 0); } +#endif void SDL_SetMouseFocus(SDL_Window * window) @@ -126,6 +200,7 @@ SDL_SetMouseFocus(SDL_Window * window) } mouse->focus = window; + mouse->has_position = SDL_FALSE; if (mouse->focus) { SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); @@ -176,10 +251,10 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) if (window != mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse entered window, synthesizing focus gain & move event\n"); + printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif - SDL_SetMouseFocus(window); - SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + SDL_SetMouseFocus(window); + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } return SDL_TRUE; } @@ -197,6 +272,21 @@ SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y); } +static int +GetScaledMouseDelta(float scale, int value, float *accum) +{ + if (scale != 1.0f) { + *accum += scale * value; + if (*accum >= 0.0f) { + value = (int)SDL_floor(*accum); + } else { + value = (int)SDL_ceil(*accum); + } + *accum -= value; + } + return value; +} + static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { @@ -205,7 +295,11 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ int xrel; int yrel; - if (mouse->relative_mode_warp) { + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } + + if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { int center_x = 0, center_y = 0; SDL_GetWindowSize(window, ¢er_x, ¢er_y); center_x /= 2; @@ -219,6 +313,13 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ } if (relative) { + if (mouse->relative_mode) { + x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y); + } else { + x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y); + } xrel = x; yrel = y; x = (mouse->last_x + xrel); @@ -236,6 +337,19 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ return 0; } + /* Ignore relative motion when first positioning the mouse */ + if (!mouse->has_position) { + xrel = 0; + yrel = 0; + mouse->has_position = SDL_TRUE; + } + + /* Ignore relative motion positioning the first touch */ + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) { + xrel = 0; + yrel = 0; + } + /* Update internal mouse coordinates */ if (!mouse->relative_mode) { mouse->x = x; @@ -250,7 +364,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { int x_max = 0, y_max = 0; - // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? + /* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */ SDL_GetWindowSize(mouse->focus, &x_max, &y_max); --x_max; --y_max; @@ -322,15 +436,17 @@ static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button) return &mouse->clickstate[button]; } -int -SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button) +static int +SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; Uint32 type; Uint32 buttonstate = mouse->buttonstate; - SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button); - Uint8 click_count; + + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } /* Figure out which event to perform */ switch (state) { @@ -358,25 +474,28 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 } mouse->buttonstate = buttonstate; - if (clickstate) { - if (state == SDL_PRESSED) { - Uint32 now = SDL_GetTicks(); + if (clicks < 0) { + SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button); + if (clickstate) { + if (state == SDL_PRESSED) { + Uint32 now = SDL_GetTicks(); - if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + SDL_double_click_time) || - SDL_abs(mouse->x - clickstate->last_x) > SDL_double_click_radius || - SDL_abs(mouse->y - clickstate->last_y) > SDL_double_click_radius) { - clickstate->click_count = 0; - } - clickstate->last_timestamp = now; - clickstate->last_x = mouse->x; - clickstate->last_y = mouse->y; - if (clickstate->click_count < 255) { - ++clickstate->click_count; + if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + mouse->double_click_time) || + SDL_abs(mouse->x - clickstate->last_x) > mouse->double_click_radius || + SDL_abs(mouse->y - clickstate->last_y) > mouse->double_click_radius) { + clickstate->click_count = 0; + } + clickstate->last_timestamp = now; + clickstate->last_x = mouse->x; + clickstate->last_y = mouse->y; + if (clickstate->click_count < 255) { + ++clickstate->click_count; + } } + clicks = clickstate->click_count; + } else { + clicks = 1; } - click_count = clickstate->click_count; - } else { - click_count = 1; } /* Post the event, if desired */ @@ -388,7 +507,7 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 event.button.which = mouseID; event.button.state = state; event.button.button = button; - event.button.clicks = click_count; + event.button.clicks = (Uint8) SDL_min(clicks, 255); event.button.x = mouse->x; event.button.y = mouse->y; posted = (SDL_PushEvent(&event) > 0); @@ -398,15 +517,29 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 if (window && state == SDL_RELEASED) { SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate); } - + return posted; } int -SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction) +SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) +{ + clicks = SDL_max(clicks, 0); + return SDL_PrivateSendMouseButton(window, mouseID, state, button, clicks); +} + +int +SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button) +{ + return SDL_PrivateSendMouseButton(window, mouseID, state, button, -1); +} + +int +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; + int integral_x, integral_y; if (window) { SDL_SetMouseFocus(window); @@ -416,6 +549,26 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M return 0; } + mouse->accumulated_wheel_x += x; + if (mouse->accumulated_wheel_x > 0) { + integral_x = (int)SDL_floor(mouse->accumulated_wheel_x); + } else if (mouse->accumulated_wheel_x < 0) { + integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x); + } else { + integral_x = 0; + } + mouse->accumulated_wheel_x -= integral_x; + + mouse->accumulated_wheel_y += y; + if (mouse->accumulated_wheel_y > 0) { + integral_y = (int)SDL_floor(mouse->accumulated_wheel_y); + } else if (mouse->accumulated_wheel_y < 0) { + integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y); + } else { + integral_y = 0; + } + mouse->accumulated_wheel_y -= integral_y; + /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) { @@ -423,8 +576,12 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M event.type = SDL_MOUSEWHEEL; event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; event.wheel.which = mouseID; - event.wheel.x = x; - event.wheel.y = y; +#if 0 /* Uncomment this when it goes in for SDL 2.1 */ + event.wheel.preciseX = x; + event.wheel.preciseY = y; +#endif + event.wheel.x = integral_x; + event.wheel.y = integral_y; event.wheel.direction = (Uint32)direction; posted = (SDL_PushEvent(&event) > 0); } @@ -449,16 +606,23 @@ SDL_MouseQuit(void) SDL_FreeCursor(cursor); cursor = next; } + mouse->cursors = NULL; if (mouse->def_cursor && mouse->FreeCursor) { mouse->FreeCursor(mouse->def_cursor); + mouse->def_cursor = NULL; } if (mouse->clickstate) { SDL_free(mouse->clickstate); + mouse->clickstate = NULL; } - SDL_zerop(mouse); + SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); } Uint32 @@ -508,7 +672,6 @@ SDL_GetGlobalMouseState(int *x, int *y) *x = *y = 0; if (!mouse->GetGlobalMouseState) { - SDL_assert(0 && "This should really be implemented for every target."); return 0; } @@ -550,21 +713,12 @@ SDL_WarpMouseGlobal(int x, int y) static SDL_bool ShouldUseRelativeModeWarp(SDL_Mouse *mouse) { - const char *hint; - if (!mouse->SetRelativeMouseMode) { + SDL_assert(mouse->WarpMouse); /* Need this functionality for relative mode warp implementation */ return SDL_TRUE; } - hint = SDL_GetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP); - if (hint) { - if (*hint == '0') { - return SDL_FALSE; - } else { - return SDL_TRUE; - } - } - return SDL_FALSE; + return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE); } int @@ -593,10 +747,15 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) } else if (mouse->SetRelativeMouseMode(enabled) < 0) { if (enabled) { /* Fall back to warp mode if native relative mode failed */ + if (!mouse->WarpMouse) { + return SDL_SetError("No relative mode implementation available"); + } mouse->relative_mode_warp = SDL_TRUE; } } mouse->relative_mode = enabled; + mouse->scale_accum_x = 0.0f; + mouse->scale_accum_y = 0.0f; if (mouse->focus) { SDL_UpdateWindowGrab(mouse->focus); diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_mouse_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_mouse_c.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_mouse_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_mouse_c.h index 03aca0a5c7..ad444922a4 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_mouse_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_mouse_c_h -#define _SDL_mouse_c_h +#ifndef SDL_mouse_c_h_ +#define SDL_mouse_c_h_ #include "SDL_mouse.h" @@ -80,9 +80,19 @@ typedef struct int xdelta; int ydelta; int last_x, last_y; /* the last reported x and y coordinates */ + float accumulated_wheel_x; + float accumulated_wheel_y; Uint32 buttonstate; + SDL_bool has_position; SDL_bool relative_mode; SDL_bool relative_mode_warp; + float normal_speed_scale; + float relative_speed_scale; + float scale_accum_x; + float scale_accum_y; + Uint32 double_click_time; + int double_click_radius; + SDL_bool touch_mouse_events; /* Data for double-click tracking */ int num_clickstates; @@ -104,9 +114,6 @@ extern int SDL_MouseInit(void); /* Get the mouse state structure */ SDL_Mouse *SDL_GetMouse(void); -/* Set the default double-click interval */ -extern void SDL_SetDoubleClickTime(Uint32 interval); - /* Set the default mouse cursor */ extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); @@ -119,12 +126,15 @@ extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int rel /* Send a mouse button event */ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button); +/* Send a mouse button event with a click count */ +extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); + /* Send a mouse wheel event */ -extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction); +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); -#endif /* _SDL_mouse_c_h */ +#endif /* SDL_mouse_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_quit.c b/3rdparty/sdl2-2.0.9/src/events/SDL_quit.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_quit.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_quit.c index 5b7105ef8b..2b24efe3cc 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_quit.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ SDL_QuitInit_Internal(void) struct sigaction action; sigaction(SIGINT, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif @@ -65,7 +65,7 @@ SDL_QuitInit_Internal(void) sigaction(SIGTERM, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif @@ -91,9 +91,7 @@ SDL_QuitInit_Internal(void) int SDL_QuitInit(void) { - const char *hint = SDL_GetHint(SDL_HINT_NO_SIGNAL_HANDLERS); - disable_signals = hint && (SDL_atoi(hint) == 1); - if (!disable_signals) { + if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { return SDL_QuitInit_Internal(); } return 0; diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_sysevents.h b/3rdparty/sdl2-2.0.9/src/events/SDL_sysevents.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_sysevents.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_sysevents.h index c4ce087643..3d9ab922de 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_sysevents.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_touch.c b/3rdparty/sdl2-2.0.9/src/events/SDL_touch.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_touch.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_touch.c index c73827c964..003741644d 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_touch.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_events_c.h" +#include "../video/SDL_sysvideo.h" static int SDL_num_touch = 0; @@ -48,7 +49,7 @@ SDL_TouchID SDL_GetTouchDevice(int index) { if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + SDL_SetError("Unknown touch device index %d", index); return 0; } return SDL_touchDevices[index]->id; @@ -74,7 +75,12 @@ SDL_GetTouch(SDL_TouchID id) { int index = SDL_GetTouchIndex(id); if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + if (SDL_GetVideoDevice()->ResetTouch != NULL) { + SDL_SetError("Unknown touch id %d, resetting", (int) id); + (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice()); + } else { + SDL_SetError("Unknown touch device id %d, cannot reset", (int) id); + } return NULL; } return SDL_touchDevices[index]; @@ -92,7 +98,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid) return -1; } -SDL_Finger * +static SDL_Finger * SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) { int index = SDL_GetFingerIndex(touch, id); @@ -346,6 +352,9 @@ SDL_DelTouch(SDL_TouchID id) SDL_num_touch--; SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch]; + + /* Delete this touch device for gestures */ + SDL_GestureDelTouch(id); } void @@ -360,6 +369,7 @@ SDL_TouchQuit(void) SDL_free(SDL_touchDevices); SDL_touchDevices = NULL; + SDL_GestureQuit(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_touch_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_touch_c.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_touch_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_touch_c.h index d025df6e84..2a4431026e 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_touch_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" #include "../../include/SDL_touch.h" -#ifndef _SDL_touch_c_h -#define _SDL_touch_c_h +#ifndef SDL_touch_c_h_ +#define SDL_touch_c_h_ typedef struct SDL_Touch { @@ -56,6 +56,6 @@ extern void SDL_DelTouch(SDL_TouchID id); /* Shutdown the touch subsystem */ extern void SDL_TouchQuit(void); -#endif /* _SDL_touch_c_h */ +#endif /* SDL_touch_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_windowevents.c b/3rdparty/sdl2-2.0.9/src/events/SDL_windowevents.c similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_windowevents.c rename to 3rdparty/sdl2-2.0.9/src/events/SDL_windowevents.c index 785ea4e0cb..1670841092 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_windowevents.c +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,16 +25,16 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" -#include "../video/SDL_sysvideo.h" -static int -RemovePendingResizedEvents(void * userdata, SDL_Event *event) +static int SDLCALL +RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && - event->window.event == SDL_WINDOWEVENT_RESIZED && + (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->window.event == SDL_WINDOWEVENT_RESIZED) && event->window.windowID == new_event->window.windowID) { /* We're about to post a new size event, drop the old one */ return 0; @@ -42,29 +42,29 @@ RemovePendingResizedEvents(void * userdata, SDL_Event *event) return 1; } -static int -RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event) +static int SDLCALL +RemovePendingMoveEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && - event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED && + event->window.event == SDL_WINDOWEVENT_MOVED && event->window.windowID == new_event->window.windowID) { - /* We're about to post a new size event, drop the old one */ + /* We're about to post a new move event, drop the old one */ return 0; } return 1; } -static int -RemovePendingMoveEvents(void * userdata, SDL_Event *event) +static int SDLCALL +RemovePendingExposedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; if (event->type == SDL_WINDOWEVENT && - event->window.event == SDL_WINDOWEVENT_MOVED && + event->window.event == SDL_WINDOWEVENT_EXPOSED && event->window.windowID == new_event->window.windowID) { - /* We're about to post a new move event, drop the old one */ + /* We're about to post a new exposed event, drop the old one */ return 0; } return 1; @@ -186,16 +186,15 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, event.window.windowID = window->id; /* Fixes queue overflow with resize events that aren't processed */ - if (windowevent == SDL_WINDOWEVENT_RESIZED) { - SDL_FilterEvents(RemovePendingResizedEvents, &event); - } if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) { - SDL_FilterEvents(RemovePendingSizeChangedEvents, &event); + SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event); } if (windowevent == SDL_WINDOWEVENT_MOVED) { SDL_FilterEvents(RemovePendingMoveEvents, &event); } - + if (windowevent == SDL_WINDOWEVENT_EXPOSED) { + SDL_FilterEvents(RemovePendingExposedEvents, &event); + } posted = (SDL_PushEvent(&event) > 0); } diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_windowevents_c.h b/3rdparty/sdl2-2.0.9/src/events/SDL_windowevents_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_windowevents_c.h rename to 3rdparty/sdl2-2.0.9/src/events/SDL_windowevents_c.h index 2a6a4c0518..a529a11312 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_windowevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_windowevents_c_h -#define _SDL_windowevents_c_h +#ifndef SDL_windowevents_c_h_ +#define SDL_windowevents_c_h_ extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2); -#endif /* _SDL_windowevents_c_h */ +#endif /* SDL_windowevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/blank_cursor.h b/3rdparty/sdl2-2.0.9/src/events/blank_cursor.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/blank_cursor.h rename to 3rdparty/sdl2-2.0.9/src/events/blank_cursor.h index 5e15852cbf..bc1bffa855 100644 --- a/3rdparty/sdl2-2.0.4/src/events/blank_cursor.h +++ b/3rdparty/sdl2-2.0.9/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/default_cursor.h b/3rdparty/sdl2-2.0.9/src/events/default_cursor.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/events/default_cursor.h rename to 3rdparty/sdl2-2.0.9/src/events/default_cursor.h index 297dd2dc11..27e82ff739 100644 --- a/3rdparty/sdl2-2.0.4/src/events/default_cursor.h +++ b/3rdparty/sdl2-2.0.9/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/scancodes_darwin.h b/3rdparty/sdl2-2.0.9/src/events/scancodes_darwin.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/events/scancodes_darwin.h rename to 3rdparty/sdl2-2.0.9/src/events/scancodes_darwin.h index 2692253095..7848d86f4c 100644 --- a/3rdparty/sdl2-2.0.4/src/events/scancodes_darwin.h +++ b/3rdparty/sdl2-2.0.9/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/scancodes_linux.h b/3rdparty/sdl2-2.0.9/src/events/scancodes_linux.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/events/scancodes_linux.h rename to 3rdparty/sdl2-2.0.9/src/events/scancodes_linux.h index 8db37df5b9..3fec4b5975 100644 --- a/3rdparty/sdl2-2.0.4/src/events/scancodes_linux.h +++ b/3rdparty/sdl2-2.0.9/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -111,7 +111,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 82 */ SDL_SCANCODE_KP_0, /* 83 */ SDL_SCANCODE_KP_PERIOD, 0, - /* 85 */ SDL_SCANCODE_UNKNOWN, /* KEY_ZENKAKUHANKAKU */ + /* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */ /* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */ /* 87 */ SDL_SCANCODE_F11, /* 88 */ SDL_SCANCODE_F12, @@ -153,7 +153,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */ /* 125 */ SDL_SCANCODE_LGUI, /* 126 */ SDL_SCANCODE_RGUI, - /* 127 */ SDL_SCANCODE_UNKNOWN, /* KEY_COMPOSE */ + /* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */ /* 128 */ SDL_SCANCODE_STOP, /* 129 */ SDL_SCANCODE_AGAIN, /* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */ @@ -174,9 +174,9 @@ static SDL_Scancode const linux_scancode_table[] = { /* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */ /* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */ /* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */ - /* 148 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG1 */ - /* 149 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG2 */ - /* 150 */ SDL_SCANCODE_UNKNOWN, /* KEY_WWW */ + /* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */ + /* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */ + /* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */ /* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */ /* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */ /* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */ @@ -192,9 +192,9 @@ static SDL_Scancode const linux_scancode_table[] = { /* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */ /* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */ /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ - /* 166 */ SDL_SCANCODE_UNKNOWN, /* KEY_STOPCD */ + /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* KEY_REWIND */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ @@ -221,7 +221,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 192 */ SDL_SCANCODE_F22, /* 193 */ SDL_SCANCODE_F23, /* 194 */ SDL_SCANCODE_F24, - 0, 0, 0, 0, + 0, 0, 0, 0, 0, /* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */ /* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */ /* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */ @@ -230,7 +230,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ - /* 208 */ SDL_SCANCODE_UNKNOWN, /* KEY_FASTFORWARD */ + /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ diff --git a/3rdparty/sdl2-2.0.4/src/events/scancodes_windows.h b/3rdparty/sdl2-2.0.9/src/events/scancodes_windows.h similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/events/scancodes_windows.h rename to 3rdparty/sdl2-2.0.9/src/events/scancodes_windows.h index b23a261ea8..f8eed1b9c3 100644 --- a/3rdparty/sdl2-2.0.4/src/events/scancodes_windows.h +++ b/3rdparty/sdl2-2.0.9/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/events/scancodes_xfree86.h b/3rdparty/sdl2-2.0.9/src/events/scancodes_xfree86.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/events/scancodes_xfree86.h rename to 3rdparty/sdl2-2.0.9/src/events/scancodes_xfree86.h index 29d9ef9449..6e65507f61 100644 --- a/3rdparty/sdl2-2.0.4/src/events/scancodes_xfree86.h +++ b/3rdparty/sdl2-2.0.9/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef scancodes_xfree86_h_ +#define scancodes_xfree86_h_ + #include "../../include/SDL_scancode.h" /* XFree86 key code to SDL scancode mapping table @@ -345,7 +349,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = { /* 165 */ SDL_SCANCODE_AUDIOPREV, /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRewind */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */ @@ -418,4 +422,91 @@ static const SDL_Scancode xfree86_scancode_table2[] = { /* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */ }; +/* Xvnc / Xtightvnc scancodes from xmodmap -pk */ +static const SDL_Scancode xvnc_scancode_table[] = { + /* 0 */ SDL_SCANCODE_LCTRL, + /* 1 */ SDL_SCANCODE_RCTRL, + /* 2 */ SDL_SCANCODE_LSHIFT, + /* 3 */ SDL_SCANCODE_RSHIFT, + /* 4 */ SDL_SCANCODE_UNKNOWN, /* Meta_L */ + /* 5 */ SDL_SCANCODE_UNKNOWN, /* Meta_R */ + /* 6 */ SDL_SCANCODE_LALT, + /* 7 */ SDL_SCANCODE_RALT, + /* 8 */ SDL_SCANCODE_SPACE, + /* 9 */ SDL_SCANCODE_0, + /* 10 */ SDL_SCANCODE_1, + /* 11 */ SDL_SCANCODE_2, + /* 12 */ SDL_SCANCODE_3, + /* 13 */ SDL_SCANCODE_4, + /* 14 */ SDL_SCANCODE_5, + /* 15 */ SDL_SCANCODE_6, + /* 16 */ SDL_SCANCODE_7, + /* 17 */ SDL_SCANCODE_8, + /* 18 */ SDL_SCANCODE_9, + /* 19 */ SDL_SCANCODE_MINUS, + /* 20 */ SDL_SCANCODE_EQUALS, + /* 21 */ SDL_SCANCODE_LEFTBRACKET, + /* 22 */ SDL_SCANCODE_RIGHTBRACKET, + /* 23 */ SDL_SCANCODE_SEMICOLON, + /* 24 */ SDL_SCANCODE_APOSTROPHE, + /* 25 */ SDL_SCANCODE_GRAVE, + /* 26 */ SDL_SCANCODE_COMMA, + /* 27 */ SDL_SCANCODE_PERIOD, + /* 28 */ SDL_SCANCODE_SLASH, + /* 29 */ SDL_SCANCODE_BACKSLASH, + /* 30 */ SDL_SCANCODE_A, + /* 31 */ SDL_SCANCODE_B, + /* 32 */ SDL_SCANCODE_C, + /* 33 */ SDL_SCANCODE_D, + /* 34 */ SDL_SCANCODE_E, + /* 35 */ SDL_SCANCODE_F, + /* 36 */ SDL_SCANCODE_G, + /* 37 */ SDL_SCANCODE_H, + /* 38 */ SDL_SCANCODE_I, + /* 39 */ SDL_SCANCODE_J, + /* 40 */ SDL_SCANCODE_K, + /* 41 */ SDL_SCANCODE_L, + /* 42 */ SDL_SCANCODE_M, + /* 43 */ SDL_SCANCODE_N, + /* 44 */ SDL_SCANCODE_O, + /* 45 */ SDL_SCANCODE_P, + /* 46 */ SDL_SCANCODE_Q, + /* 47 */ SDL_SCANCODE_R, + /* 48 */ SDL_SCANCODE_S, + /* 49 */ SDL_SCANCODE_T, + /* 50 */ SDL_SCANCODE_U, + /* 51 */ SDL_SCANCODE_V, + /* 52 */ SDL_SCANCODE_W, + /* 53 */ SDL_SCANCODE_X, + /* 54 */ SDL_SCANCODE_Y, + /* 55 */ SDL_SCANCODE_Z, + /* 56 */ SDL_SCANCODE_BACKSPACE, + /* 57 */ SDL_SCANCODE_RETURN, + /* 58 */ SDL_SCANCODE_TAB, + /* 59 */ SDL_SCANCODE_ESCAPE, + /* 60 */ SDL_SCANCODE_DELETE, + /* 61 */ SDL_SCANCODE_HOME, + /* 62 */ SDL_SCANCODE_END, + /* 63 */ SDL_SCANCODE_PAGEUP, + /* 64 */ SDL_SCANCODE_PAGEDOWN, + /* 65 */ SDL_SCANCODE_UP, + /* 66 */ SDL_SCANCODE_DOWN, + /* 67 */ SDL_SCANCODE_LEFT, + /* 68 */ SDL_SCANCODE_RIGHT, + /* 69 */ SDL_SCANCODE_F1, + /* 70 */ SDL_SCANCODE_F2, + /* 71 */ SDL_SCANCODE_F3, + /* 72 */ SDL_SCANCODE_F4, + /* 73 */ SDL_SCANCODE_F5, + /* 74 */ SDL_SCANCODE_F6, + /* 75 */ SDL_SCANCODE_F7, + /* 76 */ SDL_SCANCODE_F8, + /* 77 */ SDL_SCANCODE_F9, + /* 78 */ SDL_SCANCODE_F10, + /* 79 */ SDL_SCANCODE_F11, + /* 80 */ SDL_SCANCODE_F12, +}; + +#endif /* scancodes_xfree86_h_ */ + /* *INDENT-ON* */ diff --git a/3rdparty/sdl2-2.0.4/src/file/SDL_rwops.c b/3rdparty/sdl2-2.0.9/src/file/SDL_rwops.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/file/SDL_rwops.c rename to 3rdparty/sdl2-2.0.9/src/file/SDL_rwops.c index 38beb62850..cf5d3aa0b9 100644 --- a/3rdparty/sdl2-2.0.4/src/file/SDL_rwops.c +++ b/3rdparty/sdl2-2.0.9/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,14 +18,27 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +/* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the + configure script knows the C runtime has it and enables it. */ +#ifndef __QNXNTO__ /* Need this so Linux systems define fseek64o, ftell64o and off64_t */ #define _LARGEFILE64_SOURCE +#endif + #include "../SDL_internal.h" #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_LIMITS_H +#include +#endif /* This file provides a general interface for SDL to read and write data sources. It can easily be extended to files, memory, etc. @@ -292,6 +305,42 @@ windows_file_close(SDL_RWops * context) #ifdef HAVE_STDIO_H +#ifdef HAVE_FOPEN64 +#define fopen fopen64 +#endif +#ifdef HAVE_FSEEKO64 +#define fseek_off_t off64_t +#define fseek fseeko64 +#define ftell ftello64 +#elif defined(HAVE_FSEEKO) +#if defined(OFF_MIN) && defined(OFF_MAX) +#define FSEEK_OFF_MIN OFF_MIN +#define FSEEK_OFF_MAX OFF_MAX +#elif defined(HAVE_LIMITS_H) +/* POSIX doesn't specify the minimum and maximum macros for off_t so + * we have to improvise and dance around implementation-defined + * behavior. This may fail if the off_t type has padding bits or + * is not a two's-complement representation. The compilers will detect + * and eliminate the dead code if off_t has 64 bits. + */ +#define FSEEK_OFF_MAX (((((off_t)1 << (sizeof(off_t) * CHAR_BIT - 2)) - 1) << 1) + 1) +#define FSEEK_OFF_MIN (-(FSEEK_OFF_MAX) - 1) +#endif +#define fseek_off_t off_t +#define fseek fseeko +#define ftell ftello +#elif defined(HAVE__FSEEKI64) +#define fseek_off_t __int64 +#define fseek _fseeki64 +#define ftell _ftelli64 +#else +#ifdef HAVE_LIMITS_H +#define FSEEK_OFF_MIN LONG_MIN +#define FSEEK_OFF_MAX LONG_MAX +#endif +#define fseek_off_t long +#endif + /* Functions to read/write stdio file pointers */ static Sint64 SDLCALL @@ -312,23 +361,19 @@ stdio_size(SDL_RWops * context) static Sint64 SDLCALL stdio_seek(SDL_RWops * context, Sint64 offset, int whence) { -#ifdef HAVE_FSEEKO64 - if (fseeko64(context->hidden.stdio.fp, (off64_t)offset, whence) == 0) { - return ftello64(context->hidden.stdio.fp); - } -#elif defined(HAVE_FSEEKO) - if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) { - return ftello(context->hidden.stdio.fp); - } -#elif defined(HAVE__FSEEKI64) - if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) { - return _ftelli64(context->hidden.stdio.fp); - } -#else - if (fseek(context->hidden.stdio.fp, offset, whence) == 0) { - return ftell(context->hidden.stdio.fp); +#if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX) + if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) { + return SDL_SetError("Seek offset out of range"); } #endif + + if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) { + Sint64 pos = ftell(context->hidden.stdio.fp); + if (pos < 0) { + return SDL_SetError("Couldn't get stream offset"); + } + return pos; + } return SDL_Error(SDL_EFSEEK); } @@ -653,6 +698,59 @@ SDL_FreeRW(SDL_RWops * area) SDL_free(area); } +/* Load all the data from an SDL data stream */ +void * +SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc) +{ + const int FILE_CHUNK_SIZE = 1024; + Sint64 size; + size_t size_read, size_total; + void *data = NULL, *newdata; + + if (!src) { + SDL_InvalidParamError("src"); + return NULL; + } + + size = SDL_RWsize(src); + if (size < 0) { + size = FILE_CHUNK_SIZE; + } + data = SDL_malloc((size_t)(size + 1)); + + size_total = 0; + for (;;) { + if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) { + size = (size_total + FILE_CHUNK_SIZE); + newdata = SDL_realloc(data, (size_t)(size + 1)); + if (!newdata) { + SDL_free(data); + data = NULL; + SDL_OutOfMemory(); + goto done; + } + data = newdata; + } + + size_read = SDL_RWread(src, (char *)data+size_total, 1, (size_t)(size-size_total)); + if (size_read == 0) { + break; + } + size_total += size_read; + } + + if (datasize) { + *datasize = size_total; + } + ((char *)data)[size_total] = '\0'; + +done: + if (freesrc && src) { + SDL_RWclose(src); + } + return data; +} + /* Functions for dynamically reading and writing endian-specific values */ Uint8 diff --git a/3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.h b/3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.h rename to 3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.h index 2c63f1dab3..64edc0d0eb 100644 --- a/3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.m b/3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.m similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.m rename to 3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.m index 3385d3aa5e..8f1bf54d75 100644 --- a/3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/android/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/android/SDL_sysfilesystem.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/filesystem/android/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/android/SDL_sysfilesystem.c index 3bdf9966d7..7f3f92d7de 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/android/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ /* System dependent filesystem routines */ #include -#include #include "SDL_error.h" #include "SDL_filesystem.h" @@ -37,6 +36,7 @@ char * SDL_GetBasePath(void) { /* The current working directory is / on Android */ + SDL_Unsupported(); return NULL; } diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/cocoa/SDL_sysfilesystem.m b/3rdparty/sdl2-2.0.9/src/filesystem/cocoa/SDL_sysfilesystem.m similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/filesystem/cocoa/SDL_sysfilesystem.m rename to 3rdparty/sdl2-2.0.9/src/filesystem/cocoa/SDL_sysfilesystem.m index 6dee580524..6153a20865 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/3rdparty/sdl2-2.0.9/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,8 +71,15 @@ SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { - char *retval = NULL; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + char *retval = NULL; NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); if ([array count] > 0) { /* we only want the first item in the list. */ @@ -85,7 +92,11 @@ SDL_OutOfMemory(); } else { char *ptr; - SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s/%s/", base, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { *ptr = '\0'; diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/dummy/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/dummy/SDL_sysfilesystem.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/filesystem/dummy/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/dummy/SDL_sysfilesystem.c index 45273f24ac..f4628a10e5 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#ifdef SDL_FILESYSTEM_DUMMY +#if defined(SDL_FILESYSTEM_DUMMY) || defined(SDL_FILESYSTEM_DISABLED) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ @@ -42,6 +42,6 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } -#endif /* SDL_FILESYSTEM_DUMMY */ +#endif /* SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/emscripten/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/emscripten/SDL_sysfilesystem.c similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/filesystem/emscripten/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/emscripten/SDL_sysfilesystem.c index ca49df1b98..4ba57c1a90 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *retval; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *) SDL_malloc(len); if (!retval) { @@ -53,7 +61,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", append, app); + } if (mkdir(retval, 0700) != 0 && errno != EEXIST) { SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno)); diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/haiku/SDL_sysfilesystem.cc b/3rdparty/sdl2-2.0.9/src/filesystem/haiku/SDL_sysfilesystem.cc similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/filesystem/haiku/SDL_sysfilesystem.cc rename to 3rdparty/sdl2-2.0.9/src/filesystem/haiku/SDL_sysfilesystem.cc index 03489168e8..b56bc4bbec 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/3rdparty/sdl2-2.0.9/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,10 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ -#include -#include -#include -#include +#include +#include +#include +#include #include "SDL_error.h" #include "SDL_stdinc.h" @@ -75,13 +75,30 @@ SDL_GetPrefPath(const char *org, const char *app) { // !!! FIXME: is there a better way to do this? const char *home = SDL_getenv("HOME"); - const char *append = "config/settings/"; - const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; + const char *append = "/config/settings/"; + size_t len = SDL_strlen(home); + + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + + if (!len || (home[len - 1] == '/')) { + ++append; // home empty or ends with separator, skip the one from append + } + len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; char *retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); } else { - SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", home, append, app); + } create_directory(retval, 0700); // Haiku api: creates missing dirs } diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/nacl/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/nacl/SDL_sysfilesystem.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/filesystem/nacl/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/nacl/SDL_sysfilesystem.c index ac8fef1e32..f22ca75a64 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,3 +40,4 @@ SDL_GetPrefPath(const char *org, const char *app) #endif /* SDL_FILESYSTEM_NACL */ +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/unix/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/unix/SDL_sysfilesystem.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/filesystem/unix/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/unix/SDL_sysfilesystem.c index fa034a4565..d6af39f5b5 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/unix/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,15 +32,19 @@ #include #include #include +#include -#ifdef __FREEBSD__ +#if defined(__FREEBSD__) || defined(__OPENBSD__) #include #endif #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" +#include "SDL_rwops.h" +/* QNX's /proc/self/exefile is a text file and not a symlink. */ +#if !defined(__QNXNTO__) static char * readSymLink(const char *path) { @@ -72,7 +76,7 @@ readSymLink(const char *path) SDL_free(retval); return NULL; } - +#endif char * SDL_GetBasePath(void) @@ -90,7 +94,26 @@ SDL_GetBasePath(void) return NULL; } } -#elif defined(__SOLARIS__) +#endif +#if defined(__OPENBSD__) + char **retvalargs; + size_t len; + const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; + if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { + retvalargs = SDL_malloc(len); + if (!retvalargs) { + SDL_OutOfMemory(); + return NULL; + } + sysctl(mib, 4, retvalargs, &len, NULL, 0); + retval = SDL_malloc(PATH_MAX + 1); + if (retval) + realpath(retvalargs[0], retval); + + SDL_free(retvalargs); + } +#endif +#if defined(__SOLARIS__) const char *path = getexecname(); if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */ retval = SDL_strdup(path); @@ -103,13 +126,17 @@ SDL_GetBasePath(void) /* is a Linux-style /proc filesystem available? */ if (!retval && (access("/proc", F_OK) == 0)) { + /* !!! FIXME: after 2.0.6 ships, let's delete this code and just + use the /proc/%llu version. There's no reason to have + two copies of this plus all the #ifdefs. --ryan. */ #if defined(__FREEBSD__) retval = readSymLink("/proc/curproc/file"); #elif defined(__NETBSD__) retval = readSymLink("/proc/curproc/exe"); +#elif defined(__QNXNTO__) + retval = SDL_LoadFile("/proc/self/exefile", NULL); #else retval = readSymLink("/proc/self/exe"); /* linux. */ -#endif if (retval == NULL) { /* older kernels don't have /proc/self ... try PID version... */ char path[64]; @@ -120,6 +147,7 @@ SDL_GetBasePath(void) retval = readSymLink(path); } } +#endif } /* If we had access to argv[0] here, we could check it for a path, @@ -161,6 +189,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!envr) { /* You end up with "$HOME/.local/share/Game Name 2" */ envr = SDL_getenv("HOME"); @@ -185,7 +221,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", envr, append, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/windows/SDL_sysfilesystem.c b/3rdparty/sdl2-2.0.9/src/filesystem/windows/SDL_sysfilesystem.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/filesystem/windows/SDL_sysfilesystem.c rename to 3rdparty/sdl2-2.0.9/src/filesystem/windows/SDL_sysfilesystem.c index fd942d75fa..52197891a1 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/windows/SDL_sysfilesystem.c +++ b/3rdparty/sdl2-2.0.9/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) { WIN_SetError("Couldn't locate our prefpath"); return NULL; @@ -145,8 +153,10 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - lstrcatW(path, L"\\"); - lstrcatW(path, worg); + if (*worg) { + lstrcatW(path, L"\\"); + lstrcatW(path, worg); + } SDL_free(worg); api_result = CreateDirectoryW(path, NULL); diff --git a/3rdparty/sdl2-2.0.4/src/filesystem/winrt/SDL_sysfilesystem.cpp b/3rdparty/sdl2-2.0.9/src/filesystem/winrt/SDL_sysfilesystem.cpp similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/filesystem/winrt/SDL_sysfilesystem.cpp rename to 3rdparty/sdl2-2.0.9/src/filesystem/winrt/SDL_sysfilesystem.cpp index b4caf90377..71818dd26f 100644 --- a/3rdparty/sdl2-2.0.4/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/3rdparty/sdl2-2.0.9/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -152,6 +152,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); if ( ! srcPath) { SDL_SetError("Unable to find a source path"); @@ -186,9 +194,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - SDL_wcslcat(path, worg, new_wpath_len + 1); - SDL_free(worg); + if (*worg) { + SDL_wcslcat(path, L"\\", new_wpath_len + 1); + SDL_wcslcat(path, worg, new_wpath_len + 1); + SDL_free(worg); + } api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { @@ -219,3 +229,5 @@ SDL_GetPrefPath(const char *org, const char *app) } #endif /* __WINRT__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic.c b/3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic.c index ddce908d6b..f23ba18df2 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,9 +25,9 @@ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ #include "SDL_assert.h" +/* Global for SDL_windowshaptic.c */ SDL_Haptic *SDL_haptics = NULL; - /* * Initializes the Haptic devices. */ @@ -313,6 +313,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick * joystick) SDL_memset(haptic, 0, sizeof(SDL_Haptic)); haptic->rumble_id = -1; if (SDL_SYS_HapticOpenFromJoystick(haptic, joystick) < 0) { + SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed."); SDL_free(haptic); return NULL; } @@ -388,9 +389,11 @@ SDL_HapticClose(SDL_Haptic * haptic) void SDL_HapticQuit(void) { + while (SDL_haptics) { + SDL_HapticClose(SDL_haptics); + } + SDL_SYS_HapticQuit(); - SDL_assert(SDL_haptics == NULL); - SDL_haptics = NULL; } /* @@ -764,6 +767,7 @@ SDL_HapticRumbleInit(SDL_Haptic * haptic) SDL_zerop(efx); if (haptic->supported & SDL_HAPTIC_SINE) { efx->type = SDL_HAPTIC_SINE; + efx->periodic.direction.type = SDL_HAPTIC_CARTESIAN; efx->periodic.period = 1000; efx->periodic.magnitude = 0x4000; efx->periodic.length = 5000; diff --git a/3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic_c.h rename to 3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic_c.h index 5b9372b5c6..390dc7854d 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic_c.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,7 +19,12 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_haptic_c_h_ +#define SDL_haptic_c_h_ + extern int SDL_HapticInit(void); extern void SDL_HapticQuit(void); +#endif /* SDL_haptic_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/haptic/SDL_syshaptic.h b/3rdparty/sdl2-2.0.9/src/haptic/SDL_syshaptic.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/haptic/SDL_syshaptic.h rename to 3rdparty/sdl2-2.0.9/src/haptic/SDL_syshaptic.h index 372cefacfe..4f4cd9fefc 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/SDL_syshaptic.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" -#ifndef _SDL_syshaptic_h -#define _SDL_syshaptic_h +#ifndef SDL_syshaptic_h_ +#define SDL_syshaptic_h_ #include "SDL_haptic.h" @@ -62,7 +62,7 @@ struct _SDL_Haptic extern int SDL_SYS_HapticInit(void); /* Function to return the number of haptic devices plugged in right now */ -extern int SDL_SYS_NumHaptics(); +extern int SDL_SYS_NumHaptics(void); /* * Gets the device dependent name of the haptic device @@ -203,6 +203,6 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic); */ extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic); -#endif /* _SDL_syshaptic_h */ +#endif /* SDL_syshaptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic.c new file mode 100644 index 0000000000..7cb289ba58 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic.c @@ -0,0 +1,368 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_HAPTIC_ANDROID + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_syshaptic_c.h" +#include "../SDL_syshaptic.h" +#include "SDL_haptic.h" +#include "../../core/android/SDL_android.h" +#include "SDL_joystick.h" +#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */ +#include "../../joystick/android/SDL_sysjoystick_c.h" /* For joystick hwdata */ + + +typedef struct SDL_hapticlist_item +{ + int device_id; + char *name; + SDL_Haptic *haptic; + struct SDL_hapticlist_item *next; +} SDL_hapticlist_item; + +static SDL_hapticlist_item *SDL_hapticlist = NULL; +static SDL_hapticlist_item *SDL_hapticlist_tail = NULL; +static int numhaptics = 0; + + +int +SDL_SYS_HapticInit(void) +{ + /* Support for device connect/disconnect is API >= 16 only, + * so we poll every three seconds + * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html + */ + static Uint32 timeout = 0; + if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + timeout = SDL_GetTicks() + 3000; + Android_JNI_PollHapticDevices(); + } + return (numhaptics); +} + +int +SDL_SYS_NumHaptics(void) +{ + return (numhaptics); +} + +static SDL_hapticlist_item * +HapticByOrder(int index) +{ + SDL_hapticlist_item *item = SDL_hapticlist; + if ((index < 0) || (index >= numhaptics)) { + return NULL; + } + while (index > 0) { + SDL_assert(item != NULL); + --index; + item = item->next; + } + return item; +} + +static SDL_hapticlist_item * +HapticByDevId (int device_id) +{ + SDL_hapticlist_item *item; + for (item = SDL_hapticlist; item != NULL; item = item->next) { + if (device_id == item->device_id) { + /*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/ + return item; + } + } + return NULL; +} + +const char * +SDL_SYS_HapticName(int index) +{ + SDL_hapticlist_item *item = HapticByOrder(index); + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + return item->name; +} + + +static SDL_hapticlist_item * +OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item) +{ + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + if (item->haptic != NULL) { + SDL_SetError("Haptic already opened"); + return NULL; + } + + haptic->hwdata = (struct haptic_hwdata *)item; + item->haptic = haptic; + + haptic->supported = SDL_HAPTIC_LEFTRIGHT; + haptic->neffects = 1; + haptic->nplaying = haptic->neffects; + haptic->effects = (struct haptic_effect *)SDL_malloc (sizeof (struct haptic_effect) * haptic->neffects); + if (haptic->effects == NULL) { + SDL_OutOfMemory(); + return NULL; + } + SDL_memset(haptic->effects, 0, sizeof (struct haptic_effect) * haptic->neffects); + return item; +} + +static SDL_hapticlist_item * +OpenHapticByOrder(SDL_Haptic *haptic, int index) +{ + return OpenHaptic (haptic, HapticByOrder(index)); +} + +static SDL_hapticlist_item * +OpenHapticByDevId(SDL_Haptic *haptic, int device_id) +{ + return OpenHaptic (haptic, HapticByDevId(device_id)); +} + +int +SDL_SYS_HapticOpen(SDL_Haptic *haptic) +{ + return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0); +} + + +int +SDL_SYS_HapticMouse(void) +{ + return 0; +} + + +int +SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) +{ + SDL_hapticlist_item *item; + item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id); + return (item != NULL) ? 1 : 0; +} + + +int +SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick) +{ + return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0); +} + + +int +SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) +{ + return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0); +} + + +void +SDL_SYS_HapticClose(SDL_Haptic * haptic) +{ + ((SDL_hapticlist_item *)haptic->hwdata)->haptic = NULL; + haptic->hwdata = NULL; + return; +} + + +void +SDL_SYS_HapticQuit(void) +{ +/* We don't have any way to scan for joysticks (and their vibrators) at init, so don't wipe the list + * of joysticks here in case this is a reinit. + */ +#if 0 + SDL_hapticlist_item *item = NULL; + SDL_hapticlist_item *next = NULL; + + for (item = SDL_hapticlist; item; item = next) { + next = item->next; + SDL_free(item); + } + + SDL_hapticlist = SDL_hapticlist_tail = NULL; + numhaptics = 0; + return; +#endif +} + + +int +SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, SDL_HapticEffect * base) +{ + return 0; +} + + +int +SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, + SDL_HapticEffect * data) +{ + return 0; +} + + +int +SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, + Uint32 iterations) +{ + float large = effect->effect.leftright.large_magnitude / 32767.0f; + float small = effect->effect.leftright.small_magnitude / 32767.0f; + + float total = (large * 0.6f) + (small * 0.4f); + + Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, total, effect->effect.leftright.length); + return 0; +} + + +int +SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + Android_JNI_HapticStop (((SDL_hapticlist_item *)haptic->hwdata)->device_id); + return 0; +} + + +void +SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + return; +} + + +int +SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, + struct haptic_effect *effect) +{ + return 0; +} + + +int +SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) +{ + return 0; +} + + +int +SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) +{ + return 0; +} + +int +SDL_SYS_HapticPause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticUnpause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticStopAll(SDL_Haptic * haptic) +{ + return 0; +} + + + +int +Android_AddHaptic(int device_id, const char *name) +{ + SDL_hapticlist_item *item; + item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item)); + if (item == NULL) { + return -1; + } + + item->device_id = device_id; + item->name = SDL_strdup (name); + if (item->name == NULL) { + SDL_free (item); + return -1; + } + + if (SDL_hapticlist_tail == NULL) { + SDL_hapticlist = SDL_hapticlist_tail = item; + } else { + SDL_hapticlist_tail->next = item; + SDL_hapticlist_tail = item; + } + + ++numhaptics; + return numhaptics; +} + +int +Android_RemoveHaptic(int device_id) +{ + SDL_hapticlist_item *item; + SDL_hapticlist_item *prev = NULL; + + for (item = SDL_hapticlist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (device_id == item->device_id) { + const int retval = item->haptic ? item->haptic->index : -1; + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_hapticlist == item); + SDL_hapticlist = item->next; + } + if (item == SDL_hapticlist_tail) { + SDL_hapticlist_tail = prev; + } + + /* Need to decrement the haptic count */ + --numhaptics; + /* !!! TODO: Send a haptic remove event? */ + + SDL_free(item->name); + SDL_free(item); + return retval; + } + prev = item; + } + return -1; +} + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic_c.h new file mode 100644 index 0000000000..08634d2231 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/haptic/android/SDL_syshaptic_c.h @@ -0,0 +1,12 @@ +#include "SDL_config.h" + +#ifdef SDL_HAPTIC_ANDROID + + +extern int Android_AddHaptic(int device_id, const char *name); +extern int Android_RemoveHaptic(int device_id); + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic.c index d662012c38..67cb9f52f3 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,7 +189,7 @@ SDL_SYS_HapticInit(void) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } diff --git a/3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic_c.h rename to 3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic_c.h index 2b72aab3db..073db53b3d 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic_c.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/haptic/dummy/SDL_syshaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/dummy/SDL_syshaptic.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/haptic/dummy/SDL_syshaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/dummy/SDL_syshaptic.c index 727e7ecacc..283fe67110 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/dummy/SDL_syshaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/haptic/linux/SDL_syshaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/linux/SDL_syshaptic.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/haptic/linux/SDL_syshaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/linux/SDL_syshaptic.c index e8d7855354..4e4f8a5f2f 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/linux/SDL_syshaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,7 +49,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ /* @@ -181,13 +181,16 @@ SDL_SYS_HapticInit(void) SDL_UDEV_Quit(); return SDL_SetError("Could not setup haptic <-> udev callback"); } + + /* Force a scan to build the initial device list */ + SDL_UDEV_Scan(); #endif /* SDL_USE_LIBUDEV */ return numhaptics; } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } @@ -211,7 +214,7 @@ HapticByDevIndex(int device_index) } #if SDL_USE_LIBUDEV -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { return; @@ -609,7 +612,7 @@ SDL_SYS_HapticQuit(void) /* Opened and not closed haptics are leaked, this is on purpose. * Close your haptic devices after usage. */ SDL_free(item->fname); - item->fname = NULL; + SDL_free(item); } #if SDL_USE_LIBUDEV @@ -690,7 +693,7 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src) else if (!src->dir[0]) *dest = (src->dir[1] >= 0 ? 0x8000 : 0); else { - float f = atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */ + float f = SDL_atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */ /* atan2 takes the parameters: Y-axis-value and X-axis-value (in that order) - Y-axis-value is the second coordinate (from center to SOUTH) @@ -798,7 +801,8 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src) else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN) dest->u.periodic.waveform = FF_SAW_DOWN; dest->u.periodic.period = CLAMP(periodic->period); - dest->u.periodic.magnitude = periodic->magnitude; + /* Linux expects 0-65535, so multiply by 2 */ + dest->u.periodic.magnitude = CLAMP(periodic->magnitude) * 2; dest->u.periodic.offset = periodic->offset; /* Linux phase is defined in interval "[0x0000, 0x10000[", corresponds with "[0deg, 360deg[" phase shift. */ dest->u.periodic.phase = ((Uint32)periodic->phase * 0x10000U) / 36000; @@ -905,9 +909,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src) dest->trigger.button = 0; dest->trigger.interval = 0; - /* Rumble */ - dest->u.rumble.strong_magnitude = leftright->large_magnitude; - dest->u.rumble.weak_magnitude = leftright->small_magnitude; + /* Rumble (Linux expects 0-65535, so multiply by 2) */ + dest->u.rumble.strong_magnitude = CLAMP(leftright->large_magnitude) * 2; + dest->u.rumble.weak_magnitude = CLAMP(leftright->small_magnitude) * 2; break; diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic.c index c51470dd5a..897d1282ed 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,15 +58,6 @@ DI_SetError(const char *str, HRESULT err) return SDL_SetError("Haptic error %s", str); } -/* - * Checks to see if two GUID are the same. - */ -static int -DI_GUIDIsSame(const GUID * a, const GUID * b) -{ - return (SDL_memcmp(a, b, sizeof (GUID)) == 0); -} - /* * Callback to find the haptic devices. */ @@ -219,17 +210,17 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) { const GUID *guid = &dev->guidType; DWORD offset = 0; - if (DI_GUIDIsSame(guid, &GUID_XAxis)) { + if (WIN_IsEqualGUID(guid, &GUID_XAxis)) { offset = DIJOFS_X; - } else if (DI_GUIDIsSame(guid, &GUID_YAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_YAxis)) { offset = DIJOFS_Y; - } else if (DI_GUIDIsSame(guid, &GUID_ZAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_ZAxis)) { offset = DIJOFS_Z; - } else if (DI_GUIDIsSame(guid, &GUID_RxAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RxAxis)) { offset = DIJOFS_RX; - } else if (DI_GUIDIsSame(guid, &GUID_RyAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RyAxis)) { offset = DIJOFS_RY; - } else if (DI_GUIDIsSame(guid, &GUID_RzAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RzAxis)) { offset = DIJOFS_RZ; } else { return DIENUM_CONTINUE; /* can't use this, go on. */ @@ -251,7 +242,7 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) * Callback to get all supported effects. */ #define EFFECT_TEST(e,s) \ -if (DI_GUIDIsSame(&pei->guid, &(e))) \ +if (WIN_IsEqualGUID(&pei->guid, &(e))) \ haptic->supported |= (s) static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv) @@ -325,20 +316,12 @@ SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device /* Set data format. */ ret = IDirectInputDevice8_SetDataFormat(haptic->hwdata->device, - &c_dfDIJoystick2); + &SDL_c_dfDIJoystick2); if (FAILED(ret)) { DI_SetError("Setting data format", ret); goto acquire_err; } - /* Get number of axes. */ - ret = IDirectInputDevice8_EnumObjects(haptic->hwdata->device, - DI_DeviceObjectCallback, - haptic, DIDFT_AXIS); - if (FAILED(ret)) { - DI_SetError("Getting device axes", ret); - goto acquire_err; - } /* Acquire the device. */ ret = IDirectInputDevice8_Acquire(haptic->hwdata->device); @@ -348,6 +331,15 @@ SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device } } + /* Get number of axes. */ + ret = IDirectInputDevice8_EnumObjects(haptic->hwdata->device, + DI_DeviceObjectCallback, + haptic, DIDFT_AXIS); + if (FAILED(ret)) { + DI_SetError("Getting device axes", ret); + goto acquire_err; + } + /* Reset all actuators - just in case. */ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device, DISFFC_RESET); @@ -480,7 +472,7 @@ SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) return 0; } - return DI_GUIDIsSame(&hap_instance.guidInstance, &joy_instance.guidInstance); + return WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance); } int @@ -499,7 +491,7 @@ SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ for (item = SDL_hapticlist; item != NULL; item = item->next) { - if (!item->bXInputHaptic && DI_GUIDIsSame(&item->instance.guidInstance, &joy_instance.guidInstance)) { + if (!item->bXInputHaptic && WIN_IsEqualGUID(&item->instance.guidInstance, &joy_instance.guidInstance)) { haptic->index = index; return SDL_DINPUT_HapticOpenFromDevice(haptic, joystick->hwdata->InputDevice, SDL_TRUE); } @@ -1015,6 +1007,19 @@ SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, /* Create the actual effect. */ ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + if (ret == DIERR_NOTEXCLUSIVEACQUIRED) { + IDirectInputDevice8_Unacquire(haptic->hwdata->device); + ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device, SDL_HelperWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND); + if (SUCCEEDED(ret)) { + ret = DIERR_NOTACQUIRED; + } + } + if (ret == DIERR_INPUTLOST || ret == DIERR_NOTACQUIRED) { + ret = IDirectInputDevice8_Acquire(haptic->hwdata->device); + if (SUCCEEDED(ret)) { + ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + } + } if (FAILED(ret)) { DI_SetError("Unable to update effect", ret); goto err_update; diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic_c.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic_c.h rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic_c.h index 3dc0f13039..81c0ad142c 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic.c index 0c038fb1b9..2e806c9713 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -98,7 +98,7 @@ SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } @@ -157,7 +157,7 @@ SDL_SYS_HapticMouse(void) /* Grab the first mouse haptic device we find. */ for (item = SDL_hapticlist; item != NULL; item = item->next) { - if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER ) { + if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER) { return index; } ++index; @@ -173,14 +173,16 @@ SDL_SYS_HapticMouse(void) int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) { - const struct joystick_hwdata *hwdata = joystick->hwdata; + if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { + return 0; + } #if SDL_HAPTIC_XINPUT - if (hwdata->bXInputHaptic) { + if (joystick->hwdata->bXInputHaptic) { return 1; } #endif #if SDL_HAPTIC_DINPUT - if (hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { + if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { return 1; } #endif @@ -193,6 +195,9 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { + if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { + return 0; + } if (joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) { return 0; /* one is XInput, one is not; not the same device. */ } else if (joystick->hwdata->bXInputHaptic) { @@ -208,6 +213,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) { + SDL_assert(joystick->driver == &SDL_WINDOWS_JoystickDriver); + if (joystick->hwdata->bXInputDevice) { return SDL_XINPUT_HapticOpenFromJoystick(haptic, joystick); } else { @@ -255,7 +262,7 @@ SDL_SYS_HapticQuit(void) for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) { if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) { /* we _have_ to stop the thread before we free the XInput DLL! */ - hapticitem->hwdata->stopThread = 1; + SDL_AtomicSet(&hapticitem->hwdata->stopThread, 1); SDL_WaitThread(hapticitem->hwdata->thread, NULL); hapticitem->hwdata->thread = NULL; } diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic_c.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic_c.h rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic_c.h index 89fdd2cb9c..256ffbf355 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_windowshaptic_c.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowshaptic_c_h -#define _SDL_windowshaptic_c_h +#ifndef SDL_windowshaptic_c_h_ +#define SDL_windowshaptic_c_h_ #include "SDL_thread.h" #include "../SDL_syshaptic.h" @@ -42,8 +42,8 @@ struct haptic_hwdata Uint8 userid; /* XInput userid index for this joystick */ SDL_Thread *thread; SDL_mutex *mutex; - volatile Uint32 stopTicks; - volatile int stopThread; + Uint32 stopTicks; + SDL_atomic_t stopThread; }; @@ -82,7 +82,7 @@ extern SDL_hapticlist_item *SDL_hapticlist; extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item); extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item); -#endif /* _SDL_windowshaptic_c_h */ +#endif /* SDL_windowshaptic_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic.c b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic.c rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic.c index a46ae5f97d..53e7ad3e99 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic.c +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_xinputhaptic_c.h" #include "../../core/windows/SDL_xinput.h" #include "../../joystick/windows/SDL_windowsjoystick_c.h" +#include "../../thread/SDL_systhread.h" /* * Internal stuff. @@ -43,8 +44,7 @@ static SDL_bool loaded_xinput = SDL_FALSE; int SDL_XINPUT_HapticInit(void) { - const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED); - if (!env || SDL_atoi(env)) { + if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) { loaded_xinput = (WIN_LoadXInputDLL() == 0); } @@ -146,7 +146,7 @@ SDL_RunXInputHaptic(void *arg) { struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg; - while (!hwdata->stopThread) { + while (!SDL_AtomicGet(&hwdata->stopThread)) { SDL_Delay(50); SDL_LockMutex(hwdata->mutex); /* If we're currently running and need to stop... */ @@ -205,17 +205,8 @@ SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 userid) } SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", (int)userid); + haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata); -#if defined(__WIN32__) && !defined(HAVE_LIBC) /* !!! FIXME: this is nasty. */ -#undef SDL_CreateThread -#if SDL_DYNAMIC_API - haptic->hwdata->thread = SDL_CreateThread_REAL(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL); -#else - haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL); -#endif -#else - haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata); -#endif if (haptic->hwdata->thread == NULL) { SDL_DestroyMutex(haptic->hwdata->mutex); SDL_free(haptic->effects); @@ -261,7 +252,7 @@ SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) void SDL_XINPUT_HapticClose(SDL_Haptic * haptic) { - haptic->hwdata->stopThread = 1; + SDL_AtomicSet(&haptic->hwdata->stopThread, 1); SDL_WaitThread(haptic->hwdata->thread, NULL); SDL_DestroyMutex(haptic->hwdata->mutex); } @@ -287,8 +278,9 @@ SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, { XINPUT_VIBRATION *vib = &effect->hweffect->vibration; SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT); - vib->wLeftMotorSpeed = data->leftright.large_magnitude; - vib->wRightMotorSpeed = data->leftright.small_magnitude; + /* SDL_HapticEffect has max magnitude of 32767, XInput expects 65535 max, so multiply */ + vib->wLeftMotorSpeed = data->leftright.large_magnitude * 2; + vib->wRightMotorSpeed = data->leftright.small_magnitude * 2; SDL_LockMutex(haptic->hwdata->mutex); if (haptic->hwdata->stopTicks) { /* running right now? Update it. */ XINPUTSETSTATE(haptic->hwdata->userid, vib); diff --git a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic_c.h b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic_c.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic_c.h rename to 3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic_c.h index f9a0c85b24..eed029ed1a 100644 --- a/3rdparty/sdl2-2.0.4/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/3rdparty/sdl2-2.0.9/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/AUTHORS.txt b/3rdparty/sdl2-2.0.9/src/hidapi/AUTHORS.txt new file mode 100644 index 0000000000..7acafd78c3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/AUTHORS.txt @@ -0,0 +1,16 @@ + +HIDAPI Authors: + +Alan Ott : + Original Author and Maintainer + Linux, Windows, and Mac implementations + +Ludovic Rousseau : + Formatting for Doxygen documentation + Bug fixes + Correctness fixes + + +For a comprehensive list of contributions, see the commit list at github: + http://github.com/signal11/hidapi/commits/master + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/HACKING.txt b/3rdparty/sdl2-2.0.9/src/hidapi/HACKING.txt new file mode 100644 index 0000000000..761d4b6550 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/HACKING.txt @@ -0,0 +1,15 @@ +This file is mostly for the maintainer. + +1. Build hidapi.dll +2. Build hidtest.exe in DEBUG and RELEASE +3. Commit all + +4. Run the Following + export VERSION=0.1.0 + export TAG_NAME=hidapi-$VERSION + git tag $TAG_NAME + git archive --format zip --prefix $TAG_NAME/ $TAG_NAME >../$TAG_NAME.zip +5. Test the zip file. +6. Run the following: + git push origin $TAG_NAME + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-bsd.txt b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-bsd.txt new file mode 100644 index 0000000000..538cdf95cf --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-bsd.txt @@ -0,0 +1,26 @@ +Copyright (c) 2010, Alan Ott, Signal 11 Software +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-gpl3.txt b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-gpl3.txt new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-gpl3.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-orig.txt b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-orig.txt new file mode 100644 index 0000000000..e3f3380829 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE-orig.txt @@ -0,0 +1,9 @@ + HIDAPI - Multi-Platform library for + communication with HID devices. + + Copyright 2009, Alan Ott, Signal 11 Software. + All Rights Reserved. + + This software may be used by anyone for any reason so + long as the copyright notice in the source files + remains intact. diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE.txt b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE.txt new file mode 100644 index 0000000000..e1676d4c42 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/LICENSE.txt @@ -0,0 +1,13 @@ +HIDAPI can be used under one of three licenses. + +1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt +2. A BSD-Style License, in LICENSE-bsd.txt. +3. The more liberal original HIDAPI license. LICENSE-orig.txt + +The license chosen is at the discretion of the user of HIDAPI. For example: +1. An author of GPL software would likely use HIDAPI under the terms of the +GPL. + +2. An author of commercial closed-source software would likely use HIDAPI +under the terms of the BSD-style license or the original HIDAPI license. + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/Makefile.am new file mode 100644 index 0000000000..3382a1f040 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/Makefile.am @@ -0,0 +1,85 @@ + +ACLOCAL_AMFLAGS = -I m4 + +if OS_FREEBSD +pkgconfigdir=$(prefix)/libdata/pkgconfig +else +pkgconfigdir=$(libdir)/pkgconfig +endif + +if OS_LINUX +pkgconfig_DATA=pc/hidapi-hidraw.pc pc/hidapi-libusb.pc +else +pkgconfig_DATA=pc/hidapi.pc +endif + +SUBDIRS= + +if OS_LINUX +SUBDIRS += linux libusb +endif + +if OS_DARWIN +SUBDIRS += mac +endif + +if OS_IOS +SUBDIRS += ios +endif + +if OS_FREEBSD +SUBDIRS += libusb +endif + +if OS_KFREEBSD +SUBDIRS += libusb +endif + +if OS_WINDOWS +SUBDIRS += windows +endif + +SUBDIRS += hidtest + +if BUILD_TESTGUI +SUBDIRS += testgui +endif + +EXTRA_DIST = udev doxygen + +dist_doc_DATA = \ + README.txt \ + AUTHORS.txt \ + LICENSE-bsd.txt \ + LICENSE-gpl3.txt \ + LICENSE-orig.txt \ + LICENSE.txt + +SCMCLEAN_TARGETS= \ + aclocal.m4 \ + config.guess \ + config.sub \ + configure \ + config.h.in \ + depcomp \ + install-sh \ + ltmain.sh \ + missing \ + mac/Makefile.in \ + testgui/Makefile.in \ + libusb/Makefile.in \ + Makefile.in \ + linux/Makefile.in \ + windows/Makefile.in \ + m4/libtool.m4 \ + m4/lt~obsolete.m4 \ + m4/ltoptions.m4 \ + m4/ltsugar.m4 \ + m4/ltversion.m4 + +SCMCLEAN_DIR_TARGETS = \ + autom4te.cache + +scm-clean: distclean + rm -f $(SCMCLEAN_TARGETS) + rm -Rf $(SCMCLEAN_DIR_TARGETS) diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/README.txt b/3rdparty/sdl2-2.0.9/src/hidapi/README.txt new file mode 100644 index 0000000000..f19dae4ab7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/README.txt @@ -0,0 +1,339 @@ + HIDAPI library for Windows, Linux, FreeBSD and Mac OS X + ========================================================= + +About +====== + +HIDAPI is a multi-platform library which allows an application to interface +with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac +OS X. HIDAPI can be either built as a shared library (.so or .dll) or +can be embedded directly into a target application by adding a single source +file (per platform) and a single header. + +HIDAPI has four back-ends: + * Windows (using hid.dll) + * Linux/hidraw (using the Kernel's hidraw driver) + * Linux/libusb (using libusb-1.0) + * FreeBSD (using libusb-1.0) + * Mac (using IOHidManager) + +On Linux, either the hidraw or the libusb back-end can be used. There are +tradeoffs, and the functionality supported is slightly different. + +Linux/hidraw (linux/hid.c): +This back-end uses the hidraw interface in the Linux kernel. While this +back-end will support both USB and Bluetooth, it has some limitations on +kernels prior to 2.6.39, including the inability to send or receive feature +reports. In addition, it will only communicate with devices which have +hidraw nodes associated with them. Keyboards, mice, and some other devices +which are blacklisted from having hidraw nodes will not work. Fortunately, +for nearly all the uses of hidraw, this is not a problem. + +Linux/FreeBSD/libusb (libusb/hid.c): +This back-end uses libusb-1.0 to communicate directly to a USB device. This +back-end will of course not work with Bluetooth devices. + +HIDAPI also comes with a Test GUI. The Test GUI is cross-platform and uses +Fox Toolkit (http://www.fox-toolkit.org). It will build on every platform +which HIDAPI supports. Since it relies on a 3rd party library, building it +is optional but recommended because it is so useful when debugging hardware. + +What Does the API Look Like? +============================= +The API provides the the most commonly used HID functions including sending +and receiving of input, output, and feature reports. The sample program, +which communicates with a heavily hacked up version of the Microchip USB +Generic HID sample looks like this (with error checking removed for +simplicity): + +#ifdef WIN32 +#include +#endif +#include +#include +#include "hidapi.h" + +#define MAX_STR 255 + +int main(int argc, char* argv[]) +{ + int res; + unsigned char buf[65]; + wchar_t wstr[MAX_STR]; + hid_device *handle; + int i; + + // Initialize the hidapi library + res = hid_init(); + + // Open the device using the VID, PID, + // and optionally the Serial number. + handle = hid_open(0x4d8, 0x3f, NULL); + + // Read the Manufacturer String + res = hid_get_manufacturer_string(handle, wstr, MAX_STR); + wprintf(L"Manufacturer String: %s\n", wstr); + + // Read the Product String + res = hid_get_product_string(handle, wstr, MAX_STR); + wprintf(L"Product String: %s\n", wstr); + + // Read the Serial Number String + res = hid_get_serial_number_string(handle, wstr, MAX_STR); + wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr); + + // Read Indexed String 1 + res = hid_get_indexed_string(handle, 1, wstr, MAX_STR); + wprintf(L"Indexed String 1: %s\n", wstr); + + // Toggle LED (cmd 0x80). The first byte is the report number (0x0). + buf[0] = 0x0; + buf[1] = 0x80; + res = hid_write(handle, buf, 65); + + // Request state (cmd 0x81). The first byte is the report number (0x0). + buf[0] = 0x0; + buf[1] = 0x81; + res = hid_write(handle, buf, 65); + + // Read requested state + res = hid_read(handle, buf, 65); + + // Print out the returned buffer. + for (i = 0; i < 4; i++) + printf("buf[%d]: %d\n", i, buf[i]); + + // Finalize the hidapi library + res = hid_exit(); + + return 0; +} + +If you have your own simple test programs which communicate with standard +hardware development boards (such as those from Microchip, TI, Atmel, +FreeScale and others), please consider sending me something like the above +for inclusion into the HIDAPI source. This will help others who have the +same hardware as you do. + +License +======== +HIDAPI may be used by one of three licenses as outlined in LICENSE.txt. + +Download +========= +HIDAPI can be downloaded from github + git clone git://github.com/signal11/hidapi.git + +Build Instructions +=================== + +This section is long. Don't be put off by this. It's not long because it's +complicated to build HIDAPI; it's quite the opposite. This section is long +because of the flexibility of HIDAPI and the large number of ways in which +it can be built and used. You will likely pick a single build method. + +HIDAPI can be built in several different ways. If you elect to build a +shared library, you will need to build it from the HIDAPI source +distribution. If you choose instead to embed HIDAPI directly into your +application, you can skip the building and look at the provided platform +Makefiles for guidance. These platform Makefiles are located in linux/ +libusb/ mac/ and windows/ and are called Makefile-manual. In addition, +Visual Studio projects are provided. Even if you're going to embed HIDAPI +into your project, it is still beneficial to build the example programs. + + +Prerequisites: +--------------- + + Linux: + ------- + On Linux, you will need to install development packages for libudev, + libusb and optionally Fox-toolkit (for the test GUI). On + Debian/Ubuntu systems these can be installed by running: + sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev + + If you downloaded the source directly from the git repository (using + git clone), you'll need Autotools: + sudo apt-get install autotools-dev autoconf automake libtool + + FreeBSD: + --------- + On FreeBSD you will need to install GNU make, libiconv, and + optionally Fox-Toolkit (for the test GUI). This is done by running + the following: + pkg_add -r gmake libiconv fox16 + + If you downloaded the source directly from the git repository (using + git clone), you'll need Autotools: + pkg_add -r autotools + + Mac: + ----- + On Mac, you will need to install Fox-Toolkit if you wish to build + the Test GUI. There are two ways to do this, and each has a slight + complication. Which method you use depends on your use case. + + If you wish to build the Test GUI just for your own testing on your + own computer, then the easiest method is to install Fox-Toolkit + using ports: + sudo port install fox + + If you wish to build the TestGUI app bundle to redistribute to + others, you will need to install Fox-toolkit from source. This is + because the version of fox that gets installed using ports uses the + ports X11 libraries which are not compatible with the Apple X11 + libraries. If you install Fox with ports and then try to distribute + your built app bundle, it will simply fail to run on other systems. + To install Fox-Toolkit manually, download the source package from + http://www.fox-toolkit.org, extract it, and run the following from + within the extracted source: + ./configure && make && make install + + Windows: + --------- + On Windows, if you want to build the test GUI, you will need to get + the hidapi-externals.zip package from the download site. This + contains pre-built binaries for Fox-toolkit. Extract + hidapi-externals.zip just outside of hidapi, so that + hidapi-externals and hidapi are on the same level, as shown: + + Parent_Folder + | + +hidapi + +hidapi-externals + + Again, this step is not required if you do not wish to build the + test GUI. + + +Building HIDAPI into a shared library on Unix Platforms: +--------------------------------------------------------- + +On Unix-like systems such as Linux, FreeBSD, Mac, and even Windows, using +Mingw or Cygwin, the easiest way to build a standard system-installed shared +library is to use the GNU Autotools build system. If you checked out the +source from the git repository, run the following: + + ./bootstrap + ./configure + make + make install <----- as root, or using sudo + +If you downloaded a source package (ie: if you did not run git clone), you +can skip the ./bootstrap step. + +./configure can take several arguments which control the build. The two most +likely to be used are: + --enable-testgui + Enable build of the Test GUI. This requires Fox toolkit to + be installed. Instructions for installing Fox-Toolkit on + each platform are in the Prerequisites section above. + + --prefix=/usr + Specify where you want the output headers and libraries to + be installed. The example above will put the headers in + /usr/include and the binaries in /usr/lib. The default is to + install into /usr/local which is fine on most systems. + +Building the manual way on Unix platforms: +------------------------------------------- + +Manual Makefiles are provided mostly to give the user and idea what it takes +to build a program which embeds HIDAPI directly inside of it. These should +really be used as examples only. If you want to build a system-wide shared +library, use the Autotools method described above. + + To build HIDAPI using the manual makefiles, change to the directory + of your platform and run make. For example, on Linux run: + cd linux/ + make -f Makefile-manual + + To build the Test GUI using the manual makefiles: + cd testgui/ + make -f Makefile-manual + +Building on Windows: +--------------------- + +To build the HIDAPI DLL on Windows using Visual Studio, build the .sln file +in the windows/ directory. + +To build the Test GUI on windows using Visual Studio, build the .sln file in +the testgui/ directory. + +To build HIDAPI using MinGW or Cygwin using Autotools, use the instructions +in the section titled "Building HIDAPI into a shared library on Unix +Platforms" above. Note that building the Test GUI with MinGW or Cygwin will +require the Windows procedure in the Prerequisites section above (ie: +hidapi-externals.zip). + +To build HIDAPI using MinGW using the Manual Makefiles, see the section +"Building the manual way on Unix platforms" above. + +HIDAPI can also be built using the Windows DDK (now also called the Windows +Driver Kit or WDK). This method was originally required for the HIDAPI build +but not anymore. However, some users still prefer this method. It is not as +well supported anymore but should still work. Patches are welcome if it does +not. To build using the DDK: + + 1. Install the Windows Driver Kit (WDK) from Microsoft. + 2. From the Start menu, in the Windows Driver Kits folder, select Build + Environments, then your operating system, then the x86 Free Build + Environment (or one that is appropriate for your system). + 3. From the console, change directory to the windows/ddk_build/ directory, + which is part of the HIDAPI distribution. + 4. Type build. + 5. You can find the output files (DLL and LIB) in a subdirectory created + by the build system which is appropriate for your environment. On + Windows XP, this directory is objfre_wxp_x86/i386. + +Cross Compiling +================ + +This section talks about cross compiling HIDAPI for Linux using autotools. +This is useful for using HIDAPI on embedded Linux targets. These +instructions assume the most raw kind of embedded Linux build, where all +prerequisites will need to be built first. This process will of course vary +based on your embedded Linux build system if you are using one, such as +OpenEmbedded or Buildroot. + +For the purpose of this section, it will be assumed that the following +environment variables are exported. + + $ export STAGING=$HOME/out + $ export HOST=arm-linux + +STAGING and HOST can be modified to suit your setup. + +Prerequisites +-------------- + +Note that the build of libudev is the very basic configuration. + +Build Libusb. From the libusb source directory, run: + ./configure --host=$HOST --prefix=$STAGING + make + make install + +Build libudev. From the libudev source directory, run: + ./configure --disable-gudev --disable-introspection --disable-hwdb \ + --host=$HOST --prefix=$STAGING + make + make install + +Building HIDAPI +---------------- + +Build HIDAPI: + + PKG_CONFIG_DIR= \ + PKG_CONFIG_LIBDIR=$STAGING/lib/pkgconfig:$STAGING/share/pkgconfig \ + PKG_CONFIG_SYSROOT_DIR=$STAGING \ + ./configure --host=$HOST --prefix=$STAGING + + +Signal 11 Software - 2010-04-11 + 2010-07-28 + 2011-09-10 + 2012-05-01 + 2012-07-03 diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/android/hid.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/android/hid.cpp new file mode 100644 index 0000000000..7b8d41c71a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/android/hid.cpp @@ -0,0 +1,1159 @@ +//=================== Copyright Valve Corporation, All rights reserved. ======= +// +// Purpose: A wrapper implementing "HID" API for Android +// +// This layer glues the hidapi API to Android's USB and BLE stack. +// +//============================================================================= + +#include +#include +#include +#include // For ETIMEDOUT and ECONNRESET +#include // For malloc() and free() +#include // For memcpy() + +#define TAG "hidapi" + +// Have error log always available +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) + +#ifdef DEBUG +#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) +#else +#define LOGV(...) +#define LOGD(...) +#endif + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) + +#include "../hidapi/hidapi.h" + +typedef uint32_t uint32; +typedef uint64_t uint64; + + +struct hid_device_ +{ + int m_nId; + int m_nDeviceRefCount; +}; + +static JavaVM *g_JVM; +static pthread_key_t g_ThreadKey; + +template +class hid_device_ref +{ +public: + hid_device_ref( T *pObject = nullptr ) : m_pObject( nullptr ) + { + SetObject( pObject ); + } + + hid_device_ref( const hid_device_ref &rhs ) : m_pObject( nullptr ) + { + SetObject( rhs.GetObject() ); + } + + ~hid_device_ref() + { + SetObject( nullptr ); + } + + void SetObject( T *pObject ) + { + if ( m_pObject && m_pObject->DecrementRefCount() == 0 ) + { + delete m_pObject; + } + + m_pObject = pObject; + + if ( m_pObject ) + { + m_pObject->IncrementRefCount(); + } + } + + hid_device_ref &operator =( T *pObject ) + { + SetObject( pObject ); + return *this; + } + + hid_device_ref &operator =( const hid_device_ref &rhs ) + { + SetObject( rhs.GetObject() ); + return *this; + } + + T *GetObject() const + { + return m_pObject; + } + + T* operator->() const + { + return m_pObject; + } + + operator bool() const + { + return ( m_pObject != nullptr ); + } + +private: + T *m_pObject; +}; + +class hid_mutex_guard +{ +public: + hid_mutex_guard( pthread_mutex_t *pMutex ) : m_pMutex( pMutex ) + { + pthread_mutex_lock( m_pMutex ); + } + ~hid_mutex_guard() + { + pthread_mutex_unlock( m_pMutex ); + } + +private: + pthread_mutex_t *m_pMutex; +}; + +class hid_buffer +{ +public: + hid_buffer() : m_pData( nullptr ), m_nSize( 0 ), m_nAllocated( 0 ) + { + } + + hid_buffer( const uint8_t *pData, size_t nSize ) : m_pData( nullptr ), m_nSize( 0 ), m_nAllocated( 0 ) + { + assign( pData, nSize ); + } + + ~hid_buffer() + { + delete[] m_pData; + } + + void assign( const uint8_t *pData, size_t nSize ) + { + if ( nSize > m_nAllocated ) + { + delete[] m_pData; + m_pData = new uint8_t[ nSize ]; + m_nAllocated = nSize; + } + + m_nSize = nSize; + memcpy( m_pData, pData, nSize ); + } + + void clear() + { + m_nSize = 0; + } + + size_t size() const + { + return m_nSize; + } + + const uint8_t *data() const + { + return m_pData; + } + +private: + uint8_t *m_pData; + size_t m_nSize; + size_t m_nAllocated; +}; + +class hid_buffer_pool +{ +public: + hid_buffer_pool() : m_nSize( 0 ), m_pHead( nullptr ), m_pTail( nullptr ), m_pFree( nullptr ) + { + } + + ~hid_buffer_pool() + { + clear(); + + while ( m_pFree ) + { + hid_buffer_entry *pEntry = m_pFree; + m_pFree = m_pFree->m_pNext; + delete pEntry; + } + } + + size_t size() const { return m_nSize; } + + const hid_buffer &front() const { return m_pHead->m_buffer; } + + void pop_front() + { + hid_buffer_entry *pEntry = m_pHead; + if ( pEntry ) + { + m_pHead = pEntry->m_pNext; + if ( !m_pHead ) + { + m_pTail = nullptr; + } + pEntry->m_pNext = m_pFree; + m_pFree = pEntry; + --m_nSize; + } + } + + void emplace_back( const uint8_t *pData, size_t nSize ) + { + hid_buffer_entry *pEntry; + + if ( m_pFree ) + { + pEntry = m_pFree; + m_pFree = m_pFree->m_pNext; + } + else + { + pEntry = new hid_buffer_entry; + } + pEntry->m_pNext = nullptr; + + if ( m_pTail ) + { + m_pTail->m_pNext = pEntry; + } + else + { + m_pHead = pEntry; + } + m_pTail = pEntry; + + pEntry->m_buffer.assign( pData, nSize ); + ++m_nSize; + } + + void clear() + { + while ( size() > 0 ) + { + pop_front(); + } + } + +private: + struct hid_buffer_entry + { + hid_buffer m_buffer; + hid_buffer_entry *m_pNext; + }; + + size_t m_nSize; + hid_buffer_entry *m_pHead; + hid_buffer_entry *m_pTail; + hid_buffer_entry *m_pFree; +}; + +static jbyteArray NewByteArray( JNIEnv* env, const uint8_t *pData, size_t nDataLen ) +{ + jbyteArray array = env->NewByteArray( nDataLen ); + jbyte *pBuf = env->GetByteArrayElements( array, NULL ); + memcpy( pBuf, pData, nDataLen ); + env->ReleaseByteArrayElements( array, pBuf, 0 ); + + return array; +} + +static char *CreateStringFromJString( JNIEnv *env, const jstring &sString ) +{ + size_t nLength = env->GetStringUTFLength( sString ); + const char *pjChars = env->GetStringUTFChars( sString, NULL ); + char *psString = (char*)malloc( nLength + 1 ); + memcpy( psString, pjChars, nLength ); + psString[ nLength ] = '\0'; + env->ReleaseStringUTFChars( sString, pjChars ); + return psString; +} + +static wchar_t *CreateWStringFromJString( JNIEnv *env, const jstring &sString ) +{ + size_t nLength = env->GetStringLength( sString ); + const jchar *pjChars = env->GetStringChars( sString, NULL ); + wchar_t *pwString = (wchar_t*)malloc( ( nLength + 1 ) * sizeof( wchar_t ) ); + wchar_t *pwChars = pwString; + for ( size_t iIndex = 0; iIndex < nLength; ++iIndex ) + { + pwChars[ iIndex ] = pjChars[ iIndex ]; + } + pwString[ nLength ] = '\0'; + env->ReleaseStringChars( sString, pjChars ); + return pwString; +} + +static wchar_t *CreateWStringFromWString( const wchar_t *pwSrc ) +{ + size_t nLength = wcslen( pwSrc ); + wchar_t *pwString = (wchar_t*)malloc( ( nLength + 1 ) * sizeof( wchar_t ) ); + memcpy( pwString, pwSrc, nLength * sizeof( wchar_t ) ); + pwString[ nLength ] = '\0'; + return pwString; +} + +static hid_device_info *CopyHIDDeviceInfo( const hid_device_info *pInfo ) +{ + hid_device_info *pCopy = new hid_device_info; + *pCopy = *pInfo; + pCopy->path = strdup( pInfo->path ); + pCopy->product_string = CreateWStringFromWString( pInfo->product_string ); + pCopy->manufacturer_string = CreateWStringFromWString( pInfo->manufacturer_string ); + pCopy->serial_number = CreateWStringFromWString( pInfo->serial_number ); + return pCopy; +} + +static void FreeHIDDeviceInfo( hid_device_info *pInfo ) +{ + free( pInfo->path ); + free( pInfo->serial_number ); + free( pInfo->manufacturer_string ); + free( pInfo->product_string ); + delete pInfo; +} + +static jclass g_HIDDeviceManagerCallbackClass; +static jobject g_HIDDeviceManagerCallbackHandler; +static jmethodID g_midHIDDeviceManagerOpen; +static jmethodID g_midHIDDeviceManagerSendOutputReport; +static jmethodID g_midHIDDeviceManagerSendFeatureReport; +static jmethodID g_midHIDDeviceManagerGetFeatureReport; +static jmethodID g_midHIDDeviceManagerClose; + +static uint64_t get_timespec_ms( const struct timespec &ts ) +{ + return (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000; +} + +class CHIDDevice +{ +public: + CHIDDevice( int nDeviceID, hid_device_info *pInfo ) + { + m_nId = nDeviceID; + m_pInfo = pInfo; + + // The Bluetooth Steam Controller needs special handling + const int VALVE_USB_VID = 0x28DE; + const int D0G_BLE2_PID = 0x1106; + if ( pInfo->vendor_id == VALVE_USB_VID && pInfo->product_id == D0G_BLE2_PID ) + { + m_bIsBLESteamController = true; + } + } + + ~CHIDDevice() + { + FreeHIDDeviceInfo( m_pInfo ); + + // Note that we don't delete m_pDevice, as the app may still have a reference to it + } + + int IncrementRefCount() + { + int nValue; + pthread_mutex_lock( &m_refCountLock ); + nValue = ++m_nRefCount; + pthread_mutex_unlock( &m_refCountLock ); + return nValue; + } + + int DecrementRefCount() + { + int nValue; + pthread_mutex_lock( &m_refCountLock ); + nValue = --m_nRefCount; + pthread_mutex_unlock( &m_refCountLock ); + return nValue; + } + + int GetId() + { + return m_nId; + } + + const hid_device_info *GetDeviceInfo() + { + return m_pInfo; + } + + hid_device *GetDevice() + { + return m_pDevice; + } + + void ExceptionCheck( JNIEnv *env, const char *pszMethodName ) + { + if ( env->ExceptionCheck() ) + { + // Get our exception + jthrowable jExcept = env->ExceptionOccurred(); + + // Clear the exception so we can call JNI again + env->ExceptionClear(); + + // Get our exception message + jclass jExceptClass = env->GetObjectClass( jExcept ); + jmethodID jMessageMethod = env->GetMethodID( jExceptClass, "getMessage", "()Ljava/lang/String;" ); + jstring jMessage = (jstring)( env->CallObjectMethod( jExcept, jMessageMethod ) ); + const char *pszMessage = env->GetStringUTFChars( jMessage, NULL ); + + // ...and log it. + LOGE( "CHIDDevice::%s threw an exception: %s", pszMethodName, pszMessage ); + + // Cleanup + env->ReleaseStringUTFChars( jMessage, pszMessage ); + env->DeleteLocalRef( jMessage ); + env->DeleteLocalRef( jExceptClass ); + env->DeleteLocalRef( jExcept ); + } + } + + bool BOpen() + { + // Make sure thread is attached to JVM/env + JNIEnv *env; + g_JVM->AttachCurrentThread( &env, NULL ); + pthread_setspecific( g_ThreadKey, (void*)env ); + + m_bIsWaitingForOpen = false; + m_bOpenResult = env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerOpen, m_nId ); + ExceptionCheck( env, "BOpen" ); + + if ( m_bIsWaitingForOpen ) + { + hid_mutex_guard cvl( &m_cvLock ); + + const int OPEN_TIMEOUT_SECONDS = 60; + struct timespec ts, endtime; + clock_gettime( CLOCK_REALTIME, &ts ); + endtime = ts; + endtime.tv_sec += OPEN_TIMEOUT_SECONDS; + do + { + if ( pthread_cond_timedwait( &m_cv, &m_cvLock, &endtime ) != 0 ) + { + break; + } + } + while ( m_bIsWaitingForOpen && get_timespec_ms( ts ) < get_timespec_ms( endtime ) ); + } + + if ( !m_bOpenResult ) + { + if ( m_bIsWaitingForOpen ) + { + LOGV( "Device open failed - timed out waiting for device permission" ); + } + else + { + LOGV( "Device open failed" ); + } + return false; + } + + m_pDevice = new hid_device; + m_pDevice->m_nId = m_nId; + m_pDevice->m_nDeviceRefCount = 1; + LOGD("Creating device %d (%p), refCount = 1\n", m_pDevice->m_nId, m_pDevice); + return true; + } + + void SetOpenPending() + { + m_bIsWaitingForOpen = true; + } + + void SetOpenResult( bool bResult ) + { + if ( m_bIsWaitingForOpen ) + { + m_bOpenResult = bResult; + m_bIsWaitingForOpen = false; + pthread_cond_signal( &m_cv ); + } + } + + void ProcessInput( const uint8_t *pBuf, size_t nBufSize ) + { + hid_mutex_guard l( &m_dataLock ); + + size_t MAX_REPORT_QUEUE_SIZE = 16; + if ( m_vecData.size() >= MAX_REPORT_QUEUE_SIZE ) + { + m_vecData.pop_front(); + } + m_vecData.emplace_back( pBuf, nBufSize ); + } + + int GetInput( unsigned char *data, size_t length ) + { + hid_mutex_guard l( &m_dataLock ); + + if ( m_vecData.size() == 0 ) + { +// LOGV( "hid_read_timeout no data available" ); + return 0; + } + + const hid_buffer &buffer = m_vecData.front(); + size_t nDataLen = buffer.size() > length ? length : buffer.size(); + if ( m_bIsBLESteamController ) + { + data[0] = 0x03; + memcpy( data + 1, buffer.data(), nDataLen ); + ++nDataLen; + } + else + { + memcpy( data, buffer.data(), nDataLen ); + } + m_vecData.pop_front(); + +// LOGV("Read %u bytes", nDataLen); +// LOGV("%02x %02x %02x %02x %02x %02x %02x %02x ....", +// data[0], data[1], data[2], data[3], +// data[4], data[5], data[6], data[7]); + + return nDataLen; + } + + int SendOutputReport( const unsigned char *pData, size_t nDataLen ) + { + // Make sure thread is attached to JVM/env + JNIEnv *env; + g_JVM->AttachCurrentThread( &env, NULL ); + pthread_setspecific( g_ThreadKey, (void*)env ); + + jbyteArray pBuf = NewByteArray( env, pData, nDataLen ); + int nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendOutputReport, m_nId, pBuf ); + ExceptionCheck( env, "SendOutputReport" ); + + env->DeleteLocalRef( pBuf ); + return nRet; + } + + int SendFeatureReport( const unsigned char *pData, size_t nDataLen ) + { + // Make sure thread is attached to JVM/env + JNIEnv *env; + g_JVM->AttachCurrentThread( &env, NULL ); + pthread_setspecific( g_ThreadKey, (void*)env ); + + jbyteArray pBuf = NewByteArray( env, pData, nDataLen ); + int nRet = env->CallIntMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerSendFeatureReport, m_nId, pBuf ); + ExceptionCheck( env, "SendFeatureReport" ); + env->DeleteLocalRef( pBuf ); + return nRet; + } + + void ProcessFeatureReport( const uint8_t *pBuf, size_t nBufSize ) + { + hid_mutex_guard cvl( &m_cvLock ); + if ( m_bIsWaitingForFeatureReport ) + { + m_featureReport.assign( pBuf, nBufSize ); + + m_bIsWaitingForFeatureReport = false; + m_nFeatureReportError = 0; + pthread_cond_signal( &m_cv ); + } + } + + int GetFeatureReport( unsigned char *pData, size_t nDataLen ) + { + // Make sure thread is attached to JVM/env + JNIEnv *env; + g_JVM->AttachCurrentThread( &env, NULL ); + pthread_setspecific( g_ThreadKey, (void*)env ); + + { + hid_mutex_guard cvl( &m_cvLock ); + if ( m_bIsWaitingForFeatureReport ) + { + LOGV( "Get feature report already ongoing... bail" ); + return -1; // Read already ongoing, we currently do not serialize, TODO + } + m_bIsWaitingForFeatureReport = true; + } + + jbyteArray pBuf = NewByteArray( env, pData, nDataLen ); + int nRet = env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerGetFeatureReport, m_nId, pBuf ) ? 0 : -1; + ExceptionCheck( env, "GetFeatureReport" ); + env->DeleteLocalRef( pBuf ); + if ( nRet < 0 ) + { + LOGV( "GetFeatureReport failed" ); + m_bIsWaitingForFeatureReport = false; + return -1; + } + + { + hid_mutex_guard cvl( &m_cvLock ); + if ( m_bIsWaitingForFeatureReport ) + { + LOGV("=== Going to sleep" ); + // Wait in CV until we are no longer waiting for a feature report. + const int FEATURE_REPORT_TIMEOUT_SECONDS = 2; + struct timespec ts, endtime; + clock_gettime( CLOCK_REALTIME, &ts ); + endtime = ts; + endtime.tv_sec += FEATURE_REPORT_TIMEOUT_SECONDS; + do + { + if ( pthread_cond_timedwait( &m_cv, &m_cvLock, &endtime ) != 0 ) + { + break; + } + } + while ( m_bIsWaitingForFeatureReport && get_timespec_ms( ts ) < get_timespec_ms( endtime ) ); + + // We are back + if ( m_bIsWaitingForFeatureReport ) + { + m_nFeatureReportError = -ETIMEDOUT; + m_bIsWaitingForFeatureReport = false; + } + LOGV( "=== Got feature report err=%d", m_nFeatureReportError ); + if ( m_nFeatureReportError != 0 ) + { + return m_nFeatureReportError; + } + } + + size_t uBytesToCopy = m_featureReport.size() > nDataLen ? nDataLen : m_featureReport.size(); + memcpy( pData, m_featureReport.data(), uBytesToCopy ); + m_featureReport.clear(); + LOGV( "=== Got %u bytes", uBytesToCopy ); + + return uBytesToCopy; + } + } + + void Close( bool bDeleteDevice ) + { + // Make sure thread is attached to JVM/env + JNIEnv *env; + g_JVM->AttachCurrentThread( &env, NULL ); + pthread_setspecific( g_ThreadKey, (void*)env ); + + env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId ); + ExceptionCheck( env, "Close" ); + + hid_mutex_guard dataLock( &m_dataLock ); + m_vecData.clear(); + + // Clean and release pending feature report reads + hid_mutex_guard cvLock( &m_cvLock ); + m_featureReport.clear(); + m_bIsWaitingForFeatureReport = false; + m_nFeatureReportError = -ECONNRESET; + pthread_cond_broadcast( &m_cv ); + + if ( bDeleteDevice ) + { + delete m_pDevice; + m_pDevice = nullptr; + } + } + +private: + pthread_mutex_t m_refCountLock = PTHREAD_MUTEX_INITIALIZER; + int m_nRefCount = 0; + int m_nId = 0; + hid_device_info *m_pInfo = nullptr; + hid_device *m_pDevice = nullptr; + bool m_bIsBLESteamController = false; + + pthread_mutex_t m_dataLock = PTHREAD_MUTEX_INITIALIZER; // This lock has to be held to access m_vecData + hid_buffer_pool m_vecData; + + // For handling get_feature_report + pthread_mutex_t m_cvLock = PTHREAD_MUTEX_INITIALIZER; // This lock has to be held to access any variables below + pthread_cond_t m_cv = PTHREAD_COND_INITIALIZER; + bool m_bIsWaitingForOpen = false; + bool m_bOpenResult = false; + bool m_bIsWaitingForFeatureReport = false; + int m_nFeatureReportError = 0; + hid_buffer m_featureReport; + +public: + hid_device_ref next; +}; + +class CHIDDevice; +static pthread_mutex_t g_DevicesMutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t g_DevicesRefCountMutex = PTHREAD_MUTEX_INITIALIZER; +static hid_device_ref g_Devices; + +static hid_device_ref FindDevice( int nDeviceId ) +{ + hid_device_ref pDevice; + + hid_mutex_guard l( &g_DevicesMutex ); + for ( pDevice = g_Devices; pDevice; pDevice = pDevice->next ) + { + if ( pDevice->GetId() == nDeviceId ) + { + break; + } + } + return pDevice; +} + +static void ThreadDestroyed(void* value) +{ + /* The thread is being destroyed, detach it from the Java VM and set the g_ThreadKey value to NULL as required */ + JNIEnv *env = (JNIEnv*) value; + if (env != NULL) { + g_JVM->DetachCurrentThread(); + pthread_setspecific(g_ThreadKey, NULL); + } +} + + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface ); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); + + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz ) +{ + LOGV( "HIDDeviceRegisterCallback()"); + + env->GetJavaVM( &g_JVM ); + + /* + * Create mThreadKey so we can keep track of the JNIEnv assigned to each thread + * Refer to http://developer.android.com/guide/practices/design/jni.html for the rationale behind this + */ + if (pthread_key_create(&g_ThreadKey, ThreadDestroyed) != 0) { + __android_log_print(ANDROID_LOG_ERROR, TAG, "Error initializing pthread key"); + } + + if ( g_HIDDeviceManagerCallbackHandler != NULL ) + { + env->DeleteGlobalRef( g_HIDDeviceManagerCallbackClass ); + g_HIDDeviceManagerCallbackClass = NULL; + env->DeleteGlobalRef( g_HIDDeviceManagerCallbackHandler ); + g_HIDDeviceManagerCallbackHandler = NULL; + } + + g_HIDDeviceManagerCallbackHandler = env->NewGlobalRef( thiz ); + jclass objClass = env->GetObjectClass( thiz ); + if ( objClass ) + { + g_HIDDeviceManagerCallbackClass = reinterpret_cast< jclass >( env->NewGlobalRef( objClass ) ); + g_midHIDDeviceManagerOpen = env->GetMethodID( g_HIDDeviceManagerCallbackClass, "openDevice", "(I)Z" ); + if ( !g_midHIDDeviceManagerOpen ) + { + __android_log_print(ANDROID_LOG_ERROR, TAG, "HIDDeviceRegisterCallback: callback class missing openDevice" ); + } + g_midHIDDeviceManagerSendOutputReport = env->GetMethodID( g_HIDDeviceManagerCallbackClass, "sendOutputReport", "(I[B)I" ); + if ( !g_midHIDDeviceManagerSendOutputReport ) + { + __android_log_print(ANDROID_LOG_ERROR, TAG, "HIDDeviceRegisterCallback: callback class missing sendOutputReport" ); + } + g_midHIDDeviceManagerSendFeatureReport = env->GetMethodID( g_HIDDeviceManagerCallbackClass, "sendFeatureReport", "(I[B)I" ); + if ( !g_midHIDDeviceManagerSendFeatureReport ) + { + __android_log_print(ANDROID_LOG_ERROR, TAG, "HIDDeviceRegisterCallback: callback class missing sendFeatureReport" ); + } + g_midHIDDeviceManagerGetFeatureReport = env->GetMethodID( g_HIDDeviceManagerCallbackClass, "getFeatureReport", "(I[B)Z" ); + if ( !g_midHIDDeviceManagerGetFeatureReport ) + { + __android_log_print(ANDROID_LOG_ERROR, TAG, "HIDDeviceRegisterCallback: callback class missing getFeatureReport" ); + } + g_midHIDDeviceManagerClose = env->GetMethodID( g_HIDDeviceManagerCallbackClass, "closeDevice", "(I)V" ); + if ( !g_midHIDDeviceManagerClose ) + { + __android_log_print(ANDROID_LOG_ERROR, TAG, "HIDDeviceRegisterCallback: callback class missing closeDevice" ); + } + env->DeleteLocalRef( objClass ); + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz) +{ + LOGV("HIDDeviceReleaseCallback"); + if ( env->IsSameObject( thiz, g_HIDDeviceManagerCallbackHandler ) ) + { + env->DeleteGlobalRef( g_HIDDeviceManagerCallbackClass ); + g_HIDDeviceManagerCallbackClass = NULL; + env->DeleteGlobalRef( g_HIDDeviceManagerCallbackHandler ); + g_HIDDeviceManagerCallbackHandler = NULL; + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface ) +{ + LOGV( "HIDDeviceConnected() id=%d VID/PID = %.4x/%.4x, interface %d\n", nDeviceID, nVendorId, nProductId, nInterface ); + + hid_device_info *pInfo = new hid_device_info; + memset( pInfo, 0, sizeof( *pInfo ) ); + pInfo->path = CreateStringFromJString( env, sIdentifier ); + pInfo->vendor_id = nVendorId; + pInfo->product_id = nProductId; + pInfo->serial_number = CreateWStringFromJString( env, sSerialNumber ); + pInfo->release_number = nReleaseNumber; + pInfo->manufacturer_string = CreateWStringFromJString( env, sManufacturer ); + pInfo->product_string = CreateWStringFromJString( env, sProduct ); + pInfo->interface_number = nInterface; + + hid_device_ref pDevice( new CHIDDevice( nDeviceID, pInfo ) ); + + hid_mutex_guard l( &g_DevicesMutex ); + hid_device_ref pLast, pCurr; + for ( pCurr = g_Devices; pCurr; pLast = pCurr, pCurr = pCurr->next ) + { + continue; + } + if ( pLast ) + { + pLast->next = pDevice; + } + else + { + g_Devices = pDevice; + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID) +{ + LOGV( "HIDDeviceOpenPending() id=%d\n", nDeviceID ); + hid_device_ref pDevice = FindDevice( nDeviceID ); + if ( pDevice ) + { + pDevice->SetOpenPending(); + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened) +{ + LOGV( "HIDDeviceOpenResult() id=%d, result=%s\n", nDeviceID, bOpened ? "true" : "false" ); + hid_device_ref pDevice = FindDevice( nDeviceID ); + if ( pDevice ) + { + pDevice->SetOpenResult( bOpened ); + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID) +{ + LOGV( "HIDDeviceDisconnected() id=%d\n", nDeviceID ); + hid_device_ref pDevice; + { + hid_mutex_guard l( &g_DevicesMutex ); + hid_device_ref pLast, pCurr; + for ( pCurr = g_Devices; pCurr; pLast = pCurr, pCurr = pCurr->next ) + { + if ( pCurr->GetId() == nDeviceID ) + { + pDevice = pCurr; + + if ( pLast ) + { + pLast->next = pCurr->next; + } + else + { + g_Devices = pCurr->next; + } + } + } + } + if ( pDevice ) + { + pDevice->Close( false ); + } +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) +{ + jbyte *pBuf = env->GetByteArrayElements(value, NULL); + jsize nBufSize = env->GetArrayLength(value); + +// LOGV( "HIDDeviceInput() id=%d len=%u\n", nDeviceID, nBufSize ); + hid_device_ref pDevice = FindDevice( nDeviceID ); + if ( pDevice ) + { + pDevice->ProcessInput( reinterpret_cast< const uint8_t* >( pBuf ), nBufSize ); + } + + env->ReleaseByteArrayElements(value, pBuf, 0); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) +{ + jbyte *pBuf = env->GetByteArrayElements(value, NULL); + jsize nBufSize = env->GetArrayLength(value); + + LOGV( "HIDDeviceFeatureReport() id=%d len=%u\n", nDeviceID, nBufSize ); + hid_device_ref pDevice = FindDevice( nDeviceID ); + if ( pDevice ) + { + pDevice->ProcessFeatureReport( reinterpret_cast< const uint8_t* >( pBuf ), nBufSize ); + } + + env->ReleaseByteArrayElements(value, pBuf, 0); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + +int hid_init(void) +{ + return 0; +} + +struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + struct hid_device_info *root = NULL; + hid_mutex_guard l( &g_DevicesMutex ); + for ( hid_device_ref pDevice = g_Devices; pDevice; pDevice = pDevice->next ) + { + const hid_device_info *info = pDevice->GetDeviceInfo(); + if ( ( vendor_id == 0 && product_id == 0 ) || + ( vendor_id == info->vendor_id && product_id == info->product_id ) ) + { + hid_device_info *dev = CopyHIDDeviceInfo( info ); + dev->next = root; + root = dev; + } + } + return root; +} + +void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs) +{ + while ( devs ) + { + struct hid_device_info *next = devs->next; + FreeHIDDeviceInfo( devs ); + devs = next; + } +} + +HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + // TODO: Implement + return NULL; +} + +HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive) +{ + LOGV( "hid_open_path( %s )", path ); + + hid_device_ref< CHIDDevice > pDevice; + { + hid_mutex_guard r( &g_DevicesRefCountMutex ); + hid_mutex_guard l( &g_DevicesMutex ); + for ( hid_device_ref pCurr = g_Devices; pCurr; pCurr = pCurr->next ) + { + if ( strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) + { + hid_device *pValue = pCurr->GetDevice(); + if ( pValue ) + { + ++pValue->m_nDeviceRefCount; + LOGD("Incrementing device %d (%p), refCount = %d\n", pValue->m_nId, pValue, pValue->m_nDeviceRefCount); + return pValue; + } + + // Hold a shared pointer to the controller for the duration + pDevice = pCurr; + break; + } + } + } + if ( pDevice && pDevice->BOpen() ) + { + return pDevice->GetDevice(); + } + return NULL; +} + +int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length) +{ + LOGV( "hid_write id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->SendOutputReport( data, length ); + } + return -1; // Controller was disconnected +} + +// TODO: Implement timeout? +int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds) +{ +// LOGV( "hid_read_timeout id=%d length=%u timeout=%d", device->m_nId, length, milliseconds ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->GetInput( data, length ); + } + LOGV( "controller was disconnected" ); + return -1; // Controller was disconnected +} + +// TODO: Implement blocking +int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length) +{ + LOGV( "hid_read id=%d length=%u", device->m_nId, length ); + return hid_read_timeout( device, data, length, 0 ); +} + +// TODO: Implement? +int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock) +{ + return -1; +} + +int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length) +{ + LOGV( "hid_send_feature_report id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->SendFeatureReport( data, length ); + } + return -1; // Controller was disconnected +} + + +// Synchronous operation. Will block until completed. +int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length) +{ + LOGV( "hid_get_feature_report id=%d length=%u", device->m_nId, length ); + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + return pDevice->GetFeatureReport( data, length ); + } + return -1; // Controller was disconnected +} + + +void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device) +{ + LOGV( "hid_close id=%d", device->m_nId ); + hid_mutex_guard r( &g_DevicesRefCountMutex ); + LOGD("Decrementing device %d (%p), refCount = %d\n", device->m_nId, device, device->m_nDeviceRefCount - 1); + if ( --device->m_nDeviceRefCount == 0 ) + { + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + pDevice->Close( true ); + } + else + { + delete device; + } + LOGD("Deleted device %p\n", device); + } + +} + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->manufacturer_string, maxlen ); + return 0; + } + return -1; +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->product_string, maxlen ); + return 0; + } + return -1; +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + hid_device_ref pDevice = FindDevice( device->m_nId ); + if ( pDevice ) + { + wcsncpy( string, pDevice->GetDeviceInfo()->serial_number, maxlen ); + return 0; + } + return -1; +} + +int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen) +{ + return -1; +} + +HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device) +{ + return NULL; +} + +int hid_exit(void) +{ + return 0; +} + +} diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Android.mk b/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Android.mk new file mode 100644 index 0000000000..4462e88bf3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) + +HIDAPI_ROOT_REL:= ../.. +HIDAPI_ROOT_ABS:= $(LOCAL_PATH)/../.. + +include $(CLEAR_VARS) + +LOCAL_CPPFLAGS += -std=c++11 + +LOCAL_SRC_FILES := \ + $(HIDAPI_ROOT_REL)/android/hid.cpp + +LOCAL_MODULE := libhidapi +LOCAL_LDLIBS := -llog + +include $(BUILD_SHARED_LIBRARY) diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Application.mk b/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Application.mk new file mode 100644 index 0000000000..4fc6ba5064 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/android/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_ABI := armeabi-v7a diff --git a/3rdparty/sdl2-2.0.4/android-project/project.properties b/3rdparty/sdl2-2.0.9/src/hidapi/android/project.properties similarity index 96% rename from 3rdparty/sdl2-2.0.4/android-project/project.properties rename to 3rdparty/sdl2-2.0.9/src/hidapi/android/project.properties index 0f507e5300..6e18427a42 100644 --- a/3rdparty/sdl2-2.0.4/android-project/project.properties +++ b/3rdparty/sdl2-2.0.9/src/hidapi/android/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-12 +target=android-21 diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/bootstrap b/3rdparty/sdl2-2.0.9/src/hidapi/bootstrap new file mode 100755 index 0000000000..81e9b74b61 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/bootstrap @@ -0,0 +1,2 @@ +#!/bin/sh -x +autoreconf --install --verbose --force diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/configure.ac b/3rdparty/sdl2-2.0.9/src/hidapi/configure.ac new file mode 100644 index 0000000000..c6747f906a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/configure.ac @@ -0,0 +1,236 @@ +AC_PREREQ(2.63) + +# Version number. This is currently the only place. +m4_define([HIDAPI_MAJOR], 0) +m4_define([HIDAPI_MINOR], 8) +m4_define([HIDAPI_RELEASE], 0) +m4_define([HIDAPI_RC], -rc1) +m4_define([VERSION_STRING], HIDAPI_MAJOR[.]HIDAPI_MINOR[.]HIDAPI_RELEASE[]HIDAPI_RC) + +AC_INIT([hidapi],[VERSION_STRING],[alan@signal11.us]) + +# Library soname version +# Follow the following rules (particularly the ones in the second link): +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +# http://sourceware.org/autobook/autobook/autobook_91.html +lt_current="0" +lt_revision="0" +lt_age="0" +LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}" + +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_MACRO_DIR([m4]) + +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +LT_INIT + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_OBJC +PKG_PROG_PKG_CONFIG + + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +hidapi_lib_error() { + echo "" + echo " Library $1 was not found on this system." + echo " Please install it and re-run ./configure" + echo "" + exit 1 +} + +hidapi_prog_error() { + echo "" + echo " Program $1 was not found on this system." + echo " This program is part of $2." + echo " Please install it and re-run ./configure" + echo "" + exit 1 +} + +AC_MSG_CHECKING([operating system]) +AC_MSG_RESULT($host) +case $host in +*-linux*) + AC_MSG_RESULT([ (Linux back-end)]) + AC_DEFINE(OS_LINUX, 1, [Linux implementations]) + AC_SUBST(OS_LINUX) + backend="linux" + os="linux" + threads="pthreads" + + # HIDAPI/hidraw libs + PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev]) + LIBS_HIDRAW_PR+=" $libudev_LIBS" + CFLAGS_HIDRAW+=" $libudev_CFLAGS" + + # HIDAPI/libusb libs + AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], [hidapi_lib_error librt]) + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0]) + LIBS_LIBUSB_PRIVATE+=" $libusb_LIBS" + CFLAGS_LIBUSB+=" $libusb_CFLAGS" + ;; +*-darwin*) + AC_MSG_RESULT([ (Mac OS X back-end)]) + AC_DEFINE(OS_DARWIN, 1, [Mac implementation]) + AC_SUBST(OS_DARWIN) + backend="mac" + os="darwin" + threads="pthreads" + LIBS="${LIBS} -framework IOKit -framework CoreFoundation" + ;; +*-freebsd*) + AC_MSG_RESULT([ (FreeBSD back-end)]) + AC_DEFINE(OS_FREEBSD, 1, [FreeBSD implementation]) + AC_SUBST(OS_FREEBSD) + backend="libusb" + os="freebsd" + threads="pthreads" + + CFLAGS="$CFLAGS -I/usr/local/include" + LDFLAGS="$LDFLAGS -L/usr/local/lib" + LIBS="${LIBS}" + AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb]) + AC_CHECK_LIB([iconv], [iconv_open], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -liconv"], [hidapi_lib_error libiconv]) + echo libs_priv: $LIBS_LIBUSB_PRIVATE + ;; +*-kfreebsd*) + AC_MSG_RESULT([ (kFreeBSD back-end)]) + AC_DEFINE(OS_KFREEBSD, 1, [kFreeBSD implementation]) + AC_SUBST(OS_KFREEBSD) + backend="libusb" + os="kfreebsd" + threads="pthreads" + + AC_CHECK_LIB([usb], [libusb_init], [LIBS_LIBUSB_PRIVATE="${LIBS_LIBUSB_PRIVATE} -lusb"], [hidapi_lib_error libusb]) + echo libs_priv: $LIBS_LIBUSB_PRIVATE + ;; +*-mingw*) + AC_MSG_RESULT([ (Windows back-end, using MinGW)]) + backend="windows" + os="windows" + threads="windows" + win_implementation="mingw" + ;; +*-cygwin*) + AC_MSG_RESULT([ (Windows back-end, using Cygwin)]) + backend="windows" + os="windows" + threads="windows" + win_implementation="cygwin" + ;; +*) + AC_MSG_ERROR([HIDAPI is not supported on your operating system yet]) +esac + +LIBS_HIDRAW="${LIBS} ${LIBS_HIDRAW_PR}" +LIBS_LIBUSB="${LIBS} ${LIBS_LIBUSB_PRIVATE}" +AC_SUBST([LIBS_HIDRAW]) +AC_SUBST([LIBS_LIBUSB]) +AC_SUBST([CFLAGS_LIBUSB]) +AC_SUBST([CFLAGS_HIDRAW]) + +if test "x$os" = xwindows; then + AC_DEFINE(OS_WINDOWS, 1, [Windows implementations]) + AC_SUBST(OS_WINDOWS) + LDFLAGS="${LDFLAGS} -no-undefined" + LIBS="${LIBS} -lsetupapi" +fi + +if test "x$threads" = xpthreads; then + AX_PTHREAD([found_pthreads=yes], [found_pthreads=no]) + + if test "x$found_pthreads" = xyes; then + if test "x$os" = xlinux; then + # Only use pthreads for libusb implementation on Linux. + LIBS_LIBUSB="$PTHREAD_LIBS $LIBS_LIBUSB" + CFLAGS_LIBUSB="$CFLAGS_LIBUSB $PTHREAD_CFLAGS" + # There's no separate CC on Linux for threading, + # so it's ok that both implementations use $PTHREAD_CC + CC="$PTHREAD_CC" + else + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CC="$PTHREAD_CC" + fi + fi +fi + +# Test GUI +AC_ARG_ENABLE([testgui], + [AS_HELP_STRING([--enable-testgui], + [enable building of test GUI (default n)])], + [testgui_enabled=$enableval], + [testgui_enabled='no']) +AM_CONDITIONAL([BUILD_TESTGUI], [test "x$testgui_enabled" != "xno"]) + +# Configure the MacOS TestGUI app bundle +rm -Rf testgui/TestGUI.app +mkdir -p testgui/TestGUI.app +cp -R ${srcdir}/testgui/TestGUI.app.in/* testgui/TestGUI.app +chmod -R u+w testgui/TestGUI.app +mkdir testgui/TestGUI.app/Contents/MacOS/ + +if test "x$testgui_enabled" != "xno"; then + if test "x$os" = xdarwin; then + # On Mac OS, don't use pkg-config. + AC_CHECK_PROG([foxconfig], [fox-config], [fox-config], false) + if test "x$foxconfig" = "xfalse"; then + hidapi_prog_error fox-config "FOX Toolkit" + fi + LIBS_TESTGUI+=`$foxconfig --libs` + LIBS_TESTGUI+=" -framework Cocoa -L/usr/X11R6/lib" + CFLAGS_TESTGUI+=`$foxconfig --cflags` + OBJCFLAGS+=" -x objective-c++" + elif test "x$os" = xwindows; then + # On Windows, just set the paths for Fox toolkit + if test "x$win_implementation" = xmingw; then + CFLAGS_TESTGUI="-I\$(srcdir)/../../hidapi-externals/fox/include -g -c" + LIBS_TESTGUI=" -mwindows \$(srcdir)/../../hidapi-externals/fox/lib/libFOX-1.6.a -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32" + else + # Cygwin + CFLAGS_TESTGUI="-DWIN32 -I\$(srcdir)/../../hidapi-externals/fox/include -g -c" + LIBS_TESTGUI="\$(srcdir)/../../hidapi-externals/fox/lib/libFOX-cygwin-1.6.a -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32" + fi + else + # On Linux and FreeBSD platforms, use pkg-config to find fox. + PKG_CHECK_MODULES([fox], [fox17], [], [PKG_CHECK_MODULES([fox], [fox])]) + LIBS_TESTGUI="${LIBS_TESTGUI} $fox_LIBS" + if test "x$os" = xfreebsd; then + LIBS_TESTGUI="${LIBS_TESTGUI} -L/usr/local/lib" + fi + CFLAGS_TESTGUI="${CFLAGS_TESTGUI} $fox_CFLAGS" + fi +fi +AC_SUBST([LIBS_TESTGUI]) +AC_SUBST([CFLAGS_TESTGUI]) +AC_SUBST([backend]) + +# OS info for Automake +AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux) +AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin) +AM_CONDITIONAL(OS_FREEBSD, test "x$os" = xfreebsd) +AM_CONDITIONAL(OS_KFREEBSD, test "x$os" = xkfreebsd) +AM_CONDITIONAL(OS_WINDOWS, test "x$os" = xwindows) + +AC_CONFIG_HEADERS([config.h]) + +if test "x$os" = "xlinux"; then + AC_CONFIG_FILES([pc/hidapi-hidraw.pc]) + AC_CONFIG_FILES([pc/hidapi-libusb.pc]) +else + AC_CONFIG_FILES([pc/hidapi.pc]) +fi + +AC_SUBST(LTLDFLAGS) + +AC_CONFIG_FILES([Makefile \ + hidtest/Makefile \ + libusb/Makefile \ + linux/Makefile \ + mac/Makefile \ + testgui/Makefile \ + windows/Makefile]) +AC_OUTPUT diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/doxygen/Doxyfile b/3rdparty/sdl2-2.0.9/src/hidapi/doxygen/Doxyfile new file mode 100644 index 0000000000..9d983e9f27 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/doxygen/Doxyfile @@ -0,0 +1,1630 @@ +# Doxyfile 1.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = hidapi + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../hidapi + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans.ttf + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/hidapi/hidapi.h b/3rdparty/sdl2-2.0.9/src/hidapi/hidapi/hidapi.h new file mode 100644 index 0000000000..15d6323659 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/hidapi/hidapi.h @@ -0,0 +1,398 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 8/22/2009 + + Copyright 2009, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU General Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . +********************************************************/ + +/** @file + * @defgroup API hidapi API + */ + +#ifndef HIDAPI_H__ +#define HIDAPI_H__ + +#include + +#if defined(_WIN32) && !defined(NAMESPACE) && (0) /* SDL: don't export hidapi syms */ + #define HID_API_EXPORT __declspec(dllexport) + #define HID_API_CALL +#else + #define HID_API_EXPORT /**< API export macro */ + #define HID_API_CALL /**< API call macro */ +#endif + +#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/ + +#if defined(__cplusplus) && !defined(NAMESPACE) +extern "C" { +#endif +#ifdef NAMESPACE +namespace NAMESPACE { +#endif + + struct hid_device_; + typedef struct hid_device_ hid_device; /**< opaque hidapi structure */ + + /** hidapi info structure */ + struct hid_device_info { + /** Platform-specific device path */ + char *path; + /** Device Vendor ID */ + unsigned short vendor_id; + /** Device Product ID */ + unsigned short product_id; + /** Serial Number */ + wchar_t *serial_number; + /** Device Release Number in binary-coded decimal, + also known as Device Version Number */ + unsigned short release_number; + /** Manufacturer String */ + wchar_t *manufacturer_string; + /** Product string */ + wchar_t *product_string; + /** Usage Page for this Device/Interface + (Windows/Mac only). */ + unsigned short usage_page; + /** Usage for this Device/Interface + (Windows/Mac only).*/ + unsigned short usage; + /** The USB interface which this logical device + represents. Valid on both Linux implementations + in all cases, and valid on the Windows implementation + only if the device contains more than one interface. */ + int interface_number; + + /** Pointer to the next device */ + struct hid_device_info *next; + }; + + + /** @brief Initialize the HIDAPI library. + + This function initializes the HIDAPI library. Calling it is not + strictly necessary, as it will be called automatically by + hid_enumerate() and any of the hid_open_*() functions if it is + needed. This function should be called at the beginning of + execution however, if there is a chance of HIDAPI handles + being opened by different threads simultaneously. + + @ingroup API + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_init(void); + + /** @brief Finalize the HIDAPI library. + + This function frees all of the static data associated with + HIDAPI. It should be called at the end of execution to avoid + memory leaks. + + @ingroup API + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_exit(void); + + /** @brief Enumerate the HID Devices. + + This function returns a linked list of all the HID devices + attached to the system which match vendor_id and product_id. + If @p vendor_id is set to 0 then any vendor matches. + If @p product_id is set to 0 then any product matches. + If @p vendor_id and @p product_id are both set to 0, then + all HID devices will be returned. + + @ingroup API + @param vendor_id The Vendor ID (VID) of the types of device + to open. + @param product_id The Product ID (PID) of the types of + device to open. + + @returns + This function returns a pointer to a linked list of type + struct #hid_device, containing information about the HID devices + attached to the system, or NULL in the case of failure. Free + this linked list by calling hid_free_enumeration(). + */ + struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id); + + /** @brief Free an enumeration Linked List + + This function frees a linked list created by hid_enumerate(). + + @ingroup API + @param devs Pointer to a list of struct_device returned from + hid_enumerate(). + */ + void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs); + + /** @brief Open a HID device using a Vendor ID (VID), Product ID + (PID) and optionally a serial number. + + If @p serial_number is NULL, the first device with the + specified VID and PID is opened. + + @ingroup API + @param vendor_id The Vendor ID (VID) of the device to open. + @param product_id The Product ID (PID) of the device to open. + @param serial_number The Serial Number of the device to open + (Optionally NULL). + + @returns + This function returns a pointer to a #hid_device object on + success or NULL on failure. + */ + HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); + + /** @brief Open a HID device by its path name. + + The path name be determined by calling hid_enumerate(), or a + platform-specific path name can be used (eg: /dev/hidraw0 on + Linux). + + @ingroup API + @param path The path name of the device to open + + @returns + This function returns a pointer to a #hid_device object on + success or NULL on failure. + */ + HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive /* = false */); + + /** @brief Write an Output report to a HID device. + + The first byte of @p data[] must contain the Report ID. For + devices which only support a single report, this must be set + to 0x0. The remaining bytes contain the report data. Since + the Report ID is mandatory, calls to hid_write() will always + contain one more byte than the report contains. For example, + if a hid report is 16 bytes long, 17 bytes must be passed to + hid_write(), the Report ID (or 0x0, for devices with a + single report), followed by the report data (16 bytes). In + this example, the length passed in would be 17. + + hid_write() will send the data on the first OUT endpoint, if + one exists. If it does not, it will send the data through + the Control Endpoint (Endpoint 0). + + @ingroup API + @param device A device handle returned from hid_open(). + @param data The data to send, including the report number as + the first byte. + @param length The length in bytes of the data to send. + + @returns + This function returns the actual number of bytes written and + -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length); + + /** @brief Read an Input report from a HID device with timeout. + + Input reports are returned + to the host through the INTERRUPT IN endpoint. The first byte will + contain the Report number if the device uses numbered reports. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into. + @param length The number of bytes to read. For devices with + multiple reports, make sure to read an extra byte for + the report number. + @param milliseconds timeout in milliseconds or -1 for blocking wait. + + @returns + This function returns the actual number of bytes read and + -1 on error. If no packet was available to be read within + the timeout period, this function returns 0. + */ + int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds); + + /** @brief Read an Input report from a HID device. + + Input reports are returned + to the host through the INTERRUPT IN endpoint. The first byte will + contain the Report number if the device uses numbered reports. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into. + @param length The number of bytes to read. For devices with + multiple reports, make sure to read an extra byte for + the report number. + + @returns + This function returns the actual number of bytes read and + -1 on error. If no packet was available to be read and + the handle is in non-blocking mode, this function returns 0. + */ + int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length); + + /** @brief Set the device handle to be non-blocking. + + In non-blocking mode calls to hid_read() will return + immediately with a value of 0 if there is no data to be + read. In blocking mode, hid_read() will wait (block) until + there is data to read before returning. + + Nonblocking can be turned on and off at any time. + + @ingroup API + @param device A device handle returned from hid_open(). + @param nonblock enable or not the nonblocking reads + - 1 to enable nonblocking + - 0 to disable nonblocking. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock); + + /** @brief Send a Feature report to the device. + + Feature reports are sent over the Control endpoint as a + Set_Report transfer. The first byte of @p data[] must + contain the Report ID. For devices which only support a + single report, this must be set to 0x0. The remaining bytes + contain the report data. Since the Report ID is mandatory, + calls to hid_send_feature_report() will always contain one + more byte than the report contains. For example, if a hid + report is 16 bytes long, 17 bytes must be passed to + hid_send_feature_report(): the Report ID (or 0x0, for + devices which do not use numbered reports), followed by the + report data (16 bytes). In this example, the length passed + in would be 17. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data The data to send, including the report number as + the first byte. + @param length The length in bytes of the data to send, including + the report number. + + @returns + This function returns the actual number of bytes written and + -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length); + + /** @brief Get a feature report from a HID device. + + Set the first byte of @p data[] to the Report ID of the + report to be read. Make sure to allow space for this + extra byte in @p data[]. Upon return, the first byte will + still contain the Report ID, and the report data will + start in data[1]. + + @ingroup API + @param device A device handle returned from hid_open(). + @param data A buffer to put the read data into, including + the Report ID. Set the first byte of @p data[] to the + Report ID of the report to be read, or set it to zero + if your device does not use numbered reports. + @param length The number of bytes to read, including an + extra byte for the report ID. The buffer can be longer + than the actual report. + + @returns + This function returns the number of bytes read plus + one for the report ID (which is still in the first + byte), or -1 on error. + */ + int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length); + + /** @brief Close a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + */ + void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device); + + /** @brief Get The Manufacturer String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get The Product String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get The Serial Number String from a HID device. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen); + + /** @brief Get a string from a HID device, based on its string index. + + @ingroup API + @param device A device handle returned from hid_open(). + @param string_index The index of the string to get. + @param string A wide string buffer to put the data into. + @param maxlen The length of the buffer in multiples of wchar_t. + + @returns + This function returns 0 on success and -1 on error. + */ + int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen); + + /** @brief Get a string describing the last error which occurred. + + @ingroup API + @param device A device handle returned from hid_open(). + + @returns + This function returns a string containing the last error + which occurred or NULL if none has occurred. + */ + HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device); + +#if defined(__cplusplus) && !defined(NAMESPACE) +} +#endif +#ifdef NAMESPACE +} +#endif + +#endif + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/Makefile.am new file mode 100644 index 0000000000..d2786445a3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/Makefile.am @@ -0,0 +1,20 @@ +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ + +## Linux +if OS_LINUX +noinst_PROGRAMS = hidtest-libusb hidtest-hidraw + +hidtest_hidraw_SOURCES = hidtest.cpp +hidtest_hidraw_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la + +hidtest_libusb_SOURCES = hidtest.cpp +hidtest_libusb_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la +else + +# Other OS's +noinst_PROGRAMS = hidtest + +hidtest_SOURCES = hidtest.cpp +hidtest_LDADD = $(top_builddir)/$(backend)/libhidapi.la + +endif diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/hidtest.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/hidtest.cpp new file mode 100644 index 0000000000..94f0a5c206 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/hidtest/hidtest.cpp @@ -0,0 +1,194 @@ +/******************************************************* + Windows HID simplification + + Alan Ott + Signal 11 Software + + 8/22/2009 + + Copyright 2009 + + This contents of this file may be used by anyone + for any reason without any conditions and may be + used as a starting point for your own applications + which use HIDAPI. +********************************************************/ + +#include +#include +#include +#include +#include "hidapi.h" + +// Headers needed for sleeping. +#ifdef _WIN32 + #include +#else + #include +#endif + +int main(int argc, char* argv[]) +{ + int res; + unsigned char buf[256]; + #define MAX_STR 255 + wchar_t wstr[MAX_STR]; + hid_device *handle; + int i; + +#ifdef WIN32 + UNREFERENCED_PARAMETER(argc); + UNREFERENCED_PARAMETER(argv); +#endif + + struct hid_device_info *devs, *cur_dev; + + if (hid_init()) + return -1; + + devs = hid_enumerate(0x0, 0x0); + cur_dev = devs; + while (cur_dev) { + printf("Device Found\n type: %04hx %04hx\n path: %s\n serial_number: %ls", cur_dev->vendor_id, cur_dev->product_id, cur_dev->path, cur_dev->serial_number); + printf("\n"); + printf(" Manufacturer: %ls\n", cur_dev->manufacturer_string); + printf(" Product: %ls\n", cur_dev->product_string); + printf(" Release: %hx\n", cur_dev->release_number); + printf(" Interface: %d\n", cur_dev->interface_number); + printf("\n"); + cur_dev = cur_dev->next; + } + hid_free_enumeration(devs); + + // Set up the command buffer. + memset(buf,0x00,sizeof(buf)); + buf[0] = 0x01; + buf[1] = 0x81; + + + // Open the device using the VID, PID, + // and optionally the Serial number. + ////handle = hid_open(0x4d8, 0x3f, L"12345"); + handle = hid_open(0x4d8, 0x3f, NULL); + if (!handle) { + printf("unable to open device\n"); + return 1; + } + + // Read the Manufacturer String + wstr[0] = 0x0000; + res = hid_get_manufacturer_string(handle, wstr, MAX_STR); + if (res < 0) + printf("Unable to read manufacturer string\n"); + printf("Manufacturer String: %ls\n", wstr); + + // Read the Product String + wstr[0] = 0x0000; + res = hid_get_product_string(handle, wstr, MAX_STR); + if (res < 0) + printf("Unable to read product string\n"); + printf("Product String: %ls\n", wstr); + + // Read the Serial Number String + wstr[0] = 0x0000; + res = hid_get_serial_number_string(handle, wstr, MAX_STR); + if (res < 0) + printf("Unable to read serial number string\n"); + printf("Serial Number String: (%d) %ls", wstr[0], wstr); + printf("\n"); + + // Read Indexed String 1 + wstr[0] = 0x0000; + res = hid_get_indexed_string(handle, 1, wstr, MAX_STR); + if (res < 0) + printf("Unable to read indexed string 1\n"); + printf("Indexed String 1: %ls\n", wstr); + + // Set the hid_read() function to be non-blocking. + hid_set_nonblocking(handle, 1); + + // Try to read from the device. There shoud be no + // data here, but execution should not block. + res = hid_read(handle, buf, 17); + + // Send a Feature Report to the device + buf[0] = 0x2; + buf[1] = 0xa0; + buf[2] = 0x0a; + buf[3] = 0x00; + buf[4] = 0x00; + res = hid_send_feature_report(handle, buf, 17); + if (res < 0) { + printf("Unable to send a feature report.\n"); + } + + memset(buf,0,sizeof(buf)); + + // Read a Feature Report from the device + buf[0] = 0x2; + res = hid_get_feature_report(handle, buf, sizeof(buf)); + if (res < 0) { + printf("Unable to get a feature report.\n"); + printf("%ls", hid_error(handle)); + } + else { + // Print out the returned buffer. + printf("Feature Report\n "); + for (i = 0; i < res; i++) + printf("%02hhx ", buf[i]); + printf("\n"); + } + + memset(buf,0,sizeof(buf)); + + // Toggle LED (cmd 0x80). The first byte is the report number (0x1). + buf[0] = 0x1; + buf[1] = 0x80; + res = hid_write(handle, buf, 17); + if (res < 0) { + printf("Unable to write()\n"); + printf("Error: %ls\n", hid_error(handle)); + } + + + // Request state (cmd 0x81). The first byte is the report number (0x1). + buf[0] = 0x1; + buf[1] = 0x81; + hid_write(handle, buf, 17); + if (res < 0) + printf("Unable to write() (2)\n"); + + // Read requested state. hid_read() has been set to be + // non-blocking by the call to hid_set_nonblocking() above. + // This loop demonstrates the non-blocking nature of hid_read(). + res = 0; + while (res == 0) { + res = hid_read(handle, buf, sizeof(buf)); + if (res == 0) + printf("waiting...\n"); + if (res < 0) + printf("Unable to read()\n"); + #ifdef WIN32 + Sleep(500); + #else + usleep(500*1000); + #endif + } + + printf("Data read:\n "); + // Print out the returned buffer. + for (i = 0; i < res; i++) + printf("%02hhx ", buf[i]); + printf("\n"); + + hid_close(handle); + + /* Free static HIDAPI objects. */ + hid_exit(); + +#ifdef WIN32 + system("pause"); +#endif + + return 0; +} diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile-manual new file mode 100644 index 0000000000..939a0777ec --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile-manual @@ -0,0 +1,32 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-07-03 +########################################### + +all: hidtest + +CC=gcc +CXX=g++ +COBJS=hid.o +CPPOBJS=../hidtest/hidtest.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS+=-I../hidapi -Wall -g -c +LIBS=-framework CoreBluetooth -framework CoreFoundation + + +hidtest: $(OBJS) + g++ -Wall -g $^ $(LIBS) -o hidtest + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm -f *.o hidtest $(CPPOBJS) + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile.am new file mode 100644 index 0000000000..1f8f2cec66 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/ios/Makefile.am @@ -0,0 +1,9 @@ +lib_LTLIBRARIES = libhidapi.la +libhidapi_la_SOURCES = hid.m +libhidapi_la_LDFLAGS = $(LTLDFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ + +hdrdir = $(includedir)/hidapi +hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h + +EXTRA_DIST = Makefile-manual diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/ios/hid.m b/3rdparty/sdl2-2.0.9/src/hidapi/ios/hid.m new file mode 100644 index 0000000000..a0ca7cd022 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/ios/hid.m @@ -0,0 +1,914 @@ +//======== Copyright (c) 2017 Valve Corporation, All rights reserved. ========= +// +// Purpose: HID device abstraction temporary stub +// +//============================================================================= +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include +#include +#import +#import +#include +#include +#include +#include "../hidapi/hidapi.h" + +#define VALVE_USB_VID 0x28DE +#define D0G_BLE2_PID 0x1106 + +typedef uint32_t uint32; +typedef uint64_t uint64; + +// enables detailed NSLog logging of feature reports +#define FEATURE_REPORT_LOGGING 0 + +#define REPORT_SEGMENT_DATA_FLAG 0x80 +#define REPORT_SEGMENT_LAST_FLAG 0x40 + +#define VALVE_SERVICE @"100F6C32-1735-4313-B402-38567131E5F3" + +// (READ/NOTIFICATIONS) +#define VALVE_INPUT_CHAR @"100F6C33-1735-4313-B402-38567131E5F3" + +//  (READ/WRITE) +#define VALVE_REPORT_CHAR @"100F6C34-1735-4313-B402-38567131E5F3" + +// TODO: create CBUUID's in __attribute__((constructor)) rather than doing [CBUUID UUIDWithString:...] everywhere + +#pragma pack(push,1) + +typedef struct +{ + uint8_t segmentHeader; + uint8_t featureReportMessageID; + uint8_t length; + uint8_t settingIdentifier; + union { + uint16_t usPayload; + uint32_t uPayload; + uint64_t ulPayload; + uint8_t ucPayload[15]; + }; +} bluetoothSegment; + +typedef struct { + uint8_t id; + union { + bluetoothSegment segment; + struct { + uint8_t segmentHeader; + uint8_t featureReportMessageID; + uint8_t length; + uint8_t settingIdentifier; + union { + uint16_t usPayload; + uint32_t uPayload; + uint64_t ulPayload; + uint8_t ucPayload[15]; + }; + }; + }; +} hidFeatureReport; + +#pragma pack(pop) + +size_t GetBluetoothSegmentSize(bluetoothSegment *segment) +{ + return segment->length + 3; +} + +#define RingBuffer_cbElem 19 +#define RingBuffer_nElem 4096 + +typedef struct { + int _first, _last; + uint8_t _data[ ( RingBuffer_nElem * RingBuffer_cbElem ) ]; + pthread_mutex_t accessLock; +} RingBuffer; + +static void RingBuffer_init( RingBuffer *this ) +{ + this->_first = -1; + this->_last = 0; + pthread_mutex_init( &this->accessLock, 0 ); +} + +static bool RingBuffer_write( RingBuffer *this, const uint8_t *src ) +{ + pthread_mutex_lock( &this->accessLock ); + memcpy( &this->_data[ this->_last ], src, RingBuffer_cbElem ); + if ( this->_first == -1 ) + { + this->_first = this->_last; + } + this->_last = ( this->_last + RingBuffer_cbElem ) % (RingBuffer_nElem * RingBuffer_cbElem); + if ( this->_last == this->_first ) + { + this->_first = ( this->_first + RingBuffer_cbElem ) % (RingBuffer_nElem * RingBuffer_cbElem); + pthread_mutex_unlock( &this->accessLock ); + return false; + } + pthread_mutex_unlock( &this->accessLock ); + return true; +} + +static bool RingBuffer_read( RingBuffer *this, uint8_t *dst ) +{ + pthread_mutex_lock( &this->accessLock ); + if ( this->_first == -1 ) + { + pthread_mutex_unlock( &this->accessLock ); + return false; + } + memcpy( dst, &this->_data[ this->_first ], RingBuffer_cbElem ); + this->_first = ( this->_first + RingBuffer_cbElem ) % (RingBuffer_nElem * RingBuffer_cbElem); + if ( this->_first == this->_last ) + { + this->_first = -1; + } + pthread_mutex_unlock( &this->accessLock ); + return true; +} + + +#pragma mark HIDBLEDevice Definition + +typedef enum +{ + BLEDeviceWaitState_None, + BLEDeviceWaitState_Waiting, + BLEDeviceWaitState_Complete, + BLEDeviceWaitState_Error +} BLEDeviceWaitState; + +@interface HIDBLEDevice : NSObject +{ + RingBuffer _inputReports; + uint8_t _featureReport[20]; + BLEDeviceWaitState _waitStateForReadFeatureReport; + BLEDeviceWaitState _waitStateForWriteFeatureReport; +} + +@property (nonatomic, readwrite) bool connected; +@property (nonatomic, readwrite) bool ready; + +@property (nonatomic, strong) CBPeripheral *bleSteamController; +@property (nonatomic, strong) CBCharacteristic *bleCharacteristicInput; +@property (nonatomic, strong) CBCharacteristic *bleCharacteristicReport; + +- (id)initWithPeripheral:(CBPeripheral *)peripheral; + +@end + + +@interface HIDBLEManager : NSObject + +@property (nonatomic) int nPendingScans; +@property (nonatomic) int nPendingPairs; +@property (nonatomic, strong) CBCentralManager *centralManager; +@property (nonatomic, strong) NSMapTable *deviceMap; +@property (nonatomic, retain) dispatch_queue_t bleSerialQueue; + ++ (instancetype)sharedInstance; +- (void)startScan:(int)duration; +- (void)stopScan; +- (int)updateConnectedSteamControllers:(BOOL) bForce; +- (void)appWillResignActiveNotification:(NSNotification *)note; +- (void)appDidBecomeActiveNotification:(NSNotification *)note; + +@end + + +// singleton class - access using HIDBLEManager.sharedInstance +@implementation HIDBLEManager + ++ (instancetype)sharedInstance +{ + static HIDBLEManager *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [HIDBLEManager new]; + sharedInstance.nPendingScans = 0; + sharedInstance.nPendingPairs = 0; + + [[NSNotificationCenter defaultCenter] addObserver:sharedInstance selector:@selector(appWillResignActiveNotification:) name: UIApplicationWillResignActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:sharedInstance selector:@selector(appDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil]; + + // receive reports on a high-priority serial-queue. optionally put writes on the serial queue to avoid logical + // race conditions talking to the controller from multiple threads, although BLE fragmentation/assembly means + // that we can still screw this up. + // most importantly we need to consume reports at a high priority to avoid the OS thinking we aren't really + // listening to the BLE device, as iOS on slower devices may stop delivery of packets to the app WITHOUT ACTUALLY + // DISCONNECTING FROM THE DEVICE if we don't react quickly enough to their delivery. + // see also the error-handling states in the peripheral delegate to re-open the device if it gets closed + sharedInstance.bleSerialQueue = dispatch_queue_create( "com.valvesoftware.steamcontroller.ble", DISPATCH_QUEUE_SERIAL ); + dispatch_set_target_queue( sharedInstance.bleSerialQueue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0 ) ); + + // creating a CBCentralManager will always trigger a future centralManagerDidUpdateState: + // where any scanning gets started or connecting to existing peripherals happens, it's never already in a + // powered-on state for a newly launched application. + sharedInstance.centralManager = [[CBCentralManager alloc] initWithDelegate:sharedInstance queue:sharedInstance.bleSerialQueue]; + sharedInstance.deviceMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableWeakMemory valueOptions:NSMapTableStrongMemory capacity:4]; + }); + return sharedInstance; +} + +// called for NSNotification UIApplicationWillResignActiveNotification +- (void)appWillResignActiveNotification:(NSNotification *)note +{ + // we'll get resign-active notification if pairing is happening. + if ( self.nPendingPairs > 0 ) + return; + + for ( CBPeripheral *peripheral in self.deviceMap ) + { + HIDBLEDevice *steamController = [self.deviceMap objectForKey:peripheral]; + if ( steamController ) + { + steamController.connected = NO; + steamController.ready = NO; + [self.centralManager cancelPeripheralConnection:peripheral]; + } + } + [self.deviceMap removeAllObjects]; +} + +// called for NSNotification UIApplicationDidBecomeActiveNotification +// whenever the application comes back from being inactive, trigger a 20s pairing scan and reconnect +// any devices that may have paired while we were inactive. +- (void)appDidBecomeActiveNotification:(NSNotification *)note +{ + [self updateConnectedSteamControllers:true]; + [self startScan:20]; +} + +- (int)updateConnectedSteamControllers:(BOOL) bForce +{ + static uint64_t s_unLastUpdateTick = 0; + static mach_timebase_info_data_t s_timebase_info; + + if (s_timebase_info.denom == 0) + { + mach_timebase_info( &s_timebase_info ); + } + + uint64_t ticksNow = mach_approximate_time(); + if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) ) + return (int)self.deviceMap.count; + + // we can see previously connected BLE peripherals but can't connect until the CBCentralManager + // is fully powered up - only do work when we are in that state + if ( self.centralManager.state != CBManagerStatePoweredOn ) + return (int)self.deviceMap.count; + + // only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up + s_unLastUpdateTick = mach_approximate_time(); + + // if a pair is in-flight, the central manager may still give it back via retrieveConnected... and + // cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established + if ( self.nPendingPairs > 0 ) + return (int)self.deviceMap.count; + + NSArray *peripherals = [self.centralManager retrieveConnectedPeripheralsWithServices: @[ [CBUUID UUIDWithString:@"180A"]]]; + for ( CBPeripheral *peripheral in peripherals ) + { + // we already know this peripheral + if ( [self.deviceMap objectForKey: peripheral] != nil ) + continue; + + NSLog( @"connected peripheral: %@", peripheral ); + if ( [peripheral.name isEqualToString:@"SteamController"] ) + { + HIDBLEDevice *steamController = [[HIDBLEDevice alloc] initWithPeripheral:peripheral]; + [self.deviceMap setObject:steamController forKey:peripheral]; + [self.centralManager connectPeripheral:peripheral options:nil]; + } + } + + return (int)self.deviceMap.count; +} + +// manual API for folks to start & stop scanning +- (void)startScan:(int)duration +{ + NSLog( @"BLE: requesting scan for %d seconds", duration ); + @synchronized (self) + { + if ( _nPendingScans++ == 0 ) + { + [self.centralManager scanForPeripheralsWithServices:nil options:nil]; + } + } + + if ( duration != 0 ) + { + dispatch_after( dispatch_time( DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self stopScan]; + }); + } +} + +- (void)stopScan +{ + NSLog( @"BLE: stopping scan" ); + @synchronized (self) + { + if ( --_nPendingScans <= 0 ) + { + _nPendingScans = 0; + [self.centralManager stopScan]; + } + } +} + + +#pragma mark CBCentralManagerDelegate Implementation + +// called whenever the BLE hardware state changes. +- (void)centralManagerDidUpdateState:(CBCentralManager *)central +{ + switch ( central.state ) + { + case CBCentralManagerStatePoweredOn: + { + NSLog( @"CoreBluetooth BLE hardware is powered on and ready" ); + + // at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices, + // otherwise callers should occaisionally do additional scans. we don't want to continuously be + // scanning because it drains battery, causes other nearby people to have a hard time pairing their + // Steam Controllers, and may also trigger firmware weirdness when a device attempts to start + // the pairing sequence multiple times concurrently + if ( [self updateConnectedSteamControllers:false] == 0 ) + { + // TODO: we could limit our scan to only peripherals supporting the SteamController service, but + // that service doesn't currently fit in the base advertising packet, we'd need to put it into an + // extended scan packet. Useful optimization downstream, but not currently necessary + // NSArray *services = @[[CBUUID UUIDWithString:VALVE_SERVICE]]; + [self startScan:20]; + } + break; + } + + case CBCentralManagerStatePoweredOff: + NSLog( @"CoreBluetooth BLE hardware is powered off" ); + break; + + case CBCentralManagerStateUnauthorized: + NSLog( @"CoreBluetooth BLE state is unauthorized" ); + break; + + case CBCentralManagerStateUnknown: + NSLog( @"CoreBluetooth BLE state is unknown" ); + break; + + case CBCentralManagerStateUnsupported: + NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" ); + break; + + case CBCentralManagerStateResetting: + NSLog( @"CoreBluetooth BLE manager is resetting" ); + break; + } +} + +- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral +{ + HIDBLEDevice *steamController = [_deviceMap objectForKey:peripheral]; + steamController.connected = YES; + self.nPendingPairs -= 1; +} + +- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error +{ + NSLog( @"Failed to connect: %@", error ); + [_deviceMap removeObjectForKey:peripheral]; + self.nPendingPairs -= 1; +} + +- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI +{ + NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey]; + NSString *log = [NSString stringWithFormat:@"Found '%@'", localName]; + + if ( [localName isEqualToString:@"SteamController"] ) + { + NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData ); + self.nPendingPairs += 1; + HIDBLEDevice *steamController = [[HIDBLEDevice alloc] initWithPeripheral:peripheral]; + [self.deviceMap setObject:steamController forKey:peripheral]; + [self.centralManager connectPeripheral:peripheral options:nil]; + } +} + +- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error +{ + HIDBLEDevice *steamController = [self.deviceMap objectForKey:peripheral]; + if ( steamController ) + { + steamController.connected = NO; + steamController.ready = NO; + [self.deviceMap removeObjectForKey:peripheral]; + } +} + +@end + + +// Core Bluetooth devices calling back on event boundaries of their run-loops. so annoying. +static void process_pending_events() +{ + CFRunLoopRunResult res; + do + { + res = CFRunLoopRunInMode( kCFRunLoopDefaultMode, 0.001, FALSE ); + } + while( res != kCFRunLoopRunFinished && res != kCFRunLoopRunTimedOut ); +} + +@implementation HIDBLEDevice + +- (id)init +{ + if ( self = [super init] ) + { + RingBuffer_init( &_inputReports ); + self.bleSteamController = nil; + self.bleCharacteristicInput = nil; + self.bleCharacteristicReport = nil; + _connected = NO; + _ready = NO; + } + return self; +} + +- (id)initWithPeripheral:(CBPeripheral *)peripheral +{ + if ( self = [super init] ) + { + RingBuffer_init( &_inputReports ); + _connected = NO; + _ready = NO; + self.bleSteamController = peripheral; + if ( peripheral ) + { + peripheral.delegate = self; + } + self.bleCharacteristicInput = nil; + self.bleCharacteristicReport = nil; + } + return self; +} + +- (void)setConnected:(bool)connected +{ + _connected = connected; + if ( _connected ) + { + [_bleSteamController discoverServices:nil]; + } + else + { + NSLog( @"Disconnected" ); + } +} + +- (size_t)read_input_report:(uint8_t *)dst +{ + if ( RingBuffer_read( &_inputReports, dst+1 ) ) + { + *dst = 0x03; + return 20; + } + return 0; +} + +- (int)send_report:(const uint8_t *)data length:(size_t)length +{ + [_bleSteamController writeValue:[NSData dataWithBytes:data length:length] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; + return (int)length; +} + +- (int)send_feature_report:(hidFeatureReport *)report +{ +#if FEATURE_REPORT_LOGGING + uint8_t *reportBytes = (uint8_t *)report; + + NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ), + reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6], + reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12], + reportBytes[13], reportBytes[14], reportBytes[15], reportBytes[16], reportBytes[17], reportBytes[18], + reportBytes[19] ); +#endif + + int sendSize = (int)GetBluetoothSegmentSize( &report->segment ); + if ( sendSize > 20 ) + sendSize = 20; + +#if 1 + // fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored, + // except errors. + [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; + + // pretend we received a result anybody cares about + return 19; + +#else + // this is technically the correct send_feature_report logic if you want to make sure it gets through and is + // acknowledged or errors out + _waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting; + [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize + ] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; + + while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting ) + { + process_pending_events(); + } + + if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error ) + { + _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; + return -1; + } + + _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; + return 19; +#endif +} + +- (int)get_feature_report:(uint8_t)feature into:(uint8_t *)buffer +{ + _waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting; + [_bleSteamController readValueForCharacteristic:_bleCharacteristicReport]; + + while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting ) + process_pending_events(); + + if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error ) + { + _waitStateForReadFeatureReport = BLEDeviceWaitState_None; + return -1; + } + + memcpy( buffer, _featureReport, sizeof(_featureReport) ); + + _waitStateForReadFeatureReport = BLEDeviceWaitState_None; + +#if FEATURE_REPORT_LOGGING + NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", + buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], + buffer[7], buffer[8], buffer[9], buffer[10], buffer[11], buffer[12], + buffer[13], buffer[14], buffer[15], buffer[16], buffer[17], buffer[18], + buffer[19] ); +#endif + + return 19; +} + +#pragma mark CBPeripheralDelegate Implementation + +- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error +{ + for (CBService *service in peripheral.services) + { + NSLog( @"Found Service: %@", service ); + if ( [service.UUID isEqual:[CBUUID UUIDWithString:VALVE_SERVICE]] ) + { + [peripheral discoverCharacteristics:nil forService:service]; + } + } +} + +- (void)peripheral:(CBPeripheral *)peripheral didDiscoverDescriptorsForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + // nothing yet needed here, enable for logging + if ( /* DISABLES CODE */ (0) ) + { + for ( CBDescriptor *descriptor in characteristic.descriptors ) + { + NSLog( @" - Descriptor '%@'", descriptor ); + } + } +} + +- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error +{ + if ([service.UUID isEqual:[CBUUID UUIDWithString:VALVE_SERVICE]]) + { + for (CBCharacteristic *aChar in service.characteristics) + { + NSLog( @"Found Characteristic %@", aChar ); + + if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] ) + { + self.bleCharacteristicInput = aChar; + } + else if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_REPORT_CHAR]] ) + { + self.bleCharacteristicReport = aChar; + [self.bleSteamController discoverDescriptorsForCharacteristic: aChar]; + } + } + } +} + +- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + static uint64_t s_ticksLastOverflowReport = 0; + + // receiving an input report is the final indicator that the user accepted a pairing + // request and that we successfully established notification. CoreBluetooth has no + // notification of the pairing acknowledgement, which is a bad oversight. + if ( self.ready == NO ) + { + self.ready = YES; + HIDBLEManager.sharedInstance.nPendingPairs -= 1; + } + + if ( [characteristic.UUID isEqual:_bleCharacteristicInput.UUID] ) + { + NSData *data = [characteristic value]; + if ( data.length != 19 ) + { + NSLog( @"HIDBLE: incoming data is %lu bytes should be exactly 19", (unsigned long)data.length ); + } + if ( !RingBuffer_write( &_inputReports, (const uint8_t *)data.bytes ) ) + { + uint64_t ticksNow = mach_approximate_time(); + if ( ticksNow - s_ticksLastOverflowReport > (5ull * NSEC_PER_SEC / 10) ) + { + NSLog( @"HIDBLE: input report buffer overflow" ); + s_ticksLastOverflowReport = ticksNow; + } + } + } + else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] ) + { + memset( _featureReport, 0, sizeof(_featureReport) ); + + if ( error != nil ) + { + NSLog( @"HIDBLE: get_feature_report error: %@", error ); + _waitStateForReadFeatureReport = BLEDeviceWaitState_Error; + } + else + { + NSData *data = [characteristic value]; + if ( data.length != 20 ) + { + NSLog( @"HIDBLE: incoming data is %lu bytes should be exactly 20", (unsigned long)data.length ); + } + memcpy( _featureReport, data.bytes, MIN( data.length, sizeof(_featureReport) ) ); + _waitStateForReadFeatureReport = BLEDeviceWaitState_Complete; + } + } +} + +- (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + if ( [characteristic.UUID isEqual:[CBUUID UUIDWithString:VALVE_REPORT_CHAR]] ) + { + if ( error != nil ) + { + NSLog( @"HIDBLE: write_feature_report error: %@", error ); + _waitStateForWriteFeatureReport = BLEDeviceWaitState_Error; + } + else + { + _waitStateForWriteFeatureReport = BLEDeviceWaitState_Complete; + } + } +} + +- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + NSLog( @"didUpdateNotifcationStateForCharacteristic %@ (%@)", characteristic, error ); +} + +@end + + +#pragma mark hid_api implementation + +struct hid_device_ { + void *device_handle; + int blocking; + hid_device *next; +}; + +int HID_API_EXPORT HID_API_CALL hid_init(void) +{ + return ( HIDBLEManager.sharedInstance == nil ) ? -1 : 0; +} + +int HID_API_EXPORT HID_API_CALL hid_exit(void) +{ + return 0; +} + +void HID_API_EXPORT HID_API_CALL hid_ble_scan( bool bStart ) +{ + HIDBLEManager *bleManager = HIDBLEManager.sharedInstance; + if ( bStart ) + { + [bleManager startScan:0]; + } + else + { + [bleManager stopScan]; + } +} + +hid_device * HID_API_EXPORT hid_open_path( const char *path, int bExclusive /* = false */ ) +{ + hid_device *result = NULL; + NSString *nssPath = [NSString stringWithUTF8String:path]; + HIDBLEManager *bleManager = HIDBLEManager.sharedInstance; + NSEnumerator *devices = [bleManager.deviceMap objectEnumerator]; + + for ( HIDBLEDevice *device in devices ) + { + // we have the device but it hasn't found its service or characteristics until it is connected + if ( !device.ready || !device.connected || !device.bleCharacteristicInput ) + continue; + + if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] ) + { + result = (hid_device *)malloc( sizeof( hid_device ) ); + memset( result, 0, sizeof( hid_device ) ); + result->device_handle = (void*)CFBridgingRetain( device ); + result->blocking = NO; + // enable reporting input events on the characteristic + [device.bleSteamController setNotifyValue:YES forCharacteristic:device.bleCharacteristicInput]; + return result; + } + } + return result; +} + +void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) +{ + /* This function is identical to the Linux version. Platform independent. */ + struct hid_device_info *d = devs; + while (d) { + struct hid_device_info *next = d->next; + free(d->path); + free(d->serial_number); + free(d->manufacturer_string); + free(d->product_string); + free(d); + d = next; + } +} + +int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) +{ + /* All Nonblocking operation is handled by the library. */ + dev->blocking = !nonblock; + + return 0; +} + +struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ @autoreleasepool { + struct hid_device_info *root = NULL; + + if ( ( vendor_id == 0 && product_id == 0 ) || + ( vendor_id == VALVE_USB_VID && product_id == D0G_BLE2_PID ) ) + { + HIDBLEManager *bleManager = HIDBLEManager.sharedInstance; + [bleManager updateConnectedSteamControllers:false]; + NSEnumerator *devices = [bleManager.deviceMap objectEnumerator]; + for ( HIDBLEDevice *device in devices ) + { + // there are several brief windows in connecting to an already paired device and + // one long window waiting for users to confirm pairing where we don't want + // to consider a device ready - if we hand it back to SDL or another + // Steam Controller consumer, their additional SC setup work will fail + // in unusual/silent ways and we can actually corrupt the BLE stack for + // the entire system and kill the appletv remote's Menu button (!) + if ( device.bleSteamController.state != CBPeripheralStateConnected || + device.connected == NO || device.ready == NO ) + { + if ( device.ready == NO && device.bleCharacteristicInput != nil ) + { + // attempt to register for input reports. this call will silently fail + // until the pairing finalizes with user acceptance. oh, apple. + [device.bleSteamController setNotifyValue:YES forCharacteristic:device.bleCharacteristicInput]; + } + continue; + } + struct hid_device_info *device_info = (struct hid_device_info *)malloc( sizeof(struct hid_device_info) ); + memset( device_info, 0, sizeof(struct hid_device_info) ); + device_info->next = root; + root = device_info; + device_info->path = strdup( device.bleSteamController.identifier.UUIDString.UTF8String ); + device_info->vendor_id = VALVE_USB_VID; + device_info->product_id = D0G_BLE2_PID; + device_info->product_string = wcsdup( L"Steam Controller" ); + device_info->manufacturer_string = wcsdup( L"Valve Corporation" ); + } + } + return root; +}} + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + static wchar_t s_wszManufacturer[] = L"Valve Corporation"; + wcsncpy( string, s_wszManufacturer, sizeof(s_wszManufacturer)/sizeof(s_wszManufacturer[0]) ); + return 0; +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + static wchar_t s_wszProduct[] = L"Steam Controller"; + wcsncpy( string, s_wszProduct, sizeof(s_wszProduct)/sizeof(s_wszProduct[0]) ); + return 0; +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + static wchar_t s_wszSerial[] = L"12345"; + wcsncpy( string, s_wszSerial, sizeof(s_wszSerial)/sizeof(s_wszSerial[0]) ); + return 0; +} + +int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) +{ + HIDBLEDevice *device_handle = (__bridge HIDBLEDevice *)dev->device_handle; + + if ( !device_handle.connected ) + return -1; + + return [device_handle send_report:data length:length]; +} + +void HID_API_EXPORT hid_close(hid_device *dev) +{ + HIDBLEDevice *device_handle = CFBridgingRelease( dev->device_handle ); + + // disable reporting input events on the characteristic + if ( device_handle.connected ) { + [device_handle.bleSteamController setNotifyValue:NO forCharacteristic:device_handle.bleCharacteristicInput]; + } + + free( dev ); +} + +int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) +{ + HIDBLEDevice *device_handle = (__bridge HIDBLEDevice *)dev->device_handle; + + if ( !device_handle.connected ) + return -1; + + return [device_handle send_feature_report:(hidFeatureReport *)(void *)data]; +} + +int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) +{ + HIDBLEDevice *device_handle = (__bridge HIDBLEDevice *)dev->device_handle; + + if ( !device_handle.connected ) + return -1; + + size_t written = [device_handle get_feature_report:data[0] into:data]; + + return written == length-1 ? (int)length : (int)written; +} + +int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) +{ + HIDBLEDevice *device_handle = (__bridge HIDBLEDevice *)dev->device_handle; + + if ( !device_handle.connected ) + return -1; + + return hid_read_timeout(dev, data, length, 0); +} + +int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) +{ + HIDBLEDevice *device_handle = (__bridge HIDBLEDevice *)dev->device_handle; + + if ( !device_handle.connected ) + return -1; + + if ( milliseconds != 0 ) + { + NSLog( @"hid_read_timeout with non-zero wait" ); + } + int result = (int)[device_handle read_input_report:data]; +#if FEATURE_REPORT_LOGGING + NSLog( @"HIDBLE:hid_read_timeout (%d) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", result, + data[1], data[2], data[3], data[4], data[5], data[6], + data[7], data[8], data[9], data[10], data[11], data[12], + data[13], data[14], data[15], data[16], data[17], data[18], + data[19] ); +#endif + return result; +} + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile-manual new file mode 100644 index 0000000000..c0fe86800d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile-manual @@ -0,0 +1,18 @@ + + +OS=$(shell uname) + +ifeq ($(OS), Linux) + FILE=Makefile.linux +endif + +ifeq ($(OS), FreeBSD) + FILE=Makefile.freebsd +endif + +ifeq ($(FILE), ) +all: + $(error Your platform ${OS} is not supported by hidapi/libusb at this time.) +endif + +include $(FILE) diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.am new file mode 100644 index 0000000000..13c9d35517 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.am @@ -0,0 +1,27 @@ +AM_CPPFLAGS = -I$(top_srcdir)/hidapi $(CFLAGS_LIBUSB) + +if OS_LINUX +lib_LTLIBRARIES = libhidapi-libusb.la +libhidapi_libusb_la_SOURCES = hid.c +libhidapi_libusb_la_LDFLAGS = $(LTLDFLAGS) $(PTHREAD_CFLAGS) +libhidapi_libusb_la_LIBADD = $(LIBS_LIBUSB) +endif + +if OS_FREEBSD +lib_LTLIBRARIES = libhidapi.la +libhidapi_la_SOURCES = hid.c +libhidapi_la_LDFLAGS = $(LTLDFLAGS) +libhidapi_la_LIBADD = $(LIBS_LIBUSB) +endif + +if OS_KFREEBSD +lib_LTLIBRARIES = libhidapi.la +libhidapi_la_SOURCES = hid.c +libhidapi_la_LDFLAGS = $(LTLDFLAGS) +libhidapi_la_LIBADD = $(LIBS_LIBUSB) +endif + +hdrdir = $(includedir)/hidapi +hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h + +EXTRA_DIST = Makefile-manual diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.freebsd b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.freebsd new file mode 100644 index 0000000000..5e69e77d4e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.freebsd @@ -0,0 +1,46 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: hidtest libs + +libs: libhidapi.so + +CC ?= cc +CFLAGS ?= -Wall -g -fPIC + +CXX ?= c++ +CXXFLAGS ?= -Wall -g + +COBJS = hid.o +CPPOBJS = ../hidtest/hidtest.o +OBJS = $(COBJS) $(CPPOBJS) +INCLUDES = -I../hidapi -I/usr/local/include +LDFLAGS = -L/usr/local/lib +LIBS = -lusb -liconv -pthread + + +# Console Test Program +hidtest: $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) + +# Shared Libs +libhidapi.so: $(COBJS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS) + +# Objects +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@ + + +clean: + rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o + +.PHONY: clean libs diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.linux b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.linux new file mode 100644 index 0000000000..337b556e1c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/Makefile.linux @@ -0,0 +1,49 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: hidtest-libusb libs + +libs: libhidapi-libusb.so + +CC ?= gcc +CFLAGS ?= -Wall -g -fpic + +CXX ?= g++ +CXXFLAGS ?= -Wall -g -fpic + +LDFLAGS ?= -Wall -g + +COBJS_LIBUSB = hid.o +COBJS = $(COBJS_LIBUSB) +CPPOBJS = ../hidtest/hidtest.o +OBJS = $(COBJS) $(CPPOBJS) +LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread +LIBS = $(LIBS_USB) +INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags` + + +# Console Test Program +hidtest-libusb: $(COBJS_LIBUSB) $(CPPOBJS) + $(CXX) $(LDFLAGS) $^ $(LIBS_USB) -o $@ + +# Shared Libs +libhidapi-libusb.so: $(COBJS_LIBUSB) + $(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@ + +# Objects +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@ + + +clean: + rm -f $(OBJS) hidtest-libusb libhidapi-libusb.so ../hidtest/hidtest.o + +.PHONY: clean libs diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hid.c b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hid.c new file mode 100644 index 0000000000..17378fff4a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hid.c @@ -0,0 +1,1620 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 8/22/2009 + Linux Version - 6/2/2010 + Libusb Version - 8/13/2010 + FreeBSD Version - 11/1/2011 + + Copyright 2009, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU General Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . +********************************************************/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */ +#endif + +/* C */ +#include +#include +#include +#include +#include +#include + +/* Unix */ +#include +#include +#include +#include +#include +#include +#include +#include + +/* GNU / LibUSB */ +#include +#ifndef __ANDROID__ +#include +#endif + +#include "hidapi.h" + +#ifdef NAMESPACE +namespace NAMESPACE +{ +#endif + +#ifdef __ANDROID__ + +/* Barrier implementation because Android/Bionic don't have pthread_barrier. + This implementation came from Brent Priddy and was posted on + StackOverflow. It is used with his permission. */ +typedef int pthread_barrierattr_t; +typedef struct pthread_barrier { + pthread_mutex_t mutex; + pthread_cond_t cond; + int count; + int trip_count; +} pthread_barrier_t; + +static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) +{ + if(count == 0) { + errno = EINVAL; + return -1; + } + + if(pthread_mutex_init(&barrier->mutex, 0) < 0) { + return -1; + } + if(pthread_cond_init(&barrier->cond, 0) < 0) { + pthread_mutex_destroy(&barrier->mutex); + return -1; + } + barrier->trip_count = count; + barrier->count = 0; + + return 0; +} + +static int pthread_barrier_destroy(pthread_barrier_t *barrier) +{ + pthread_cond_destroy(&barrier->cond); + pthread_mutex_destroy(&barrier->mutex); + return 0; +} + +static int pthread_barrier_wait(pthread_barrier_t *barrier) +{ + pthread_mutex_lock(&barrier->mutex); + ++(barrier->count); + if(barrier->count >= barrier->trip_count) + { + barrier->count = 0; + pthread_cond_broadcast(&barrier->cond); + pthread_mutex_unlock(&barrier->mutex); + return 1; + } + else + { + pthread_cond_wait(&barrier->cond, &(barrier->mutex)); + pthread_mutex_unlock(&barrier->mutex); + return 0; + } +} + +#endif + +#if defined(__cplusplus) && !defined(NAMESPACE) +extern "C" { +#endif + +#ifdef DEBUG_PRINTF +#define LOG(...) fprintf(stderr, __VA_ARGS__) +#else +#define LOG(...) do {} while (0) +#endif + +#ifndef __FreeBSD__ +#define DETACH_KERNEL_DRIVER +#endif + +/* Uncomment to enable the retrieval of Usage and Usage Page in +hid_enumerate(). Warning, on platforms different from FreeBSD +this is very invasive as it requires the detach +and re-attach of the kernel driver. See comments inside hid_enumerate(). +libusb HIDAPI programs are encouraged to use the interface number +instead to differentiate between interfaces on a composite HID device. */ +/*#define INVASIVE_GET_USAGE*/ + +/* Linked List of input reports received from the device. */ +struct input_report { + uint8_t *data; + size_t len; + struct input_report *next; +}; + + +struct hid_device_ { + /* Handle to the actual device. */ + libusb_device_handle *device_handle; + + /* Endpoint information */ + int input_endpoint; + int output_endpoint; + int input_ep_max_packet_size; + + /* The interface number of the HID */ + int interface; + + /* Indexes of Strings */ + int manufacturer_index; + int product_index; + int serial_index; + + /* Whether blocking reads are used */ + int blocking; /* boolean */ + + /* Read thread objects */ + pthread_t thread; + pthread_mutex_t mutex; /* Protects input_reports */ + pthread_cond_t condition; + pthread_barrier_t barrier; /* Ensures correct startup sequence */ + int shutdown_thread; + int cancelled; + struct libusb_transfer *transfer; + + /* List of received input reports. */ + struct input_report *input_reports; +}; + +static libusb_context *usb_context = NULL; + +uint16_t get_usb_code_for_current_locale(void); +static int return_data(hid_device *dev, unsigned char *data, size_t length); + +static hid_device *new_hid_device(void) +{ + hid_device *dev = (hid_device *)calloc(1, sizeof(hid_device)); + dev->blocking = 1; + + pthread_mutex_init(&dev->mutex, NULL); + pthread_cond_init(&dev->condition, NULL); + pthread_barrier_init(&dev->barrier, NULL, 2); + + return dev; +} + +static void free_hid_device(hid_device *dev) +{ + /* Clean up the thread objects */ + pthread_barrier_destroy(&dev->barrier); + pthread_cond_destroy(&dev->condition); + pthread_mutex_destroy(&dev->mutex); + + /* Free the device itself */ + free(dev); +} + +#if 0 +/*TODO: Implement this funciton on hidapi/libusb.. */ +static void register_error(hid_device *device, const char *op) +{ + +} +#endif + +#ifdef INVASIVE_GET_USAGE +/* Get bytes from a HID Report Descriptor. + Only call with a num_bytes of 0, 1, 2, or 4. */ +static uint32_t get_bytes(uint8_t *rpt, size_t len, size_t num_bytes, size_t cur) +{ + /* Return if there aren't enough bytes. */ + if (cur + num_bytes >= len) + return 0; + + if (num_bytes == 0) + return 0; + else if (num_bytes == 1) { + return rpt[cur+1]; + } + else if (num_bytes == 2) { + return (rpt[cur+2] * 256 + rpt[cur+1]); + } + else if (num_bytes == 4) { + return (rpt[cur+4] * 0x01000000 + + rpt[cur+3] * 0x00010000 + + rpt[cur+2] * 0x00000100 + + rpt[cur+1] * 0x00000001); + } + else + return 0; +} + +/* Retrieves the device's Usage Page and Usage from the report + descriptor. The algorithm is simple, as it just returns the first + Usage and Usage Page that it finds in the descriptor. + The return value is 0 on success and -1 on failure. */ +static int get_usage(uint8_t *report_descriptor, size_t size, + unsigned short *usage_page, unsigned short *usage) +{ + unsigned int i = 0; + int size_code; + int data_len, key_size; + int usage_found = 0, usage_page_found = 0; + + while (i < size) { + int key = report_descriptor[i]; + int key_cmd = key & 0xfc; + + //printf("key: %02hhx\n", key); + + if ((key & 0xf0) == 0xf0) { + /* This is a Long Item. The next byte contains the + length of the data section (value) for this key. + See the HID specification, version 1.11, section + 6.2.2.3, titled "Long Items." */ + if (i+1 < size) + data_len = report_descriptor[i+1]; + else + data_len = 0; /* malformed report */ + key_size = 3; + } + else { + /* This is a Short Item. The bottom two bits of the + key contain the size code for the data section + (value) for this key. Refer to the HID + specification, version 1.11, section 6.2.2.2, + titled "Short Items." */ + size_code = key & 0x3; + switch (size_code) { + case 0: + case 1: + case 2: + data_len = size_code; + break; + case 3: + data_len = 4; + break; + default: + /* Can't ever happen since size_code is & 0x3 */ + data_len = 0; + break; + }; + key_size = 1; + } + + if (key_cmd == 0x4) { + *usage_page = get_bytes(report_descriptor, size, data_len, i); + usage_page_found = 1; + //printf("Usage Page: %x\n", (uint32_t)*usage_page); + } + if (key_cmd == 0x8) { + *usage = get_bytes(report_descriptor, size, data_len, i); + usage_found = 1; + //printf("Usage: %x\n", (uint32_t)*usage); + } + + if (usage_page_found && usage_found) + return 0; /* success */ + + /* Skip over this key and it's associated data */ + i += data_len + key_size; + } + + return -1; /* failure */ +} +#endif /* INVASIVE_GET_USAGE */ + +#if defined(__FreeBSD__) && __FreeBSD__ < 10 +/* The libusb version included in FreeBSD < 10 doesn't have this function. In + mainline libusb, it's inlined in libusb.h. This function will bear a striking + resemblance to that one, because there's about one way to code it. + + Note that the data parameter is Unicode in UTF-16LE encoding. + Return value is the number of bytes in data, or LIBUSB_ERROR_*. + */ +static inline int libusb_get_string_descriptor(libusb_device_handle *dev, + uint8_t descriptor_index, uint16_t lang_id, + unsigned char *data, int length) +{ + return libusb_control_transfer(dev, + LIBUSB_ENDPOINT_IN | 0x0, /* Endpoint 0 IN */ + LIBUSB_REQUEST_GET_DESCRIPTOR, + (LIBUSB_DT_STRING << 8) | descriptor_index, + lang_id, data, (uint16_t) length, 1000); +} + +#endif + + +/* Get the first language the device says it reports. This comes from + USB string #0. */ +static uint16_t get_first_language(libusb_device_handle *dev) +{ + uint16_t buf[32]; + int len; + + /* Get the string from libusb. */ + len = libusb_get_string_descriptor(dev, + 0x0, /* String ID */ + 0x0, /* Language */ + (unsigned char*)buf, + sizeof(buf)); + if (len < 4) + return 0x0; + + return buf[1]; /* First two bytes are len and descriptor type. */ +} + +static int is_language_supported(libusb_device_handle *dev, uint16_t lang) +{ + uint16_t buf[32]; + int len; + int i; + + /* Get the string from libusb. */ + len = libusb_get_string_descriptor(dev, + 0x0, /* String ID */ + 0x0, /* Language */ + (unsigned char*)buf, + sizeof(buf)); + if (len < 4) + return 0x0; + + + len /= 2; /* language IDs are two-bytes each. */ + /* Start at index 1 because there are two bytes of protocol data. */ + for (i = 1; i < len; i++) { + if (buf[i] == lang) + return 1; + } + + return 0; +} + + +/* This function returns a newly allocated wide string containing the USB + device string numbered by the index. The returned string must be freed + by using free(). */ +static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) +{ + char buf[512]; + int len; + wchar_t *str = NULL; + +#ifndef __ANDROID__ /* we don't use iconv on Android */ + wchar_t wbuf[256]; + /* iconv variables */ + iconv_t ic; + size_t inbytes; + size_t outbytes; + size_t res; +#ifdef __FreeBSD__ + const char *inptr; +#else + char *inptr; +#endif + char *outptr; +#endif + + /* Determine which language to use. */ + uint16_t lang; + lang = get_usb_code_for_current_locale(); + if (!is_language_supported(dev, lang)) + lang = get_first_language(dev); + + /* Get the string from libusb. */ + len = libusb_get_string_descriptor(dev, + idx, + lang, + (unsigned char*)buf, + sizeof(buf)); + if (len < 0) + return NULL; + +#ifdef __ANDROID__ + + /* Bionic does not have iconv support nor wcsdup() function, so it + has to be done manually. The following code will only work for + code points that can be represented as a single UTF-16 character, + and will incorrectly convert any code points which require more + than one UTF-16 character. + + Skip over the first character (2-bytes). */ + len -= 2; + str = malloc((len / 2 + 1) * sizeof(wchar_t)); + int i; + for (i = 0; i < len / 2; i++) { + str[i] = buf[i * 2 + 2] | (buf[i * 2 + 3] << 8); + } + str[len / 2] = 0x00000000; + +#else + + /* buf does not need to be explicitly NULL-terminated because + it is only passed into iconv() which does not need it. */ + + /* Initialize iconv. */ + ic = iconv_open("WCHAR_T", "UTF-16LE"); + if (ic == (iconv_t)-1) { + LOG("iconv_open() failed\n"); + return NULL; + } + + /* Convert to native wchar_t (UTF-32 on glibc/BSD systems). + Skip the first character (2-bytes). */ + inptr = buf+2; + inbytes = len-2; + outptr = (char*) wbuf; + outbytes = sizeof(wbuf); + res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes); + if (res == (size_t)-1) { + LOG("iconv() failed\n"); + goto err; + } + + /* Write the terminating NULL. */ + wbuf[sizeof(wbuf)/sizeof(wbuf[0])-1] = 0x00000000; + if (outbytes >= sizeof(wbuf[0])) + *((wchar_t*)outptr) = 0x00000000; + + /* Allocate and copy the string. */ + str = wcsdup(wbuf); + +err: + iconv_close(ic); + +#endif + + return str; +} + +static char *make_path(libusb_device *dev, int interface_number) +{ + char str[64]; + snprintf(str, sizeof(str), "%04x:%04x:%02x", + libusb_get_bus_number(dev), + libusb_get_device_address(dev), + interface_number); + str[sizeof(str)-1] = '\0'; + + return strdup(str); +} + + +int HID_API_EXPORT hid_init(void) +{ + if (!usb_context) { + const char *locale; + + /* Init Libusb */ + if (libusb_init(&usb_context)) + return -1; + + /* Set the locale if it's not set. */ + locale = setlocale(LC_CTYPE, NULL); + if (!locale) + setlocale(LC_CTYPE, ""); + } + + return 0; +} + +int HID_API_EXPORT hid_exit(void) +{ + if (usb_context) { + libusb_exit(usb_context); + usb_context = NULL; + } + + return 0; +} + +static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_descriptor *intf_desc) +{ + static const int XB360_IFACE_SUBCLASS = 93; + static const int XB360_IFACE_PROTOCOL = 1; /* Wired only */ + static const int SUPPORTED_VENDORS[] = { + 0x0079, /* GPD Win 2 */ + 0x044f, /* Thrustmaster */ + 0x045e, /* Microsoft */ + 0x046d, /* Logitech */ + 0x056e, /* Elecom */ + 0x06a3, /* Saitek */ + 0x0738, /* Mad Catz */ + 0x07ff, /* Mad Catz */ + 0x0e6f, /* Unknown */ + 0x0f0d, /* Hori */ + 0x11c9, /* Nacon */ + 0x12ab, /* Unknown */ + 0x1430, /* RedOctane */ + 0x146b, /* BigBen */ + 0x1532, /* Razer Sabertooth */ + 0x15e4, /* Numark */ + 0x162e, /* Joytech */ + 0x1689, /* Razer Onza */ + 0x1bad, /* Harmonix */ + 0x24c6, /* PowerA */ + }; + + if (intf_desc->bInterfaceNumber == 0 && + intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC && + intf_desc->bInterfaceSubClass == XB360_IFACE_SUBCLASS && + intf_desc->bInterfaceProtocol == XB360_IFACE_PROTOCOL) { + int i; + for (i = 0; i < sizeof(SUPPORTED_VENDORS)/sizeof(SUPPORTED_VENDORS[0]); ++i) { + if (vendor_id == SUPPORTED_VENDORS[i]) { + return 1; + } + } + } + return 0; +} + +static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_descriptor *intf_desc) +{ + static const int XB1_IFACE_SUBCLASS = 71; + static const int XB1_IFACE_PROTOCOL = 208; + static const int SUPPORTED_VENDORS[] = { + 0x045e, /* Microsoft */ + 0x0738, /* Mad Catz */ + 0x0e6f, /* Unknown */ + 0x0f0d, /* Hori */ + 0x1532, /* Razer Wildcat */ + 0x24c6, /* PowerA */ + }; + + if (intf_desc->bInterfaceNumber == 0 && + intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC && + intf_desc->bInterfaceSubClass == XB1_IFACE_SUBCLASS && + intf_desc->bInterfaceProtocol == XB1_IFACE_PROTOCOL) { + int i; + for (i = 0; i < sizeof(SUPPORTED_VENDORS)/sizeof(SUPPORTED_VENDORS[0]); ++i) { + if (vendor_id == SUPPORTED_VENDORS[i]) { + return 1; + } + } + } + return 0; +} + +static int should_enumerate_interface(unsigned short vendor_id, const struct libusb_interface_descriptor *intf_desc) +{ + if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) + return 1; + + /* Also enumerate Xbox 360 controllers */ + if (is_xbox360(vendor_id, intf_desc)) + { + /* hid_write() to Xbox 360 controllers doesn't seem to work on Linux: + - xpad 1-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -2 + Xbox 360 controller support is good on Linux anyway, so we'll ignore this for now. + return 1; + */ + } + + /* Also enumerate Xbox One controllers */ + if (is_xboxone(vendor_id, intf_desc)) + return 1; + + return 0; +} + +struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + libusb_device **devs; + libusb_device *dev; + libusb_device_handle *handle; + ssize_t num_devs; + int i = 0; + + struct hid_device_info *root = NULL; /* return object */ + struct hid_device_info *cur_dev = NULL; + + if(hid_init() < 0) + return NULL; + + num_devs = libusb_get_device_list(usb_context, &devs); + if (num_devs < 0) + return NULL; + while ((dev = devs[i++]) != NULL) { + struct libusb_device_descriptor desc; + struct libusb_config_descriptor *conf_desc = NULL; + int j, k; + int interface_num = 0; + + int res = libusb_get_device_descriptor(dev, &desc); + unsigned short dev_vid = desc.idVendor; + unsigned short dev_pid = desc.idProduct; + + res = libusb_get_active_config_descriptor(dev, &conf_desc); + if (res < 0) + libusb_get_config_descriptor(dev, 0, &conf_desc); + if (conf_desc) { + for (j = 0; j < conf_desc->bNumInterfaces; j++) { + const struct libusb_interface *intf = &conf_desc->interface[j]; + for (k = 0; k < intf->num_altsetting; k++) { + const struct libusb_interface_descriptor *intf_desc; + intf_desc = &intf->altsetting[k]; + if (should_enumerate_interface(dev_vid, intf_desc)) { + interface_num = intf_desc->bInterfaceNumber; + + /* Check the VID/PID against the arguments */ + if ((vendor_id == 0x0 || vendor_id == dev_vid) && + (product_id == 0x0 || product_id == dev_pid)) { + struct hid_device_info *tmp; + + /* VID/PID match. Create the record. */ + tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); + if (cur_dev) { + cur_dev->next = tmp; + } + else { + root = tmp; + } + cur_dev = tmp; + + /* Fill out the record */ + cur_dev->next = NULL; + cur_dev->path = make_path(dev, interface_num); + + res = libusb_open(dev, &handle); + + if (res >= 0) { + /* Serial Number */ + if (desc.iSerialNumber > 0) + cur_dev->serial_number = + get_usb_string(handle, desc.iSerialNumber); + + /* Manufacturer and Product strings */ + if (desc.iManufacturer > 0) + cur_dev->manufacturer_string = + get_usb_string(handle, desc.iManufacturer); + if (desc.iProduct > 0) + cur_dev->product_string = + get_usb_string(handle, desc.iProduct); + +#ifdef INVASIVE_GET_USAGE +{ + /* + This section is removed because it is too + invasive on the system. Getting a Usage Page + and Usage requires parsing the HID Report + descriptor. Getting a HID Report descriptor + involves claiming the interface. Claiming the + interface involves detaching the kernel driver. + Detaching the kernel driver is hard on the system + because it will unclaim interfaces (if another + app has them claimed) and the re-attachment of + the driver will sometimes change /dev entry names. + It is for these reasons that this section is + #if 0. For composite devices, use the interface + field in the hid_device_info struct to distinguish + between interfaces. */ + unsigned char data[256]; +#ifdef DETACH_KERNEL_DRIVER + int detached = 0; + /* Usage Page and Usage */ + res = libusb_kernel_driver_active(handle, interface_num); + if (res == 1) { + res = libusb_detach_kernel_driver(handle, interface_num); + if (res < 0) + LOG("Couldn't detach kernel driver, even though a kernel driver was attached."); + else + detached = 1; + } +#endif + res = libusb_claim_interface(handle, interface_num); + if (res >= 0) { + /* Get the HID Report Descriptor. */ + res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8)|interface_num, 0, data, sizeof(data), 5000); + if (res >= 0) { + unsigned short page=0, usage=0; + /* Parse the usage and usage page + out of the report descriptor. */ + get_usage(data, res, &page, &usage); + cur_dev->usage_page = page; + cur_dev->usage = usage; + } + else + LOG("libusb_control_transfer() for getting the HID report failed with %d\n", res); + + /* Release the interface */ + res = libusb_release_interface(handle, interface_num); + if (res < 0) + LOG("Can't release the interface.\n"); + } + else + LOG("Can't claim interface %d\n", res); +#ifdef DETACH_KERNEL_DRIVER + /* Re-attach kernel driver if necessary. */ + if (detached) { + res = libusb_attach_kernel_driver(handle, interface_num); + if (res < 0) + LOG("Couldn't re-attach kernel driver.\n"); + } +#endif +} +#endif /* INVASIVE_GET_USAGE */ + + libusb_close(handle); + } + /* VID/PID */ + cur_dev->vendor_id = dev_vid; + cur_dev->product_id = dev_pid; + + /* Release Number */ + cur_dev->release_number = desc.bcdDevice; + + /* Interface Number */ + cur_dev->interface_number = interface_num; + } + } + } /* altsettings */ + } /* interfaces */ + libusb_free_config_descriptor(conf_desc); + } + } + + libusb_free_device_list(devs, 1); + + return root; +} + +void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) +{ + struct hid_device_info *d = devs; + while (d) { + struct hid_device_info *next = d->next; + free(d->path); + free(d->serial_number); + free(d->manufacturer_string); + free(d->product_string); + free(d); + d = next; + } +} + +hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + struct hid_device_info *devs, *cur_dev; + const char *path_to_open = NULL; + hid_device *handle = NULL; + + devs = hid_enumerate(vendor_id, product_id); + cur_dev = devs; + while (cur_dev) { + if (cur_dev->vendor_id == vendor_id && + cur_dev->product_id == product_id) { + if (serial_number) { + if (cur_dev->serial_number && + wcscmp(serial_number, cur_dev->serial_number) == 0) { + path_to_open = cur_dev->path; + break; + } + } + else { + path_to_open = cur_dev->path; + break; + } + } + cur_dev = cur_dev->next; + } + + if (path_to_open) { + /* Open the device */ + handle = hid_open_path(path_to_open, 0); + } + + hid_free_enumeration(devs); + + return handle; +} + +static void read_callback(struct libusb_transfer *transfer) +{ + hid_device *dev = (hid_device *)transfer->user_data; + int res; + + if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { + + struct input_report *rpt = (struct input_report *)malloc(sizeof(*rpt)); + rpt->data = (uint8_t *)malloc(transfer->actual_length); + memcpy(rpt->data, transfer->buffer, transfer->actual_length); + rpt->len = transfer->actual_length; + rpt->next = NULL; + + pthread_mutex_lock(&dev->mutex); + + /* Attach the new report object to the end of the list. */ + if (dev->input_reports == NULL) { + /* The list is empty. Put it at the root. */ + dev->input_reports = rpt; + pthread_cond_signal(&dev->condition); + } + else { + /* Find the end of the list and attach. */ + struct input_report *cur = dev->input_reports; + int num_queued = 0; + while (cur->next != NULL) { + cur = cur->next; + num_queued++; + } + cur->next = rpt; + + /* Pop one off if we've reached 30 in the queue. This + way we don't grow forever if the user never reads + anything from the device. */ + if (num_queued > 30) { + return_data(dev, NULL, 0); + } + } + pthread_mutex_unlock(&dev->mutex); + } + else if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { + dev->shutdown_thread = 1; + dev->cancelled = 1; + return; + } + else if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) { + dev->shutdown_thread = 1; + dev->cancelled = 1; + return; + } + else if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT) { + //LOG("Timeout (normal)\n"); + } + else { + LOG("Unknown transfer code: %d\n", transfer->status); + } + + /* Re-submit the transfer object. */ + res = libusb_submit_transfer(transfer); + if (res != 0) { + LOG("Unable to submit URB. libusb error code: %d\n", res); + dev->shutdown_thread = 1; + dev->cancelled = 1; + } +} + + +static void *read_thread(void *param) +{ + hid_device *dev = (hid_device *)param; + unsigned char *buf; + const size_t length = dev->input_ep_max_packet_size; + + /* Set up the transfer object. */ + buf = (unsigned char *)malloc(length); + dev->transfer = libusb_alloc_transfer(0); + libusb_fill_interrupt_transfer(dev->transfer, + dev->device_handle, + dev->input_endpoint, + buf, + length, + read_callback, + dev, + 5000/*timeout*/); + + /* Make the first submission. Further submissions are made + from inside read_callback() */ + libusb_submit_transfer(dev->transfer); + + /* Notify the main thread that the read thread is up and running. */ + pthread_barrier_wait(&dev->barrier); + + /* Handle all the events. */ + while (!dev->shutdown_thread) { + int res; + res = libusb_handle_events(usb_context); + if (res < 0) { + /* There was an error. */ + LOG("read_thread(): libusb reports error # %d\n", res); + + /* Break out of this loop only on fatal error.*/ + if (res != LIBUSB_ERROR_BUSY && + res != LIBUSB_ERROR_TIMEOUT && + res != LIBUSB_ERROR_OVERFLOW && + res != LIBUSB_ERROR_INTERRUPTED) { + break; + } + } + } + + /* Cancel any transfer that may be pending. This call will fail + if no transfers are pending, but that's OK. */ + libusb_cancel_transfer(dev->transfer); + + while (!dev->cancelled) + libusb_handle_events_completed(usb_context, &dev->cancelled); + + /* Now that the read thread is stopping, Wake any threads which are + waiting on data (in hid_read_timeout()). Do this under a mutex to + make sure that a thread which is about to go to sleep waiting on + the condition actually will go to sleep before the condition is + signaled. */ + pthread_mutex_lock(&dev->mutex); + pthread_cond_broadcast(&dev->condition); + pthread_mutex_unlock(&dev->mutex); + + /* The dev->transfer->buffer and dev->transfer objects are cleaned up + in hid_close(). They are not cleaned up here because this thread + could end either due to a disconnect or due to a user + call to hid_close(). In both cases the objects can be safely + cleaned up after the call to pthread_join() (in hid_close()), but + since hid_close() calls libusb_cancel_transfer(), on these objects, + they can not be cleaned up here. */ + + return NULL; +} + + +hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) +{ + hid_device *dev = NULL; + + libusb_device **devs; + libusb_device *usb_dev; + int res; + int d = 0; + int good_open = 0; + + if(hid_init() < 0) + return NULL; + + dev = new_hid_device(); + + libusb_get_device_list(usb_context, &devs); + while ((usb_dev = devs[d++]) != NULL) { + struct libusb_device_descriptor desc; + struct libusb_config_descriptor *conf_desc = NULL; + int i,j,k; + libusb_get_device_descriptor(usb_dev, &desc); + + if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0) + continue; + for (j = 0; j < conf_desc->bNumInterfaces; j++) { + const struct libusb_interface *intf = &conf_desc->interface[j]; + for (k = 0; k < intf->num_altsetting; k++) { + const struct libusb_interface_descriptor *intf_desc; + intf_desc = &intf->altsetting[k]; + if (should_enumerate_interface(desc.idVendor, intf_desc)) { + char *dev_path = make_path(usb_dev, intf_desc->bInterfaceNumber); + if (!strcmp(dev_path, path)) { + /* Matched Paths. Open this device */ + + /* OPEN HERE */ + res = libusb_open(usb_dev, &dev->device_handle); + if (res < 0) { + LOG("can't open device\n"); + free(dev_path); + break; + } + good_open = 1; +#ifdef DETACH_KERNEL_DRIVER + /* Detach the kernel driver, but only if the + device is managed by the kernel */ + if (libusb_kernel_driver_active(dev->device_handle, intf_desc->bInterfaceNumber) == 1) { + res = libusb_detach_kernel_driver(dev->device_handle, intf_desc->bInterfaceNumber); + if (res < 0) { + libusb_close(dev->device_handle); + LOG("Unable to detach Kernel Driver\n"); + free(dev_path); + good_open = 0; + break; + } + } +#endif + res = libusb_claim_interface(dev->device_handle, intf_desc->bInterfaceNumber); + if (res < 0) { + LOG("can't claim interface %d: %d\n", intf_desc->bInterfaceNumber, res); + free(dev_path); + libusb_close(dev->device_handle); + good_open = 0; + break; + } + + /* Store off the string descriptor indexes */ + dev->manufacturer_index = desc.iManufacturer; + dev->product_index = desc.iProduct; + dev->serial_index = desc.iSerialNumber; + + /* Store off the interface number */ + dev->interface = intf_desc->bInterfaceNumber; + + /* Find the INPUT and OUTPUT endpoints. An + OUTPUT endpoint is not required. */ + for (i = 0; i < intf_desc->bNumEndpoints; i++) { + const struct libusb_endpoint_descriptor *ep + = &intf_desc->endpoint[i]; + + /* Determine the type and direction of this + endpoint. */ + int is_interrupt = + (ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) + == LIBUSB_TRANSFER_TYPE_INTERRUPT; + int is_output = + (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) + == LIBUSB_ENDPOINT_OUT; + int is_input = + (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) + == LIBUSB_ENDPOINT_IN; + + /* Decide whether to use it for input or output. */ + if (dev->input_endpoint == 0 && + is_interrupt && is_input) { + /* Use this endpoint for INPUT */ + dev->input_endpoint = ep->bEndpointAddress; + dev->input_ep_max_packet_size = ep->wMaxPacketSize; + } + if (dev->output_endpoint == 0 && + is_interrupt && is_output) { + /* Use this endpoint for OUTPUT */ + dev->output_endpoint = ep->bEndpointAddress; + } + } + + pthread_create(&dev->thread, NULL, read_thread, dev); + + /* Wait here for the read thread to be initialized. */ + pthread_barrier_wait(&dev->barrier); + + } + free(dev_path); + } + } + } + libusb_free_config_descriptor(conf_desc); + + } + + libusb_free_device_list(devs, 1); + + /* If we have a good handle, return it. */ + if (good_open) { + return dev; + } + else { + /* Unable to open any devices. */ + free_hid_device(dev); + return NULL; + } +} + + +int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) +{ + int res; + int report_number = data[0]; + int skipped_report_id = 0; + + if (report_number == 0x0) { + data++; + length--; + skipped_report_id = 1; + } + + + if (dev->output_endpoint <= 0) { + /* No interrupt out endpoint. Use the Control Endpoint */ + res = libusb_control_transfer(dev->device_handle, + LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT, + 0x09/*HID Set_Report*/, + (2/*HID output*/ << 8) | report_number, + dev->interface, + (unsigned char *)data, length, + 1000/*timeout millis*/); + + if (res < 0) + return -1; + + if (skipped_report_id) + length++; + + return length; + } + else { + /* Use the interrupt out endpoint */ + int actual_length; + res = libusb_interrupt_transfer(dev->device_handle, + dev->output_endpoint, + (unsigned char*)data, + length, + &actual_length, 1000); + + if (res < 0) + return -1; + + if (skipped_report_id) + actual_length++; + + return actual_length; + } +} + +/* Helper function, to simplify hid_read(). + This should be called with dev->mutex locked. */ +static int return_data(hid_device *dev, unsigned char *data, size_t length) +{ + /* Copy the data out of the linked list item (rpt) into the + return buffer (data), and delete the liked list item. */ + struct input_report *rpt = dev->input_reports; + size_t len = (length < rpt->len)? length: rpt->len; + if (data && len > 0) + memcpy(data, rpt->data, len); + dev->input_reports = rpt->next; + free(rpt->data); + free(rpt); + return len; +} + +static void cleanup_mutex(void *param) +{ + hid_device *dev = (hid_device *)param; + pthread_mutex_unlock(&dev->mutex); +} + + +int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) +{ + int bytes_read = -1; + +#if 0 + int transferred; + int res = libusb_interrupt_transfer(dev->device_handle, dev->input_endpoint, data, length, &transferred, 5000); + LOG("transferred: %d\n", transferred); + return transferred; +#endif + + pthread_mutex_lock(&dev->mutex); + pthread_cleanup_push(&cleanup_mutex, dev); + + /* There's an input report queued up. Return it. */ + if (dev->input_reports) { + /* Return the first one */ + bytes_read = return_data(dev, data, length); + goto ret; + } + + if (dev->shutdown_thread) { + /* This means the device has been disconnected. + An error code of -1 should be returned. */ + bytes_read = -1; + goto ret; + } + + if (milliseconds == -1) { + /* Blocking */ + while (!dev->input_reports && !dev->shutdown_thread) { + pthread_cond_wait(&dev->condition, &dev->mutex); + } + if (dev->input_reports) { + bytes_read = return_data(dev, data, length); + } + } + else if (milliseconds > 0) { + /* Non-blocking, but called with timeout. */ + int res; + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec += milliseconds / 1000; + ts.tv_nsec += (milliseconds % 1000) * 1000000; + if (ts.tv_nsec >= 1000000000L) { + ts.tv_sec++; + ts.tv_nsec -= 1000000000L; + } + + while (!dev->input_reports && !dev->shutdown_thread) { + res = pthread_cond_timedwait(&dev->condition, &dev->mutex, &ts); + if (res == 0) { + if (dev->input_reports) { + bytes_read = return_data(dev, data, length); + break; + } + + /* If we're here, there was a spurious wake up + or the read thread was shutdown. Run the + loop again (ie: don't break). */ + } + else if (res == ETIMEDOUT) { + /* Timed out. */ + bytes_read = 0; + break; + } + else { + /* Error. */ + bytes_read = -1; + break; + } + } + } + else { + /* Purely non-blocking */ + bytes_read = 0; + } + +ret: + pthread_mutex_unlock(&dev->mutex); + pthread_cleanup_pop(0); + + return bytes_read; +} + +int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) +{ + return hid_read_timeout(dev, data, length, dev->blocking ? -1 : 0); +} + +int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) +{ + dev->blocking = !nonblock; + + return 0; +} + + +int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) +{ + int res = -1; + int skipped_report_id = 0; + int report_number = data[0]; + + if (report_number == 0x0) { + data++; + length--; + skipped_report_id = 1; + } + + res = libusb_control_transfer(dev->device_handle, + LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT, + 0x09/*HID set_report*/, + (3/*HID feature*/ << 8) | report_number, + dev->interface, + (unsigned char *)data, length, + 1000/*timeout millis*/); + + if (res < 0) + return -1; + + /* Account for the report ID */ + if (skipped_report_id) + length++; + + return length; +} + +int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) +{ + int res = -1; + int skipped_report_id = 0; + int report_number = data[0]; + + if (report_number == 0x0) { + /* Offset the return buffer by 1, so that the report ID + will remain in byte 0. */ + data++; + length--; + skipped_report_id = 1; + } + res = libusb_control_transfer(dev->device_handle, + LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN, + 0x01/*HID get_report*/, + (3/*HID feature*/ << 8) | report_number, + dev->interface, + (unsigned char *)data, length, + 1000/*timeout millis*/); + + if (res < 0) + return -1; + + if (skipped_report_id) + res++; + + return res; +} + + +void HID_API_EXPORT hid_close(hid_device *dev) +{ + if (!dev) + return; + + /* Cause read_thread() to stop. */ + dev->shutdown_thread = 1; + libusb_cancel_transfer(dev->transfer); + + /* Wait for read_thread() to end. */ + pthread_join(dev->thread, NULL); + + /* Clean up the Transfer objects allocated in read_thread(). */ + free(dev->transfer->buffer); + libusb_free_transfer(dev->transfer); + + /* release the interface */ + libusb_release_interface(dev->device_handle, dev->interface); + + /* Close the handle */ + libusb_close(dev->device_handle); + + /* Clear out the queue of received reports. */ + pthread_mutex_lock(&dev->mutex); + while (dev->input_reports) { + return_data(dev, NULL, 0); + } + pthread_mutex_unlock(&dev->mutex); + + free_hid_device(dev); +} + + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return hid_get_indexed_string(dev, dev->manufacturer_index, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return hid_get_indexed_string(dev, dev->product_index, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return hid_get_indexed_string(dev, dev->serial_index, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) +{ + wchar_t *str; + + str = get_usb_string(dev->device_handle, string_index); + if (str) { + wcsncpy(string, str, maxlen); + string[maxlen-1] = L'\0'; + free(str); + return 0; + } + else + return -1; +} + + +HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) +{ + return NULL; +} + + +struct lang_map_entry { + const char *name; + const char *string_code; + uint16_t usb_code; +}; + +#define LANG(name,code,usb_code) { name, code, usb_code } +static struct lang_map_entry lang_map[] = { + LANG("Afrikaans", "af", 0x0436), + LANG("Albanian", "sq", 0x041C), + LANG("Arabic - United Arab Emirates", "ar_ae", 0x3801), + LANG("Arabic - Bahrain", "ar_bh", 0x3C01), + LANG("Arabic - Algeria", "ar_dz", 0x1401), + LANG("Arabic - Egypt", "ar_eg", 0x0C01), + LANG("Arabic - Iraq", "ar_iq", 0x0801), + LANG("Arabic - Jordan", "ar_jo", 0x2C01), + LANG("Arabic - Kuwait", "ar_kw", 0x3401), + LANG("Arabic - Lebanon", "ar_lb", 0x3001), + LANG("Arabic - Libya", "ar_ly", 0x1001), + LANG("Arabic - Morocco", "ar_ma", 0x1801), + LANG("Arabic - Oman", "ar_om", 0x2001), + LANG("Arabic - Qatar", "ar_qa", 0x4001), + LANG("Arabic - Saudi Arabia", "ar_sa", 0x0401), + LANG("Arabic - Syria", "ar_sy", 0x2801), + LANG("Arabic - Tunisia", "ar_tn", 0x1C01), + LANG("Arabic - Yemen", "ar_ye", 0x2401), + LANG("Armenian", "hy", 0x042B), + LANG("Azeri - Latin", "az_az", 0x042C), + LANG("Azeri - Cyrillic", "az_az", 0x082C), + LANG("Basque", "eu", 0x042D), + LANG("Belarusian", "be", 0x0423), + LANG("Bulgarian", "bg", 0x0402), + LANG("Catalan", "ca", 0x0403), + LANG("Chinese - China", "zh_cn", 0x0804), + LANG("Chinese - Hong Kong SAR", "zh_hk", 0x0C04), + LANG("Chinese - Macau SAR", "zh_mo", 0x1404), + LANG("Chinese - Singapore", "zh_sg", 0x1004), + LANG("Chinese - Taiwan", "zh_tw", 0x0404), + LANG("Croatian", "hr", 0x041A), + LANG("Czech", "cs", 0x0405), + LANG("Danish", "da", 0x0406), + LANG("Dutch - Netherlands", "nl_nl", 0x0413), + LANG("Dutch - Belgium", "nl_be", 0x0813), + LANG("English - Australia", "en_au", 0x0C09), + LANG("English - Belize", "en_bz", 0x2809), + LANG("English - Canada", "en_ca", 0x1009), + LANG("English - Caribbean", "en_cb", 0x2409), + LANG("English - Ireland", "en_ie", 0x1809), + LANG("English - Jamaica", "en_jm", 0x2009), + LANG("English - New Zealand", "en_nz", 0x1409), + LANG("English - Phillippines", "en_ph", 0x3409), + LANG("English - Southern Africa", "en_za", 0x1C09), + LANG("English - Trinidad", "en_tt", 0x2C09), + LANG("English - Great Britain", "en_gb", 0x0809), + LANG("English - United States", "en_us", 0x0409), + LANG("Estonian", "et", 0x0425), + LANG("Farsi", "fa", 0x0429), + LANG("Finnish", "fi", 0x040B), + LANG("Faroese", "fo", 0x0438), + LANG("French - France", "fr_fr", 0x040C), + LANG("French - Belgium", "fr_be", 0x080C), + LANG("French - Canada", "fr_ca", 0x0C0C), + LANG("French - Luxembourg", "fr_lu", 0x140C), + LANG("French - Switzerland", "fr_ch", 0x100C), + LANG("Gaelic - Ireland", "gd_ie", 0x083C), + LANG("Gaelic - Scotland", "gd", 0x043C), + LANG("German - Germany", "de_de", 0x0407), + LANG("German - Austria", "de_at", 0x0C07), + LANG("German - Liechtenstein", "de_li", 0x1407), + LANG("German - Luxembourg", "de_lu", 0x1007), + LANG("German - Switzerland", "de_ch", 0x0807), + LANG("Greek", "el", 0x0408), + LANG("Hebrew", "he", 0x040D), + LANG("Hindi", "hi", 0x0439), + LANG("Hungarian", "hu", 0x040E), + LANG("Icelandic", "is", 0x040F), + LANG("Indonesian", "id", 0x0421), + LANG("Italian - Italy", "it_it", 0x0410), + LANG("Italian - Switzerland", "it_ch", 0x0810), + LANG("Japanese", "ja", 0x0411), + LANG("Korean", "ko", 0x0412), + LANG("Latvian", "lv", 0x0426), + LANG("Lithuanian", "lt", 0x0427), + LANG("F.Y.R.O. Macedonia", "mk", 0x042F), + LANG("Malay - Malaysia", "ms_my", 0x043E), + LANG("Malay – Brunei", "ms_bn", 0x083E), + LANG("Maltese", "mt", 0x043A), + LANG("Marathi", "mr", 0x044E), + LANG("Norwegian - Bokml", "no_no", 0x0414), + LANG("Norwegian - Nynorsk", "no_no", 0x0814), + LANG("Polish", "pl", 0x0415), + LANG("Portuguese - Portugal", "pt_pt", 0x0816), + LANG("Portuguese - Brazil", "pt_br", 0x0416), + LANG("Raeto-Romance", "rm", 0x0417), + LANG("Romanian - Romania", "ro", 0x0418), + LANG("Romanian - Republic of Moldova", "ro_mo", 0x0818), + LANG("Russian", "ru", 0x0419), + LANG("Russian - Republic of Moldova", "ru_mo", 0x0819), + LANG("Sanskrit", "sa", 0x044F), + LANG("Serbian - Cyrillic", "sr_sp", 0x0C1A), + LANG("Serbian - Latin", "sr_sp", 0x081A), + LANG("Setsuana", "tn", 0x0432), + LANG("Slovenian", "sl", 0x0424), + LANG("Slovak", "sk", 0x041B), + LANG("Sorbian", "sb", 0x042E), + LANG("Spanish - Spain (Traditional)", "es_es", 0x040A), + LANG("Spanish - Argentina", "es_ar", 0x2C0A), + LANG("Spanish - Bolivia", "es_bo", 0x400A), + LANG("Spanish - Chile", "es_cl", 0x340A), + LANG("Spanish - Colombia", "es_co", 0x240A), + LANG("Spanish - Costa Rica", "es_cr", 0x140A), + LANG("Spanish - Dominican Republic", "es_do", 0x1C0A), + LANG("Spanish - Ecuador", "es_ec", 0x300A), + LANG("Spanish - Guatemala", "es_gt", 0x100A), + LANG("Spanish - Honduras", "es_hn", 0x480A), + LANG("Spanish - Mexico", "es_mx", 0x080A), + LANG("Spanish - Nicaragua", "es_ni", 0x4C0A), + LANG("Spanish - Panama", "es_pa", 0x180A), + LANG("Spanish - Peru", "es_pe", 0x280A), + LANG("Spanish - Puerto Rico", "es_pr", 0x500A), + LANG("Spanish - Paraguay", "es_py", 0x3C0A), + LANG("Spanish - El Salvador", "es_sv", 0x440A), + LANG("Spanish - Uruguay", "es_uy", 0x380A), + LANG("Spanish - Venezuela", "es_ve", 0x200A), + LANG("Southern Sotho", "st", 0x0430), + LANG("Swahili", "sw", 0x0441), + LANG("Swedish - Sweden", "sv_se", 0x041D), + LANG("Swedish - Finland", "sv_fi", 0x081D), + LANG("Tamil", "ta", 0x0449), + LANG("Tatar", "tt", 0X0444), + LANG("Thai", "th", 0x041E), + LANG("Turkish", "tr", 0x041F), + LANG("Tsonga", "ts", 0x0431), + LANG("Ukrainian", "uk", 0x0422), + LANG("Urdu", "ur", 0x0420), + LANG("Uzbek - Cyrillic", "uz_uz", 0x0843), + LANG("Uzbek – Latin", "uz_uz", 0x0443), + LANG("Vietnamese", "vi", 0x042A), + LANG("Xhosa", "xh", 0x0434), + LANG("Yiddish", "yi", 0x043D), + LANG("Zulu", "zu", 0x0435), + LANG(NULL, NULL, 0x0), +}; + +uint16_t get_usb_code_for_current_locale(void) +{ + char *locale; + char search_string[64]; + char *ptr; + struct lang_map_entry *lang; + + /* Get the current locale. */ + locale = setlocale(0, NULL); + if (!locale) + return 0x0; + + /* Make a copy of the current locale string. */ + strncpy(search_string, locale, sizeof(search_string)); + search_string[sizeof(search_string)-1] = '\0'; + + /* Chop off the encoding part, and make it lower case. */ + ptr = search_string; + while (*ptr) { + *ptr = tolower(*ptr); + if (*ptr == '.') { + *ptr = '\0'; + break; + } + ptr++; + } + + /* Find the entry which matches the string code of our locale. */ + lang = lang_map; + while (lang->string_code) { + if (!strcmp(lang->string_code, search_string)) { + return lang->usb_code; + } + lang++; + } + + /* There was no match. Find with just the language only. */ + /* Chop off the variant. Chop it off at the '_'. */ + ptr = search_string; + while (*ptr) { + *ptr = tolower(*ptr); + if (*ptr == '_') { + *ptr = '\0'; + break; + } + ptr++; + } + +#if 0 /* TODO: Do we need this? */ + /* Find the entry which matches the string code of our language. */ + lang = lang_map; + while (lang->string_code) { + if (!strcmp(lang->string_code, search_string)) { + return lang->usb_code; + } + lang++; + } +#endif + + /* Found nothing. */ + return 0x0; +} + +#if defined(__cplusplus) && !defined(NAMESPACE) +} +#endif + +#ifdef NAMESPACE +} +#endif + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hidusb.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hidusb.cpp new file mode 100644 index 0000000000..5006306165 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/libusb/hidusb.cpp @@ -0,0 +1,3 @@ + +#define NAMESPACE HIDUSB +#include "hid.c" diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile-manual new file mode 100644 index 0000000000..04ce1de45d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile-manual @@ -0,0 +1,49 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: hidtest-hidraw libs + +libs: libhidapi-hidraw.so + +CC ?= gcc +CFLAGS ?= -Wall -g -fpic + +CXX ?= g++ +CXXFLAGS ?= -Wall -g -fpic + +LDFLAGS ?= -Wall -g + + +COBJS = hid.o +CPPOBJS = ../hidtest/hidtest.o +OBJS = $(COBJS) $(CPPOBJS) +LIBS_UDEV = `pkg-config libudev --libs` -lrt +LIBS = $(LIBS_UDEV) +INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags` + + +# Console Test Program +hidtest-hidraw: $(COBJS) $(CPPOBJS) + $(CXX) $(LDFLAGS) $^ $(LIBS_UDEV) -o $@ + +# Shared Libs +libhidapi-hidraw.so: $(COBJS) + $(CC) $(LDFLAGS) $(LIBS_UDEV) -shared -fpic -Wl,-soname,$@.0 $^ -o $@ + +# Objects +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@ + + +clean: + rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so ../hidtest/hidtest.o + +.PHONY: clean libs diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile.am new file mode 100644 index 0000000000..230eeb75a2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/Makefile.am @@ -0,0 +1,10 @@ +lib_LTLIBRARIES = libhidapi-hidraw.la +libhidapi_hidraw_la_SOURCES = hid.c +libhidapi_hidraw_la_LDFLAGS = $(LTLDFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_HIDRAW) +libhidapi_hidraw_la_LIBADD = $(LIBS_HIDRAW) + +hdrdir = $(includedir)/hidapi +hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h + +EXTRA_DIST = Makefile-manual diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/README.txt b/3rdparty/sdl2-2.0.9/src/hidapi/linux/README.txt new file mode 100644 index 0000000000..800669495c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/README.txt @@ -0,0 +1,59 @@ + +There are two implementations of HIDAPI for Linux. One (linux/hid.c) uses the +Linux hidraw driver, and the other (libusb/hid.c) uses libusb. Which one you +use depends on your application. Complete functionality of the hidraw +version depends on patches to the Linux kernel which are not currently in +the mainline. These patches have to do with sending and receiving feature +reports. The libusb implementation uses libusb to talk directly to the +device, bypassing any Linux HID driver. The disadvantage of the libusb +version is that it will only work with USB devices, while the hidraw +implementation will work with Bluetooth devices as well. + +To use HIDAPI, simply drop either linux/hid.c or libusb/hid.c into your +application and build using the build parameters in the Makefile. + + +Libusb Implementation notes +---------------------------- +For the libusb implementation, libusb-1.0 must be installed. Libusb 1.0 is +different than the legacy libusb 0.1 which is installed on many systems. To +install libusb-1.0 on Ubuntu and other Debian-based systems, run: + sudo apt-get install libusb-1.0-0-dev + + +Hidraw Implementation notes +---------------------------- +For the hidraw implementation, libudev headers and libraries are required to +build hidapi programs. To install libudev libraries on Ubuntu, +and other Debian-based systems, run: + sudo apt-get install libudev-dev + +On Redhat-based systems, run the following as root: + yum install libudev-devel + +Unfortunately, the hidraw driver, which the linux version of hidapi is based +on, contains bugs in kernel versions < 2.6.36, which the client application +should be aware of. + +Bugs (hidraw implementation only): +----------------------------------- +On Kernel versions < 2.6.34, if your device uses numbered reports, an extra +byte will be returned at the beginning of all reports returned from read() +for hidraw devices. This is worked around in the libary. No action should be +necessary in the client library. + +On Kernel versions < 2.6.35, reports will only be sent using a Set_Report +transfer on the CONTROL endpoint. No data will ever be sent on an Interrupt +Out endpoint if one exists. This is fixed in 2.6.35. In 2.6.35, OUTPUT +reports will be sent to the device on the first INTERRUPT OUT endpoint if it +exists; If it does not exist, OUTPUT reports will be sent on the CONTROL +endpoint. + +On Kernel versions < 2.6.36, add an extra byte containing the report number +to sent reports if numbered reports are used, and the device does not +contain an INTERRPUT OUT endpoint for OUTPUT transfers. For example, if +your device uses numbered reports and wants to send {0x2 0xff 0xff 0xff} to +the device (0x2 is the report number), you must send {0x2 0x2 0xff 0xff +0xff}. If your device has the optional Interrupt OUT endpoint, this does not +apply (but really on 2.6.35 only, because 2.6.34 won't use the interrupt +out endpoint). diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.c b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.c new file mode 100644 index 0000000000..b78e009f0c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.c @@ -0,0 +1,898 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 8/22/2009 + Linux Version - 6/2/2009 + + Copyright 2009, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU General Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . +********************************************************/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* needed for wcsdup() before glibc 2.10 */ +#endif + +/* C */ +#include +#include +#include +#include +#include + +/* Unix */ +#include +#include +#include +#include +#include +#include +#include + +/* Linux */ +#include +#include +#include +#include + +#include "hidapi.h" + +#ifdef NAMESPACE +namespace NAMESPACE +{ +#endif + +/* Definitions from linux/hidraw.h. Since these are new, some distros + may not have header files which contain them. */ +#ifndef HIDIOCSFEATURE +#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) +#endif +#ifndef HIDIOCGFEATURE +#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) +#endif + +/* USB HID device property names */ +const char *device_string_names[] = { + "manufacturer", + "product", + "serial", +}; + +/* Symbolic names for the properties above */ +enum device_string_id { + DEVICE_STRING_MANUFACTURER, + DEVICE_STRING_PRODUCT, + DEVICE_STRING_SERIAL, + + DEVICE_STRING_COUNT, +}; + +struct hid_device_ { + int device_handle; + int blocking; + int uses_numbered_reports; + int is_bluetooth; +}; + + +static __u32 kernel_version = 0; + +static __u32 detect_kernel_version(void) +{ + struct utsname name; + int major, minor, release; + int ret; + + uname(&name); + ret = sscanf(name.release, "%d.%d.%d", &major, &minor, &release); + if (ret == 3) { + return KERNEL_VERSION(major, minor, release); + } + + ret = sscanf(name.release, "%d.%d", &major, &minor); + if (ret == 2) { + return KERNEL_VERSION(major, minor, 0); + } + + printf("Couldn't determine kernel version from version string \"%s\"\n", name.release); + return 0; +} + +static hid_device *new_hid_device(void) +{ + hid_device *dev = (hid_device *)calloc(1, sizeof(hid_device)); + dev->device_handle = -1; + dev->blocking = 1; + dev->uses_numbered_reports = 0; + dev->is_bluetooth = 0; + + return dev; +} + + +/* The caller must free the returned string with free(). */ +static wchar_t *utf8_to_wchar_t(const char *utf8) +{ + wchar_t *ret = NULL; + + if (utf8) { + size_t wlen = mbstowcs(NULL, utf8, 0); + if ((size_t) -1 == wlen) { + return wcsdup(L""); + } + ret = (wchar_t *)calloc(wlen+1, sizeof(wchar_t)); + mbstowcs(ret, utf8, wlen+1); + ret[wlen] = 0x0000; + } + + return ret; +} + +/* Get an attribute value from a udev_device and return it as a whar_t + string. The returned string must be freed with free() when done.*/ +static wchar_t *copy_udev_string(struct udev_device *dev, const char *udev_name) +{ + return utf8_to_wchar_t(udev_device_get_sysattr_value(dev, udev_name)); +} + +/* uses_numbered_reports() returns 1 if report_descriptor describes a device + which contains numbered reports. */ +static int uses_numbered_reports(__u8 *report_descriptor, __u32 size) { + unsigned int i = 0; + int size_code; + int data_len, key_size; + + while (i < size) { + int key = report_descriptor[i]; + + /* Check for the Report ID key */ + if (key == 0x85/*Report ID*/) { + /* This device has a Report ID, which means it uses + numbered reports. */ + return 1; + } + + //printf("key: %02hhx\n", key); + + if ((key & 0xf0) == 0xf0) { + /* This is a Long Item. The next byte contains the + length of the data section (value) for this key. + See the HID specification, version 1.11, section + 6.2.2.3, titled "Long Items." */ + if (i+1 < size) + data_len = report_descriptor[i+1]; + else + data_len = 0; /* malformed report */ + key_size = 3; + } + else { + /* This is a Short Item. The bottom two bits of the + key contain the size code for the data section + (value) for this key. Refer to the HID + specification, version 1.11, section 6.2.2.2, + titled "Short Items." */ + size_code = key & 0x3; + switch (size_code) { + case 0: + case 1: + case 2: + data_len = size_code; + break; + case 3: + data_len = 4; + break; + default: + /* Can't ever happen since size_code is & 0x3 */ + data_len = 0; + break; + }; + key_size = 1; + } + + /* Skip over this key and it's associated data */ + i += data_len + key_size; + } + + /* Didn't find a Report ID key. Device doesn't use numbered reports. */ + return 0; +} + +/* + * The caller is responsible for free()ing the (newly-allocated) character + * strings pointed to by serial_number_utf8 and product_name_utf8 after use. + */ +static int +parse_uevent_info(const char *uevent, int *bus_type, + unsigned short *vendor_id, unsigned short *product_id, + char **serial_number_utf8, char **product_name_utf8) +{ + char *tmp = strdup(uevent); + char *saveptr = NULL; + char *line; + char *key; + char *value; + + int found_id = 0; + int found_serial = 0; + int found_name = 0; + + line = strtok_r(tmp, "\n", &saveptr); + while (line != NULL) { + /* line: "KEY=value" */ + key = line; + value = strchr(line, '='); + if (!value) { + goto next_line; + } + *value = '\0'; + value++; + + if (strcmp(key, "HID_ID") == 0) { + /** + * type vendor product + * HID_ID=0003:000005AC:00008242 + **/ + int ret = sscanf(value, "%x:%hx:%hx", bus_type, vendor_id, product_id); + if (ret == 3) { + found_id = 1; + } + } else if (strcmp(key, "HID_NAME") == 0) { + /* The caller has to free the product name */ + *product_name_utf8 = strdup(value); + found_name = 1; + } else if (strcmp(key, "HID_UNIQ") == 0) { + /* The caller has to free the serial number */ + *serial_number_utf8 = strdup(value); + found_serial = 1; + } + +next_line: + line = strtok_r(NULL, "\n", &saveptr); + } + + free(tmp); + return (found_id && found_name && found_serial); +} + +static int is_bluetooth(hid_device *dev) +{ + struct udev *udev; + struct udev_device *udev_dev, *hid_dev; + struct stat s; + int ret = -1; + + /* Create the udev object */ + udev = udev_new(); + if (!udev) { + printf("Can't create udev\n"); + return -1; + } + + /* Get the dev_t (major/minor numbers) from the file handle. */ + ret = fstat(dev->device_handle, &s); + if (-1 == ret) { + udev_unref(udev); + return ret; + } + + /* Open a udev device from the dev_t. 'c' means character device. */ + udev_dev = udev_device_new_from_devnum(udev, 'c', s.st_rdev); + if (udev_dev) { + hid_dev = udev_device_get_parent_with_subsystem_devtype( + udev_dev, + "hid", + NULL); + if (hid_dev) { + unsigned short dev_vid; + unsigned short dev_pid; + int bus_type; + char *serial_number_utf8 = NULL; + char *product_name_utf8 = NULL; + + ret = parse_uevent_info( + udev_device_get_sysattr_value(hid_dev, "uevent"), + &bus_type, + &dev_vid, + &dev_pid, + &serial_number_utf8, + &product_name_utf8); + free(serial_number_utf8); + free(product_name_utf8); + + ret = (bus_type == BUS_BLUETOOTH); + + /* hid_dev doesn't need to be (and can't be) unref'd. + I'm not sure why, but it'll throw double-free() errors. */ + } + udev_device_unref(udev_dev); + } + + udev_unref(udev); + + return ret; +} + + +static int get_device_string(hid_device *dev, enum device_string_id key, wchar_t *string, size_t maxlen) +{ + struct udev *udev; + struct udev_device *udev_dev, *parent, *hid_dev; + struct stat s; + int ret = -1; + char *serial_number_utf8 = NULL; + char *product_name_utf8 = NULL; + char *tmp; + + /* Create the udev object */ + udev = udev_new(); + if (!udev) { + printf("Can't create udev\n"); + return -1; + } + + /* Get the dev_t (major/minor numbers) from the file handle. */ + ret = fstat(dev->device_handle, &s); + if (-1 == ret) { + udev_unref(udev); + return ret; + } + /* Open a udev device from the dev_t. 'c' means character device. */ + udev_dev = udev_device_new_from_devnum(udev, 'c', s.st_rdev); + if (udev_dev) { + hid_dev = udev_device_get_parent_with_subsystem_devtype( + udev_dev, + "hid", + NULL); + if (hid_dev) { + unsigned short dev_vid; + unsigned short dev_pid; + int bus_type; + size_t retm; + + ret = parse_uevent_info( + udev_device_get_sysattr_value(hid_dev, "uevent"), + &bus_type, + &dev_vid, + &dev_pid, + &serial_number_utf8, + &product_name_utf8); + + if (bus_type == BUS_BLUETOOTH) { + switch (key) { + case DEVICE_STRING_MANUFACTURER: + wcsncpy(string, L"", maxlen); + ret = 0; + break; + case DEVICE_STRING_PRODUCT: + retm = mbstowcs(string, product_name_utf8, maxlen); + ret = (retm == (size_t)-1)? -1: 0; + break; + case DEVICE_STRING_SERIAL: + /* Bluetooth serial numbers are often the bluetooth device address + and we want that with the colons stripped out, which is the correct + serial number for PS4 controllers + */ + while ((tmp = strchr(serial_number_utf8, ':')) != NULL) { + memmove(tmp, tmp+1, strlen(tmp)); + } + retm = mbstowcs(string, serial_number_utf8, maxlen); + ret = (retm == (size_t)-1)? -1: 0; + break; + case DEVICE_STRING_COUNT: + default: + ret = -1; + break; + } + } + else { + /* This is a USB device. Find its parent USB Device node. */ + parent = udev_device_get_parent_with_subsystem_devtype( + udev_dev, + "usb", + "usb_device"); + if (parent) { + const char *str; + const char *key_str = NULL; + + if (key >= 0 && key < DEVICE_STRING_COUNT) { + key_str = device_string_names[key]; + } else { + ret = -1; + goto end; + } + + str = udev_device_get_sysattr_value(parent, key_str); + if (str) { + /* Convert the string from UTF-8 to wchar_t */ + retm = mbstowcs(string, str, maxlen); + ret = (retm == (size_t)-1)? -1: 0; + goto end; + } + } + } + } + } + +end: + free(serial_number_utf8); + free(product_name_utf8); + + udev_device_unref(udev_dev); + /* parent and hid_dev don't need to be (and can't be) unref'd. + I'm not sure why, but they'll throw double-free() errors. */ + udev_unref(udev); + + return ret; +} + +int HID_API_EXPORT hid_init(void) +{ + const char *locale; + + /* Set the locale if it's not set. */ + locale = setlocale(LC_CTYPE, NULL); + if (!locale) + setlocale(LC_CTYPE, ""); + + kernel_version = detect_kernel_version(); + + return 0; +} + +int HID_API_EXPORT hid_exit(void) +{ + /* Nothing to do for this in the Linux/hidraw implementation. */ + return 0; +} + + +struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *devices, *dev_list_entry; + + struct hid_device_info *root = NULL; /* return object */ + struct hid_device_info *cur_dev = NULL; + struct hid_device_info *prev_dev = NULL; /* previous device */ + + hid_init(); + + /* Create the udev object */ + udev = udev_new(); + if (!udev) { + printf("Can't create udev\n"); + return NULL; + } + + /* Create a list of the devices in the 'hidraw' subsystem. */ + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_subsystem(enumerate, "hidraw"); + udev_enumerate_scan_devices(enumerate); + devices = udev_enumerate_get_list_entry(enumerate); + /* For each item, see if it matches the vid/pid, and if so + create a udev_device record for it */ + udev_list_entry_foreach(dev_list_entry, devices) { + const char *sysfs_path; + const char *dev_path; + const char *str; + struct udev_device *raw_dev; /* The device's hidraw udev node. */ + struct udev_device *hid_dev; /* The device's HID udev node. */ + struct udev_device *usb_dev; /* The device's USB udev node. */ + struct udev_device *intf_dev; /* The device's interface (in the USB sense). */ + unsigned short dev_vid; + unsigned short dev_pid; + char *serial_number_utf8 = NULL; + char *product_name_utf8 = NULL; + int bus_type; + int result; + + /* Get the filename of the /sys entry for the device + and create a udev_device object (dev) representing it */ + sysfs_path = udev_list_entry_get_name(dev_list_entry); + raw_dev = udev_device_new_from_syspath(udev, sysfs_path); + dev_path = udev_device_get_devnode(raw_dev); + + hid_dev = udev_device_get_parent_with_subsystem_devtype( + raw_dev, + "hid", + NULL); + + if (!hid_dev) { + /* Unable to find parent hid device. */ + goto next; + } + + result = parse_uevent_info( + udev_device_get_sysattr_value(hid_dev, "uevent"), + &bus_type, + &dev_vid, + &dev_pid, + &serial_number_utf8, + &product_name_utf8); + + if (!result) { + /* parse_uevent_info() failed for at least one field. */ + goto next; + } + + if (bus_type != BUS_USB && bus_type != BUS_BLUETOOTH) { + /* We only know how to handle USB and BT devices. */ + goto next; + } + + if (access(dev_path, R_OK|W_OK) != 0) { + /* We can't open this device, ignore it */ + goto next; + } + + /* Check the VID/PID against the arguments */ + if ((vendor_id == 0x0 || vendor_id == dev_vid) && + (product_id == 0x0 || product_id == dev_pid)) { + struct hid_device_info *tmp; + + /* VID/PID match. Create the record. */ + tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + if (cur_dev) { + cur_dev->next = tmp; + } + else { + root = tmp; + } + prev_dev = cur_dev; + cur_dev = tmp; + + /* Fill out the record */ + cur_dev->next = NULL; + cur_dev->path = dev_path? strdup(dev_path): NULL; + + /* VID/PID */ + cur_dev->vendor_id = dev_vid; + cur_dev->product_id = dev_pid; + + /* Serial Number */ + cur_dev->serial_number = utf8_to_wchar_t(serial_number_utf8); + + /* Release Number */ + cur_dev->release_number = 0x0; + + /* Interface Number */ + cur_dev->interface_number = -1; + + switch (bus_type) { + case BUS_USB: + /* The device pointed to by raw_dev contains information about + the hidraw device. In order to get information about the + USB device, get the parent device with the + subsystem/devtype pair of "usb"/"usb_device". This will + be several levels up the tree, but the function will find + it. */ + usb_dev = udev_device_get_parent_with_subsystem_devtype( + raw_dev, + "usb", + "usb_device"); + + if (!usb_dev) { + /* Free this device */ + free(cur_dev->serial_number); + free(cur_dev->path); + free(cur_dev); + + /* Take it off the device list. */ + if (prev_dev) { + prev_dev->next = NULL; + cur_dev = prev_dev; + } + else { + cur_dev = root = NULL; + } + + goto next; + } + + /* Manufacturer and Product strings */ + cur_dev->manufacturer_string = copy_udev_string(usb_dev, device_string_names[DEVICE_STRING_MANUFACTURER]); + cur_dev->product_string = copy_udev_string(usb_dev, device_string_names[DEVICE_STRING_PRODUCT]); + + /* Release Number */ + str = udev_device_get_sysattr_value(usb_dev, "bcdDevice"); + cur_dev->release_number = (str)? strtol(str, NULL, 16): 0x0; + + /* Get a handle to the interface's udev node. */ + intf_dev = udev_device_get_parent_with_subsystem_devtype( + raw_dev, + "usb", + "usb_interface"); + if (intf_dev) { + str = udev_device_get_sysattr_value(intf_dev, "bInterfaceNumber"); + cur_dev->interface_number = (str)? strtol(str, NULL, 16): -1; + } + + break; + + case BUS_BLUETOOTH: + /* Manufacturer and Product strings */ + cur_dev->manufacturer_string = wcsdup(L""); + cur_dev->product_string = utf8_to_wchar_t(product_name_utf8); + + break; + + default: + /* Unknown device type - this should never happen, as we + * check for USB and Bluetooth devices above */ + break; + } + } + + next: + free(serial_number_utf8); + free(product_name_utf8); + udev_device_unref(raw_dev); + /* hid_dev, usb_dev and intf_dev don't need to be (and can't be) + unref()d. It will cause a double-free() error. I'm not + sure why. */ + } + /* Free the enumerator and udev objects. */ + udev_enumerate_unref(enumerate); + udev_unref(udev); + + return root; +} + +void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) +{ + struct hid_device_info *d = devs; + while (d) { + struct hid_device_info *next = d->next; + free(d->path); + free(d->serial_number); + free(d->manufacturer_string); + free(d->product_string); + free(d); + d = next; + } +} + +hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + struct hid_device_info *devs, *cur_dev; + const char *path_to_open = NULL; + hid_device *handle = NULL; + + devs = hid_enumerate(vendor_id, product_id); + cur_dev = devs; + while (cur_dev) { + if (cur_dev->vendor_id == vendor_id && + cur_dev->product_id == product_id) { + if (serial_number) { + if (wcscmp(serial_number, cur_dev->serial_number) == 0) { + path_to_open = cur_dev->path; + break; + } + } + else { + path_to_open = cur_dev->path; + break; + } + } + cur_dev = cur_dev->next; + } + + if (path_to_open) { + /* Open the device */ + handle = hid_open_path(path_to_open, 0); + } + + hid_free_enumeration(devs); + + return handle; +} + +hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) +{ + hid_device *dev = NULL; + + hid_init(); + + dev = new_hid_device(); + + /* OPEN HERE */ + dev->device_handle = open(path, O_RDWR); + + /* If we have a good handle, return it. */ + if (dev->device_handle > 0) { + + /* Get the report descriptor */ + int res, desc_size = 0; + struct hidraw_report_descriptor rpt_desc; + + memset(&rpt_desc, 0x0, sizeof(rpt_desc)); + + /* Get Report Descriptor Size */ + res = ioctl(dev->device_handle, HIDIOCGRDESCSIZE, &desc_size); + if (res < 0) + perror("HIDIOCGRDESCSIZE"); + + + /* Get Report Descriptor */ + rpt_desc.size = desc_size; + res = ioctl(dev->device_handle, HIDIOCGRDESC, &rpt_desc); + if (res < 0) { + perror("HIDIOCGRDESC"); + } else { + /* Determine if this device uses numbered reports. */ + dev->uses_numbered_reports = + uses_numbered_reports(rpt_desc.value, + rpt_desc.size); + } + + dev->is_bluetooth = (is_bluetooth(dev) == 1); + + return dev; + } + else { + /* Unable to open any devices. */ + free(dev); + return NULL; + } +} + + +int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) +{ + int bytes_written; + + bytes_written = write(dev->device_handle, data, length); + + return bytes_written; +} + + +int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) +{ + int bytes_read; + + if (milliseconds >= 0) { + /* Milliseconds is either 0 (non-blocking) or > 0 (contains + a valid timeout). In both cases we want to call poll() + and wait for data to arrive. Don't rely on non-blocking + operation (O_NONBLOCK) since some kernels don't seem to + properly report device disconnection through read() when + in non-blocking mode. */ + int ret; + struct pollfd fds; + + fds.fd = dev->device_handle; + fds.events = POLLIN; + fds.revents = 0; + ret = poll(&fds, 1, milliseconds); + if (ret == -1 || ret == 0) { + /* Error or timeout */ + return ret; + } + else { + /* Check for errors on the file descriptor. This will + indicate a device disconnection. */ + if (fds.revents & (POLLERR | POLLHUP | POLLNVAL)) + return -1; + } + } + + bytes_read = read(dev->device_handle, data, length); + if (bytes_read < 0 && (errno == EAGAIN || errno == EINPROGRESS)) + bytes_read = 0; + + if (bytes_read >= 0 && + kernel_version != 0 && + kernel_version < KERNEL_VERSION(2,6,34) && + dev->uses_numbered_reports) { + /* Work around a kernel bug. Chop off the first byte. */ + memmove(data, data+1, bytes_read); + bytes_read--; + } + + return bytes_read; +} + +int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) +{ + return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0); +} + +int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) +{ + /* Do all non-blocking in userspace using poll(), since it looks + like there's a bug in the kernel in some versions where + read() will not return -1 on disconnection of the USB device */ + + dev->blocking = !nonblock; + return 0; /* Success */ +} + + +int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) +{ + int res; + + res = ioctl(dev->device_handle, HIDIOCSFEATURE(length), data); + if (res < 0) + perror("ioctl (SFEATURE)"); + + return res; +} + +int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) +{ + int res; + + /* It looks like HIDIOCGFEATURE() on Bluetooth devices doesn't return the report number */ + if (dev->is_bluetooth) { + data[1] = data[0]; + ++data; + --length; + } + res = ioctl(dev->device_handle, HIDIOCGFEATURE(length), data); + if (res < 0) + perror("ioctl (GFEATURE)"); + else if (dev->is_bluetooth) + ++res; + + return res; +} + + +void HID_API_EXPORT hid_close(hid_device *dev) +{ + if (!dev) + return; + close(dev->device_handle); + free(dev); +} + + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_device_string(dev, DEVICE_STRING_MANUFACTURER, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_device_string(dev, DEVICE_STRING_PRODUCT, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_device_string(dev, DEVICE_STRING_SERIAL, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) +{ + return -1; +} + + +HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) +{ + return NULL; +} + +#ifdef NAMESPACE +} +#endif + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.cpp new file mode 100644 index 0000000000..841f34fb43 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hid.cpp @@ -0,0 +1,333 @@ +//=================== Copyright Valve Corporation, All rights reserved. ======= +// +// Purpose: A wrapper around both the libusb and hidraw versions of HIDAPI +// +// The libusb version doesn't support Bluetooth, but not all Linux +// distributions allow access to /dev/hidraw* +// +// This merges the two, at a small performance cost, until distributions +// have granted access to /dev/hidraw* +// +//============================================================================= + +#define NAMESPACE HIDRAW +#include "../hidapi/hidapi.h" +#undef NAMESPACE +#undef HIDAPI_H__ + +#define NAMESPACE HIDUSB +#include "../hidapi/hidapi.h" +#undef NAMESPACE +#undef HIDAPI_H__ + +#include "../hidapi/hidapi.h" + +#include "../../../public/tier1/utlvector.h" +#include "../../../public/tier1/utlhashmap.h" + + +template +void CopyHIDDeviceInfo( T *pSrc, struct hid_device_info *pDst ) +{ + pDst->path = pSrc->path ? strdup( pSrc->path ) : NULL; + pDst->vendor_id = pSrc->vendor_id; + pDst->product_id = pSrc->product_id; + pDst->serial_number = pSrc->serial_number ? wcsdup( pSrc->serial_number ) : NULL; + pDst->release_number = pSrc->release_number; + pDst->manufacturer_string = pSrc->manufacturer_string ? wcsdup( pSrc->manufacturer_string ) : NULL; + pDst->product_string = pSrc->product_string ? wcsdup( pSrc->product_string ) : NULL; + pDst->usage_page = pSrc->usage_page; + pDst->usage = pSrc->usage; + pDst->interface_number = pSrc->interface_number; + pDst->next = NULL; +} + +extern "C" +{ + +enum EHIDAPIType +{ + k_EHIDAPIUnknown, + k_EHIDAPIRAW, + k_EHIDAPIUSB +}; + +static CUtlHashMap s_hashDeviceToAPI; + +static EHIDAPIType GetAPIForDevice( hid_device *pDevice ) +{ + int iIndex = s_hashDeviceToAPI.Find( (uintptr_t)pDevice ); + if ( iIndex != -1 ) + { + return s_hashDeviceToAPI[ iIndex ]; + } + return k_EHIDAPIUnknown; +} + +struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + struct HIDUSB::hid_device_info *usb_devs = HIDUSB::hid_enumerate( vendor_id, product_id ); + struct HIDUSB::hid_device_info *usb_dev; + struct HIDRAW::hid_device_info *raw_devs = HIDRAW::hid_enumerate( vendor_id, product_id ); + struct HIDRAW::hid_device_info *raw_dev; + struct hid_device_info *devs = NULL, *last = NULL, *new_dev; + + for ( usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next ) + { + bool bFound = false; + for ( raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next ) + { + if ( usb_dev->vendor_id == raw_dev->vendor_id && usb_dev->product_id == raw_dev->product_id ) + { + bFound = true; + break; + } + } + +//printf("%s USB device VID/PID 0x%.4x/0x%.4x, %ls %ls\n", bFound ? "Found matching" : "Added new", usb_dev->vendor_id, usb_dev->product_id, usb_dev->manufacturer_string, usb_dev->product_string ); + + if ( !bFound ) + { + new_dev = new struct hid_device_info; + CopyHIDDeviceInfo( usb_dev, new_dev ); + + if ( last ) + { + last->next = new_dev; + } + else + { + devs = new_dev; + } + last = new_dev; + } + } + HIDUSB::hid_free_enumeration( usb_devs ); + + for ( raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next ) + { + new_dev = new struct hid_device_info; + CopyHIDDeviceInfo( raw_dev, new_dev ); + new_dev->next = NULL; + + if ( last ) + { + last->next = new_dev; + } + else + { + devs = new_dev; + } + last = new_dev; + } + HIDRAW::hid_free_enumeration( raw_devs ); + + return devs; +} + +void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs) +{ + while ( devs ) + { + struct hid_device_info *next = devs->next; + free( devs->path ); + free( devs->serial_number ); + free( devs->manufacturer_string ); + free( devs->product_string ); + delete devs; + devs = next; + } +} + +HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + hid_device *pDevice = NULL; + if ( ( pDevice = (hid_device *)HIDRAW::hid_open( vendor_id, product_id, serial_number ) ) != NULL ) + { + s_hashDeviceToAPI.Insert( (uintptr_t)pDevice, k_EHIDAPIRAW ); + return pDevice; + } + if ( ( pDevice = (hid_device *)HIDUSB::hid_open( vendor_id, product_id, serial_number ) ) != NULL ) + { + s_hashDeviceToAPI.Insert( (uintptr_t)pDevice, k_EHIDAPIUSB ); + return pDevice; + } + return NULL; +} + +HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive) +{ + hid_device *pDevice = NULL; + if ( ( pDevice = (hid_device *)HIDRAW::hid_open_path( path, bExclusive ) ) != NULL ) + { + s_hashDeviceToAPI.Insert( (uintptr_t)pDevice, k_EHIDAPIRAW ); + return pDevice; + } + if ( ( pDevice = (hid_device *)HIDUSB::hid_open_path( path, bExclusive ) ) != NULL ) + { + s_hashDeviceToAPI.Insert( (uintptr_t)pDevice, k_EHIDAPIUSB ); + return pDevice; + } + return NULL; +} + +int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_write( (HIDRAW::hid_device*)device, data, length ); + case k_EHIDAPIUSB: + return HIDUSB::hid_write( (HIDUSB::hid_device*)device, data, length ); + default: + return -1; + } +} + +int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_read_timeout( (HIDRAW::hid_device*)device, data, length, milliseconds ); + case k_EHIDAPIUSB: + return HIDUSB::hid_read_timeout( (HIDUSB::hid_device*)device, data, length, milliseconds ); + default: + return -1; + } +} + +int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_read( (HIDRAW::hid_device*)device, data, length ); + case k_EHIDAPIUSB: + return HIDUSB::hid_read( (HIDUSB::hid_device*)device, data, length ); + default: + return -1; + } +} + +int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_set_nonblocking( (HIDRAW::hid_device*)device, nonblock ); + case k_EHIDAPIUSB: + return HIDUSB::hid_set_nonblocking( (HIDUSB::hid_device*)device, nonblock ); + default: + return -1; + } +} + +int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_send_feature_report( (HIDRAW::hid_device*)device, data, length ); + case k_EHIDAPIUSB: + return HIDUSB::hid_send_feature_report( (HIDUSB::hid_device*)device, data, length ); + default: + return -1; + } +} + +int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_get_feature_report( (HIDRAW::hid_device*)device, data, length ); + case k_EHIDAPIUSB: + return HIDUSB::hid_get_feature_report( (HIDUSB::hid_device*)device, data, length ); + default: + return -1; + } +} + +void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + HIDRAW::hid_close( (HIDRAW::hid_device*)device ); + break; + case k_EHIDAPIUSB: + HIDUSB::hid_close( (HIDUSB::hid_device*)device ); + break; + default: + break; + } + s_hashDeviceToAPI.Remove( (uintptr_t)device ); +} + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_get_manufacturer_string( (HIDRAW::hid_device*)device, string, maxlen ); + case k_EHIDAPIUSB: + return HIDUSB::hid_get_manufacturer_string( (HIDUSB::hid_device*)device, string, maxlen ); + default: + return -1; + } +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_get_product_string( (HIDRAW::hid_device*)device, string, maxlen ); + case k_EHIDAPIUSB: + return HIDUSB::hid_get_product_string( (HIDUSB::hid_device*)device, string, maxlen ); + default: + return -1; + } +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_get_serial_number_string( (HIDRAW::hid_device*)device, string, maxlen ); + case k_EHIDAPIUSB: + return HIDUSB::hid_get_serial_number_string( (HIDUSB::hid_device*)device, string, maxlen ); + default: + return -1; + } +} + +int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_get_indexed_string( (HIDRAW::hid_device*)device, string_index, string, maxlen ); + case k_EHIDAPIUSB: + return HIDUSB::hid_get_indexed_string( (HIDUSB::hid_device*)device, string_index, string, maxlen ); + default: + return -1; + } +} + +HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device) +{ + switch ( GetAPIForDevice( device ) ) + { + case k_EHIDAPIRAW: + return HIDRAW::hid_error( (HIDRAW::hid_device*)device ); + case k_EHIDAPIUSB: + return HIDUSB::hid_error( (HIDUSB::hid_device*)device ); + default: + return NULL; + } +} + +} diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/linux/hidraw.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hidraw.cpp new file mode 100644 index 0000000000..1bf6fad246 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/linux/hidraw.cpp @@ -0,0 +1,3 @@ + +#define NAMESPACE HIDRAW +#include "hid.c" diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/m4/ax_pthread.m4 b/3rdparty/sdl2-2.0.9/src/hidapi/m4/ax_pthread.m4 new file mode 100644 index 0000000000..d90de34d14 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/m4/ax_pthread.m4 @@ -0,0 +1,309 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 18 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/m4/pkg.m4 b/3rdparty/sdl2-2.0.9/src/hidapi/m4/pkg.m4 new file mode 100644 index 0000000000..0048a3fa05 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/m4/pkg.m4 @@ -0,0 +1,157 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile-manual new file mode 100644 index 0000000000..5399b5a70f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile-manual @@ -0,0 +1,32 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-07-03 +########################################### + +all: hidtest + +CC=gcc +CXX=g++ +COBJS=hid.o +CPPOBJS=../hidtest/hidtest.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS+=-I../hidapi -Wall -g -c +LIBS=-framework IOKit -framework CoreFoundation + + +hidtest: $(OBJS) + g++ -Wall -g $^ $(LIBS) -o hidtest + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm -f *.o hidtest $(CPPOBJS) + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile.am new file mode 100644 index 0000000000..23d96e08fb --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/mac/Makefile.am @@ -0,0 +1,9 @@ +lib_LTLIBRARIES = libhidapi.la +libhidapi_la_SOURCES = hid.c +libhidapi_la_LDFLAGS = $(LTLDFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ + +hdrdir = $(includedir)/hidapi +hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h + +EXTRA_DIST = Makefile-manual diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/mac/hid.c b/3rdparty/sdl2-2.0.9/src/hidapi/mac/hid.c new file mode 100644 index 0000000000..d462d26e38 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/mac/hid.c @@ -0,0 +1,1191 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 2010-07-03 + + Copyright 2010, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . + ********************************************************/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +/* See Apple Technical Note TN2187 for details on IOHidManager. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hidapi.h" + +/* Barrier implementation because Mac OSX doesn't have pthread_barrier. + It also doesn't have clock_gettime(). So much for POSIX and SUSv2. + This implementation came from Brent Priddy and was posted on + StackOverflow. It is used with his permission. */ +typedef int pthread_barrierattr_t; +typedef struct pthread_barrier { + pthread_mutex_t mutex; + pthread_cond_t cond; + int count; + int trip_count; +} pthread_barrier_t; + +static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count) +{ + if(count == 0) { + errno = EINVAL; + return -1; + } + + if(pthread_mutex_init(&barrier->mutex, 0) < 0) { + return -1; + } + if(pthread_cond_init(&barrier->cond, 0) < 0) { + pthread_mutex_destroy(&barrier->mutex); + return -1; + } + barrier->trip_count = count; + barrier->count = 0; + + return 0; +} + +static int pthread_barrier_destroy(pthread_barrier_t *barrier) +{ + pthread_cond_destroy(&barrier->cond); + pthread_mutex_destroy(&barrier->mutex); + return 0; +} + +static int pthread_barrier_wait(pthread_barrier_t *barrier) +{ + pthread_mutex_lock(&barrier->mutex); + ++(barrier->count); + if(barrier->count >= barrier->trip_count) + { + barrier->count = 0; + pthread_cond_broadcast(&barrier->cond); + pthread_mutex_unlock(&barrier->mutex); + return 1; + } + else + { + pthread_cond_wait(&barrier->cond, &(barrier->mutex)); + pthread_mutex_unlock(&barrier->mutex); + return 0; + } +} + +static int return_data(hid_device *dev, unsigned char *data, size_t length); + +/* Linked List of input reports received from the device. */ +struct input_report { + uint8_t *data; + size_t len; + struct input_report *next; +}; + +struct hid_device_ { + IOHIDDeviceRef device_handle; + int blocking; + int uses_numbered_reports; + int disconnected; + CFStringRef run_loop_mode; + CFRunLoopRef run_loop; + CFRunLoopSourceRef source; + uint8_t *input_report_buf; + CFIndex max_input_report_len; + struct input_report *input_reports; + + pthread_t thread; + pthread_mutex_t mutex; /* Protects input_reports */ + pthread_cond_t condition; + pthread_barrier_t barrier; /* Ensures correct startup sequence */ + pthread_barrier_t shutdown_barrier; /* Ensures correct shutdown sequence */ + int shutdown_thread; + + hid_device *next; +}; + +/* Static list of all the devices open. This way when a device gets + disconnected, its hid_device structure can be marked as disconnected + from hid_device_removal_callback(). */ +static hid_device *device_list = NULL; +static pthread_mutex_t device_list_mutex = PTHREAD_MUTEX_INITIALIZER; + +static hid_device *new_hid_device(void) +{ + hid_device *dev = (hid_device*)calloc(1, sizeof(hid_device)); + dev->device_handle = NULL; + dev->blocking = 1; + dev->uses_numbered_reports = 0; + dev->disconnected = 0; + dev->run_loop_mode = NULL; + dev->run_loop = NULL; + dev->source = NULL; + dev->input_report_buf = NULL; + dev->input_reports = NULL; + dev->shutdown_thread = 0; + dev->next = NULL; + + /* Thread objects */ + pthread_mutex_init(&dev->mutex, NULL); + pthread_cond_init(&dev->condition, NULL); + pthread_barrier_init(&dev->barrier, NULL, 2); + pthread_barrier_init(&dev->shutdown_barrier, NULL, 2); + + /* Add the new record to the device_list. */ + pthread_mutex_lock(&device_list_mutex); + if (!device_list) + device_list = dev; + else { + hid_device *d = device_list; + while (d) { + if (!d->next) { + d->next = dev; + break; + } + d = d->next; + } + } + pthread_mutex_unlock(&device_list_mutex); + + return dev; +} + +static void free_hid_device(hid_device *dev) +{ + if (!dev) + return; + + /* Delete any input reports still left over. */ + struct input_report *rpt = dev->input_reports; + while (rpt) { + struct input_report *next = rpt->next; + free(rpt->data); + free(rpt); + rpt = next; + } + + /* Free the string and the report buffer. The check for NULL + is necessary here as CFRelease() doesn't handle NULL like + free() and others do. */ + if (dev->run_loop_mode) + CFRelease(dev->run_loop_mode); + if (dev->source) + CFRelease(dev->source); + free(dev->input_report_buf); + + /* Clean up the thread objects */ + pthread_barrier_destroy(&dev->shutdown_barrier); + pthread_barrier_destroy(&dev->barrier); + pthread_cond_destroy(&dev->condition); + pthread_mutex_destroy(&dev->mutex); + + /* Remove it from the device list. */ + pthread_mutex_lock(&device_list_mutex); + hid_device *d = device_list; + if (d == dev) { + device_list = d->next; + } + else { + while (d) { + if (d->next == dev) { + d->next = d->next->next; + break; + } + + d = d->next; + } + } + pthread_mutex_unlock(&device_list_mutex); + + /* Free the structure itself. */ + free(dev); +} + +static IOHIDManagerRef hid_mgr = 0x0; + + +#if 0 +static void register_error(hid_device *device, const char *op) +{ + +} +#endif + + +static int32_t get_int_property(IOHIDDeviceRef device, CFStringRef key) +{ + CFTypeRef ref; + int32_t value; + + ref = IOHIDDeviceGetProperty(device, key); + if (ref) { + if (CFGetTypeID(ref) == CFNumberGetTypeID()) { + CFNumberGetValue((CFNumberRef) ref, kCFNumberSInt32Type, &value); + return value; + } + } + return 0; +} + +static unsigned short get_vendor_id(IOHIDDeviceRef device) +{ + return get_int_property(device, CFSTR(kIOHIDVendorIDKey)); +} + +static unsigned short get_product_id(IOHIDDeviceRef device) +{ + return get_int_property(device, CFSTR(kIOHIDProductIDKey)); +} + + +static int32_t get_max_report_length(IOHIDDeviceRef device) +{ + return get_int_property(device, CFSTR(kIOHIDMaxInputReportSizeKey)); +} + +static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t *buf, size_t len) +{ + CFStringRef str; + + if (!len) + return 0; + + str = (CFStringRef)IOHIDDeviceGetProperty(device, prop); + + buf[0] = 0; + + if (str) { + len --; + + CFIndex str_len = CFStringGetLength(str); + CFRange range; + range.location = 0; + range.length = (str_len > len)? len: str_len; + CFIndex used_buf_len; + CFIndex chars_copied; + chars_copied = CFStringGetBytes(str, + range, + kCFStringEncodingUTF32LE, + (char)'?', + FALSE, + (UInt8*)buf, + len, + &used_buf_len); + + buf[chars_copied] = 0; + return (int)chars_copied; + } + else + return 0; + +} + +static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, char *buf, size_t len) +{ + CFStringRef str; + if (!len) + return 0; + + str = (CFStringRef)IOHIDDeviceGetProperty(device, prop); + + buf[0] = 0; + + if (str) { + len--; + + CFIndex str_len = CFStringGetLength(str); + CFRange range; + range.location = 0; + range.length = (str_len > len)? len: str_len; + CFIndex used_buf_len; + CFIndex chars_copied; + chars_copied = CFStringGetBytes(str, + range, + kCFStringEncodingUTF8, + (char)'?', + FALSE, + (UInt8*)buf, + len, + &used_buf_len); + + buf[chars_copied] = 0; + return (int)used_buf_len; + } + else + return 0; +} + + +static int get_serial_number(IOHIDDeviceRef device, wchar_t *buf, size_t len) +{ + return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); +} + +static int get_manufacturer_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) +{ + return get_string_property(device, CFSTR(kIOHIDManufacturerKey), buf, len); +} + +static int get_product_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) +{ + return get_string_property(device, CFSTR(kIOHIDProductKey), buf, len); +} + + +/* Implementation of wcsdup() for Mac. */ +static wchar_t *dup_wcs(const wchar_t *s) +{ + size_t len = wcslen(s); + wchar_t *ret = (wchar_t *)malloc((len+1)*sizeof(wchar_t)); + wcscpy(ret, s); + + return ret; +} + + +static int make_path(IOHIDDeviceRef device, char *buf, size_t len) +{ + int res; + unsigned short vid, pid; + char transport[32]; + + buf[0] = '\0'; + + res = get_string_property_utf8( + device, CFSTR(kIOHIDTransportKey), + transport, sizeof(transport)); + + if (!res) + return -1; + + vid = get_vendor_id(device); + pid = get_product_id(device); + + res = snprintf(buf, len, "%s_%04hx_%04hx_%p", + transport, vid, pid, device); + + + buf[len-1] = '\0'; + return res+1; +} + +/* Initialize the IOHIDManager. Return 0 for success and -1 for failure. */ +static int init_hid_manager(void) +{ + + /* Initialize all the HID Manager Objects */ + hid_mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + if (hid_mgr) { + IOHIDManagerSetDeviceMatching(hid_mgr, NULL); + IOHIDManagerScheduleWithRunLoop(hid_mgr, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + return 0; + } + + return -1; +} + +/* Initialize the IOHIDManager if necessary. This is the public function, and + it is safe to call this function repeatedly. Return 0 for success and -1 + for failure. */ +int HID_API_EXPORT hid_init(void) +{ + if (!hid_mgr) { + return init_hid_manager(); + } + + /* Already initialized. */ + return 0; +} + +int HID_API_EXPORT hid_exit(void) +{ + if (hid_mgr) { + /* Close the HID manager. */ + IOHIDManagerClose(hid_mgr, kIOHIDOptionsTypeNone); + CFRelease(hid_mgr); + hid_mgr = NULL; + } + + return 0; +} + +static void process_pending_events() { + SInt32 res; + do { + res = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.001, FALSE); + } while(res != kCFRunLoopRunFinished && res != kCFRunLoopRunTimedOut); +} + +struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + struct hid_device_info *root = NULL; // return object + struct hid_device_info *cur_dev = NULL; + CFIndex num_devices; + int i; + + setlocale(LC_ALL,""); + + /* Set up the HID Manager if it hasn't been done */ + if (hid_init() < 0) + return NULL; + + /* give the IOHIDManager a chance to update itself */ + process_pending_events(); + + /* Get a list of the Devices */ + CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); + if (!device_set) + return NULL; + + /* Convert the list into a C array so we can iterate easily. */ + num_devices = CFSetGetCount(device_set); + if (!num_devices) { + CFRelease(device_set); + return NULL; + } + IOHIDDeviceRef *device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef)); + CFSetGetValues(device_set, (const void **) device_array); + + /* Iterate over each device, making an entry for it. */ + for (i = 0; i < num_devices; i++) { + unsigned short dev_vid; + unsigned short dev_pid; +#define BUF_LEN 256 + wchar_t buf[BUF_LEN]; + char cbuf[BUF_LEN]; + + IOHIDDeviceRef dev = device_array[i]; + + if (!dev) { + continue; + } + dev_vid = get_vendor_id(dev); + dev_pid = get_product_id(dev); + + /* Check the VID/PID against the arguments */ + if ((vendor_id == 0x0 && product_id == 0x0) || + (vendor_id == dev_vid && product_id == dev_pid)) { + struct hid_device_info *tmp; + size_t len; + + /* VID/PID match. Create the record. */ + tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + if (cur_dev) { + cur_dev->next = tmp; + } + else { + root = tmp; + } + cur_dev = tmp; + + // Get the Usage Page and Usage for this device. + cur_dev->usage_page = get_int_property(dev, CFSTR(kIOHIDPrimaryUsagePageKey)); + cur_dev->usage = get_int_property(dev, CFSTR(kIOHIDPrimaryUsageKey)); + + /* Fill out the record */ + cur_dev->next = NULL; + len = make_path(dev, cbuf, sizeof(cbuf)); + cur_dev->path = strdup(cbuf); + + /* Serial Number */ + get_serial_number(dev, buf, BUF_LEN); + cur_dev->serial_number = dup_wcs(buf); + + /* Manufacturer and Product strings */ + get_manufacturer_string(dev, buf, BUF_LEN); + cur_dev->manufacturer_string = dup_wcs(buf); + get_product_string(dev, buf, BUF_LEN); + cur_dev->product_string = dup_wcs(buf); + + /* VID/PID */ + cur_dev->vendor_id = dev_vid; + cur_dev->product_id = dev_pid; + + /* Release Number */ + cur_dev->release_number = get_int_property(dev, CFSTR(kIOHIDVersionNumberKey)); + + /* Interface Number (Unsupported on Mac)*/ + cur_dev->interface_number = -1; + } + } + + free(device_array); + CFRelease(device_set); + + return root; +} + +void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs) +{ + /* This function is identical to the Linux version. Platform independent. */ + struct hid_device_info *d = devs; + while (d) { + struct hid_device_info *next = d->next; + free(d->path); + free(d->serial_number); + free(d->manufacturer_string); + free(d->product_string); + free(d); + d = next; + } +} + +hid_device * HID_API_EXPORT hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + /* This function is identical to the Linux version. Platform independent. */ + struct hid_device_info *devs, *cur_dev; + const char *path_to_open = NULL; + hid_device * handle = NULL; + + devs = hid_enumerate(vendor_id, product_id); + cur_dev = devs; + while (cur_dev) { + if (cur_dev->vendor_id == vendor_id && + cur_dev->product_id == product_id) { + if (serial_number) { + if (wcscmp(serial_number, cur_dev->serial_number) == 0) { + path_to_open = cur_dev->path; + break; + } + } + else { + path_to_open = cur_dev->path; + break; + } + } + cur_dev = cur_dev->next; + } + + if (path_to_open) { + /* Open the device */ + handle = hid_open_path(path_to_open, 0); + } + + hid_free_enumeration(devs); + + return handle; +} + +static void hid_device_removal_callback(void *context, IOReturn result, + void *sender, IOHIDDeviceRef dev_ref) +{ + /* Stop the Run Loop for this device. */ + pthread_mutex_lock(&device_list_mutex); + hid_device *d = device_list; + while (d) { + if (d->device_handle == dev_ref) { + d->disconnected = 1; + CFRunLoopStop(d->run_loop); + } + + d = d->next; + } + pthread_mutex_unlock(&device_list_mutex); +} + +/* The Run Loop calls this function for each input report received. + This function puts the data into a linked list to be picked up by + hid_read(). */ +static void hid_report_callback(void *context, IOReturn result, void *sender, + IOHIDReportType report_type, uint32_t report_id, + uint8_t *report, CFIndex report_length) +{ + struct input_report *rpt; + hid_device *dev = (hid_device *)context; + + /* Make a new Input Report object */ + rpt = (struct input_report *)calloc(1, sizeof(struct input_report)); + rpt->data = (uint8_t *)calloc(1, report_length); + memcpy(rpt->data, report, report_length); + rpt->len = report_length; + rpt->next = NULL; + + /* Lock this section */ + pthread_mutex_lock(&dev->mutex); + + /* Attach the new report object to the end of the list. */ + if (dev->input_reports == NULL) { + /* The list is empty. Put it at the root. */ + dev->input_reports = rpt; + } + else { + /* Find the end of the list and attach. */ + struct input_report *cur = dev->input_reports; + int num_queued = 0; + while (cur->next != NULL) { + cur = cur->next; + num_queued++; + } + cur->next = rpt; + + /* Pop one off if we've reached 30 in the queue. This + way we don't grow forever if the user never reads + anything from the device. */ + if (num_queued > 30) { + return_data(dev, NULL, 0); + } + } + + /* Signal a waiting thread that there is data. */ + pthread_cond_signal(&dev->condition); + + /* Unlock */ + pthread_mutex_unlock(&dev->mutex); + +} + +/* This gets called when the read_thred's run loop gets signaled by + hid_close(), and serves to stop the read_thread's run loop. */ +static void perform_signal_callback(void *context) +{ + hid_device *dev = (hid_device *)context; + CFRunLoopStop(dev->run_loop); //TODO: CFRunLoopGetCurrent() +} + +static void *read_thread(void *param) +{ + hid_device *dev = (hid_device *)param; + + /* Move the device's run loop to this thread. */ + IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetCurrent(), dev->run_loop_mode); + + /* Create the RunLoopSource which is used to signal the + event loop to stop when hid_close() is called. */ + CFRunLoopSourceContext ctx; + memset(&ctx, 0, sizeof(ctx)); + ctx.version = 0; + ctx.info = dev; + ctx.perform = &perform_signal_callback; + dev->source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0/*order*/, &ctx); + CFRunLoopAddSource(CFRunLoopGetCurrent(), dev->source, dev->run_loop_mode); + + /* Store off the Run Loop so it can be stopped from hid_close() + and on device disconnection. */ + dev->run_loop = CFRunLoopGetCurrent(); + + /* Notify the main thread that the read thread is up and running. */ + pthread_barrier_wait(&dev->barrier); + + /* Run the Event Loop. CFRunLoopRunInMode() will dispatch HID input + reports into the hid_report_callback(). */ + SInt32 code; + while (!dev->shutdown_thread && !dev->disconnected) { + code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE); + /* Return if the device has been disconnected */ + if (code == kCFRunLoopRunFinished) { + dev->disconnected = 1; + break; + } + + + /* Break if The Run Loop returns Finished or Stopped. */ + if (code != kCFRunLoopRunTimedOut && + code != kCFRunLoopRunHandledSource) { + /* There was some kind of error. Setting + shutdown seems to make sense, but + there may be something else more appropriate */ + dev->shutdown_thread = 1; + break; + } + } + + /* Now that the read thread is stopping, Wake any threads which are + waiting on data (in hid_read_timeout()). Do this under a mutex to + make sure that a thread which is about to go to sleep waiting on + the condition acutally will go to sleep before the condition is + signaled. */ + pthread_mutex_lock(&dev->mutex); + pthread_cond_broadcast(&dev->condition); + pthread_mutex_unlock(&dev->mutex); + + /* Wait here until hid_close() is called and makes it past + the call to CFRunLoopWakeUp(). This thread still needs to + be valid when that function is called on the other thread. */ + pthread_barrier_wait(&dev->shutdown_barrier); + + return NULL; +} + +hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) +{ + int i; + hid_device *dev = NULL; + CFIndex num_devices; + + dev = new_hid_device(); + + /* Set up the HID Manager if it hasn't been done */ + if (hid_init() < 0) + return NULL; + + /* give the IOHIDManager a chance to update itself */ + process_pending_events(); + + CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); + + num_devices = CFSetGetCount(device_set); + IOHIDDeviceRef *device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef)); + CFSetGetValues(device_set, (const void **) device_array); + for (i = 0; i < num_devices; i++) { + char cbuf[BUF_LEN]; + size_t len; + IOHIDDeviceRef os_dev = device_array[i]; + + len = make_path(os_dev, cbuf, sizeof(cbuf)); + if (!strcmp(cbuf, path)) { + // Matched Paths. Open this Device. + IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone); + if (ret == kIOReturnSuccess) { + char str[32]; + + free(device_array); + CFRelease(device_set); + dev->device_handle = os_dev; + + /* Create the buffers for receiving data */ + dev->max_input_report_len = (CFIndex) get_max_report_length(os_dev); + dev->input_report_buf = (uint8_t *)calloc(dev->max_input_report_len, sizeof(uint8_t)); + + /* Create the Run Loop Mode for this device. + printing the reference seems to work. */ + sprintf(str, "HIDAPI_%p", os_dev); + dev->run_loop_mode = + CFStringCreateWithCString(NULL, str, kCFStringEncodingASCII); + + /* Attach the device to a Run Loop */ + IOHIDDeviceRegisterInputReportCallback( + os_dev, dev->input_report_buf, dev->max_input_report_len, + &hid_report_callback, dev); + IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, hid_device_removal_callback, NULL); + + /* Start the read thread */ + pthread_create(&dev->thread, NULL, read_thread, dev); + + /* Wait here for the read thread to be initialized. */ + pthread_barrier_wait(&dev->barrier); + + return dev; + } + else { + goto return_error; + } + } + } + +return_error: + free(device_array); + CFRelease(device_set); + free_hid_device(dev); + return NULL; +} + +static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char *data, size_t length) +{ + const char *pass_through_magic = "MAGIC0"; + size_t pass_through_magic_length = strlen(pass_through_magic); + unsigned char report_id = data[0]; + const unsigned char *data_to_send; + size_t length_to_send; + IOReturn res; + + /* Return if the device has been disconnected. */ + if (dev->disconnected) + return -1; + + if (report_id == 0x0) { + /* Not using numbered Reports. + Don't send the report number. */ + data_to_send = data+1; + length_to_send = length-1; + } + else if (length > 6 && memcmp(data, pass_through_magic, pass_through_magic_length) == 0) { + report_id = data[pass_through_magic_length]; + data_to_send = data+pass_through_magic_length; + length_to_send = length-pass_through_magic_length; + } + else { + /* Using numbered Reports. + Send the Report Number */ + data_to_send = data; + length_to_send = length; + } + + if (!dev->disconnected) { + res = IOHIDDeviceSetReport(dev->device_handle, + type, + report_id, /* Report ID*/ + data_to_send, length_to_send); + + if (res == kIOReturnSuccess) { + return (int)length; + } + else if (res == kIOReturnUnsupported) { + /*printf("kIOReturnUnsupported\n");*/ + return -1; + } + else { + /*printf("0x%x\n", res);*/ + return -1; + } + } + + return -1; +} + +int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length) +{ + return set_report(dev, kIOHIDReportTypeOutput, data, length); +} + +/* Helper function, so that this isn't duplicated in hid_read(). */ +static int return_data(hid_device *dev, unsigned char *data, size_t length) +{ + /* Copy the data out of the linked list item (rpt) into the + return buffer (data), and delete the liked list item. */ + struct input_report *rpt = dev->input_reports; + size_t len = (length < rpt->len)? length: rpt->len; + memcpy(data, rpt->data, len); + dev->input_reports = rpt->next; + free(rpt->data); + free(rpt); + return (int)len; +} + +static int cond_wait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + while (!dev->input_reports) { + int res = pthread_cond_wait(cond, mutex); + if (res != 0) + return res; + + /* A res of 0 means we may have been signaled or it may + be a spurious wakeup. Check to see that there's acutally + data in the queue before returning, and if not, go back + to sleep. See the pthread_cond_timedwait() man page for + details. */ + + if (dev->shutdown_thread || dev->disconnected) + return -1; + } + + return 0; +} + +static int cond_timedwait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) +{ + while (!dev->input_reports) { + int res = pthread_cond_timedwait(cond, mutex, abstime); + if (res != 0) + return res; + + /* A res of 0 means we may have been signaled or it may + be a spurious wakeup. Check to see that there's acutally + data in the queue before returning, and if not, go back + to sleep. See the pthread_cond_timedwait() man page for + details. */ + + if (dev->shutdown_thread || dev->disconnected) + return -1; + } + + return 0; + +} + +int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) +{ + int bytes_read = -1; + + /* Lock the access to the report list. */ + pthread_mutex_lock(&dev->mutex); + + /* There's an input report queued up. Return it. */ + if (dev->input_reports) { + /* Return the first one */ + bytes_read = return_data(dev, data, length); + goto ret; + } + + /* Return if the device has been disconnected. */ + if (dev->disconnected) { + bytes_read = -1; + goto ret; + } + + if (dev->shutdown_thread) { + /* This means the device has been closed (or there + has been an error. An error code of -1 should + be returned. */ + bytes_read = -1; + goto ret; + } + + /* There is no data. Go to sleep and wait for data. */ + + if (milliseconds == -1) { + /* Blocking */ + int res; + res = cond_wait(dev, &dev->condition, &dev->mutex); + if (res == 0) + bytes_read = return_data(dev, data, length); + else { + /* There was an error, or a device disconnection. */ + bytes_read = -1; + } + } + else if (milliseconds > 0) { + /* Non-blocking, but called with timeout. */ + int res; + struct timespec ts; + struct timeval tv; + gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, &ts); + ts.tv_sec += milliseconds / 1000; + ts.tv_nsec += (milliseconds % 1000) * 1000000; + if (ts.tv_nsec >= 1000000000L) { + ts.tv_sec++; + ts.tv_nsec -= 1000000000L; + } + + res = cond_timedwait(dev, &dev->condition, &dev->mutex, &ts); + if (res == 0) + bytes_read = return_data(dev, data, length); + else if (res == ETIMEDOUT) + bytes_read = 0; + else + bytes_read = -1; + } + else { + /* Purely non-blocking */ + bytes_read = 0; + } + +ret: + /* Unlock */ + pthread_mutex_unlock(&dev->mutex); + return bytes_read; +} + +int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length) +{ + return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0); +} + +int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) +{ + /* All Nonblocking operation is handled by the library. */ + dev->blocking = !nonblock; + + return 0; +} + +int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) +{ + return set_report(dev, kIOHIDReportTypeFeature, data, length); +} + +int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) +{ + CFIndex len = length; + IOReturn res; + + /* Return if the device has been unplugged. */ + if (dev->disconnected) + return -1; + + int skipped_report_id = 0; + int report_number = data[0]; + if (report_number == 0x0) { + /* Offset the return buffer by 1, so that the report ID + will remain in byte 0. */ + data++; + len--; + skipped_report_id = 1; + } + + res = IOHIDDeviceGetReport(dev->device_handle, + kIOHIDReportTypeFeature, + report_number, /* Report ID */ + data, &len); + if (res != kIOReturnSuccess) + return -1; + + if (skipped_report_id) + len++; + + return (int)len; +} + + +void HID_API_EXPORT hid_close(hid_device *dev) +{ + if (!dev) + return; + + /* Disconnect the report callback before close. */ + if (!dev->disconnected) { + IOHIDDeviceRegisterInputReportCallback( + dev->device_handle, dev->input_report_buf, dev->max_input_report_len, + NULL, dev); + IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, NULL, dev); + IOHIDDeviceUnscheduleFromRunLoop(dev->device_handle, dev->run_loop, dev->run_loop_mode); + IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetMain(), kCFRunLoopDefaultMode); + } + + /* Cause read_thread() to stop. */ + dev->shutdown_thread = 1; + + /* Wake up the run thread's event loop so that the thread can exit. */ + CFRunLoopSourceSignal(dev->source); + CFRunLoopWakeUp(dev->run_loop); + + /* Notify the read thread that it can shut down now. */ + pthread_barrier_wait(&dev->shutdown_barrier); + + /* Wait for read_thread() to end. */ + pthread_join(dev->thread, NULL); + + /* Close the OS handle to the device, but only if it's not + been unplugged. If it's been unplugged, then calling + IOHIDDeviceClose() will crash. */ + if (!dev->disconnected) { + IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone); + } + + /* Clear out the queue of received reports. */ + pthread_mutex_lock(&dev->mutex); + while (dev->input_reports) { + return_data(dev, NULL, 0); + } + pthread_mutex_unlock(&dev->mutex); + + free_hid_device(dev); +} + +int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_manufacturer_string(dev->device_handle, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_product_string(dev->device_handle, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + return get_serial_number(dev->device_handle, string, maxlen); +} + +int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) +{ + // TODO: + + return 0; +} + + +HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) +{ + // TODO: + + return NULL; +} + + + + + + +#if 0 +static int32_t get_location_id(IOHIDDeviceRef device) +{ + return get_int_property(device, CFSTR(kIOHIDLocationIDKey)); +} + +static int32_t get_usage(IOHIDDeviceRef device) +{ + int32_t res; + res = get_int_property(device, CFSTR(kIOHIDDeviceUsageKey)); + if (!res) + res = get_int_property(device, CFSTR(kIOHIDPrimaryUsageKey)); + return res; +} + +static int32_t get_usage_page(IOHIDDeviceRef device) +{ + int32_t res; + res = get_int_property(device, CFSTR(kIOHIDDeviceUsagePageKey)); + if (!res) + res = get_int_property(device, CFSTR(kIOHIDPrimaryUsagePageKey)); + return res; +} + +static int get_transport(IOHIDDeviceRef device, wchar_t *buf, size_t len) +{ + return get_string_property(device, CFSTR(kIOHIDTransportKey), buf, len); +} + + +int main(void) +{ + IOHIDManagerRef mgr; + int i; + + mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + IOHIDManagerSetDeviceMatching(mgr, NULL); + IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone); + + CFSetRef device_set = IOHIDManagerCopyDevices(mgr); + + CFIndex num_devices = CFSetGetCount(device_set); + IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef)); + CFSetGetValues(device_set, (const void **) device_array); + + setlocale(LC_ALL, ""); + + for (i = 0; i < num_devices; i++) { + IOHIDDeviceRef dev = device_array[i]; + printf("Device: %p\n", dev); + printf(" %04hx %04hx\n", get_vendor_id(dev), get_product_id(dev)); + + wchar_t serial[256], buf[256]; + char cbuf[256]; + get_serial_number(dev, serial, 256); + + + printf(" Serial: %ls\n", serial); + printf(" Loc: %ld\n", get_location_id(dev)); + get_transport(dev, buf, 256); + printf(" Trans: %ls\n", buf); + make_path(dev, cbuf, 256); + printf(" Path: %s\n", cbuf); + + } + + return 0; +} +#endif + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-hidraw.pc.in b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-hidraw.pc.in new file mode 100644 index 0000000000..e20558d5a3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-hidraw.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: hidapi-hidraw +Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the hidraw implementation. +Version: @VERSION@ +Libs: -L${libdir} -lhidapi-hidraw +Cflags: -I${includedir}/hidapi diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-libusb.pc.in b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-libusb.pc.in new file mode 100644 index 0000000000..2e49506553 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi-libusb.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: hidapi-libusb +Description: C Library for USB HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the libusb implementation. +Version: @VERSION@ +Libs: -L${libdir} -lhidapi-libusb +Cflags: -I${includedir}/hidapi diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi.pc.in b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi.pc.in new file mode 100644 index 0000000000..5835c99bf5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/pc/hidapi.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: hidapi +Description: C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. +Version: @VERSION@ +Libs: -L${libdir} -lhidapi +Cflags: -I${includedir}/hidapi diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile-manual new file mode 100644 index 0000000000..3f61705f25 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile-manual @@ -0,0 +1,26 @@ + + +OS=$(shell uname) + +ifeq ($(OS), Darwin) + FILE=Makefile.mac +endif + +ifneq (,$(findstring MINGW,$(OS))) + FILE=Makefile.mingw +endif + +ifeq ($(OS), Linux) + FILE=Makefile.linux +endif + +ifeq ($(OS), FreeBSD) + FILE=Makefile.freebsd +endif + +ifeq ($(FILE), ) +all: + $(error Your platform ${OS} is not supported at this time.) +endif + +include $(FILE) diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.am new file mode 100644 index 0000000000..1c02f3f2c3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.am @@ -0,0 +1,43 @@ + +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ $(CFLAGS_TESTGUI) + +if OS_LINUX +## Linux +bin_PROGRAMS = hidapi-hidraw-testgui hidapi-libusb-testgui + +hidapi_hidraw_testgui_SOURCES = test.cpp +hidapi_hidraw_testgui_LDADD = $(top_builddir)/linux/libhidapi-hidraw.la $(LIBS_TESTGUI) + +hidapi_libusb_testgui_SOURCES = test.cpp +hidapi_libusb_testgui_LDADD = $(top_builddir)/libusb/libhidapi-libusb.la $(LIBS_TESTGUI) +else +## Other OS's +bin_PROGRAMS = hidapi-testgui + +hidapi_testgui_SOURCES = test.cpp +hidapi_testgui_LDADD = $(top_builddir)/$(backend)/libhidapi.la $(LIBS_TESTGUI) +endif + +if OS_DARWIN +hidapi_testgui_SOURCES = test.cpp mac_support_cocoa.m mac_support.h +# Rules for copying the binary and its dependencies into the app bundle. +TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT): hidapi-testgui$(EXEEXT) + $(srcdir)/copy_to_bundle.sh + +all: all-am TestGUI.app/Contents/MacOS/hidapi-testgui$(EXEEXT) + +endif + +EXTRA_DIST = \ + copy_to_bundle.sh \ + Makefile-manual \ + Makefile.freebsd \ + Makefile.linux \ + Makefile.mac \ + Makefile.mingw \ + TestGUI.app.in \ + testgui.sln \ + testgui.vcproj + +distclean-local: + rm -rf TestGUI.app diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.freebsd b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.freebsd new file mode 100644 index 0000000000..09a24737cc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.freebsd @@ -0,0 +1,33 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: testgui + +CC=cc +CXX=c++ +COBJS=../libusb/hid.o +CPPOBJS=test.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS=-I../hidapi -I/usr/local/include `fox-config --cflags` -Wall -g -c +LDFLAGS= -L/usr/local/lib +LIBS= -lusb -liconv `fox-config --libs` -pthread + + +testgui: $(OBJS) + $(CXX) -Wall -g $^ $(LDFLAGS) -o $@ $(LIBS) + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm *.o testgui + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.linux b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.linux new file mode 100644 index 0000000000..d32e16317b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.linux @@ -0,0 +1,32 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: testgui + +CC=gcc +CXX=g++ +COBJS=../libusb/hid.o +CPPOBJS=test.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags` `pkg-config libusb-1.0 --cflags` +LIBS=-ludev -lrt -lpthread `fox-config --libs` `pkg-config libusb-1.0 --libs` + + +testgui: $(OBJS) + g++ -Wall -g $^ $(LIBS) -o testgui + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm *.o testgui + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mac b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mac new file mode 100644 index 0000000000..cda7d49e93 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mac @@ -0,0 +1,46 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-07-03 +########################################### + +all: hidapi-testgui + +CC=gcc +CXX=g++ +COBJS=../mac/hid.o +CPPOBJS=test.o +OBJCOBJS=mac_support_cocoa.o +OBJS=$(COBJS) $(CPPOBJS) $(OBJCOBJS) +CFLAGS=-I../hidapi -Wall -g -c `fox-config --cflags` +LDFLAGS=-L/usr/X11R6/lib +LIBS=`fox-config --libs` -framework IOKit -framework CoreFoundation -framework Cocoa + + +hidapi-testgui: $(OBJS) TestGUI.app + g++ -Wall -g $(OBJS) $(LIBS) $(LDFLAGS) -o hidapi-testgui + ./copy_to_bundle.sh + #cp TestGUI.app/Contents/MacOS/hidapi-testgui TestGUI.app/Contents/MacOS/tg + #cp start.sh TestGUI.app/Contents/MacOS/hidapi-testgui + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +$(OBJCOBJS): %.o: %.m + $(CXX) $(CFLAGS) -x objective-c++ $< -o $@ + +TestGUI.app: TestGUI.app.in + rm -Rf TestGUI.app + mkdir -p TestGUI.app + cp -R TestGUI.app.in/ TestGUI.app + +clean: + rm -f $(OBJS) hidapi-testgui + rm -Rf TestGUI.app + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mingw b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mingw new file mode 100644 index 0000000000..df0f69d1d0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/Makefile.mingw @@ -0,0 +1,32 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: hidapi-testgui + +CC=gcc +CXX=g++ +COBJS=../windows/hid.o +CPPOBJS=test.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS=-I../hidapi -I../../hidapi-externals/fox/include -g -c +LIBS= -mwindows -lsetupapi -L../../hidapi-externals/fox/lib -Wl,-Bstatic -lFOX-1.6 -Wl,-Bdynamic -lgdi32 -Wl,--enable-auto-import -static-libgcc -static-libstdc++ -lkernel32 + + +hidapi-testgui: $(OBJS) + g++ -g $^ $(LIBS) -o hidapi-testgui + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm -f *.o hidapi-testgui.exe + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Info.plist b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Info.plist new file mode 100644 index 0000000000..ab473d53a8 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + + CFBundleExecutable + hidapi-testgui + CFBundleIconFile + Signal11.icns + CFBundleIdentifier + us.signal11.hidtestgui + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + testgui + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CSResourcesFileMapped + + + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/PkgInfo b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/PkgInfo new file mode 100644 index 0000000000..bd04210fb4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000..dea12de4ca Binary files /dev/null and b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings differ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns new file mode 100644 index 0000000000..bb6b7bd5f9 Binary files /dev/null and b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns differ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/copy_to_bundle.sh b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/copy_to_bundle.sh new file mode 100755 index 0000000000..f0fc767a92 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/copy_to_bundle.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +#### Configuration: +# The name of the executable. It is assumed +# that it is in the current working directory. +EXE_NAME=hidapi-testgui +# Path to the executable directory inside the bundle. +# This must be an absolute path, so use $PWD. +EXEPATH=$PWD/TestGUI.app/Contents/MacOS +# Libraries to explicitly bundle, even though they +# may not be in /opt/local. One per line. These +# are used with grep, so only a portion of the name +# is required. eg: libFOX, libz, etc. +LIBS_TO_BUNDLE=libFOX + + +function copydeps { + local file=$1 + # echo "Copying deps for $file...." + local BASE_OF_EXE=`basename $file` + + # A will contain the dependencies of this library + local A=`otool -LX $file |cut -f 1 -d " "` + local i + for i in $A; do + local BASE=`basename $i` + + # See if it's a lib we specifically want to bundle + local bundle_this_lib=0 + local j + for j in $LIBS_TO_BUNDLE; do + echo $i |grep -q $j + if [ $? -eq 0 ]; then + bundle_this_lib=1 + echo "bundling $i because it's in the list." + break; + fi + done + + # See if it's in /opt/local. Bundle all in /opt/local + local isOptLocal=0 + echo $i |grep -q /opt/local + if [ $? -eq 0 ]; then + isOptLocal=1 + echo "bundling $i because it's in /opt/local." + fi + + # Bundle the library + if [ $isOptLocal -ne 0 ] || [ $bundle_this_lib -ne 0 ]; then + + # Copy the file into the bundle if it exists. + if [ -f $EXEPATH/$BASE ]; then + z=0 + else + cp $i $EXEPATH + chmod 755 $EXEPATH/$BASE + fi + + + # echo "$BASE_OF_EXE depends on $BASE" + + # Fix the paths using install_name_tool and then + # call this function recursively for each dependency + # of this library. + if [ $BASE_OF_EXE != $BASE ]; then + + # Fix the paths + install_name_tool -id @executable_path/$BASE $EXEPATH/$BASE + install_name_tool -change $i @executable_path/$BASE $EXEPATH/$BASE_OF_EXE + + # Call this function (recursive) on + # on each dependency of this library. + copydeps $EXEPATH/$BASE + fi + fi + done +} + +rm -f $EXEPATH/* + +# Copy the binary into the bundle. Use ../libtool to do this if it's +# available beacuse if $EXE_NAME was built with autotools, it will be +# necessary. If ../libtool not available, just use cp to do the copy, but +# only if $EXE_NAME is a binary. +if [ -x ../libtool ]; then + ../libtool --mode=install cp $EXE_NAME $EXEPATH +else + file -bI $EXE_NAME |grep binary + if [ $? -ne 0 ]; then + echo "There is no ../libtool and $EXE_NAME is not a binary." + echo "I'm not sure what to do." + exit 1 + else + cp $EXE_NAME $EXEPATH + fi +fi +copydeps $EXEPATH/$EXE_NAME diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.cpp new file mode 100644 index 0000000000..e1e3874422 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.cpp @@ -0,0 +1,134 @@ +/******************************* + Mac support for HID Test GUI + + Alan Ott + Signal 11 Software + + Some of this code is from Apple Documentation, most notably + http://developer.apple.com/legacy/mac/library/documentation/AppleScript/Conceptual/AppleEvents/AppleEvents.pdf +*******************************/ + +#include +#include + + +extern FXMainWindow *g_main_window; + +static pascal OSErr HandleQuitMessage(const AppleEvent *theAppleEvent, AppleEvent + *reply, long handlerRefcon) +{ + puts("Quitting\n"); + FXApp::instance()->exit(); + return 0; +} + +static pascal OSErr HandleReopenMessage(const AppleEvent *theAppleEvent, AppleEvent + *reply, long handlerRefcon) +{ + puts("Showing"); + g_main_window->show(); + return 0; +} + +static pascal OSErr HandleWildCardMessage(const AppleEvent *theAppleEvent, AppleEvent + *reply, long handlerRefcon) +{ + puts("WildCard\n"); + return 0; +} + +OSStatus AEHandler(EventHandlerCallRef inCaller, EventRef inEvent, void* inRefcon) +{ + Boolean release = false; + EventRecord eventRecord; + OSErr ignoreErrForThisSample; + + // Events of type kEventAppleEvent must be removed from the queue + // before being passed to AEProcessAppleEvent. + if (IsEventInQueue(GetMainEventQueue(), inEvent)) + { + // RemoveEventFromQueue will release the event, which will + // destroy it if we don't retain it first. + RetainEvent(inEvent); + release = true; + RemoveEventFromQueue(GetMainEventQueue(), inEvent); + } + // Convert the event ref to the type AEProcessAppleEvent expects. + ConvertEventRefToEventRecord(inEvent, &eventRecord); + ignoreErrForThisSample = AEProcessAppleEvent(&eventRecord); + if (release) + ReleaseEvent(inEvent); + // This Carbon event has been handled, even if no AppleEvent handlers + // were installed for the Apple event. + return noErr; +} + +static void HandleEvent(EventRecord *event) +{ + //printf("What: %d message %x\n", event->what, event->message); + if (event->what == osEvt) { + if (((event->message >> 24) & 0xff) == suspendResumeMessage) { + if (event->message & resumeFlag) { + g_main_window->show(); + } + } + } + +#if 0 + switch (event->what) + { + case mouseDown: + //HandleMouseDown(event); + break; + case keyDown: + case autoKey: + //HandleKeyPress(event); + break; + case kHighLevelEvent: + puts("Calling ProcessAppleEvent\n"); + AEProcessAppleEvent(event); + break; + } +#endif +} + +void +init_apple_message_system() +{ + OSErr err; + static const EventTypeSpec appleEvents[] = + { + { kEventClassAppleEvent, kEventAppleEvent } + }; + + /* Install the handler for Apple Events */ + InstallApplicationEventHandler(NewEventHandlerUPP(AEHandler), + GetEventTypeCount(appleEvents), appleEvents, 0, NULL); + + /* Install handlers for the individual Apple Events that come + from the Dock icon: the Reopen (click), and the Quit messages. */ + err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, + NewAEEventHandlerUPP(HandleQuitMessage), 0, false); + err = AEInstallEventHandler(kCoreEventClass, kAEReopenApplication, + NewAEEventHandlerUPP(HandleReopenMessage), 0, false); +#if 0 + // Left as an example of a wild card match. + err = AEInstallEventHandler(kCoreEventClass, typeWildCard, + NewAEEventHandlerUPP(HandleWildMessage), 0, false); +#endif +} + +void +check_apple_events() +{ + RgnHandle cursorRgn = NULL; + Boolean gotEvent=TRUE; + EventRecord event; + + while (gotEvent) { + gotEvent = WaitNextEvent(everyEvent, &event, 0L/*timeout*/, cursorRgn); + if (gotEvent) { + HandleEvent(&event); + } + } +} diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.h b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.h new file mode 100644 index 0000000000..7d9ab493b5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support.h @@ -0,0 +1,17 @@ +/******************************* + Mac support for HID Test GUI + + Alan Ott + Signal 11 Software + +*******************************/ + +#ifndef MAC_SUPPORT_H__ +#define MAC_SUPPORT_H__ + +extern "C" { + void init_apple_message_system(); + void check_apple_events(); +} + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support_cocoa.m b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support_cocoa.m new file mode 100644 index 0000000000..75de7e9c42 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/mac_support_cocoa.m @@ -0,0 +1,94 @@ +/******************************* + Mac support for HID Test GUI + + Alan Ott + Signal 11 Software +*******************************/ + +#include +#import + +extern FXMainWindow *g_main_window; + + +@interface MyAppDelegate : NSObject +{ +} +@end + +@implementation MyAppDelegate +- (void) applicationWillBecomeActive:(NSNotification*)notif +{ + printf("WillBecomeActive\n"); + g_main_window->show(); + +} + +- (void) applicationWillTerminate:(NSNotification*)notif +{ + /* Doesn't get called. Not sure why */ + printf("WillTerminate\n"); + FXApp::instance()->exit(); +} + +- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication*)sender +{ + /* Doesn't get called. Not sure why */ + printf("ShouldTerminate\n"); + return YES; +} + +- (void) applicationWillHide:(NSNotification*)notif +{ + printf("WillHide\n"); + g_main_window->hide(); +} + +- (void) handleQuitEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent +{ + printf("QuitEvent\n"); + FXApp::instance()->exit(); +} + +@end + +extern "C" { + +void +init_apple_message_system() +{ + static MyAppDelegate *d = [MyAppDelegate new]; + + [[NSApplication sharedApplication] setDelegate:d]; + + /* Register for Apple Events. */ + /* This is from + http://stackoverflow.com/questions/1768497/application-exit-event */ + NSAppleEventManager *aem = [NSAppleEventManager sharedAppleEventManager]; + [aem setEventHandler:d + andSelector:@selector(handleQuitEvent:withReplyEvent:) + forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; +} + +void +check_apple_events() +{ + NSApplication *app = [NSApplication sharedApplication]; + + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + while (1) { + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue:YES]; + if (event == NULL) + break; + else { + //printf("Event happened: Type: %d\n", event->_type); + [app sendEvent: event]; + } + } + [pool release]; +} + +} /* extern "C" */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/start.sh b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/start.sh new file mode 100755 index 0000000000..980635d955 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/start.sh @@ -0,0 +1,2 @@ +#!/bin/bash +xterm -e /Users/alan/work/hidapi/testgui/TestGUI.app/Contents/MacOS/tg diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/test.cpp b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/test.cpp new file mode 100644 index 0000000000..538db79172 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/test.cpp @@ -0,0 +1,532 @@ +/******************************************************* + Demo Program for HIDAPI + + Alan Ott + Signal 11 Software + + 2010-07-20 + + Copyright 2010, All Rights Reserved + + This contents of this file may be used by anyone + for any reason without any conditions and may be + used as a starting point for your own applications + which use HIDAPI. +********************************************************/ + + +#include + +#include "hidapi.h" +#include "mac_support.h" +#include +#include +#include + +#ifdef _WIN32 + // Thanks Microsoft, but I know how to use strncpy(). + #pragma warning(disable:4996) +#endif + +class MainWindow : public FXMainWindow { + FXDECLARE(MainWindow) + +public: + enum { + ID_FIRST = FXMainWindow::ID_LAST, + ID_CONNECT, + ID_DISCONNECT, + ID_RESCAN, + ID_SEND_OUTPUT_REPORT, + ID_SEND_FEATURE_REPORT, + ID_GET_FEATURE_REPORT, + ID_CLEAR, + ID_TIMER, + ID_MAC_TIMER, + ID_LAST, + }; + +private: + FXList *device_list; + FXButton *connect_button; + FXButton *disconnect_button; + FXButton *rescan_button; + FXButton *output_button; + FXLabel *connected_label; + FXTextField *output_text; + FXTextField *output_len; + FXButton *feature_button; + FXButton *get_feature_button; + FXTextField *feature_text; + FXTextField *feature_len; + FXTextField *get_feature_text; + FXText *input_text; + FXFont *title_font; + + struct hid_device_info *devices; + hid_device *connected_device; + size_t getDataFromTextField(FXTextField *tf, char *buf, size_t len); + int getLengthFromTextField(FXTextField *tf); + + +protected: + MainWindow() {}; +public: + MainWindow(FXApp *a); + ~MainWindow(); + virtual void create(); + + long onConnect(FXObject *sender, FXSelector sel, void *ptr); + long onDisconnect(FXObject *sender, FXSelector sel, void *ptr); + long onRescan(FXObject *sender, FXSelector sel, void *ptr); + long onSendOutputReport(FXObject *sender, FXSelector sel, void *ptr); + long onSendFeatureReport(FXObject *sender, FXSelector sel, void *ptr); + long onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr); + long onClear(FXObject *sender, FXSelector sel, void *ptr); + long onTimeout(FXObject *sender, FXSelector sel, void *ptr); + long onMacTimeout(FXObject *sender, FXSelector sel, void *ptr); +}; + +// FOX 1.7 changes the timeouts to all be nanoseconds. +// Fox 1.6 had all timeouts as milliseconds. +#if (FOX_MINOR >= 7) + const int timeout_scalar = 1000*1000; +#else + const int timeout_scalar = 1; +#endif + +FXMainWindow *g_main_window; + + +FXDEFMAP(MainWindow) MainWindowMap [] = { + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_CONNECT, MainWindow::onConnect ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_DISCONNECT, MainWindow::onDisconnect ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_RESCAN, MainWindow::onRescan ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_SEND_OUTPUT_REPORT, MainWindow::onSendOutputReport ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_SEND_FEATURE_REPORT, MainWindow::onSendFeatureReport ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_GET_FEATURE_REPORT, MainWindow::onGetFeatureReport ), + FXMAPFUNC(SEL_COMMAND, MainWindow::ID_CLEAR, MainWindow::onClear ), + FXMAPFUNC(SEL_TIMEOUT, MainWindow::ID_TIMER, MainWindow::onTimeout ), + FXMAPFUNC(SEL_TIMEOUT, MainWindow::ID_MAC_TIMER, MainWindow::onMacTimeout ), +}; + +FXIMPLEMENT(MainWindow, FXMainWindow, MainWindowMap, ARRAYNUMBER(MainWindowMap)); + +MainWindow::MainWindow(FXApp *app) + : FXMainWindow(app, "HIDAPI Test Application", NULL, NULL, DECOR_ALL, 200,100, 425,700) +{ + devices = NULL; + connected_device = NULL; + + FXVerticalFrame *vf = new FXVerticalFrame(this, LAYOUT_FILL_Y|LAYOUT_FILL_X); + + FXLabel *label = new FXLabel(vf, "HIDAPI Test Tool"); + title_font = new FXFont(getApp(), "Arial", 14, FXFont::Bold); + label->setFont(title_font); + + new FXLabel(vf, + "Select a device and press Connect.", NULL, JUSTIFY_LEFT); + new FXLabel(vf, + "Output data bytes can be entered in the Output section, \n" + "separated by space, comma or brackets. Data starting with 0x\n" + "is treated as hex. Data beginning with a 0 is treated as \n" + "octal. All other data is treated as decimal.", NULL, JUSTIFY_LEFT); + new FXLabel(vf, + "Data received from the device appears in the Input section.", + NULL, JUSTIFY_LEFT); + new FXLabel(vf, + "Optionally, a report length may be specified. Extra bytes are\n" + "padded with zeros. If no length is specified, the length is \n" + "inferred from the data.", + NULL, JUSTIFY_LEFT); + new FXLabel(vf, ""); + + // Device List and Connect/Disconnect buttons + FXHorizontalFrame *hf = new FXHorizontalFrame(vf, LAYOUT_FILL_X); + //device_list = new FXList(new FXHorizontalFrame(hf,FRAME_SUNKEN|FRAME_THICK, 0,0,0,0, 0,0,0,0), NULL, 0, LISTBOX_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0,0,300,200); + device_list = new FXList(new FXHorizontalFrame(hf,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0), NULL, 0, LISTBOX_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,300,200); + FXVerticalFrame *buttonVF = new FXVerticalFrame(hf); + connect_button = new FXButton(buttonVF, "Connect", NULL, this, ID_CONNECT, BUTTON_NORMAL|LAYOUT_FILL_X); + disconnect_button = new FXButton(buttonVF, "Disconnect", NULL, this, ID_DISCONNECT, BUTTON_NORMAL|LAYOUT_FILL_X); + disconnect_button->disable(); + rescan_button = new FXButton(buttonVF, "Re-Scan devices", NULL, this, ID_RESCAN, BUTTON_NORMAL|LAYOUT_FILL_X); + new FXHorizontalFrame(buttonVF, 0, 0,0,0,0, 0,0,50,0); + + connected_label = new FXLabel(vf, "Disconnected"); + + new FXHorizontalFrame(vf); + + // Output Group Box + FXGroupBox *gb = new FXGroupBox(vf, "Output", FRAME_GROOVE|LAYOUT_FILL_X); + FXMatrix *matrix = new FXMatrix(gb, 3, MATRIX_BY_COLUMNS|LAYOUT_FILL_X); + new FXLabel(matrix, "Data"); + new FXLabel(matrix, "Length"); + new FXLabel(matrix, ""); + + //hf = new FXHorizontalFrame(gb, LAYOUT_FILL_X); + output_text = new FXTextField(matrix, 30, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); + output_text->setText("1 0x81 0"); + output_len = new FXTextField(matrix, 5, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); + output_button = new FXButton(matrix, "Send Output Report", NULL, this, ID_SEND_OUTPUT_REPORT, BUTTON_NORMAL|LAYOUT_FILL_X); + output_button->disable(); + //new FXHorizontalFrame(matrix, LAYOUT_FILL_X); + + //hf = new FXHorizontalFrame(gb, LAYOUT_FILL_X); + feature_text = new FXTextField(matrix, 30, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); + feature_len = new FXTextField(matrix, 5, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); + feature_button = new FXButton(matrix, "Send Feature Report", NULL, this, ID_SEND_FEATURE_REPORT, BUTTON_NORMAL|LAYOUT_FILL_X); + feature_button->disable(); + + get_feature_text = new FXTextField(matrix, 30, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); + new FXWindow(matrix); + get_feature_button = new FXButton(matrix, "Get Feature Report", NULL, this, ID_GET_FEATURE_REPORT, BUTTON_NORMAL|LAYOUT_FILL_X); + get_feature_button->disable(); + + + // Input Group Box + gb = new FXGroupBox(vf, "Input", FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y); + FXVerticalFrame *innerVF = new FXVerticalFrame(gb, LAYOUT_FILL_X|LAYOUT_FILL_Y); + input_text = new FXText(new FXHorizontalFrame(innerVF,LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, 0,0,0,0, 0,0,0,0), NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y); + input_text->setEditable(false); + new FXButton(innerVF, "Clear", NULL, this, ID_CLEAR, BUTTON_NORMAL|LAYOUT_RIGHT); + + +} + +MainWindow::~MainWindow() +{ + if (connected_device) + hid_close(connected_device); + hid_exit(); + delete title_font; +} + +void +MainWindow::create() +{ + FXMainWindow::create(); + show(); + + onRescan(NULL, 0, NULL); + + +#ifdef __APPLE__ + init_apple_message_system(); +#endif + + getApp()->addTimeout(this, ID_MAC_TIMER, + 50 * timeout_scalar /*50ms*/); +} + +long +MainWindow::onConnect(FXObject *sender, FXSelector sel, void *ptr) +{ + if (connected_device != NULL) + return 1; + + FXint cur_item = device_list->getCurrentItem(); + if (cur_item < 0) + return -1; + FXListItem *item = device_list->getItem(cur_item); + if (!item) + return -1; + struct hid_device_info *device_info = (struct hid_device_info*) item->getData(); + if (!device_info) + return -1; + + connected_device = hid_open_path(device_info->path); + + if (!connected_device) { + FXMessageBox::error(this, MBOX_OK, "Device Error", "Unable To Connect to Device"); + return -1; + } + + hid_set_nonblocking(connected_device, 1); + + getApp()->addTimeout(this, ID_TIMER, + 5 * timeout_scalar /*5ms*/); + + FXString s; + s.format("Connected to: %04hx:%04hx -", device_info->vendor_id, device_info->product_id); + s += FXString(" ") + device_info->manufacturer_string; + s += FXString(" ") + device_info->product_string; + connected_label->setText(s); + output_button->enable(); + feature_button->enable(); + get_feature_button->enable(); + connect_button->disable(); + disconnect_button->enable(); + input_text->setText(""); + + + return 1; +} + +long +MainWindow::onDisconnect(FXObject *sender, FXSelector sel, void *ptr) +{ + hid_close(connected_device); + connected_device = NULL; + connected_label->setText("Disconnected"); + output_button->disable(); + feature_button->disable(); + get_feature_button->disable(); + connect_button->enable(); + disconnect_button->disable(); + + getApp()->removeTimeout(this, ID_TIMER); + + return 1; +} + +long +MainWindow::onRescan(FXObject *sender, FXSelector sel, void *ptr) +{ + struct hid_device_info *cur_dev; + + device_list->clearItems(); + + // List the Devices + hid_free_enumeration(devices); + devices = hid_enumerate(0x0, 0x0); + cur_dev = devices; + while (cur_dev) { + // Add it to the List Box. + FXString s; + FXString usage_str; + s.format("%04hx:%04hx -", cur_dev->vendor_id, cur_dev->product_id); + s += FXString(" ") + cur_dev->manufacturer_string; + s += FXString(" ") + cur_dev->product_string; + usage_str.format(" (usage: %04hx:%04hx) ", cur_dev->usage_page, cur_dev->usage); + s += usage_str; + FXListItem *li = new FXListItem(s, NULL, cur_dev); + device_list->appendItem(li); + + cur_dev = cur_dev->next; + } + + if (device_list->getNumItems() == 0) + device_list->appendItem("*** No Devices Connected ***"); + else { + device_list->selectItem(0); + } + + return 1; +} + +size_t +MainWindow::getDataFromTextField(FXTextField *tf, char *buf, size_t len) +{ + const char *delim = " ,{}\t\r\n"; + FXString data = tf->getText(); + const FXchar *d = data.text(); + size_t i = 0; + + // Copy the string from the GUI. + size_t sz = strlen(d); + char *str = (char*) malloc(sz+1); + strcpy(str, d); + + // For each token in the string, parse and store in buf[]. + char *token = strtok(str, delim); + while (token) { + char *endptr; + long int val = strtol(token, &endptr, 0); + buf[i++] = val; + token = strtok(NULL, delim); + } + + free(str); + return i; +} + +/* getLengthFromTextField() + Returns length: + 0: empty text field + >0: valid length + -1: invalid length */ +int +MainWindow::getLengthFromTextField(FXTextField *tf) +{ + long int len; + FXString str = tf->getText(); + size_t sz = str.length(); + + if (sz > 0) { + char *endptr; + len = strtol(str.text(), &endptr, 0); + if (endptr != str.text() && *endptr == '\0') { + if (len <= 0) { + FXMessageBox::error(this, MBOX_OK, "Invalid length", "Enter a length greater than zero."); + return -1; + } + return len; + } + else + return -1; + } + + return 0; +} + +long +MainWindow::onSendOutputReport(FXObject *sender, FXSelector sel, void *ptr) +{ + char buf[256]; + size_t data_len, len; + int textfield_len; + + memset(buf, 0x0, sizeof(buf)); + textfield_len = getLengthFromTextField(output_len); + data_len = getDataFromTextField(output_text, buf, sizeof(buf)); + + if (textfield_len < 0) { + FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is invalid. Please enter a number in hex, octal, or decimal."); + return 1; + } + + if (textfield_len > sizeof(buf)) { + FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is too long."); + return 1; + } + + len = (textfield_len)? textfield_len: data_len; + + int res = hid_write(connected_device, (const unsigned char*)buf, len); + if (res < 0) { + FXMessageBox::error(this, MBOX_OK, "Error Writing", "Could not write to device. Error reported was: %ls", hid_error(connected_device)); + } + + return 1; +} + +long +MainWindow::onSendFeatureReport(FXObject *sender, FXSelector sel, void *ptr) +{ + char buf[256]; + size_t data_len, len; + int textfield_len; + + memset(buf, 0x0, sizeof(buf)); + textfield_len = getLengthFromTextField(feature_len); + data_len = getDataFromTextField(feature_text, buf, sizeof(buf)); + + if (textfield_len < 0) { + FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is invalid. Please enter a number in hex, octal, or decimal."); + return 1; + } + + if (textfield_len > sizeof(buf)) { + FXMessageBox::error(this, MBOX_OK, "Invalid length", "Length field is too long."); + return 1; + } + + len = (textfield_len)? textfield_len: data_len; + + int res = hid_send_feature_report(connected_device, (const unsigned char*)buf, len); + if (res < 0) { + FXMessageBox::error(this, MBOX_OK, "Error Writing", "Could not send feature report to device. Error reported was: %ls", hid_error(connected_device)); + } + + return 1; +} + +long +MainWindow::onGetFeatureReport(FXObject *sender, FXSelector sel, void *ptr) +{ + char buf[256]; + size_t len; + + memset(buf, 0x0, sizeof(buf)); + len = getDataFromTextField(get_feature_text, buf, sizeof(buf)); + + if (len != 1) { + FXMessageBox::error(this, MBOX_OK, "Too many numbers", "Enter only a single report number in the text field"); + } + + int res = hid_get_feature_report(connected_device, (unsigned char*)buf, sizeof(buf)); + if (res < 0) { + FXMessageBox::error(this, MBOX_OK, "Error Getting Report", "Could not get feature report from device. Error reported was: %ls", hid_error(connected_device)); + } + + if (res > 0) { + FXString s; + s.format("Returned Feature Report. %d bytes:\n", res); + for (int i = 0; i < res; i++) { + FXString t; + t.format("%02hhx ", buf[i]); + s += t; + if ((i+1) % 4 == 0) + s += " "; + if ((i+1) % 16 == 0) + s += "\n"; + } + s += "\n"; + input_text->appendText(s); + input_text->setBottomLine(INT_MAX); + } + + return 1; +} + +long +MainWindow::onClear(FXObject *sender, FXSelector sel, void *ptr) +{ + input_text->setText(""); + return 1; +} + +long +MainWindow::onTimeout(FXObject *sender, FXSelector sel, void *ptr) +{ + unsigned char buf[256]; + int res = hid_read(connected_device, buf, sizeof(buf)); + + if (res > 0) { + FXString s; + s.format("Received %d bytes:\n", res); + for (int i = 0; i < res; i++) { + FXString t; + t.format("%02hhx ", buf[i]); + s += t; + if ((i+1) % 4 == 0) + s += " "; + if ((i+1) % 16 == 0) + s += "\n"; + } + s += "\n"; + input_text->appendText(s); + input_text->setBottomLine(INT_MAX); + } + if (res < 0) { + input_text->appendText("hid_read() returned error\n"); + input_text->setBottomLine(INT_MAX); + } + + getApp()->addTimeout(this, ID_TIMER, + 5 * timeout_scalar /*5ms*/); + return 1; +} + +long +MainWindow::onMacTimeout(FXObject *sender, FXSelector sel, void *ptr) +{ +#ifdef __APPLE__ + check_apple_events(); + + getApp()->addTimeout(this, ID_MAC_TIMER, + 50 * timeout_scalar /*50ms*/); +#endif + + return 1; +} + +int main(int argc, char **argv) +{ + FXApp app("HIDAPI Test Application", "Signal 11 Software"); + app.init(argc, argv); + g_main_window = new MainWindow(&app); + app.create(); + app.run(); + return 0; +} diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.sln b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.sln new file mode 100644 index 0000000000..56be6c6a57 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgui", "testgui.vcproj", "{08769AC3-785A-4DDC-BFC7-1775414B7AB7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Debug|Win32.ActiveCfg = Debug|Win32 + {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Debug|Win32.Build.0 = Debug|Win32 + {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Release|Win32.ActiveCfg = Release|Win32 + {08769AC3-785A-4DDC-BFC7-1775414B7AB7}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.vcproj b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.vcproj new file mode 100644 index 0000000000..91be8eedf9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/testgui/testgui.vcproj @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/udev/99-hid.rules b/3rdparty/sdl2-2.0.9/src/hidapi/udev/99-hid.rules new file mode 100644 index 0000000000..0385f50b05 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/udev/99-hid.rules @@ -0,0 +1,33 @@ +# This is a sample udev file for HIDAPI devices which changes the permissions +# to 0666 (world readable/writable) for a specified device on Linux systems. + + +# If you are using the libusb implementation of hidapi (libusb/hid.c), then +# use something like the following line, substituting the VID and PID with +# those of your device. Note that for kernels before 2.6.24, you will need +# to substitute "usb" with "usb_device". It shouldn't hurt to use two lines +# (one each way) for compatibility with older systems. + +# HIDAPI/libusb +SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003f", MODE="0666" + + +# If you are using the hidraw implementation (linux/hid.c), then do something +# like the following, substituting the VID and PID with your device. Busnum 1 +# is USB. + +# HIDAPI/hidraw +KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003f", MODE="0666" + +# Once done, optionally rename this file for your device, and drop it into +# /etc/udev/rules.d and unplug and re-plug your device. This is all that is +# necessary to see the new permissions. Udev does not have to be restarted. + +# Note that the hexadecimal values for VID and PID are case sensitive and +# must be lower case. + +# If you think permissions of 0666 are too loose, then see: +# http://reactivated.net/writing_udev_rules.html for more information on finer +# grained permission setting. For example, it might be sufficient to just +# set the group or user owner for specific devices (for example the plugdev +# group on some systems). diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile-manual b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile-manual new file mode 100644 index 0000000000..ac471d66da --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile-manual @@ -0,0 +1,14 @@ + + +OS=$(shell uname) + +ifneq (,$(findstring MINGW,$(OS))) + FILE=Makefile.mingw +endif + +ifeq ($(FILE), ) +all: + $(error Your platform ${OS} is not supported at this time.) +endif + +include $(FILE) diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.am b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.am new file mode 100644 index 0000000000..97e261ac9e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.am @@ -0,0 +1,16 @@ +lib_LTLIBRARIES = libhidapi.la +libhidapi_la_SOURCES = hid.c +libhidapi_la_LDFLAGS = $(LTLDFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/hidapi/ +libhidapi_la_LIBADD = $(LIBS) + +hdrdir = $(includedir)/hidapi +hdr_HEADERS = $(top_srcdir)/hidapi/hidapi.h + +EXTRA_DIST = \ + ddk_build \ + hidapi.vcproj \ + hidtest.vcproj \ + Makefile-manual \ + Makefile.mingw \ + hidapi.sln diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.mingw b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.mingw new file mode 100644 index 0000000000..b8000041dd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/Makefile.mingw @@ -0,0 +1,35 @@ +########################################### +# Simple Makefile for HIDAPI test program +# +# Alan Ott +# Signal 11 Software +# 2010-06-01 +########################################### + +all: hidtest libhidapi.dll + +CC=gcc +CXX=g++ +COBJS=hid.o +CPPOBJS=../hidtest/hidtest.o +OBJS=$(COBJS) $(CPPOBJS) +CFLAGS=-I../hidapi -g -c +LIBS= -lsetupapi +DLL_LDFLAGS = -mwindows -lsetupapi + +hidtest: $(OBJS) + g++ -g $^ $(LIBS) -o hidtest + +libhidapi.dll: $(OBJS) + $(CC) -g $^ $(DLL_LDFLAGS) -o libhidapi.dll + +$(COBJS): %.o: %.c + $(CC) $(CFLAGS) $< -o $@ + +$(CPPOBJS): %.o: %.cpp + $(CXX) $(CFLAGS) $< -o $@ + +clean: + rm *.o ../hidtest/*.o hidtest.exe + +.PHONY: clean diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/hidapi.def b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/hidapi.def new file mode 100644 index 0000000000..05e35afd68 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/hidapi.def @@ -0,0 +1,17 @@ +LIBRARY hidapi +EXPORTS + hid_open @1 + hid_write @2 + hid_read @3 + hid_close @4 + hid_get_product_string @5 + hid_get_manufacturer_string @6 + hid_get_serial_number_string @7 + hid_get_indexed_string @8 + hid_error @9 + hid_set_nonblocking @10 + hid_enumerate @11 + hid_open_path @12 + hid_send_feature_report @13 + hid_get_feature_report @14 + \ No newline at end of file diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/makefile b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/makefile new file mode 100644 index 0000000000..637f712a42 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/makefile @@ -0,0 +1,49 @@ +############################################################################# +# +# Copyright (C) Microsoft Corporation 1995, 1996 +# All Rights Reserved. +# +# MAKEFILE for HID directory +# +############################################################################# + +!IFDEF WIN95_BUILD + +ROOT=..\..\..\.. + +VERSIONLIST = debug retail +IS_32 = TRUE +IS_SDK = TRUE +IS_PRIVATE = TRUE +IS_SDK = TRUE +IS_DDK = TRUE +WIN32 = TRUE +COMMONMKFILE = hidapi.mk + +!include $(ROOT)\dev\master.mk + + +!ELSE + +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the driver components of the Windows NT DDK +# + +!IF DEFINED(_NT_TARGET_VERSION) +! IF $(_NT_TARGET_VERSION)>=0x501 +! INCLUDE $(NTMAKEENV)\makefile.def +! ELSE +# Only warn once per directory +! INCLUDE $(NTMAKEENV)\makefile.plt +! IF "$(BUILD_PASS)"=="PASS1" +! message BUILDMSG: Warning : The sample "$(MAKEDIR)" is not valid for the current OS target. +! ENDIF +! ENDIF +!ELSE +! INCLUDE $(NTMAKEENV)\makefile.def +!ENDIF + +!ENDIF + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/sources b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/sources new file mode 100644 index 0000000000..7f06a0963e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/ddk_build/sources @@ -0,0 +1,23 @@ +TARGETNAME=hidapi +TARGETTYPE=DYNLINK +UMTYPE=console +UMENTRY=main + +MSC_WARNING_LEVEL=/W3 /WX + +TARGETLIBS=$(SDK_LIB_PATH)\hid.lib \ + $(SDK_LIB_PATH)\setupapi.lib \ + $(SDK_LIB_PATH)\kernel32.lib \ + $(SDK_LIB_PATH)\comdlg32.lib + +USE_MSVCRT=1 + +INCLUDES= ..\..\hidapi +SOURCES= ..\hid.c \ + + +TARGET_DESTINATION=retail + +MUI=0 +MUI_COMMENT="HID Interface DLL" + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/hid.c b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hid.c new file mode 100644 index 0000000000..3795e18ada --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hid.c @@ -0,0 +1,988 @@ +/******************************************************* + HIDAPI - Multi-Platform library for + communication with HID devices. + + Alan Ott + Signal 11 Software + + 8/22/2009 + + Copyright 2009, All Rights Reserved. + + At the discretion of the user of this library, + this software may be licensed under the terms of the + GNU General Public License v3, a BSD-Style license, or the + original HIDAPI license as outlined in the LICENSE.txt, + LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt + files located at the root of the source distribution. + These files may also be found in the public source + code repository located at: + http://github.com/signal11/hidapi . +********************************************************/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include + +#if 0 /* can cause redefinition errors on some toolchains */ +#ifdef __MINGW32__ +#include +#include +#endif + +#ifdef __CYGWIN__ +#include +#define _wcsdup wcsdup +#endif +#endif /* */ + +#ifndef _NTDEF_ +typedef LONG NTSTATUS; +#endif + +/* SDL C runtime functions */ +#include "SDL_stdinc.h" + +#define calloc SDL_calloc +#define free SDL_free +#define malloc SDL_malloc +#define memcpy SDL_memcpy +#define memset SDL_memset +#define strcmp SDL_strcmp +#define strlen SDL_strlen +#define strncpy SDL_strlcpy +#define strstr SDL_strstr +#define strtol SDL_strtol +#define wcscmp SDL_wcscmp +#define _wcsdup SDL_wcsdup + +/* The maximum number of characters that can be passed into the + HidD_Get*String() functions without it failing.*/ +#define MAX_STRING_WCHARS 0xFFF + +/*#define HIDAPI_USE_DDK*/ + +#ifdef __cplusplus +extern "C" { +#endif + #include + #include + #ifdef HIDAPI_USE_DDK + #include + #endif + + /* Copied from inc/ddk/hidclass.h, part of the Windows DDK. */ + #define HID_OUT_CTL_CODE(id) \ + CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS) + #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include +#include + + +#include "../hidapi/hidapi.h" + +#undef MIN +#define MIN(x,y) ((x) < (y)? (x): (y)) + +#ifdef _MSC_VER + /* Thanks Microsoft, but I know how to use strncpy(). */ + #pragma warning(disable:4996) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HIDAPI_USE_DDK + /* Since we're not building with the DDK, and the HID header + files aren't part of the SDK, we have to define all this + stuff here. In lookup_functions(), the function pointers + defined below are set. */ + typedef struct _HIDD_ATTRIBUTES{ + ULONG Size; + USHORT VendorID; + USHORT ProductID; + USHORT VersionNumber; + } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; + + typedef USHORT USAGE; + typedef struct _HIDP_CAPS { + USAGE Usage; + USAGE UsagePage; + USHORT InputReportByteLength; + USHORT OutputReportByteLength; + USHORT FeatureReportByteLength; + USHORT Reserved[17]; + USHORT fields_not_used_by_hidapi[10]; + } HIDP_CAPS, *PHIDP_CAPS; + typedef void* PHIDP_PREPARSED_DATA; + #define HIDP_STATUS_SUCCESS 0x110000 + + typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib); + typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len); + typedef BOOLEAN (__stdcall *HidD_GetManufacturerString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); + typedef BOOLEAN (__stdcall *HidD_GetProductString_)(HANDLE handle, PVOID buffer, ULONG buffer_len); + typedef BOOLEAN (__stdcall *HidD_SetFeature_)(HANDLE handle, PVOID data, ULONG length); + typedef BOOLEAN (__stdcall *HidD_GetFeature_)(HANDLE handle, PVOID data, ULONG length); + typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len); + typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, PHIDP_PREPARSED_DATA *preparsed_data); + typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(PHIDP_PREPARSED_DATA preparsed_data); + typedef NTSTATUS (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps); + typedef BOOLEAN (__stdcall *HidD_SetNumInputBuffers_)(HANDLE handle, ULONG number_buffers); + typedef BOOLEAN(__stdcall *HidD_SetOutputReport_ )(HANDLE handle, PVOID buffer, ULONG buffer_len); + static HidD_GetAttributes_ HidD_GetAttributes; + static HidD_GetSerialNumberString_ HidD_GetSerialNumberString; + static HidD_GetManufacturerString_ HidD_GetManufacturerString; + static HidD_GetProductString_ HidD_GetProductString; + static HidD_SetFeature_ HidD_SetFeature; + static HidD_GetFeature_ HidD_GetFeature; + static HidD_GetIndexedString_ HidD_GetIndexedString; + static HidD_GetPreparsedData_ HidD_GetPreparsedData; + static HidD_FreePreparsedData_ HidD_FreePreparsedData; + static HidP_GetCaps_ HidP_GetCaps; + static HidD_SetNumInputBuffers_ HidD_SetNumInputBuffers; + static HidD_SetOutputReport_ HidD_SetOutputReport; + + static HMODULE lib_handle = NULL; + static BOOLEAN initialized = FALSE; +#endif /* HIDAPI_USE_DDK */ + +struct hid_device_ { + HANDLE device_handle; + BOOL blocking; + USHORT output_report_length; + size_t input_report_length; + void *last_error_str; + DWORD last_error_num; + BOOL read_pending; + char *read_buf; + OVERLAPPED ol; +}; + +static hid_device *new_hid_device() +{ + hid_device *dev = (hid_device*) calloc(1, sizeof(hid_device)); + dev->device_handle = INVALID_HANDLE_VALUE; + dev->blocking = TRUE; + dev->output_report_length = 0; + dev->input_report_length = 0; + dev->last_error_str = NULL; + dev->last_error_num = 0; + dev->read_pending = FALSE; + dev->read_buf = NULL; + memset(&dev->ol, 0, sizeof(dev->ol)); + dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*initial state f=nonsignaled*/, NULL); + + return dev; +} + +static void free_hid_device(hid_device *dev) +{ + CloseHandle(dev->ol.hEvent); + CloseHandle(dev->device_handle); + LocalFree(dev->last_error_str); + free(dev->read_buf); + free(dev); +} + +static void register_error(hid_device *device, const char *op) +{ + WCHAR *ptr, *msg; + + DWORD count = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPWSTR)&msg, 0/*sz*/, + NULL); + if (!count) + return; + + /* Get rid of the CR and LF that FormatMessage() sticks at the + end of the message. Thanks Microsoft! */ + ptr = msg; + while (*ptr) { + if (*ptr == '\r') { + *ptr = 0x0000; + break; + } + ptr++; + } + + /* Store the message off in the Device entry so that + the hid_error() function can pick it up. */ + LocalFree(device->last_error_str); + device->last_error_str = msg; +} + +#ifndef HIDAPI_USE_DDK +static int lookup_functions() +{ + lib_handle = LoadLibraryA("hid.dll"); + if (lib_handle) { +#define RESOLVE(x) x = (x##_)GetProcAddress(lib_handle, #x); if (!x) return -1; + RESOLVE(HidD_GetAttributes); + RESOLVE(HidD_GetSerialNumberString); + RESOLVE(HidD_GetManufacturerString); + RESOLVE(HidD_GetProductString); + RESOLVE(HidD_SetFeature); + RESOLVE(HidD_GetFeature); + RESOLVE(HidD_GetIndexedString); + RESOLVE(HidD_GetPreparsedData); + RESOLVE(HidD_FreePreparsedData); + RESOLVE(HidP_GetCaps); + RESOLVE(HidD_SetNumInputBuffers); + RESOLVE(HidD_SetOutputReport); +#undef RESOLVE + } + else + return -1; + + return 0; +} +#endif + +static HANDLE open_device(const char *path, BOOL enumerate, BOOL bExclusive ) +{ + HANDLE handle; + // Opening with access 0 causes keyboards to stop responding in some system configurations + // http://steamcommunity.com/discussions/forum/1/1843493219428923893 + // Thanks to co-wie (Ka-wei Low ) for help narrowing down the problem on his system + //DWORD desired_access = (enumerate)? 0: (GENERIC_WRITE | GENERIC_READ); + DWORD desired_access = ( GENERIC_WRITE | GENERIC_READ ); + DWORD share_mode = bExclusive ? 0 : ( FILE_SHARE_READ | FILE_SHARE_WRITE ); + + handle = CreateFileA(path, + desired_access, + share_mode, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED,/*FILE_ATTRIBUTE_NORMAL,*/ + 0); + + return handle; +} + +int HID_API_EXPORT hid_init(void) +{ +#ifndef HIDAPI_USE_DDK + if (!initialized) { + if (lookup_functions() < 0) { + hid_exit(); + return -1; + } + initialized = TRUE; + } +#endif + return 0; +} + +int HID_API_EXPORT hid_exit(void) +{ +#ifndef HIDAPI_USE_DDK + if (lib_handle) + FreeLibrary(lib_handle); + lib_handle = NULL; + initialized = FALSE; +#endif + return 0; +} + +struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id) +{ + BOOL res; + struct hid_device_info *root = NULL; /* return object */ + struct hid_device_info *cur_dev = NULL; + + /* Windows objects for interacting with the driver. */ + GUID InterfaceClassGuid = {0x4d1e55b2, 0xf16f, 0x11cf, {0x88, 0xcb, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} }; + SP_DEVINFO_DATA devinfo_data; + SP_DEVICE_INTERFACE_DATA device_interface_data; + SP_DEVICE_INTERFACE_DETAIL_DATA_A *device_interface_detail_data = NULL; + HDEVINFO device_info_set = INVALID_HANDLE_VALUE; + int device_index = 0; + int i; + + if (hid_init() < 0) + return NULL; + + /* Initialize the Windows objects. */ + memset(&devinfo_data, 0x0, sizeof(devinfo_data)); + devinfo_data.cbSize = sizeof(SP_DEVINFO_DATA); + device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); + + /* Get information for all the devices belonging to the HID class. */ + device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + + /* Iterate over each device in the HID class, looking for the right one. */ + + for (;;) { + HANDLE write_handle = INVALID_HANDLE_VALUE; + DWORD required_size = 0; + HIDD_ATTRIBUTES attrib; + + res = SetupDiEnumDeviceInterfaces(device_info_set, + NULL, + &InterfaceClassGuid, + device_index, + &device_interface_data); + + if (!res) { + /* A return of FALSE from this function means that + there are no more devices. */ + break; + } + + /* Call with 0-sized detail size, and let the function + tell us how long the detail struct needs to be. The + size is put in &required_size. */ + res = SetupDiGetDeviceInterfaceDetailA(device_info_set, + &device_interface_data, + NULL, + 0, + &required_size, + NULL); + + /* Allocate a long enough structure for device_interface_detail_data. */ + device_interface_detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*) malloc(required_size); + device_interface_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); + + /* Get the detailed data for this device. The detail data gives us + the device path for this device, which is then passed into + CreateFile() to get a handle to the device. */ + res = SetupDiGetDeviceInterfaceDetailA(device_info_set, + &device_interface_data, + device_interface_detail_data, + required_size, + NULL, + NULL); + + if (!res) { + /* register_error(dev, "Unable to call SetupDiGetDeviceInterfaceDetail"); + Continue to the next device. */ + goto cont; + } + + /* Make sure this device is of Setup Class "HIDClass" and has a + driver bound to it. */ + for (i = 0; ; i++) { + char driver_name[256]; + + /* Populate devinfo_data. This function will return failure + when there are no more interfaces left. */ + res = SetupDiEnumDeviceInfo(device_info_set, i, &devinfo_data); + if (!res) + goto cont; + + res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data, + SPDRP_CLASS, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL); + if (!res) + goto cont; + + if (strcmp(driver_name, "HIDClass") == 0) { + /* See if there's a driver bound. */ + res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data, + SPDRP_DRIVER, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL); + if (res) + break; + } + } + + //wprintf(L"HandleName: %s\n", device_interface_detail_data->DevicePath); + + /* Open a handle to the device */ + write_handle = open_device(device_interface_detail_data->DevicePath, TRUE, FALSE); + + /* Check validity of write_handle. */ + if (write_handle == INVALID_HANDLE_VALUE) { + /* Unable to open the device. */ + //register_error(dev, "CreateFile"); + goto cont_close; + } + + + /* Get the Vendor ID and Product ID for this device. */ + attrib.Size = sizeof(HIDD_ATTRIBUTES); + HidD_GetAttributes(write_handle, &attrib); + //wprintf(L"Product/Vendor: %x %x\n", attrib.ProductID, attrib.VendorID); + + /* Check the VID/PID to see if we should add this + device to the enumeration list. */ + if ((vendor_id == 0x0 || attrib.VendorID == vendor_id) && + (product_id == 0x0 || attrib.ProductID == product_id)) { + + #define WSTR_LEN 512 + const char *str; + struct hid_device_info *tmp; + PHIDP_PREPARSED_DATA pp_data = NULL; + HIDP_CAPS caps; + BOOLEAN hidp_res; + NTSTATUS nt_res; + wchar_t wstr[WSTR_LEN]; /* TODO: Determine Size */ + size_t len; + + /* VID/PID match. Create the record. */ + tmp = (struct hid_device_info*) calloc(1, sizeof(struct hid_device_info)); + if (cur_dev) { + cur_dev->next = tmp; + } + else { + root = tmp; + } + cur_dev = tmp; + + /* Get the Usage Page and Usage for this device. */ + hidp_res = HidD_GetPreparsedData(write_handle, &pp_data); + if (hidp_res) { + nt_res = HidP_GetCaps(pp_data, &caps); + if (nt_res == HIDP_STATUS_SUCCESS) { + cur_dev->usage_page = caps.UsagePage; + cur_dev->usage = caps.Usage; + } + + HidD_FreePreparsedData(pp_data); + } + + /* Fill out the record */ + cur_dev->next = NULL; + str = device_interface_detail_data->DevicePath; + if (str) { + len = strlen(str); + cur_dev->path = (char*) calloc(len+1, sizeof(char)); + strncpy(cur_dev->path, str, len+1); + cur_dev->path[len] = '\0'; + } + else + cur_dev->path = NULL; + + /* Serial Number */ + hidp_res = HidD_GetSerialNumberString(write_handle, wstr, sizeof(wstr)); + wstr[WSTR_LEN-1] = 0x0000; + if (hidp_res) { + cur_dev->serial_number = _wcsdup(wstr); + } + + /* Manufacturer String */ + hidp_res = HidD_GetManufacturerString(write_handle, wstr, sizeof(wstr)); + wstr[WSTR_LEN-1] = 0x0000; + if (hidp_res) { + cur_dev->manufacturer_string = _wcsdup(wstr); + } + + /* Product String */ + hidp_res = HidD_GetProductString(write_handle, wstr, sizeof(wstr)); + wstr[WSTR_LEN-1] = 0x0000; + if (hidp_res) { + cur_dev->product_string = _wcsdup(wstr); + } + + /* VID/PID */ + cur_dev->vendor_id = attrib.VendorID; + cur_dev->product_id = attrib.ProductID; + + /* Release Number */ + cur_dev->release_number = attrib.VersionNumber; + + /* Interface Number. It can sometimes be parsed out of the path + on Windows if a device has multiple interfaces. See + http://msdn.microsoft.com/en-us/windows/hardware/gg487473 or + search for "Hardware IDs for HID Devices" at MSDN. If it's not + in the path, it's set to -1. */ + cur_dev->interface_number = -1; + if (cur_dev->path) { + char *interface_component = strstr(cur_dev->path, "&mi_"); + if (interface_component) { + char *hex_str = interface_component + 4; + char *endptr = NULL; + cur_dev->interface_number = strtol(hex_str, &endptr, 16); + if (endptr == hex_str) { + /* The parsing failed. Set interface_number to -1. */ + cur_dev->interface_number = -1; + } + } + } + } + +cont_close: + CloseHandle(write_handle); +cont: + /* We no longer need the detail data. It can be freed */ + free(device_interface_detail_data); + + device_index++; + + } + + /* Close the device information handle. */ + SetupDiDestroyDeviceInfoList(device_info_set); + + return root; + +} + +void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs) +{ + /* TODO: Merge this with the Linux version. This function is platform-independent. */ + struct hid_device_info *d = devs; + while (d) { + struct hid_device_info *next = d->next; + free(d->path); + free(d->serial_number); + free(d->manufacturer_string); + free(d->product_string); + free(d); + d = next; + } +} + + +HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) +{ + /* TODO: Merge this functions with the Linux version. This function should be platform independent. */ + struct hid_device_info *devs, *cur_dev; + const char *path_to_open = NULL; + hid_device *handle = NULL; + + devs = hid_enumerate(vendor_id, product_id); + cur_dev = devs; + while (cur_dev) { + if (cur_dev->vendor_id == vendor_id && + cur_dev->product_id == product_id) { + if (serial_number) { + if (wcscmp(serial_number, cur_dev->serial_number) == 0) { + path_to_open = cur_dev->path; + break; + } + } + else { + path_to_open = cur_dev->path; + break; + } + } + cur_dev = cur_dev->next; + } + + if (path_to_open) { + /* Open the device */ + handle = hid_open_path(path_to_open, 0); + } + + hid_free_enumeration(devs); + + return handle; +} + +HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive) +{ + hid_device *dev; + HIDP_CAPS caps; + PHIDP_PREPARSED_DATA pp_data = NULL; + BOOLEAN res; + NTSTATUS nt_res; + + if (hid_init() < 0) { + return NULL; + } + + dev = new_hid_device(); + + /* Open a handle to the device */ + dev->device_handle = open_device(path, FALSE, bExclusive); + + /* Check validity of write_handle. */ + if (dev->device_handle == INVALID_HANDLE_VALUE) { + /* Unable to open the device. */ + register_error(dev, "CreateFile"); + goto err; + } + + /* Set the Input Report buffer size to 64 reports. */ + res = HidD_SetNumInputBuffers(dev->device_handle, 64); + if (!res) { + register_error(dev, "HidD_SetNumInputBuffers"); + goto err; + } + + /* Get the Input Report length for the device. */ + res = HidD_GetPreparsedData(dev->device_handle, &pp_data); + if (!res) { + register_error(dev, "HidD_GetPreparsedData"); + goto err; + } + nt_res = HidP_GetCaps(pp_data, &caps); + if (nt_res != HIDP_STATUS_SUCCESS) { + register_error(dev, "HidP_GetCaps"); + goto err_pp_data; + } + dev->output_report_length = caps.OutputReportByteLength; + dev->input_report_length = caps.InputReportByteLength; + HidD_FreePreparsedData(pp_data); + + dev->read_buf = (char*) malloc(dev->input_report_length); + + return dev; + +err_pp_data: + HidD_FreePreparsedData(pp_data); +err: + free_hid_device(dev); + return NULL; +} + +int HID_API_EXPORT HID_API_CALL hid_write_output_report(hid_device *dev, const unsigned char *data, size_t length) +{ + BOOL res; + res = HidD_SetOutputReport(dev->device_handle, (void *)data, (ULONG)length); + if (res) + return (int)length; + else + return -1; +} + +int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length) +{ + DWORD bytes_written; + BOOL res; + size_t stashed_length = length; + OVERLAPPED ol; + unsigned char *buf; + memset(&ol, 0, sizeof(ol)); + + /* Make sure the right number of bytes are passed to WriteFile. Windows + expects the number of bytes which are in the _longest_ report (plus + one for the report number) bytes even if the data is a report + which is shorter than that. Windows gives us this value in + caps.OutputReportByteLength. If a user passes in fewer bytes than this, + create a temporary buffer which is the proper size. */ + if (length >= dev->output_report_length) { + /* The user passed the right number of bytes. Use the buffer as-is. */ + buf = (unsigned char *) data; + } else { + /* Create a temporary buffer and copy the user's data + into it, padding the rest with zeros. */ + buf = (unsigned char *) malloc(dev->output_report_length); + memcpy(buf, data, length); + memset(buf + length, 0, dev->output_report_length - length); + length = dev->output_report_length; + } + if (length > 512) + { + return hid_write_output_report( dev, data, stashed_length ); + } + else + { + res = WriteFile( dev->device_handle, buf, ( DWORD ) length, NULL, &ol ); + if (!res) { + if (GetLastError() != ERROR_IO_PENDING) { + /* WriteFile() failed. Return error. */ + register_error(dev, "WriteFile"); + bytes_written = (DWORD) -1; + goto end_of_function; + } + } + + /* Wait here until the write is done. This makes + hid_write() synchronous. */ + res = GetOverlappedResult(dev->device_handle, &ol, &bytes_written, TRUE/*wait*/); + if (!res) { + /* The Write operation failed. */ + register_error(dev, "WriteFile"); + bytes_written = (DWORD) -1; + goto end_of_function; + } + } +end_of_function: + if (buf != data) + free(buf); + + return bytes_written; +} + + +int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds) +{ + DWORD bytes_read = 0; + size_t copy_len = 0; + BOOL res; + + /* Copy the handle for convenience. */ + HANDLE ev = dev->ol.hEvent; + + if (!dev->read_pending) { + /* Start an Overlapped I/O read. */ + dev->read_pending = TRUE; + memset(dev->read_buf, 0, dev->input_report_length); + ResetEvent(ev); + res = ReadFile(dev->device_handle, dev->read_buf, (DWORD)dev->input_report_length, &bytes_read, &dev->ol); + + if (!res) { + if (GetLastError() != ERROR_IO_PENDING) { + /* ReadFile() has failed. + Clean up and return error. */ + CancelIo(dev->device_handle); + dev->read_pending = FALSE; + goto end_of_function; + } + } + } + + if (milliseconds >= 0) { + /* See if there is any data yet. */ + res = WaitForSingleObject(ev, milliseconds); + if (res != WAIT_OBJECT_0) { + /* There was no data this time. Return zero bytes available, + but leave the Overlapped I/O running. */ + return 0; + } + } + + /* Either WaitForSingleObject() told us that ReadFile has completed, or + we are in non-blocking mode. Get the number of bytes read. The actual + data has been copied to the data[] array which was passed to ReadFile(). */ + res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/); + + /* Set pending back to false, even if GetOverlappedResult() returned error. */ + dev->read_pending = FALSE; + + if (res && bytes_read > 0) { + if (dev->read_buf[0] == 0x0) { + /* If report numbers aren't being used, but Windows sticks a report + number (0x0) on the beginning of the report anyway. To make this + work like the other platforms, and to make it work more like the + HID spec, we'll skip over this byte. */ + bytes_read--; + copy_len = length > bytes_read ? bytes_read : length; + memcpy(data, dev->read_buf+1, copy_len); + } + else { + /* Copy the whole buffer, report number and all. */ + copy_len = length > bytes_read ? bytes_read : length; + memcpy(data, dev->read_buf, copy_len); + } + } + +end_of_function: + if (!res) { + register_error(dev, "GetOverlappedResult"); + return -1; + } + + return (int)copy_len; +} + +int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length) +{ + return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0); +} + +int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonblock) +{ + dev->blocking = !nonblock; + return 0; /* Success */ +} + +int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) +{ + BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, (ULONG)length); + if (!res) { + register_error(dev, "HidD_SetFeature"); + return -1; + } + + return (int)length; +} + + +int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) +{ + BOOL res; +#if 0 + res = HidD_GetFeature(dev->device_handle, (PVOID)data, (ULONG)length); + if (!res) { + register_error(dev, "HidD_GetFeature"); + return -1; + } + return 0; /* HidD_GetFeature() doesn't give us an actual length, unfortunately */ +#else + DWORD bytes_returned; + + OVERLAPPED ol; + memset(&ol, 0, sizeof(ol)); + + res = DeviceIoControl(dev->device_handle, + IOCTL_HID_GET_FEATURE, + data, (DWORD)length, + data, (DWORD)length, + &bytes_returned, &ol); + + if (!res) { + if (GetLastError() != ERROR_IO_PENDING) { + /* DeviceIoControl() failed. Return error. */ + register_error(dev, "Send Feature Report DeviceIoControl"); + return -1; + } + } + + /* Wait here until the write is done. This makes + hid_get_feature_report() synchronous. */ + res = GetOverlappedResult(dev->device_handle, &ol, &bytes_returned, TRUE/*wait*/); + if (!res) { + /* The operation failed. */ + register_error(dev, "Send Feature Report GetOverLappedResult"); + return -1; + } + + /* bytes_returned does not include the first byte which contains the + report ID. The data buffer actually contains one more byte than + bytes_returned. */ + bytes_returned++; + + + return bytes_returned; +#endif +} + +void HID_API_EXPORT HID_API_CALL hid_close(hid_device *dev) +{ + if (!dev) + return; + CancelIo(dev->device_handle); + free_hid_device(dev); +} + +int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + BOOL res; + + res = HidD_GetManufacturerString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); + if (!res) { + register_error(dev, "HidD_GetManufacturerString"); + return -1; + } + + return 0; +} + +int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + BOOL res; + + res = HidD_GetProductString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); + if (!res) { + register_error(dev, "HidD_GetProductString"); + return -1; + } + + return 0; +} + +int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen) +{ + BOOL res; + + res = HidD_GetSerialNumberString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); + if (!res) { + register_error(dev, "HidD_GetSerialNumberString"); + return -1; + } + + return 0; +} + +int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) +{ + BOOL res; + + res = HidD_GetIndexedString(dev->device_handle, string_index, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); + if (!res) { + register_error(dev, "HidD_GetIndexedString"); + return -1; + } + + return 0; +} + +HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) +{ + return (wchar_t*)dev->last_error_str; +} + + +#if 0 + +/*#define PICPGM*/ +/*#define S11*/ +#define P32 +#ifdef S11 + unsigned short VendorID = 0xa0a0; + unsigned short ProductID = 0x0001; +#endif + +#ifdef P32 + unsigned short VendorID = 0x04d8; + unsigned short ProductID = 0x3f; +#endif + +#ifdef PICPGM + unsigned short VendorID = 0x04d8; + unsigned short ProductID = 0x0033; +#endif + +int __cdecl main(int argc, char* argv[]) +{ + int res; + unsigned char buf[65]; + + UNREFERENCED_PARAMETER(argc); + UNREFERENCED_PARAMETER(argv); + + /* Set up the command buffer. */ + memset(buf,0x00,sizeof(buf)); + buf[0] = 0; + buf[1] = 0x81; + + + /* Open the device. */ + int handle = open(VendorID, ProductID, L"12345"); + if (handle < 0) + printf("unable to open device\n"); + + + /* Toggle LED (cmd 0x80) */ + buf[1] = 0x80; + res = write(handle, buf, 65); + if (res < 0) + printf("Unable to write()\n"); + + /* Request state (cmd 0x81) */ + buf[1] = 0x81; + write(handle, buf, 65); + if (res < 0) + printf("Unable to write() (2)\n"); + + /* Read requested state */ + read(handle, buf, 65); + if (res < 0) + printf("Unable to read()\n"); + + /* Print out the returned buffer. */ + for (int i = 0; i < 4; i++) + printf("buf[%d]: %d\n", i, buf[i]); + + return 0; +} +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.sln b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.sln new file mode 100644 index 0000000000..d45c397bf5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "hidapi.vcproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidtest", "hidtest.vcproj", "{23E9FF6A-49D1-4993-B2B5-BBB992C6C712}" + ProjectSection(ProjectDependencies) = postProject + {A107C21C-418A-4697-BB10-20C3AA60E2E4} = {A107C21C-418A-4697-BB10-20C3AA60E2E4} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|Win32.ActiveCfg = Debug|Win32 + {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Debug|Win32.Build.0 = Debug|Win32 + {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|Win32.ActiveCfg = Release|Win32 + {A107C21C-418A-4697-BB10-20C3AA60E2E4}.Release|Win32.Build.0 = Release|Win32 + {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|Win32.ActiveCfg = Debug|Win32 + {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Debug|Win32.Build.0 = Debug|Win32 + {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|Win32.ActiveCfg = Release|Win32 + {23E9FF6A-49D1-4993-B2B5-BBB992C6C712}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.vcproj b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.vcproj new file mode 100644 index 0000000000..aea5a0bdc7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidapi.vcproj @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidtest.vcproj b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidtest.vcproj new file mode 100644 index 0000000000..cf71195826 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/hidapi/windows/hidtest.vcproj @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontroller.c b/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontroller.c new file mode 100644 index 0000000000..eb1ef06546 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontroller.c @@ -0,0 +1,2075 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* This is the game controller API for Simple DirectMedia Layer */ + +#include "SDL_events.h" +#include "SDL_assert.h" +#include "SDL_hints.h" +#include "SDL_timer.h" +#include "SDL_sysjoystick.h" +#include "SDL_joystick_c.h" +#include "SDL_gamecontrollerdb.h" + +#if !SDL_EVENTS_DISABLED +#include "../events/SDL_events_c.h" +#endif + +#if defined(__ANDROID__) +#include "SDL_system.h" +#endif + + +/* Many controllers turn the center button into an instantaneous button press */ +#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250 + +#define SDL_CONTROLLER_PLATFORM_FIELD "platform:" + +/* a list of currently opened game controllers */ +static SDL_GameController *SDL_gamecontrollers = NULL; + +typedef struct +{ + SDL_GameControllerBindType inputType; + union + { + int button; + + struct { + int axis; + int axis_min; + int axis_max; + } axis; + + struct { + int hat; + int hat_mask; + } hat; + + } input; + + SDL_GameControllerBindType outputType; + union + { + SDL_GameControllerButton button; + + struct { + SDL_GameControllerAxis axis; + int axis_min; + int axis_max; + } axis; + + } output; + +} SDL_ExtendedGameControllerBind; + +/* our hard coded list of mapping support */ +typedef enum +{ + SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT, + SDL_CONTROLLER_MAPPING_PRIORITY_API, + SDL_CONTROLLER_MAPPING_PRIORITY_USER, +} SDL_ControllerMappingPriority; + +typedef struct _ControllerMapping_t +{ + SDL_JoystickGUID guid; + char *name; + char *mapping; + SDL_ControllerMappingPriority priority; + struct _ControllerMapping_t *next; +} ControllerMapping_t; + +static SDL_JoystickGUID s_zeroGUID; +static ControllerMapping_t *s_pSupportedControllers = NULL; +static ControllerMapping_t *s_pDefaultMapping = NULL; +static ControllerMapping_t *s_pHIDAPIMapping = NULL; +static ControllerMapping_t *s_pXInputMapping = NULL; + +/* The SDL game controller structure */ +struct _SDL_GameController +{ + SDL_Joystick *joystick; /* underlying joystick device */ + int ref_count; + + const char *name; + int num_bindings; + SDL_ExtendedGameControllerBind *bindings; + SDL_ExtendedGameControllerBind **last_match_axis; + Uint8 *last_hat_mask; + Uint32 guide_button_down; + + struct _SDL_GameController *next; /* pointer to next game controller we have allocated */ +}; + + +typedef struct +{ + int num_entries; + int max_entries; + Uint32 *entries; +} SDL_vidpid_list; + +static SDL_vidpid_list SDL_allowed_controllers; +static SDL_vidpid_list SDL_ignored_controllers; + +static void +SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list) +{ + Uint32 entry; + char *spot; + char *file = NULL; + + list->num_entries = 0; + + if (hint && *hint == '@') { + spot = file = (char *)SDL_LoadFile(hint+1, NULL); + } else { + spot = (char *)hint; + } + + if (!spot) { + return; + } + + while ((spot = SDL_strstr(spot, "0x")) != NULL) { + entry = (Uint16)SDL_strtol(spot, &spot, 0); + entry <<= 16; + spot = SDL_strstr(spot, "0x"); + if (!spot) { + break; + } + entry |= (Uint16)SDL_strtol(spot, &spot, 0); + + if (list->num_entries == list->max_entries) { + int max_entries = list->max_entries + 16; + Uint32 *entries = (Uint32 *)SDL_realloc(list->entries, max_entries*sizeof(*list->entries)); + if (entries == NULL) { + /* Out of memory, go with what we have already */ + break; + } + list->entries = entries; + list->max_entries = max_entries; + } + list->entries[list->num_entries++] = entry; + } + + if (file) { + SDL_free(file); + } +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers); +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers); +} + +static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); +static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); + +/* + * If there is an existing add event in the queue, it needs to be modified + * to have the right value for which, because the number of controllers in + * the system is now one less. + */ +static void UpdateEventsForDeviceRemoval() +{ + int i, num_events; + SDL_Event *events; + + num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEADDED); + if (num_events <= 0) { + return; + } + + events = SDL_stack_alloc(SDL_Event, num_events); + if (!events) { + return; + } + + num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEADDED); + for (i = 0; i < num_events; ++i) { + --events[i].cdevice.which; + } + SDL_PeepEvents(events, num_events, SDL_ADDEVENT, 0, 0); + + SDL_stack_free(events); +} + +static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGameControllerBind *b) +{ + if (a->outputType != b->outputType) { + return SDL_FALSE; + } + + if (a->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + return (a->output.axis.axis == b->output.axis.axis); + } else { + return (a->output.button == b->output.button); + } +} + +static void ResetOutput(SDL_GameController *gamecontroller, SDL_ExtendedGameControllerBind *bind) +{ + if (bind->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, bind->output.axis.axis, 0); + } else { + SDL_PrivateGameControllerButton(gamecontroller, bind->output.button, SDL_RELEASED); + } +} + +static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int value) +{ + int i; + SDL_ExtendedGameControllerBind *last_match = gamecontroller->last_match_axis[axis]; + SDL_ExtendedGameControllerBind *match = NULL; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + axis == binding->input.axis.axis) { + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + if (value >= binding->input.axis.axis_min && + value <= binding->input.axis.axis_max) { + match = binding; + break; + } + } else { + if (value >= binding->input.axis.axis_max && + value <= binding->input.axis.axis_min) { + match = binding; + break; + } + } + } + } + + if (last_match && (!match || !HasSameOutput(last_match, match))) { + /* Clear the last input that this axis generated */ + ResetOutput(gamecontroller, last_match); + } + + if (match) { + if (match->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) { + float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min); + value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min)); + } + SDL_PrivateGameControllerAxis(gamecontroller, match->output.axis.axis, (Sint16)value); + } else { + Uint8 state; + int threshold = match->input.axis.axis_min + (match->input.axis.axis_max - match->input.axis.axis_min) / 2; + if (match->input.axis.axis_max < match->input.axis.axis_min) { + state = (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } else { + state = (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + SDL_PrivateGameControllerButton(gamecontroller, match->output.button, state); + } + } + gamecontroller->last_match_axis[axis] = match; +} + +static void HandleJoystickButton(SDL_GameController *gamecontroller, int button, Uint8 state) +{ + int i; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON && + button == binding->input.button) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min; + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)value); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, state); + } + break; + } + } +} + +static void HandleJoystickHat(SDL_GameController *gamecontroller, int hat, Uint8 value) +{ + int i; + Uint8 last_mask = gamecontroller->last_hat_mask[hat]; + Uint8 changed_mask = (last_mask ^ value); + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT && hat == binding->input.hat.hat) { + if ((changed_mask & binding->input.hat.hat_mask) != 0) { + if (value & binding->input.hat.hat_mask) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, SDL_PRESSED); + } + } else { + ResetOutput(gamecontroller, binding); + } + } + } + } + gamecontroller->last_hat_mask[hat] = value; +} + +/* + * Event filter to fire controller events from joystick ones + */ +static int SDLCALL SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) +{ + switch(event->type) { + case SDL_JOYAXISMOTION: + { + SDL_GameController *controllerlist = SDL_gamecontrollers; + while (controllerlist) { + if (controllerlist->joystick->instance_id == event->jaxis.which) { + HandleJoystickAxis(controllerlist, event->jaxis.axis, event->jaxis.value); + break; + } + controllerlist = controllerlist->next; + } + } + break; + case SDL_JOYBUTTONDOWN: + case SDL_JOYBUTTONUP: + { + SDL_GameController *controllerlist = SDL_gamecontrollers; + while (controllerlist) { + if (controllerlist->joystick->instance_id == event->jbutton.which) { + HandleJoystickButton(controllerlist, event->jbutton.button, event->jbutton.state); + break; + } + controllerlist = controllerlist->next; + } + } + break; + case SDL_JOYHATMOTION: + { + SDL_GameController *controllerlist = SDL_gamecontrollers; + while (controllerlist) { + if (controllerlist->joystick->instance_id == event->jhat.which) { + HandleJoystickHat(controllerlist, event->jhat.hat, event->jhat.value); + break; + } + controllerlist = controllerlist->next; + } + } + break; + case SDL_JOYDEVICEADDED: + { + if (SDL_IsGameController(event->jdevice.which)) { + SDL_Event deviceevent; + deviceevent.type = SDL_CONTROLLERDEVICEADDED; + deviceevent.cdevice.which = event->jdevice.which; + SDL_PushEvent(&deviceevent); + } + } + break; + case SDL_JOYDEVICEREMOVED: + { + SDL_GameController *controllerlist = SDL_gamecontrollers; + while (controllerlist) { + if (controllerlist->joystick->instance_id == event->jdevice.which) { + SDL_Event deviceevent; + + deviceevent.type = SDL_CONTROLLERDEVICEREMOVED; + deviceevent.cdevice.which = event->jdevice.which; + SDL_PushEvent(&deviceevent); + + UpdateEventsForDeviceRemoval(); + break; + } + controllerlist = controllerlist->next; + } + } + break; + default: + break; + } + + return 1; +} + +/* + * Helper function to scan the mappings database for a controller with the specified GUID + */ +static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid, SDL_bool exact_match) +{ + ControllerMapping_t *pSupportedController = s_pSupportedControllers; + while (pSupportedController) { + if (SDL_memcmp(guid, &pSupportedController->guid, sizeof(*guid)) == 0) { + return pSupportedController; + } + pSupportedController = pSupportedController->next; + } + if (!exact_match) { + if (SDL_IsJoystickHIDAPI(*guid)) { + /* This is a HIDAPI device */ + return s_pHIDAPIMapping; + } +#if SDL_JOYSTICK_XINPUT + if (SDL_IsJoystickXInput(*guid)) { + /* This is an XInput device */ + return s_pXInputMapping; + } +#endif + } + return NULL; +} + +static const char* map_StringForControllerAxis[] = { + "leftx", + "lefty", + "rightx", + "righty", + "lefttrigger", + "righttrigger", + NULL +}; + +/* + * convert a string to its enum equivalent + */ +SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString) +{ + int entry; + + if (pchString && (*pchString == '+' || *pchString == '-')) { + ++pchString; + } + + if (!pchString || !pchString[0]) { + return SDL_CONTROLLER_AXIS_INVALID; + } + + for (entry = 0; map_StringForControllerAxis[entry]; ++entry) { + if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry])) + return (SDL_GameControllerAxis) entry; + } + return SDL_CONTROLLER_AXIS_INVALID; +} + +/* + * convert an enum to its string equivalent + */ +const char* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis) +{ + if (axis > SDL_CONTROLLER_AXIS_INVALID && axis < SDL_CONTROLLER_AXIS_MAX) { + return map_StringForControllerAxis[axis]; + } + return NULL; +} + +static const char* map_StringForControllerButton[] = { + "a", + "b", + "x", + "y", + "back", + "guide", + "start", + "leftstick", + "rightstick", + "leftshoulder", + "rightshoulder", + "dpup", + "dpdown", + "dpleft", + "dpright", + NULL +}; + +/* + * convert a string to its enum equivalent + */ +SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchString) +{ + int entry; + if (!pchString || !pchString[0]) + return SDL_CONTROLLER_BUTTON_INVALID; + + for (entry = 0; map_StringForControllerButton[entry]; ++entry) { + if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0) + return (SDL_GameControllerButton) entry; + } + return SDL_CONTROLLER_BUTTON_INVALID; +} + +/* + * convert an enum to its string equivalent + */ +const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis) +{ + if (axis > SDL_CONTROLLER_BUTTON_INVALID && axis < SDL_CONTROLLER_BUTTON_MAX) { + return map_StringForControllerButton[axis]; + } + return NULL; +} + +/* + * given a controller button name and a joystick name update our mapping structure with it + */ +static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontroller, const char *szGameButton, const char *szJoystickButton) +{ + SDL_ExtendedGameControllerBind bind; + SDL_GameControllerButton button; + SDL_GameControllerAxis axis; + SDL_bool invert_input = SDL_FALSE; + char half_axis_input = 0; + char half_axis_output = 0; + + if (*szGameButton == '+' || *szGameButton == '-') { + half_axis_output = *szGameButton++; + } + + axis = SDL_GameControllerGetAxisFromString(szGameButton); + button = SDL_GameControllerGetButtonFromString(szGameButton); + if (axis != SDL_CONTROLLER_AXIS_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.output.axis.axis = axis; + if (axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else { + if (half_axis_output == '+') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_output == '-') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; + } else { + bind.output.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } + } + } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.output.button = button; + } else { + SDL_SetError("Unexpected controller element %s", szGameButton); + return; + } + + if (*szJoystickButton == '+' || *szJoystickButton == '-') { + half_axis_input = *szJoystickButton++; + } + if (szJoystickButton[SDL_strlen(szJoystickButton) - 1] == '~') { + invert_input = SDL_TRUE; + } + + if (szJoystickButton[0] == 'a' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]); + if (half_axis_input == '+') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_input == '-') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; + } else { + bind.input.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } + if (invert_input) { + int tmp = bind.input.axis.axis_min; + bind.input.axis.axis_min = bind.input.axis.axis_max; + bind.input.axis.axis_max = tmp; + } + } else if (szJoystickButton[0] == 'b' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.input.button = SDL_atoi(&szJoystickButton[1]); + } else if (szJoystickButton[0] == 'h' && SDL_isdigit(szJoystickButton[1]) && + szJoystickButton[2] == '.' && SDL_isdigit(szJoystickButton[3])) { + int hat = SDL_atoi(&szJoystickButton[1]); + int mask = SDL_atoi(&szJoystickButton[3]); + bind.inputType = SDL_CONTROLLER_BINDTYPE_HAT; + bind.input.hat.hat = hat; + bind.input.hat.hat_mask = mask; + } else { + SDL_SetError("Unexpected joystick element: %s", szJoystickButton); + return; + } + + ++gamecontroller->num_bindings; + gamecontroller->bindings = (SDL_ExtendedGameControllerBind *)SDL_realloc(gamecontroller->bindings, gamecontroller->num_bindings * sizeof(*gamecontroller->bindings)); + if (!gamecontroller->bindings) { + gamecontroller->num_bindings = 0; + SDL_OutOfMemory(); + return; + } + gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind; +} + + +/* + * given a controller mapping string update our mapping object + */ +static void +SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecontroller, const char *pchString) +{ + char szGameButton[20]; + char szJoystickButton[20]; + SDL_bool bGameButton = SDL_TRUE; + int i = 0; + const char *pchPos = pchString; + + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); + + while (pchPos && *pchPos) { + if (*pchPos == ':') { + i = 0; + bGameButton = SDL_FALSE; + } else if (*pchPos == ' ') { + + } else if (*pchPos == ',') { + i = 0; + bGameButton = SDL_TRUE; + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); + + } else if (bGameButton) { + if (i >= sizeof(szGameButton)) { + SDL_SetError("Button name too large: %s", szGameButton); + return; + } + szGameButton[i] = *pchPos; + i++; + } else { + if (i >= sizeof(szJoystickButton)) { + SDL_SetError("Joystick button name too large: %s", szJoystickButton); + return; + } + szJoystickButton[i] = *pchPos; + i++; + } + pchPos++; + } + + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); + +} + +/* + * Make a new button mapping struct + */ +static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, const char *pchName, const char *pchMapping) +{ + int i; + + gamecontroller->name = pchName; + gamecontroller->num_bindings = 0; + SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis)); + + SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pchMapping); + + /* Set the zero point for triggers */ + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && + (binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { + if (binding->input.axis.axis < gamecontroller->joystick->naxes) { + gamecontroller->joystick->axes[binding->input.axis.axis].value = + gamecontroller->joystick->axes[binding->input.axis.axis].zero = (Sint16)binding->input.axis.axis_min; + } + } + } +} + + +/* + * grab the guid string from a mapping string + */ +static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) +{ + const char *pFirstComma = SDL_strchr(pMapping, ','); + if (pFirstComma) { + char *pchGUID = SDL_malloc(pFirstComma - pMapping + 1); + if (!pchGUID) { + SDL_OutOfMemory(); + return NULL; + } + SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping); + pchGUID[pFirstComma - pMapping] = '\0'; + + /* Convert old style GUIDs to the new style in 2.0.5 */ +#if __WIN32__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[16], &pchGUID[4], 4); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#elif __MACOSX__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && + SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#endif + return pchGUID; + } + return NULL; +} + + +/* + * grab the name string from a mapping string + */ +static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) +{ + const char *pFirstComma, *pSecondComma; + char *pchName; + + pFirstComma = SDL_strchr(pMapping, ','); + if (!pFirstComma) + return NULL; + + pSecondComma = SDL_strchr(pFirstComma + 1, ','); + if (!pSecondComma) + return NULL; + + pchName = SDL_malloc(pSecondComma - pFirstComma); + if (!pchName) { + SDL_OutOfMemory(); + return NULL; + } + SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma); + pchName[pSecondComma - pFirstComma - 1] = 0; + return pchName; +} + + +/* + * grab the button mapping string from a mapping string + */ +static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) +{ + const char *pFirstComma, *pSecondComma; + + pFirstComma = SDL_strchr(pMapping, ','); + if (!pFirstComma) + return NULL; + + pSecondComma = SDL_strchr(pFirstComma + 1, ','); + if (!pSecondComma) + return NULL; + + return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */ +} + +/* + * Helper function to refresh a mapping + */ +static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) +{ + SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; + while (gamecontrollerlist) { + if (!SDL_memcmp(&gamecontrollerlist->joystick->guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { + /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ + SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping->name, pControllerMapping->mapping); + + { + SDL_Event event; + event.type = SDL_CONTROLLERDEVICEREMAPPED; + event.cdevice.which = gamecontrollerlist->joystick->instance_id; + SDL_PushEvent(&event); + } + } + + gamecontrollerlist = gamecontrollerlist->next; + } +} + +/* + * Helper function to add a mapping for a guid + */ +static ControllerMapping_t * +SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority) +{ + char *pchName; + char *pchMapping; + ControllerMapping_t *pControllerMapping; + + pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString); + if (!pchName) { + SDL_SetError("Couldn't parse name from %s", mappingString); + return NULL; + } + + pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString); + if (!pchMapping) { + SDL_free(pchName); + SDL_SetError("Couldn't parse %s", mappingString); + return NULL; + } + + pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID, SDL_TRUE); + if (pControllerMapping) { + /* Only overwrite the mapping if the priority is the same or higher. */ + if (pControllerMapping->priority <= priority) { + /* Update existing mapping */ + SDL_free(pControllerMapping->name); + pControllerMapping->name = pchName; + SDL_free(pControllerMapping->mapping); + pControllerMapping->mapping = pchMapping; + pControllerMapping->priority = priority; + /* refresh open controllers */ + SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + } else { + SDL_free(pchName); + SDL_free(pchMapping); + } + *existing = SDL_TRUE; + } else { + pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); + if (!pControllerMapping) { + SDL_free(pchName); + SDL_free(pchMapping); + SDL_OutOfMemory(); + return NULL; + } + pControllerMapping->guid = jGUID; + pControllerMapping->name = pchName; + pControllerMapping->mapping = pchMapping; + pControllerMapping->next = NULL; + pControllerMapping->priority = priority; + + if (s_pSupportedControllers) { + /* Add the mapping to the end of the list */ + ControllerMapping_t *pCurrMapping, *pPrevMapping; + + for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->next; + pCurrMapping; + pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->next ) { + continue; + } + pPrevMapping->next = pControllerMapping; + } else { + s_pSupportedControllers = pControllerMapping; + } + *existing = SDL_FALSE; + } + return pControllerMapping; +} + +#ifdef __ANDROID__ +/* + * Helper function to guess at a mapping based on the elements reported for this controller + */ +static ControllerMapping_t *SDL_CreateMappingForAndroidController(const char *name, SDL_JoystickGUID guid) +{ + SDL_bool existing; + char name_string[128]; + char mapping_string[1024]; + int button_mask; + int axis_mask; + + button_mask = SDL_SwapLE16(*(Uint16*)(&guid.data[sizeof(guid.data)-4])); + axis_mask = SDL_SwapLE16(*(Uint16*)(&guid.data[sizeof(guid.data)-2])); + if (!button_mask && !axis_mask) { + /* Accelerometer, shouldn't have a game controller mapping */ + return NULL; + } + + /* Remove any commas in the name */ + SDL_strlcpy(name_string, name, sizeof(name_string)); + { + char *spot; + for (spot = name_string; *spot; ++spot) { + if (*spot == ',') { + *spot = ' '; + } + } + } + SDL_snprintf(mapping_string, sizeof(mapping_string), "none,%s,", name_string); + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_A)) { + SDL_strlcat(mapping_string, "a:b0,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_B)) { + SDL_strlcat(mapping_string, "b:b1,", sizeof(mapping_string)); + } else if (button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) { + /* Use the back button as "B" for easy UI navigation with TV remotes */ + SDL_strlcat(mapping_string, "b:b4,", sizeof(mapping_string)); + button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_BACK); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_X)) { + SDL_strlcat(mapping_string, "x:b2,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_Y)) { + SDL_strlcat(mapping_string, "y:b3,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) { + SDL_strlcat(mapping_string, "back:b4,", sizeof(mapping_string)); + } +#if 0 /* The guide button generally isn't functional (or acts as a home button) on most Android controllers */ + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) { + SDL_strlcat(mapping_string, "guide:b5,", sizeof(mapping_string)); +#if 0 /* Actually this will be done in Steam */ + } else if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { + /* The guide button doesn't exist, use the start button instead, + so you can do Steam guide button chords and open the Steam overlay. + */ + SDL_strlcat(mapping_string, "guide:b6,", sizeof(mapping_string)); + button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_START); +#endif + } +#endif + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { + SDL_strlcat(mapping_string, "start:b6,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) { + SDL_strlcat(mapping_string, "leftstick:b7,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) { + SDL_strlcat(mapping_string, "rightstick:b8,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER)) { + SDL_strlcat(mapping_string, "leftshoulder:b9,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)) { + SDL_strlcat(mapping_string, "rightshoulder:b10,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_UP)) { + SDL_strlcat(mapping_string, "dpup:b11,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN)) { + SDL_strlcat(mapping_string, "dpdown:b12,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT)) { + SDL_strlcat(mapping_string, "dpleft:b13,", sizeof(mapping_string)); + } + if (button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) { + SDL_strlcat(mapping_string, "dpright:b14,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTX)) { + SDL_strlcat(mapping_string, "leftx:a0,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTY)) { + SDL_strlcat(mapping_string, "lefty:a1,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTX)) { + SDL_strlcat(mapping_string, "rightx:a2,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTY)) { + SDL_strlcat(mapping_string, "righty:a3,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT)) { + SDL_strlcat(mapping_string, "lefttrigger:a4,", sizeof(mapping_string)); + } + if (axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { + SDL_strlcat(mapping_string, "righttrigger:a5,", sizeof(mapping_string)); + } + return SDL_PrivateAddMappingForGUID(guid, mapping_string, + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); +} +#endif /* __ANDROID__ */ + + +/* + * Helper function to determine pre-calculated offset to certain joystick mappings + */ +static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid) +{ + ControllerMapping_t *mapping; + + mapping = SDL_PrivateGetControllerMappingForGUID(&guid, SDL_FALSE); +#ifdef __LINUX__ + if (!mapping && name) { + if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { + /* The Linux driver xpad.c maps the wireless dpad to buttons */ + SDL_bool existing; + mapping = SDL_PrivateAddMappingForGUID(guid, +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + } + } +#endif /* __LINUX__ */ + + if (!mapping && name) { + if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) { + mapping = s_pXInputMapping; + } + } +#ifdef __ANDROID__ + if (!mapping && name && !SDL_IsJoystickHIDAPI(guid)) { + mapping = SDL_CreateMappingForAndroidController(name, guid); + } +#endif + if (!mapping) { + mapping = s_pDefaultMapping; + } + return mapping; +} + +static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +{ + const char *name; + SDL_JoystickGUID guid; + ControllerMapping_t *mapping; + + SDL_LockJoysticks(); + + if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + SDL_UnlockJoysticks(); + return (NULL); + } + + name = SDL_JoystickNameForIndex(device_index); + guid = SDL_JoystickGetDeviceGUID(device_index); + mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); + SDL_UnlockJoysticks(); + return mapping; +} + +/* + * Add or update an entry into the Mappings Database + */ +int +SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw) +{ + const char *platform = SDL_GetPlatform(); + int controllers = 0; + char *buf, *line, *line_end, *tmp, *comma, line_platform[64]; + size_t db_size, platform_len; + + if (rw == NULL) { + return SDL_SetError("Invalid RWops"); + } + db_size = (size_t)SDL_RWsize(rw); + + buf = (char *)SDL_malloc(db_size + 1); + if (buf == NULL) { + if (freerw) { + SDL_RWclose(rw); + } + return SDL_SetError("Could not allocate space to read DB into memory"); + } + + if (SDL_RWread(rw, buf, db_size, 1) != 1) { + if (freerw) { + SDL_RWclose(rw); + } + SDL_free(buf); + return SDL_SetError("Could not read DB"); + } + + if (freerw) { + SDL_RWclose(rw); + } + + buf[db_size] = '\0'; + line = buf; + + while (line < buf + db_size) { + line_end = SDL_strchr(line, '\n'); + if (line_end != NULL) { + *line_end = '\0'; + } else { + line_end = buf + db_size; + } + + /* Extract and verify the platform */ + tmp = SDL_strstr(line, SDL_CONTROLLER_PLATFORM_FIELD); + if (tmp != NULL) { + tmp += SDL_strlen(SDL_CONTROLLER_PLATFORM_FIELD); + comma = SDL_strchr(tmp, ','); + if (comma != NULL) { + platform_len = comma - tmp + 1; + if (platform_len + 1 < SDL_arraysize(line_platform)) { + SDL_strlcpy(line_platform, tmp, platform_len); + if (SDL_strncasecmp(line_platform, platform, platform_len) == 0 && + SDL_GameControllerAddMapping(line) > 0) { + controllers++; + } + } + } + } + + line = line_end + 1; + } + + SDL_free(buf); + return controllers; +} + +/* + * Add or update an entry into the Mappings Database with a priority + */ +static int +SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority) +{ + char *pchGUID; + SDL_JoystickGUID jGUID; + SDL_bool is_default_mapping = SDL_FALSE; + SDL_bool is_hidapi_mapping = SDL_FALSE; + SDL_bool is_xinput_mapping = SDL_FALSE; + SDL_bool existing = SDL_FALSE; + ControllerMapping_t *pControllerMapping; + + if (!mappingString) { + return SDL_InvalidParamError("mappingString"); + } + + pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString); + if (!pchGUID) { + return SDL_SetError("Couldn't parse GUID from %s", mappingString); + } + if (!SDL_strcasecmp(pchGUID, "default")) { + is_default_mapping = SDL_TRUE; + } else if (!SDL_strcasecmp(pchGUID, "hidapi")) { + is_hidapi_mapping = SDL_TRUE; + } else if (!SDL_strcasecmp(pchGUID, "xinput")) { + is_xinput_mapping = SDL_TRUE; + } + jGUID = SDL_JoystickGetGUIDFromString(pchGUID); + SDL_free(pchGUID); + + pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority); + if (!pControllerMapping) { + return -1; + } + + if (existing) { + return 0; + } else { + if (is_default_mapping) { + s_pDefaultMapping = pControllerMapping; + } else if (is_hidapi_mapping) { + s_pHIDAPIMapping = pControllerMapping; + } else if (is_xinput_mapping) { + s_pXInputMapping = pControllerMapping; + } + return 1; + } +} + +/* + * Add or update an entry into the Mappings Database + */ +int +SDL_GameControllerAddMapping(const char *mappingString) +{ + return SDL_PrivateGameControllerAddMapping(mappingString, SDL_CONTROLLER_MAPPING_PRIORITY_API); +} + +/* + * Get the number of mappings installed + */ +int +SDL_GameControllerNumMappings(void) +{ + int num_mappings = 0; + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + ++num_mappings; + } + return num_mappings; +} + +/* + * Get the mapping at a particular index. + */ +char * +SDL_GameControllerMappingForIndex(int mapping_index) +{ + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + if (mapping_index == 0) { + char *pMappingString; + char pchGUID[33]; + size_t needed; + + SDL_JoystickGetGUIDString(mapping->guid, pchGUID, sizeof(pchGUID)); + /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ + needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; + pMappingString = SDL_malloc(needed); + if (!pMappingString) { + SDL_OutOfMemory(); + return NULL; + } + SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); + return pMappingString; + } + --mapping_index; + } + return NULL; +} + +/* + * Get the mapping string for this GUID + */ +char * +SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid) +{ + char *pMappingString = NULL; + ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(&guid, SDL_FALSE); + if (mapping) { + char pchGUID[33]; + size_t needed; + SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID)); + /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ + needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; + pMappingString = SDL_malloc(needed); + if (!pMappingString) { + SDL_OutOfMemory(); + return NULL; + } + SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); + } + return pMappingString; +} + +/* + * Get the mapping string for this device + */ +char * +SDL_GameControllerMapping(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) { + return NULL; + } + + return SDL_GameControllerMappingForGUID(gamecontroller->joystick->guid); +} + +static void +SDL_GameControllerLoadHints() +{ + const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG); + if (hint && hint[0]) { + size_t nchHints = SDL_strlen(hint); + char *pUserMappings = SDL_malloc(nchHints + 1); + char *pTempMappings = pUserMappings; + SDL_memcpy(pUserMappings, hint, nchHints); + pUserMappings[nchHints] = '\0'; + while (pUserMappings) { + char *pchNewLine = NULL; + + pchNewLine = SDL_strchr(pUserMappings, '\n'); + if (pchNewLine) + *pchNewLine = '\0'; + + SDL_PrivateGameControllerAddMapping(pUserMappings, SDL_CONTROLLER_MAPPING_PRIORITY_USER); + + if (pchNewLine) { + pUserMappings = pchNewLine + 1; + } else { + pUserMappings = NULL; + } + } + SDL_free(pTempMappings); + } +} + +/* + * Fill the given buffer with the expected controller mapping filepath. + * Usually this will just be CONTROLLER_MAPPING_FILE, but for Android, + * we want to get the internal storage path. + */ +static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size) +{ +#ifdef CONTROLLER_MAPPING_FILE +#define STRING(X) SDL_STRINGIFY_ARG(X) + return SDL_strlcpy(path, STRING(CONTROLLER_MAPPING_FILE), size) < size; +#elif defined(__ANDROID__) + return SDL_snprintf(path, size, "%s/controller_map.txt", SDL_AndroidGetInternalStoragePath()) < size; +#else + return SDL_FALSE; +#endif +} + +/* + * Initialize the game controller system, mostly load our DB of controller config mappings + */ +int +SDL_GameControllerInitMappings(void) +{ + char szControllerMapPath[1024]; + int i = 0; + const char *pMappingString = NULL; + pMappingString = s_ControllerMappings[i]; + while (pMappingString) { + SDL_PrivateGameControllerAddMapping(pMappingString, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + + i++; + pMappingString = s_ControllerMappings[i]; + } + + if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) { + SDL_GameControllerAddMappingsFromFile(szControllerMapPath); + } + + /* load in any user supplied config */ + SDL_GameControllerLoadHints(); + + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + return (0); +} + +int +SDL_GameControllerInit(void) +{ + int i; + + /* watch for joy events and fire controller ones if needed */ + SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL); + + /* Send added events for controllers currently attached */ + for (i = 0; i < SDL_NumJoysticks(); ++i) { + if (SDL_IsGameController(i)) { + SDL_Event deviceevent; + deviceevent.type = SDL_CONTROLLERDEVICEADDED; + deviceevent.cdevice.which = i; + SDL_PushEvent(&deviceevent); + } + } + + return (0); +} + + +/* + * Get the implementation dependent name of a controller + */ +const char * +SDL_GameControllerNameForIndex(int device_index) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if (pSupportedController) { + if (SDL_strcmp(pSupportedController->name, "*") == 0) { + return SDL_JoystickNameForIndex(device_index); + } else { + return pSupportedController->name; + } + } + return NULL; +} + + +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * If no mapping can be found, this function returns NULL. + */ +char * +SDL_GameControllerMappingForDeviceIndex(int joystick_index) +{ + char *pMappingString = NULL; + ControllerMapping_t *mapping; + + SDL_LockJoysticks(); + mapping = SDL_PrivateGetControllerMapping(joystick_index); + if (mapping) { + SDL_JoystickGUID guid; + char pchGUID[33]; + size_t needed; + guid = SDL_JoystickGetDeviceGUID(joystick_index); + SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID)); + /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ + needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; + pMappingString = SDL_malloc(needed); + if (!pMappingString) { + SDL_OutOfMemory(); + SDL_UnlockJoysticks(); + return NULL; + } + SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); + } + SDL_UnlockJoysticks(); + return pMappingString; +} + + +/* + * Return 1 if the joystick with this name and GUID is a supported controller + */ +SDL_bool +SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); + if (pSupportedController) { + return SDL_TRUE; + } + return SDL_FALSE; +} + +/* + * Return 1 if the joystick at this device index is a supported controller + */ +SDL_bool +SDL_IsGameController(int device_index) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if (pSupportedController) { + return SDL_TRUE; + } + return SDL_FALSE; +} + +/* + * Return 1 if the game controller should be ignored by SDL + */ +SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) +{ + int i; + Uint16 vendor; + Uint16 product; + Uint16 version; + Uint32 vidpid; + + if (SDL_allowed_controllers.num_entries == 0 && + SDL_ignored_controllers.num_entries == 0) { + return SDL_FALSE; + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version); + + if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) { + /* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */ + SDL_bool bSteamVirtualGamepad = SDL_FALSE; +#if defined(__LINUX__) + bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF); +#elif defined(__MACOSX__) + bSteamVirtualGamepad = (vendor == 0x045E && product == 0x028E && version == 1); +#elif defined(__WIN32__) + /* We can't tell on Windows, but Steam will block others in input hooks */ + bSteamVirtualGamepad = SDL_TRUE; +#endif + if (bSteamVirtualGamepad) { + return SDL_FALSE; + } + } + + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_allowed_controllers.num_entries > 0) { + for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) { + if (vidpid == SDL_allowed_controllers.entries[i]) { + return SDL_FALSE; + } + } + return SDL_TRUE; + } else { + for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) { + if (vidpid == SDL_ignored_controllers.entries[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; + } +} + +/* + * Open a controller for use - the index passed as an argument refers to + * the N'th controller on the system. This index is the value which will + * identify this controller in future controller events. + * + * This function returns a controller identifier, or NULL if an error occurred. + */ +SDL_GameController * +SDL_GameControllerOpen(int device_index) +{ + SDL_JoystickID instance_id; + SDL_GameController *gamecontroller; + SDL_GameController *gamecontrollerlist; + ControllerMapping_t *pSupportedController = NULL; + + SDL_LockJoysticks(); + + gamecontrollerlist = SDL_gamecontrollers; + /* If the controller is already open, return it */ + instance_id = SDL_JoystickGetDeviceInstanceID(device_index); + while (gamecontrollerlist) { + if (instance_id == gamecontrollerlist->joystick->instance_id) { + gamecontroller = gamecontrollerlist; + ++gamecontroller->ref_count; + SDL_UnlockJoysticks(); + return (gamecontroller); + } + gamecontrollerlist = gamecontrollerlist->next; + } + + /* Find a controller mapping */ + pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if (!pSupportedController) { + SDL_SetError("Couldn't find mapping for device (%d)", device_index); + SDL_UnlockJoysticks(); + return NULL; + } + + /* Create and initialize the controller */ + gamecontroller = (SDL_GameController *) SDL_calloc(1, sizeof(*gamecontroller)); + if (gamecontroller == NULL) { + SDL_OutOfMemory(); + SDL_UnlockJoysticks(); + return NULL; + } + + gamecontroller->joystick = SDL_JoystickOpen(device_index); + if (!gamecontroller->joystick) { + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; + } + + if (gamecontroller->joystick->naxes) { + gamecontroller->last_match_axis = (SDL_ExtendedGameControllerBind **)SDL_calloc(gamecontroller->joystick->naxes, sizeof(*gamecontroller->last_match_axis)); + if (!gamecontroller->last_match_axis) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; + } + } + if (gamecontroller->joystick->nhats) { + gamecontroller->last_hat_mask = (Uint8 *)SDL_calloc(gamecontroller->joystick->nhats, sizeof(*gamecontroller->last_hat_mask)); + if (!gamecontroller->last_hat_mask) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; + } + } + + SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController->name, pSupportedController->mapping); + + /* Add the controller to list */ + ++gamecontroller->ref_count; + /* Link the controller in the list */ + gamecontroller->next = SDL_gamecontrollers; + SDL_gamecontrollers = gamecontroller; + + SDL_UnlockJoysticks(); + + return (gamecontroller); +} + +/* + * Manually pump for controller updates. + */ +void +SDL_GameControllerUpdate(void) +{ + /* Just for API completeness; the joystick API does all the work. */ + SDL_JoystickUpdate(); +} + +/* + * Get the current state of an axis control on a controller + */ +Sint16 +SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) +{ + int i; + + if (!gamecontroller) + return 0; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + int value = 0; + SDL_bool valid_input_range; + SDL_bool valid_output_range; + + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + } + if (valid_input_range) { + if (binding->input.axis.axis_min != binding->output.axis.axis_min || binding->input.axis.axis_max != binding->output.axis.axis_max) { + float normalized_value = (float)(value - binding->input.axis.axis_min) / (binding->input.axis.axis_max - binding->input.axis.axis_min); + value = binding->output.axis.axis_min + (int)(normalized_value * (binding->output.axis.axis_max - binding->output.axis.axis_min)); + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + value = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + if (value == SDL_PRESSED) { + value = binding->output.axis.axis_max; + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + if (hat_mask & binding->input.hat.hat_mask) { + value = binding->output.axis.axis_max; + } + } + + if (binding->output.axis.axis_min < binding->output.axis.axis_max) { + valid_output_range = (value >= binding->output.axis.axis_min && value <= binding->output.axis.axis_max); + } else { + valid_output_range = (value >= binding->output.axis.axis_max && value <= binding->output.axis.axis_min); + } + /* If the value is zero, there might be another binding that makes it non-zero */ + if (value != 0 && valid_output_range) { + return (Sint16)value; + } + } + } + return 0; +} + +/* + * Get the current state of a button on a controller + */ +Uint8 +SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) +{ + int i; + + if (!gamecontroller) + return 0; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_bool valid_input_range; + + int value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + int threshold = binding->input.axis.axis_min + (binding->input.axis.axis_max - binding->input.axis.axis_min) / 2; + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + if (valid_input_range) { + return (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + if (valid_input_range) { + return (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + return SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + return (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED; + } + } + } + return SDL_RELEASED; +} + +const char * +SDL_GameControllerName(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) + return NULL; + + if (SDL_strcmp(gamecontroller->name, "*") == 0) { + return SDL_JoystickName(SDL_GameControllerGetJoystick(gamecontroller)); + } else { + return gamecontroller->name; + } +} + +int +SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller) +{ + return SDL_JoystickGetPlayerIndex(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetVendor(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProduct(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller)); +} + +/* + * Return if the controller in question is currently attached to the system, + * \return 0 if not plugged in, 1 if still present. + */ +SDL_bool +SDL_GameControllerGetAttached(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) + return SDL_FALSE; + + return SDL_JoystickGetAttached(gamecontroller->joystick); +} + +/* + * Get the joystick for this controller + */ +SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) + return NULL; + + return gamecontroller->joystick; +} + + +/* + * Find the SDL_GameController that owns this instance id + */ +SDL_GameController * +SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) +{ + SDL_GameController *gamecontroller; + + SDL_LockJoysticks(); + gamecontroller = SDL_gamecontrollers; + while (gamecontroller) { + if (gamecontroller->joystick->instance_id == joyid) { + SDL_UnlockJoysticks(); + return gamecontroller; + } + gamecontroller = gamecontroller->next; + } + SDL_UnlockJoysticks(); + return NULL; +} + + +/* + * Get the SDL joystick layer binding for this controller axis mapping + */ +SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) +{ + int i; + SDL_GameControllerButtonBind bind; + SDL_zero(bind); + + if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID) + return bind; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + /* FIXME: There might be multiple axes bound now that we have axis ranges... */ + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } + } + return bind; +} + + +/* + * Get the SDL joystick layer binding for this controller button mapping + */ +SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) +{ + int i; + SDL_GameControllerButtonBind bind; + SDL_zero(bind); + + if (!gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID) + return bind; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } + } + return bind; +} + + +int +SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_JoystickRumble(SDL_GameControllerGetJoystick(gamecontroller), low_frequency_rumble, high_frequency_rumble, duration_ms); +} + +void +SDL_GameControllerClose(SDL_GameController * gamecontroller) +{ + SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev; + + if (!gamecontroller) + return; + + SDL_LockJoysticks(); + + /* First decrement ref count */ + if (--gamecontroller->ref_count > 0) { + SDL_UnlockJoysticks(); + return; + } + + SDL_JoystickClose(gamecontroller->joystick); + + gamecontrollerlist = SDL_gamecontrollers; + gamecontrollerlistprev = NULL; + while (gamecontrollerlist) { + if (gamecontroller == gamecontrollerlist) { + if (gamecontrollerlistprev) { + /* unlink this entry */ + gamecontrollerlistprev->next = gamecontrollerlist->next; + } else { + SDL_gamecontrollers = gamecontroller->next; + } + break; + } + gamecontrollerlistprev = gamecontrollerlist; + gamecontrollerlist = gamecontrollerlist->next; + } + + SDL_free(gamecontroller->bindings); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller->last_hat_mask); + SDL_free(gamecontroller); + + SDL_UnlockJoysticks(); +} + + +/* + * Quit the controller subsystem + */ +void +SDL_GameControllerQuit(void) +{ + SDL_LockJoysticks(); + while (SDL_gamecontrollers) { + SDL_gamecontrollers->ref_count = 1; + SDL_GameControllerClose(SDL_gamecontrollers); + } + SDL_UnlockJoysticks(); +} + +void +SDL_GameControllerQuitMappings(void) +{ + ControllerMapping_t *pControllerMap; + + while (s_pSupportedControllers) { + pControllerMap = s_pSupportedControllers; + s_pSupportedControllers = s_pSupportedControllers->next; + SDL_free(pControllerMap->name); + SDL_free(pControllerMap->mapping); + SDL_free(pControllerMap); + } + + SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); + + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + if (SDL_allowed_controllers.entries) { + SDL_free(SDL_allowed_controllers.entries); + SDL_zero(SDL_allowed_controllers); + } + if (SDL_ignored_controllers.entries) { + SDL_free(SDL_ignored_controllers.entries); + SDL_zero(SDL_ignored_controllers); + } +} + +/* + * Event filter to transform joystick events into appropriate game controller ones + */ +static int +SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value) +{ + int posted; + + /* translate the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_CONTROLLERAXISMOTION; + event.caxis.which = gamecontroller->joystick->instance_id; + event.caxis.axis = axis; + event.caxis.value = value; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return (posted); +} + + +/* + * Event filter to transform joystick events into appropriate game controller ones + */ +static int +SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state) +{ + int posted; +#if !SDL_EVENTS_DISABLED + SDL_Event event; + + if (button == SDL_CONTROLLER_BUTTON_INVALID) + return (0); + + switch (state) { + case SDL_PRESSED: + event.type = SDL_CONTROLLERBUTTONDOWN; + break; + case SDL_RELEASED: + event.type = SDL_CONTROLLERBUTTONUP; + break; + default: + /* Invalid state -- bail */ + return (0); + } +#endif /* !SDL_EVENTS_DISABLED */ + + if (button == SDL_CONTROLLER_BUTTON_GUIDE) { + Uint32 now = SDL_GetTicks(); + if (state == SDL_PRESSED) { + gamecontroller->guide_button_down = now; + + if (gamecontroller->joystick->delayed_guide_button) { + /* Skip duplicate press */ + return (0); + } + } else { + if (!SDL_TICKS_PASSED(now, gamecontroller->guide_button_down+SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS) && !gamecontroller->joystick->force_recentering) { + gamecontroller->joystick->delayed_guide_button = SDL_TRUE; + return (0); + } + gamecontroller->joystick->delayed_guide_button = SDL_FALSE; + } + } + + /* translate the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(event.type) == SDL_ENABLE) { + event.cbutton.which = gamecontroller->joystick->instance_id; + event.cbutton.button = button; + event.cbutton.state = state; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return (posted); +} + +/* + * Turn off controller events + */ +int +SDL_GameControllerEventState(int state) +{ +#if SDL_EVENTS_DISABLED + return SDL_IGNORE; +#else + const Uint32 event_list[] = { + SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, + SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, + }; + unsigned int i; + + switch (state) { + case SDL_QUERY: + state = SDL_IGNORE; + for (i = 0; i < SDL_arraysize(event_list); ++i) { + state = SDL_EventState(event_list[i], SDL_QUERY); + if (state == SDL_ENABLE) { + break; + } + } + break; + default: + for (i = 0; i < SDL_arraysize(event_list); ++i) { + SDL_EventState(event_list[i], state); + } + break; + } + return (state); +#endif /* SDL_EVENTS_DISABLED */ +} + +void +SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick) +{ + SDL_GameController *controllerlist = SDL_gamecontrollers; + while (controllerlist) { + if (controllerlist->joystick == joystick) { + SDL_PrivateGameControllerButton(controllerlist, SDL_CONTROLLER_BUTTON_GUIDE, SDL_RELEASED); + break; + } + controllerlist = controllerlist->next; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontrollerdb.h b/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontrollerdb.h new file mode 100644 index 0000000000..9d95c90788 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontrollerdb.h @@ -0,0 +1,592 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + + +/* Default mappings we support + + The easiest way to generate a new mapping is to start Steam in Big Picture + mode, configure your joystick and then look in config/config.vdf in your + Steam installation directory for the "SDL_GamepadBind" entry. + + Alternatively, you can use the app located in test/controllermap + */ +static const char *s_ControllerMappings [] = +{ +#if SDL_JOYSTICK_XINPUT + "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", +#endif +#if SDL_JOYSTICK_DINPUT + "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,", + "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000c82d00000060000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000c82d00000061000000000000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "030000008f0e00001200000000000000,Acme GA-02,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", + "03000000fa190000f0ff000000000000,Acteck AGJ-3200,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00000263000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00001101000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00001401000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00001402000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00001901000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00001a01000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d62000001d57000000000000,Airflo PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,", + "03000000d6200000e557000000000000,Batarang,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,", + "030000006f0e00003201000000000000,Battlefield 4 PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000bc2000006012000000000000,Betop 2126F,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000bc2000000055000000000000,Betop BFM Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000bc2000006312000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000bc2000006412000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000c01100000555000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000c01100000655000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000790000000700000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,", + "03000000808300000300000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,", + "030000006b1400000055000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000006b1400000103000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,", + "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000451300000830000000000000,Defender Game Racer X7,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000bd12000002e0000000000000,Dual USB Vibration Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,", + "030000006f0e00003001000000000000,EA SPORTS PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000008f0e00000f31000000000000,EXEQ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "03000000b80500000410000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,", + "03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,", + "03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", + "78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,", + "03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,", + "030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,", + "03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "030000005c1a00003330000000000000,Genius MaxFire Grandias 12V,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", + "030000008305000031b0000000000000,Genius Maxfire Blaze 3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000451300000010000000000000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000008305000009a0000000000000,Genius,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000f025000021c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000f0250000c383000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000f0250000c483000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000f0250000c283000000000000,Gioteck,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000632500002605000000000000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,", + "03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,", + "030000000d0f00000900000000000000,Hori Pad 3 Turbo,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005400000000000000,Hori Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00004d00000000000000,Hori Pad A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f0000c100000000000000,Horipad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", + "030000006f0e00002401000000000000,INJUSTICE FightStick PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "03000000ac0500002c02000000000000,IPEGA,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000b50700001403000000000000,Impact Black,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "030000006e0500000520000000000000,JC-P301U,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,", + "030000006e0500000320000000000000,JC-U3613M (DInput),a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,", + "030000006e0500000720000000000000,JC-W01U,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,", + "03000000790000000200000000000000,King PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,", + "030000006d040000d1ca000000000000,Logitech ChillStream,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d040000d2ca000000000000,Logitech Cordless Precision,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,", + "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700006382000000000000,MLG GamePad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "03000000380700006652000000000000,Mad Catz C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,", + "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700008433000000000000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008483000000000000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700006252000000000000,Mad Catz Micro C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,", + "03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000002a0600001024000000000000,Matricom,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", + "03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,", + "03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,", + "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000efbe0000edfe000000000000,Monect Virtual Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", + "030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "03000000152000000182000000000000,NGDS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", + "030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,rightshoulder:b5,rightstick:a2,righttrigger:b7,start:b9,x:b2,y:b3,", + "03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,", + "03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,", + "03000000782300000a10000000000000,Onlive Wireless Controller,a:b15,b:b14,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b11,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b13,y:b12,", + "030000006b14000001a1000000000000,Orange Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,", + "03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,", + "03000000632500002306000000000000,PS Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "03000000100800000100000000000000,PS1 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "030000008f0e00007530000000000000,PS1 Controller,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000100800000300000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,", + "03000000250900008888000000000000,PS2 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "03000000666600006706000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", + "030000006b1400000303000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000009d0d00001330000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000250900000500000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", + "030000004c0500006802000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b10,lefttrigger:a3~,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:a4~,rightx:a2,righty:a5,start:b8,x:b3,y:b0,", + "03000000632500007505000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", + "030000008f0e00001431000000000000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000003807000056a8000000000000,PS3 RF pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d62000009557000000000000,Pro Elite PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d62000009f31000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000d6200000c757000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,", + "03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,", + "03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", + "03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,", + "03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,", + "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000321500000204000000000000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000321500000104000000000000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", + "0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", + "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000006f0e00001e01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00002801000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00002f01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,", + "03000000341a00000908000000000000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,", + "03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,", + "03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,", + "03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,", + "03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,", + "03000000a30600002106000000000000,Saitek PS1000,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000a306000020f6000000000000,Saitek PS2700,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", + "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", + "030000008f0e00000800000000000000,SpeedLink Strike FX,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000c01100000591000000000000,Speedlink Torid,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,", + "03000000110100001914000000000000,SteelSeries,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000d620000011a7000000000000,Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000004f04000007d0000000000000,T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000023b3000000000000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,", + "03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "03000000d62000006000000000000000,Tournament PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000005f140000c501000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000b80500000210000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000300f00000701000000000000,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000341a00002308000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000005509000000b4000000000000,USB gamepad,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,", + "030000006b1400000203000000000000,USB gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000790000000a00000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,", + "03000000f0250000c183000000000000,USB gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000ff1100004133000000000000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,", + "03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000341a00000608000000000000,Xeox,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", + "03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", + "030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", +#endif +#if defined(__MACOSX__) + "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "03000000a00500003232000009010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", + "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,", + "030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ + "03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700008433000000010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008483000000010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,", + "030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000321500000104000000010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,", + "03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,", + "030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000005e0400008e02000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000110100002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", + "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,", + "03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,", + "03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,", + "050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,", + "050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,", + "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", + "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", +#endif +#if defined(__LINUX__) + "03000000c82d00000190000011010000,8Bitdo NES30 Pro 8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000c82d00002038000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000c82d00000061000000010000,8Bitdo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "05000000c82d00003028000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,", + "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,", + "030000006f0e00003901000020060000,Afterglow Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006f0e00003901000000430000,Afterglow Prismatic Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006f0e00001302000000010000,Afterglow,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,", + "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", + "030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "0300000079000000d418000000010000,GPD Win 2 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,", + "030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", + "03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00006a00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,", + "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", + "03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,", + "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,", + "03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,", + "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,", + "03000000250900006688000000010000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700008433000011010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008483000011010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,", + "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,", + "030000005e0400000e00000000010000,Microsoft SideWinder,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,", + "030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,", + "030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,", + "05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,", + "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,", + "03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,", + "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000006f0e00001402000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000008f0e00000300000010010000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "050000004c0500006802000000800000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "05000000504c415953544154494f4e00,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "060000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", + "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000008916000000fd000024010000,Razer Onza Tournament Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000321500000104000011010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008916000000fe000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000c6240000045d000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "0300000000f000000300000000010000,RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", + "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000006f0e00001e01000011010000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006f0e00004601000001010000,Rock Candy Xbox One Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000006f0e00001f01000000010000,Rock Candy,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000632500007505000010010000,SHANWAN PS3/PC Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000341a00000908000010010000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,", + "03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,", + "03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,", + "03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,", + "03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000632500002305000010010000,ShanWan USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000ad1b000038f0000090040000,Street Fighter IV FightStick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,", + "0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", + "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,", + "030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,", + "03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,", + "03000000790000000600000007010000,USB gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", + "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,", + "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", + "030000005e040000a102000014010000,Xbox 360 Wireless Receiver (XBOX),a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,", + "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", + "030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,", + "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", + "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,", +#endif +#if defined(__ANDROID__) + "05000000d6020000e5890000dfff3f00,GPD XD Plus,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", + "05000000bc20000000550000ffff3f00,GameSir G3w,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "050000005509000003720000cf7f3f00,NVIDIA Controller v01.01,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "050000005509000010720000ffff3f00,NVIDIA Controller v01.03,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b17,y:b2,", /* Extremely slow in Bluetooth mode on Android */ + "050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "050000004c050000c4050000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", + "050000004c050000cc090000fffe3f00,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", + "050000003215000000090000bf7f3f00,Razer Serval,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "050000005e040000e00200000ffe3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b17,y:b2,", + "050000005e040000fd020000ffff3f00,Xbox One Wireless Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "050000005e04000091020000ff073f00,Xbox Wireless Controller,a:b0,b:b1,back:b4,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", /* The DPAD doesn't seem to work on this controller on Android TV? */ +#endif +#if defined(SDL_JOYSTICK_MFI) + "05000000ac0500000100000000006d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", + "05000000ac0500000200000000006d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,", + "05000000ac0500000300000000006d03,Remote,a:b0,b:b2,leftx:a0,lefty:a1,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", +#endif +#if defined(SDL_JOYSTICK_EMSCRIPTEN) + "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", +#endif + "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + NULL +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick.c b/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick.c new file mode 100644 index 0000000000..02903f5f96 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick.c @@ -0,0 +1,1584 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* This is the joystick API for Simple DirectMedia Layer */ + +#include "SDL.h" +#include "SDL_atomic.h" +#include "SDL_events.h" +#include "SDL_sysjoystick.h" +#include "SDL_assert.h" +#include "SDL_hints.h" + +#if !SDL_EVENTS_DISABLED +#include "../events/SDL_events_c.h" +#endif +#include "../video/SDL_sysvideo.h" + +/* This is included in only one place because it has a large static list of controllers */ +#include "controller_type.h" + +#ifdef __WIN32__ +/* Needed for checking for input remapping programs */ +#include "../core/windows/SDL_windows.h" + +#undef UNICODE /* We want ASCII functions */ +#include +#endif + +static SDL_JoystickDriver *SDL_joystick_drivers[] = { +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT) + &SDL_WINDOWS_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_LINUX + &SDL_LINUX_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_IOKIT + &SDL_DARWIN_JoystickDriver, +#endif +#if defined(__IPHONEOS__) || defined(__TVOS__) + &SDL_IOS_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_ANDROID + &SDL_ANDROID_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_EMSCRIPTEN + &SDL_EMSCRIPTEN_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_HAIKU + &SDL_HAIKU_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */ + &SDL_BSD_JoystickDriver, +#endif +#ifdef SDL_JOYSTICK_HIDAPI + &SDL_HIDAPI_JoystickDriver, +#endif +#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) + &SDL_DUMMY_JoystickDriver +#endif +}; +static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE; +static SDL_Joystick *SDL_joysticks = NULL; +static SDL_bool SDL_updating_joystick = SDL_FALSE; +static SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */ +static SDL_atomic_t SDL_next_joystick_instance_id; + +void +SDL_LockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_LockMutex(SDL_joystick_lock); + } +} + +void +SDL_UnlockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_UnlockMutex(SDL_joystick_lock); + } +} + + +static void SDLCALL +SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + if (hint && *hint == '1') { + SDL_joystick_allows_background_events = SDL_TRUE; + } else { + SDL_joystick_allows_background_events = SDL_FALSE; + } +} + +int +SDL_JoystickInit(void) +{ + int i, status; + + SDL_GameControllerInitMappings(); + + /* Create the joystick list lock */ + if (!SDL_joystick_lock) { + SDL_joystick_lock = SDL_CreateMutex(); + } + + /* See if we should allow joystick events while in the background */ + SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + SDL_JoystickAllowBackgroundEventsChanged, NULL); + +#if !SDL_EVENTS_DISABLED + if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { + return -1; + } +#endif /* !SDL_EVENTS_DISABLED */ + + status = -1; + for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { + if (SDL_joystick_drivers[i]->Init() >= 0) { + status = 0; + } + } + return status; +} + +/* + * Count the number of joysticks attached to the system + */ +int +SDL_NumJoysticks(void) +{ + int i, total_joysticks = 0; + SDL_LockJoysticks(); + for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { + total_joysticks += SDL_joystick_drivers[i]->GetCount(); + } + SDL_UnlockJoysticks(); + return total_joysticks; +} + +/* + * Return the next available joystick instance ID + * This may be called by drivers from multiple threads, unprotected by any locks + */ +SDL_JoystickID SDL_GetNextJoystickInstanceID() +{ + return SDL_AtomicIncRef(&SDL_next_joystick_instance_id); +} + +/* + * Get the driver and device index for an API device index + * This should be called while the joystick lock is held, to prevent another thread from updating the list + */ +SDL_bool +SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriver **driver, int *driver_index) +{ + int i, num_joysticks, total_joysticks = 0; + + if (device_index >= 0) { + for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { + num_joysticks = SDL_joystick_drivers[i]->GetCount(); + if (device_index < num_joysticks) { + *driver = SDL_joystick_drivers[i]; + *driver_index = device_index; + return SDL_TRUE; + } + device_index -= num_joysticks; + total_joysticks += num_joysticks; + } + } + + SDL_SetError("There are %d joysticks available", total_joysticks); + return SDL_FALSE; +} + +/* + * Perform any needed fixups for joystick names + */ +static const char * +SDL_FixupJoystickName(const char *name) +{ + if (name) { + const char *skip_prefix = "NVIDIA Corporation "; + + if (SDL_strncmp(name, skip_prefix, SDL_strlen(skip_prefix)) == 0) { + name += SDL_strlen(skip_prefix); + } + } + return name; +} + + +/* + * Get the implementation dependent name of a joystick + */ +const char * +SDL_JoystickNameForIndex(int device_index) +{ + SDL_JoystickDriver *driver; + const char *name = NULL; + + SDL_LockJoysticks(); + if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + name = SDL_FixupJoystickName(driver->GetDeviceName(device_index)); + } + SDL_UnlockJoysticks(); + + /* FIXME: Really we should reference count this name so it doesn't go away after unlock */ + return name; +} + +int +SDL_JoystickGetDevicePlayerIndex(int device_index) +{ + SDL_JoystickDriver *driver; + int player_index = -1; + + SDL_LockJoysticks(); + if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + player_index = driver->GetDevicePlayerIndex(device_index); + } + SDL_UnlockJoysticks(); + + return player_index; +} + +/* + * Return true if this joystick is known to have all axes centered at zero + * This isn't generally needed unless the joystick never generates an initial axis value near zero, + * e.g. it's emulating axes with digital buttons + */ +static SDL_bool +SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick) +{ + static Uint32 zero_centered_joysticks[] = { + MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */ + MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */ + }; + + int i; + Uint32 id = MAKE_VIDPID(SDL_JoystickGetVendor(joystick), + SDL_JoystickGetProduct(joystick)); + +/*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/ + + if (joystick->naxes == 2) { + /* Assume D-pad or thumbstick style axes are centered at 0 */ + return SDL_TRUE; + } + + for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) { + if (id == zero_centered_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +/* + * Open a joystick for use - the index passed as an argument refers to + * the N'th joystick on the system. This index is the value which will + * identify this joystick in future joystick events. + * + * This function returns a joystick identifier, or NULL if an error occurred. + */ +SDL_Joystick * +SDL_JoystickOpen(int device_index) +{ + SDL_JoystickDriver *driver; + SDL_JoystickID instance_id; + SDL_Joystick *joystick; + SDL_Joystick *joysticklist; + const char *joystickname = NULL; + + SDL_LockJoysticks(); + + if (!SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + SDL_UnlockJoysticks(); + return NULL; + } + + joysticklist = SDL_joysticks; + /* If the joystick is already open, return it + * it is important that we have a single joystick * for each instance id + */ + instance_id = driver->GetDeviceInstanceID(device_index); + while (joysticklist) { + if (instance_id == joysticklist->instance_id) { + joystick = joysticklist; + ++joystick->ref_count; + SDL_UnlockJoysticks(); + return joystick; + } + joysticklist = joysticklist->next; + } + + /* Create and initialize the joystick */ + joystick = (SDL_Joystick *) SDL_calloc(sizeof(*joystick), 1); + if (joystick == NULL) { + SDL_OutOfMemory(); + SDL_UnlockJoysticks(); + return NULL; + } + joystick->driver = driver; + joystick->instance_id = instance_id; + joystick->attached = SDL_TRUE; + joystick->player_index = -1; + + if (driver->Open(joystick, device_index) < 0) { + SDL_free(joystick); + SDL_UnlockJoysticks(); + return NULL; + } + + joystickname = driver->GetDeviceName(device_index); + if (joystickname) { + joystick->name = SDL_strdup(joystickname); + } else { + joystick->name = NULL; + } + + joystick->guid = driver->GetDeviceGUID(device_index); + + if (joystick->naxes > 0) { + joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo)); + } + if (joystick->nhats > 0) { + joystick->hats = (Uint8 *) SDL_calloc(joystick->nhats, sizeof(Uint8)); + } + if (joystick->nballs > 0) { + joystick->balls = (struct balldelta *) SDL_calloc(joystick->nballs, sizeof(*joystick->balls)); + } + if (joystick->nbuttons > 0) { + joystick->buttons = (Uint8 *) SDL_calloc(joystick->nbuttons, sizeof(Uint8)); + } + if (((joystick->naxes > 0) && !joystick->axes) + || ((joystick->nhats > 0) && !joystick->hats) + || ((joystick->nballs > 0) && !joystick->balls) + || ((joystick->nbuttons > 0) && !joystick->buttons)) { + SDL_OutOfMemory(); + SDL_JoystickClose(joystick); + SDL_UnlockJoysticks(); + return NULL; + } + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + + /* If this joystick is known to have all zero centered axes, skip the auto-centering code */ + if (SDL_JoystickAxesCenteredAtZero(joystick)) { + int i; + + for (i = 0; i < joystick->naxes; ++i) { + joystick->axes[i].has_initial_value = SDL_TRUE; + } + } + + joystick->is_game_controller = SDL_IsGameController(device_index); + + /* Add joystick to list */ + ++joystick->ref_count; + /* Link the joystick in the list */ + joystick->next = SDL_joysticks; + SDL_joysticks = joystick; + + SDL_UnlockJoysticks(); + + driver->Update(joystick); + + return joystick; +} + + +/* + * Checks to make sure the joystick is valid. + */ +int +SDL_PrivateJoystickValid(SDL_Joystick * joystick) +{ + int valid; + + if (joystick == NULL) { + SDL_SetError("Joystick hasn't been opened yet"); + valid = 0; + } else { + valid = 1; + } + + return valid; +} + +/* + * Get the number of multi-dimensional axis controls on a joystick + */ +int +SDL_JoystickNumAxes(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->naxes; +} + +/* + * Get the number of hats on a joystick + */ +int +SDL_JoystickNumHats(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->nhats; +} + +/* + * Get the number of trackballs on a joystick + */ +int +SDL_JoystickNumBalls(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->nballs; +} + +/* + * Get the number of buttons on a joystick + */ +int +SDL_JoystickNumButtons(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->nbuttons; +} + +/* + * Get the current state of an axis control on a joystick + */ +Sint16 +SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) +{ + Sint16 state; + + if (!SDL_PrivateJoystickValid(joystick)) { + return 0; + } + if (axis < joystick->naxes) { + state = joystick->axes[axis].value; + } else { + SDL_SetError("Joystick only has %d axes", joystick->naxes); + state = 0; + } + return state; +} + +/* + * Get the initial state of an axis control on a joystick + */ +SDL_bool +SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, int axis, Sint16 *state) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return SDL_FALSE; + } + if (axis >= joystick->naxes) { + SDL_SetError("Joystick only has %d axes", joystick->naxes); + return SDL_FALSE; + } + if (state) { + *state = joystick->axes[axis].initial_value; + } + return joystick->axes[axis].has_initial_value; +} + +/* + * Get the current state of a hat on a joystick + */ +Uint8 +SDL_JoystickGetHat(SDL_Joystick * joystick, int hat) +{ + Uint8 state; + + if (!SDL_PrivateJoystickValid(joystick)) { + return 0; + } + if (hat < joystick->nhats) { + state = joystick->hats[hat]; + } else { + SDL_SetError("Joystick only has %d hats", joystick->nhats); + state = 0; + } + return state; +} + +/* + * Get the ball axis change since the last poll + */ +int +SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy) +{ + int retval; + + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + + retval = 0; + if (ball < joystick->nballs) { + if (dx) { + *dx = joystick->balls[ball].dx; + } + if (dy) { + *dy = joystick->balls[ball].dy; + } + joystick->balls[ball].dx = 0; + joystick->balls[ball].dy = 0; + } else { + return SDL_SetError("Joystick only has %d balls", joystick->nballs); + } + return retval; +} + +/* + * Get the current state of a button on a joystick + */ +Uint8 +SDL_JoystickGetButton(SDL_Joystick * joystick, int button) +{ + Uint8 state; + + if (!SDL_PrivateJoystickValid(joystick)) { + return 0; + } + if (button < joystick->nbuttons) { + state = joystick->buttons[button]; + } else { + SDL_SetError("Joystick only has %d buttons", joystick->nbuttons); + state = 0; + } + return state; +} + +/* + * Return if the joystick in question is currently attached to the system, + * \return SDL_FALSE if not plugged in, SDL_TRUE if still present. + */ +SDL_bool +SDL_JoystickGetAttached(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return SDL_FALSE; + } + + return joystick->attached; +} + +/* + * Get the instance id for this opened joystick + */ +SDL_JoystickID +SDL_JoystickInstanceID(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + + return joystick->instance_id; +} + +/* + * Find the SDL_Joystick that owns this instance id + */ +SDL_Joystick * +SDL_JoystickFromInstanceID(SDL_JoystickID joyid) +{ + SDL_Joystick *joystick; + + SDL_LockJoysticks(); + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { + if (joystick->instance_id == joyid) { + break; + } + } + SDL_UnlockJoysticks(); + return joystick; +} + +/* + * Get the friendly name of this joystick + */ +const char * +SDL_JoystickName(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return NULL; + } + + return SDL_FixupJoystickName(joystick->name); +} + +int +SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->player_index; +} + +int +SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return -1; + } + return joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); +} + +/* + * Close a joystick previously opened with SDL_JoystickOpen() + */ +void +SDL_JoystickClose(SDL_Joystick * joystick) +{ + SDL_Joystick *joysticklist; + SDL_Joystick *joysticklistprev; + + if (!SDL_PrivateJoystickValid(joystick)) { + return; + } + + SDL_LockJoysticks(); + + /* First decrement ref count */ + if (--joystick->ref_count > 0) { + SDL_UnlockJoysticks(); + return; + } + + if (SDL_updating_joystick) { + SDL_UnlockJoysticks(); + return; + } + + joystick->driver->Close(joystick); + joystick->hwdata = NULL; + + joysticklist = SDL_joysticks; + joysticklistprev = NULL; + while (joysticklist) { + if (joystick == joysticklist) { + if (joysticklistprev) { + /* unlink this entry */ + joysticklistprev->next = joysticklist->next; + } else { + SDL_joysticks = joystick->next; + } + break; + } + joysticklistprev = joysticklist; + joysticklist = joysticklist->next; + } + + SDL_free(joystick->name); + + /* Free the data associated with this joystick */ + SDL_free(joystick->axes); + SDL_free(joystick->hats); + SDL_free(joystick->balls); + SDL_free(joystick->buttons); + SDL_free(joystick); + + SDL_UnlockJoysticks(); +} + +void +SDL_JoystickQuit(void) +{ + int i; + + /* Make sure we're not getting called in the middle of updating joysticks */ + SDL_assert(!SDL_updating_joystick); + + SDL_LockJoysticks(); + + /* Stop the event polling */ + while (SDL_joysticks) { + SDL_joysticks->ref_count = 1; + SDL_JoystickClose(SDL_joysticks); + } + + /* Quit the joystick setup */ + for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { + SDL_joystick_drivers[i]->Quit(); + } + + SDL_UnlockJoysticks(); + +#if !SDL_EVENTS_DISABLED + SDL_QuitSubSystem(SDL_INIT_EVENTS); +#endif + + SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + SDL_JoystickAllowBackgroundEventsChanged, NULL); + + if (SDL_joystick_lock) { + SDL_DestroyMutex(SDL_joystick_lock); + SDL_joystick_lock = NULL; + } + + SDL_GameControllerQuitMappings(); +} + + +static SDL_bool +SDL_PrivateJoystickShouldIgnoreEvent() +{ + if (SDL_joystick_allows_background_events) { + return SDL_FALSE; + } + + if (SDL_HasWindows() && SDL_GetKeyboardFocus() == NULL) { + /* We have windows but we don't have focus, ignore the event. */ + return SDL_TRUE; + } + return SDL_FALSE; +} + +/* These are global for SDL_sysjoystick.c and SDL_events.c */ + +void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) +{ +#if !SDL_EVENTS_DISABLED + SDL_Event event; + int device_index; + + device_index = SDL_JoystickGetDeviceIndexFromInstanceID(device_instance); + if (device_index < 0) { + return; + } + + event.type = SDL_JOYDEVICEADDED; + + if (SDL_GetEventState(event.type) == SDL_ENABLE) { + event.jdevice.which = device_index; + SDL_PushEvent(&event); + } +#endif /* !SDL_EVENTS_DISABLED */ +} + +/* + * If there is an existing add event in the queue, it needs to be modified + * to have the right value for which, because the number of controllers in + * the system is now one less. + */ +static void UpdateEventsForDeviceRemoval() +{ + int i, num_events; + SDL_Event *events; + + num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED); + if (num_events <= 0) { + return; + } + + events = SDL_stack_alloc(SDL_Event, num_events); + if (!events) { + return; + } + + num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED); + for (i = 0; i < num_events; ++i) { + --events[i].jdevice.which; + } + SDL_PeepEvents(events, num_events, SDL_ADDEVENT, 0, 0); + + SDL_stack_free(events); +} + +void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) +{ + SDL_Joystick *joystick; + +#if !SDL_EVENTS_DISABLED + SDL_Event event; + + event.type = SDL_JOYDEVICEREMOVED; + + if (SDL_GetEventState(event.type) == SDL_ENABLE) { + event.jdevice.which = device_instance; + SDL_PushEvent(&event); + } + + UpdateEventsForDeviceRemoval(); +#endif /* !SDL_EVENTS_DISABLED */ + + /* Mark this joystick as no longer attached */ + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { + if (joystick->instance_id == device_instance) { + joystick->attached = SDL_FALSE; + joystick->force_recentering = SDL_TRUE; + break; + } + } +} + +int +SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) +{ + int posted; + + /* Make sure we're not getting garbage or duplicate events */ + if (axis >= joystick->naxes) { + return 0; + } + if (!joystick->axes[axis].has_initial_value) { + joystick->axes[axis].initial_value = value; + joystick->axes[axis].value = value; + joystick->axes[axis].zero = value; + joystick->axes[axis].has_initial_value = SDL_TRUE; + } + if (value == joystick->axes[axis].value) { + return 0; + } + if (!joystick->axes[axis].sent_initial_value) { + /* Make sure we don't send motion until there's real activity on this axis */ + const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */ + if (SDL_abs(value - joystick->axes[axis].value) <= MAX_ALLOWED_JITTER) { + return 0; + } + joystick->axes[axis].sent_initial_value = SDL_TRUE; + joystick->axes[axis].value = value; /* Just so we pass the check above */ + SDL_PrivateJoystickAxis(joystick, axis, joystick->axes[axis].initial_value); + } + + /* We ignore events if we don't have keyboard focus, except for centering + * events. + */ + if (SDL_PrivateJoystickShouldIgnoreEvent()) { + if ((value > joystick->axes[axis].zero && value >= joystick->axes[axis].value) || + (value < joystick->axes[axis].zero && value <= joystick->axes[axis].value)) { + return 0; + } + } + + /* Update internal joystick state */ + joystick->axes[axis].value = value; + + /* Post the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_JOYAXISMOTION; + event.jaxis.which = joystick->instance_id; + event.jaxis.axis = axis; + event.jaxis.value = value; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return posted; +} + +int +SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value) +{ + int posted; + + /* Make sure we're not getting garbage or duplicate events */ + if (hat >= joystick->nhats) { + return 0; + } + if (value == joystick->hats[hat]) { + return 0; + } + + /* We ignore events if we don't have keyboard focus, except for centering + * events. + */ + if (SDL_PrivateJoystickShouldIgnoreEvent()) { + if (value != SDL_HAT_CENTERED) { + return 0; + } + } + + /* Update internal joystick state */ + joystick->hats[hat] = value; + + /* Post the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { + SDL_Event event; + event.jhat.type = SDL_JOYHATMOTION; + event.jhat.which = joystick->instance_id; + event.jhat.hat = hat; + event.jhat.value = value; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return posted; +} + +int +SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball, + Sint16 xrel, Sint16 yrel) +{ + int posted; + + /* Make sure we're not getting garbage events */ + if (ball >= joystick->nballs) { + return 0; + } + + /* We ignore events if we don't have keyboard focus. */ + if (SDL_PrivateJoystickShouldIgnoreEvent()) { + return 0; + } + + /* Update internal mouse state */ + joystick->balls[ball].dx += xrel; + joystick->balls[ball].dy += yrel; + + /* Post the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { + SDL_Event event; + event.jball.type = SDL_JOYBALLMOTION; + event.jball.which = joystick->instance_id; + event.jball.ball = ball; + event.jball.xrel = xrel; + event.jball.yrel = yrel; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return posted; +} + +int +SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state) +{ + int posted; +#if !SDL_EVENTS_DISABLED + SDL_Event event; + + switch (state) { + case SDL_PRESSED: + event.type = SDL_JOYBUTTONDOWN; + break; + case SDL_RELEASED: + event.type = SDL_JOYBUTTONUP; + break; + default: + /* Invalid state -- bail */ + return 0; + } +#endif /* !SDL_EVENTS_DISABLED */ + + /* Make sure we're not getting garbage or duplicate events */ + if (button >= joystick->nbuttons) { + return 0; + } + if (state == joystick->buttons[button]) { + return 0; + } + + /* We ignore events if we don't have keyboard focus, except for button + * release. */ + if (SDL_PrivateJoystickShouldIgnoreEvent()) { + if (state == SDL_PRESSED) { + return 0; + } + } + + /* Update internal joystick state */ + joystick->buttons[button] = state; + + /* Post the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(event.type) == SDL_ENABLE) { + event.jbutton.which = joystick->instance_id; + event.jbutton.button = button; + event.jbutton.state = state; + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return posted; +} + +void +SDL_JoystickUpdate(void) +{ + int i; + SDL_Joystick *joystick; + + SDL_LockJoysticks(); + + if (SDL_updating_joystick) { + /* The joysticks are already being updated */ + SDL_UnlockJoysticks(); + return; + } + + SDL_updating_joystick = SDL_TRUE; + + /* Make sure the list is unlocked while dispatching events to prevent application deadlocks */ + SDL_UnlockJoysticks(); + + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { + if (joystick->attached) { + joystick->driver->Update(joystick); + + if (joystick->delayed_guide_button) { + SDL_GameControllerHandleDelayedGuideButton(joystick); + } + } + + if (joystick->force_recentering) { + /* Tell the app that everything is centered/unpressed... */ + for (i = 0; i < joystick->naxes; i++) { + if (joystick->axes[i].has_initial_value) { + SDL_PrivateJoystickAxis(joystick, i, joystick->axes[i].zero); + } + } + + for (i = 0; i < joystick->nbuttons; i++) { + SDL_PrivateJoystickButton(joystick, i, 0); + } + + for (i = 0; i < joystick->nhats; i++) { + SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED); + } + + joystick->force_recentering = SDL_FALSE; + } + } + + SDL_LockJoysticks(); + + SDL_updating_joystick = SDL_FALSE; + + /* If any joysticks were closed while updating, free them here */ + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { + if (joystick->ref_count <= 0) { + SDL_JoystickClose(joystick); + } + } + + /* this needs to happen AFTER walking the joystick list above, so that any + dangling hardware data from removed devices can be free'd + */ + for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { + SDL_joystick_drivers[i]->Detect(); + } + + SDL_UnlockJoysticks(); +} + +int +SDL_JoystickEventState(int state) +{ +#if SDL_EVENTS_DISABLED + return SDL_DISABLE; +#else + const Uint32 event_list[] = { + SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, + SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED + }; + unsigned int i; + + switch (state) { + case SDL_QUERY: + state = SDL_DISABLE; + for (i = 0; i < SDL_arraysize(event_list); ++i) { + state = SDL_EventState(event_list[i], SDL_QUERY); + if (state == SDL_ENABLE) { + break; + } + } + break; + default: + for (i = 0; i < SDL_arraysize(event_list); ++i) { + SDL_EventState(event_list[i], state); + } + break; + } + return state; +#endif /* SDL_EVENTS_DISABLED */ +} + +void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version) +{ + Uint16 *guid16 = (Uint16 *)guid.data; + + /* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */ + if (/* guid16[0] is device bus type */ + guid16[1] == 0x0000 && + /* guid16[2] is vendor ID */ + guid16[3] == 0x0000 && + /* guid16[4] is product ID */ + guid16[5] == 0x0000 + /* guid16[6] is product version */ + ) { + if (vendor) { + *vendor = guid16[2]; + } + if (product) { + *product = guid16[4]; + } + if (version) { + *version = guid16[6]; + } + } else { + if (vendor) { + *vendor = 0; + } + if (product) { + *product = 0; + } + if (version) { + *version = 0; + } + } +} + +SDL_bool +SDL_IsJoystickPS4(Uint16 vendor, Uint16 product) +{ + return (GuessControllerType(vendor, product) == k_eControllerType_PS4Controller); +} + +SDL_bool +SDL_IsJoystickNintendoSwitchPro(Uint16 vendor, Uint16 product) +{ + return (GuessControllerType(vendor, product) == k_eControllerType_SwitchProController); +} + +SDL_bool +SDL_IsJoystickSteamController(Uint16 vendor, Uint16 product) +{ + return BIsSteamController(GuessControllerType(vendor, product)); +} + +SDL_bool +SDL_IsJoystickXbox360(Uint16 vendor, Uint16 product) +{ + /* Filter out some bogus values here */ + if (vendor == 0x0000 && product == 0x0000) { + return SDL_FALSE; + } + if (vendor == 0x0001 && product == 0x0001) { + return SDL_FALSE; + } + return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller); +} + +SDL_bool +SDL_IsJoystickXboxOne(Uint16 vendor, Uint16 product) +{ + return (GuessControllerType(vendor, product) == k_eControllerType_XBoxOneController); +} + +SDL_bool +SDL_IsJoystickXInput(SDL_JoystickGUID guid) +{ + return (guid.data[14] == 'x') ? SDL_TRUE : SDL_FALSE; +} + +SDL_bool +SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid) +{ + return (guid.data[14] == 'h') ? SDL_TRUE : SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) +{ + static Uint32 wheel_joysticks[] = { + MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */ + MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */ + MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */ + MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */ + MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */ + MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */ + MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ + MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ + MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ + MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ + MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ + }; + int i; + + for (i = 0; i < SDL_arraysize(wheel_joysticks); ++i) { + if (vidpid == wheel_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid) +{ + static Uint32 flightstick_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */ + MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ + }; + int i; + + for (i = 0; i < SDL_arraysize(flightstick_joysticks); ++i) { + if (vidpid == flightstick_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid) +{ + static Uint32 throttle_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */ + MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */ + }; + int i; + + for (i = 0; i < SDL_arraysize(throttle_joysticks); ++i) { + if (vidpid == throttle_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) +{ + Uint16 vendor; + Uint16 product; + Uint32 vidpid; + + if (SDL_IsJoystickXInput(guid)) { + /* XInput GUID, get the type based on the XInput device subtype */ + switch (guid.data[15]) { + case 0x01: /* XINPUT_DEVSUBTYPE_GAMEPAD */ + return SDL_JOYSTICK_TYPE_GAMECONTROLLER; + case 0x02: /* XINPUT_DEVSUBTYPE_WHEEL */ + return SDL_JOYSTICK_TYPE_WHEEL; + case 0x03: /* XINPUT_DEVSUBTYPE_ARCADE_STICK */ + return SDL_JOYSTICK_TYPE_ARCADE_STICK; + case 0x04: /* XINPUT_DEVSUBTYPE_FLIGHT_STICK */ + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + case 0x05: /* XINPUT_DEVSUBTYPE_DANCE_PAD */ + return SDL_JOYSTICK_TYPE_DANCE_PAD; + case 0x06: /* XINPUT_DEVSUBTYPE_GUITAR */ + case 0x07: /* XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE */ + case 0x0B: /* XINPUT_DEVSUBTYPE_GUITAR_BASS */ + return SDL_JOYSTICK_TYPE_GUITAR; + case 0x08: /* XINPUT_DEVSUBTYPE_DRUM_KIT */ + return SDL_JOYSTICK_TYPE_DRUM_KIT; + case 0x13: /* XINPUT_DEVSUBTYPE_ARCADE_PAD */ + return SDL_JOYSTICK_TYPE_ARCADE_PAD; + default: + return SDL_JOYSTICK_TYPE_UNKNOWN; + } + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_IsJoystickProductWheel(vidpid)) { + return SDL_JOYSTICK_TYPE_WHEEL; + } + + if (SDL_IsJoystickProductFlightStick(vidpid)) { + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + } + + if (SDL_IsJoystickProductThrottle(vidpid)) { + return SDL_JOYSTICK_TYPE_THROTTLE; + } + + if (GuessControllerType(vendor, product) != k_eControllerType_UnknownNonSteamController) { + return SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + + return SDL_JOYSTICK_TYPE_UNKNOWN; +} + +static SDL_bool SDL_IsPS4RemapperRunning(void) +{ +#ifdef __WIN32__ + const char *mapper_processes[] = { + "DS4Windows.exe", + "InputMapper.exe", + }; + int i; + PROCESSENTRY32 pe32; + SDL_bool found = SDL_FALSE; + + /* Take a snapshot of all processes in the system */ + HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hProcessSnap != INVALID_HANDLE_VALUE) { + pe32.dwSize = sizeof(PROCESSENTRY32); + if (Process32First(hProcessSnap, &pe32)) { + do + { + for (i = 0; i < SDL_arraysize(mapper_processes); ++i) { + if (SDL_strcasecmp(pe32.szExeFile, mapper_processes[i]) == 0) { + found = SDL_TRUE; + } + } + } while (Process32Next(hProcessSnap, &pe32) && !found); + } + CloseHandle(hProcessSnap); + } + return found; +#else + return SDL_FALSE; +#endif +} + +SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) +{ + Uint16 vendor; + Uint16 product; + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + + if (SDL_IsJoystickPS4(vendor, product) && SDL_IsPS4RemapperRunning()) { + return SDL_TRUE; + } + + if (SDL_IsGameControllerNameAndGUID(name, guid) && + SDL_ShouldIgnoreGameController(name, guid)) { + return SDL_TRUE; + } + + return SDL_FALSE; +} + +/* return the guid for this index */ +SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) +{ + SDL_JoystickDriver *driver; + SDL_JoystickGUID guid; + + SDL_LockJoysticks(); + if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + guid = driver->GetDeviceGUID(device_index); + } else { + SDL_zero(guid); + } + SDL_UnlockJoysticks(); + + return guid; +} + +Uint16 SDL_JoystickGetDeviceVendor(int device_index) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetDeviceProduct(int device_index) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetDeviceProductVersion(int device_index) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetDeviceType(int device_index) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (SDL_IsGameController(device_index)) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + +SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index) +{ + SDL_JoystickDriver *driver; + SDL_JoystickID instance_id = -1; + + SDL_LockJoysticks(); + if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + instance_id = driver->GetDeviceInstanceID(device_index); + } + SDL_UnlockJoysticks(); + + return instance_id; +} + +int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id) +{ + int i, num_joysticks, device_index = -1; + + SDL_LockJoysticks(); + num_joysticks = SDL_NumJoysticks(); + for (i = 0; i < num_joysticks; ++i) { + if (SDL_JoystickGetDeviceInstanceID(i) == instance_id) { + device_index = i; + break; + } + } + SDL_UnlockJoysticks(); + + return device_index; +} + +SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + SDL_JoystickGUID emptyGUID; + SDL_zero(emptyGUID); + return emptyGUID; + } + return joystick->guid; +} + +Uint16 SDL_JoystickGetVendor(SDL_Joystick * joystick) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetProduct(SDL_Joystick * joystick) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetProductVersion(SDL_Joystick * joystick) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetType(SDL_Joystick * joystick) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (joystick && joystick->is_game_controller) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + +/* convert the guid to a printable string */ +void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) +{ + static const char k_rgchHexToASCII[] = "0123456789abcdef"; + int i; + + if ((pszGUID == NULL) || (cbGUID <= 0)) { + return; + } + + for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) { + /* each input byte writes 2 ascii chars, and might write a null byte. */ + /* If we don't have room for next input byte, stop */ + unsigned char c = guid.data[i]; + + *pszGUID++ = k_rgchHexToASCII[c >> 4]; + *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; + } + *pszGUID = '\0'; +} + +/*----------------------------------------------------------------------------- + * Purpose: Returns the 4 bit nibble for a hex character + * Input : c - + * Output : unsigned char + *-----------------------------------------------------------------------------*/ +static unsigned char nibble(char c) +{ + if ((c >= '0') && (c <= '9')) { + return (unsigned char)(c - '0'); + } + + if ((c >= 'A') && (c <= 'F')) { + return (unsigned char)(c - 'A' + 0x0a); + } + + if ((c >= 'a') && (c <= 'f')) { + return (unsigned char)(c - 'a' + 0x0a); + } + + /* received an invalid character, and no real way to return an error */ + /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */ + return 0; +} + +/* convert the string version of a joystick guid to the struct */ +SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID) +{ + SDL_JoystickGUID guid; + int maxoutputbytes= sizeof(guid); + size_t len = SDL_strlen(pchGUID); + Uint8 *p; + size_t i; + + /* Make sure it's even */ + len = (len) & ~0x1; + + SDL_memset(&guid, 0x00, sizeof(guid)); + + p = (Uint8 *)&guid; + for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) { + *p = (nibble(pchGUID[i]) << 4) | nibble(pchGUID[i+1]); + } + + return guid; +} + +/* update the power level for this joystick */ +void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick, SDL_JoystickPowerLevel ePowerLevel) +{ + joystick->epowerlevel = ePowerLevel; +} + +/* return its power level */ +SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return SDL_JOYSTICK_POWER_UNKNOWN; + } + return joystick->epowerlevel; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick_c.h new file mode 100644 index 0000000000..900d5904c9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick_c.h @@ -0,0 +1,106 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_joystick_c_h_ +#define SDL_joystick_c_h_ + +#include "../SDL_internal.h" + +/* Useful functions and variables from SDL_joystick.c */ +#include "SDL_joystick.h" + +struct _SDL_JoystickDriver; + +/* Initialization and shutdown functions */ +extern int SDL_JoystickInit(void); +extern void SDL_JoystickQuit(void); + +/* Function to get the next available joystick instance ID */ +extern SDL_JoystickID SDL_GetNextJoystickInstanceID(void); + +/* Initialization and shutdown functions */ +extern int SDL_GameControllerInitMappings(void); +extern void SDL_GameControllerQuitMappings(void); +extern int SDL_GameControllerInit(void); +extern void SDL_GameControllerQuit(void); + +/* Function to get the joystick driver and device index for an API device index */ +extern SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index); + +/* Function to return the device index for a joystick ID, or -1 if not found */ +extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id); + +/* Function to extract information from an SDL joystick GUID */ +extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version); + +/* Function to return whether a joystick is a PS4 controller */ +extern SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id); + +/* Function to return whether a joystick is a Nintendo Switch Pro controller */ +extern SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id); + +/* Function to return whether a joystick is a Steam Controller */ +extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id); + +/* Function to return whether a joystick is an Xbox 360 controller */ +extern SDL_bool SDL_IsJoystickXbox360(Uint16 vendor_id, Uint16 product_id); + +/* Function to return whether a joystick is an Xbox One controller */ +extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id); + +/* Function to return whether a joystick guid comes from the XInput driver */ +extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid); + +/* Function to return whether a joystick guid comes from the HIDAPI driver */ +extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid); + +/* Function to return whether a joystick should be ignored */ +extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid); + +/* Function to return whether a joystick name and GUID is a game controller */ +extern SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid); + +/* Function to return whether a game controller should be ignored */ +extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid); + +/* Handle delayed guide button on a game controller */ +extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick); + +/* Internal event queueing functions */ +extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance); +extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance); +extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick, + Uint8 axis, Sint16 value); +extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick, + Uint8 ball, Sint16 xrel, Sint16 yrel); +extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick, + Uint8 hat, Uint8 value); +extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick, + Uint8 button, Uint8 state); +extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick, + SDL_JoystickPowerLevel ePowerLevel); + +/* Internal sanity checking functions */ +extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick); + +#endif /* SDL_joystick_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/SDL_sysjoystick.h b/3rdparty/sdl2-2.0.9/src/joystick/SDL_sysjoystick.h new file mode 100644 index 0000000000..3416693610 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/SDL_sysjoystick.h @@ -0,0 +1,157 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#ifndef SDL_sysjoystick_h_ +#define SDL_sysjoystick_h_ + +/* This is the system specific header for the SDL joystick API */ + +#include "SDL_joystick.h" +#include "SDL_joystick_c.h" + +/* The SDL joystick structure */ +typedef struct _SDL_JoystickAxisInfo +{ + Sint16 initial_value; /* Initial axis state */ + Sint16 value; /* Current axis state */ + Sint16 zero; /* Zero point on the axis (-32768 for triggers) */ + SDL_bool has_initial_value; /* Whether we've seen a value on the axis yet */ + SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */ +} SDL_JoystickAxisInfo; + +struct _SDL_Joystick +{ + SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ + char *name; /* Joystick name - system dependent */ + int player_index; /* Joystick player index, or -1 if unavailable */ + SDL_JoystickGUID guid; /* Joystick guid */ + + int naxes; /* Number of axis controls on the joystick */ + SDL_JoystickAxisInfo *axes; + + int nhats; /* Number of hats on the joystick */ + Uint8 *hats; /* Current hat states */ + + int nballs; /* Number of trackballs on the joystick */ + struct balldelta { + int dx; + int dy; + } *balls; /* Current ball motion deltas */ + + int nbuttons; /* Number of buttons on the joystick */ + Uint8 *buttons; /* Current button states */ + + SDL_bool attached; + SDL_bool is_game_controller; + SDL_bool delayed_guide_button; /* SDL_TRUE if this device has the guide button event delayed */ + SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */ + SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */ + struct _SDL_JoystickDriver *driver; + + struct joystick_hwdata *hwdata; /* Driver dependent information */ + + int ref_count; /* Reference count for multiple opens */ + + struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ +}; + +#if defined(__IPHONEOS__) || defined(__ANDROID__) +#define HAVE_STEAMCONTROLLERS +#define USE_STEAMCONTROLLER_HIDAPI +#elif defined(__LINUX__) +#define HAVE_STEAMCONTROLLERS +#define USE_STEAMCONTROLLER_LINUX +#endif + +/* Device bus definitions */ +#define SDL_HARDWARE_BUS_USB 0x03 +#define SDL_HARDWARE_BUS_BLUETOOTH 0x05 + +/* Macro to combine a USB vendor ID and product ID into a single Uint32 value */ +#define MAKE_VIDPID(VID, PID) (((Uint32)(VID))<<16|(PID)) + +typedef struct _SDL_JoystickDriver +{ + /* Function to scan the system for joysticks. + * Joystick 0 should be the system default joystick. + * This function should return 0, or -1 on an unrecoverable error. + */ + int (*Init)(void); + + /* Function to return the number of joystick devices plugged in right now */ + int (*GetCount)(void); + + /* Function to cause any queued joystick insertions to be processed */ + void (*Detect)(void); + + /* Function to get the device-dependent name of a joystick */ + const char *(*GetDeviceName)(int device_index); + + /* Function to get the player index of a joystick */ + int (*GetDevicePlayerIndex)(int device_index); + + /* Function to return the stable GUID for a plugged in device */ + SDL_JoystickGUID (*GetDeviceGUID)(int device_index); + + /* Function to get the current instance id of the joystick located at device_index */ + SDL_JoystickID (*GetDeviceInstanceID)(int device_index); + + /* Function to open a joystick for use. + The joystick to open is specified by the device index. + This should fill the nbuttons and naxes fields of the joystick structure. + It returns 0, or -1 if there is an error. + */ + int (*Open)(SDL_Joystick * joystick, int device_index); + + /* Rumble functionality */ + int (*Rumble)(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + + /* Function to update the state of a joystick - called as a device poll. + * This function shouldn't update the joystick structure directly, + * but instead should call SDL_PrivateJoystick*() to deliver events + * and update joystick device state. + */ + void (*Update)(SDL_Joystick * joystick); + + /* Function to close a joystick after use */ + void (*Close)(SDL_Joystick * joystick); + + /* Function to perform any system-specific joystick related cleanup */ + void (*Quit)(void); + +} SDL_JoystickDriver; + +/* The available joystick drivers */ +extern SDL_JoystickDriver SDL_ANDROID_JoystickDriver; +extern SDL_JoystickDriver SDL_BSD_JoystickDriver; +extern SDL_JoystickDriver SDL_DARWIN_JoystickDriver; +extern SDL_JoystickDriver SDL_DUMMY_JoystickDriver; +extern SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver; +extern SDL_JoystickDriver SDL_HAIKU_JoystickDriver; +extern SDL_JoystickDriver SDL_HIDAPI_JoystickDriver; +extern SDL_JoystickDriver SDL_IOS_JoystickDriver; +extern SDL_JoystickDriver SDL_LINUX_JoystickDriver; +extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver; + +#endif /* SDL_sysjoystick_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick.c similarity index 55% rename from 3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick.c index 8656a5322d..69b657fc9f 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/android/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,10 +27,6 @@ #include "SDL_error.h" #include "SDL_events.h" -#if !SDL_EVENTS_DISABLED -#include "../../events/SDL_events_c.h" -#endif - #include "SDL_joystick.h" #include "SDL_hints.h" #include "SDL_assert.h" @@ -38,7 +34,9 @@ #include "SDL_log.h" #include "SDL_sysjoystick_c.h" #include "../SDL_joystick_c.h" +#include "../../events/SDL_keyboard_c.h" #include "../../core/android/SDL_android.h" +#include "../hidapi/SDL_hidapijoystick_c.h" #include "android/keycodes.h" @@ -71,9 +69,30 @@ static SDL_joylist_item * JoystickByDeviceId(int device_id); static SDL_joylist_item *SDL_joylist = NULL; static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; -static int instance_counter = 0; +/* Public domain CRC implementation adapted from: + http://home.thep.lu.se/~bjorn/crc/crc32_simple.c +*/ +static Uint32 crc32_for_byte(Uint32 r) +{ + int i; + for(i = 0; i < 8; ++i) { + r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1; + } + return r ^ (Uint32)0xFF000000L; +} + +static Uint32 crc32(const void *data, int count) +{ + Uint32 crc = 0; + int i; + for(i = 0; i < count; ++i) { + crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8; + } + return crc; +} + /* Function to convert Android keyCodes into SDL ones. * This code manipulation is done to get a sequential list of codes. * FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS @@ -81,10 +100,9 @@ static int instance_counter = 0; static int keycode_to_SDL(int keycode) { - /* FIXME: If this function gets too unwiedly in the future, replace with a lookup table */ + /* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */ int button = 0; - switch(keycode) - { + switch (keycode) { /* Some gamepad buttons (API 9) */ case AKEYCODE_BUTTON_A: button = SDL_CONTROLLER_BUTTON_A; @@ -113,6 +131,7 @@ keycode_to_SDL(int keycode) case AKEYCODE_BUTTON_START: button = SDL_CONTROLLER_BUTTON_START; break; + case AKEYCODE_BACK: case AKEYCODE_BUTTON_SELECT: button = SDL_CONTROLLER_BUTTON_BACK; break; @@ -146,7 +165,9 @@ keycode_to_SDL(int keycode) button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT; break; case AKEYCODE_DPAD_CENTER: - button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */ + /* This is handled better by applications as the A button */ + /*button = SDL_CONTROLLER_BUTTON_MAX+4;*/ /* Not supported by GameController */ + button = SDL_CONTROLLER_BUTTON_A; break; /* More gamepad buttons (API 12), these get mapped to 20...35*/ @@ -171,7 +192,7 @@ keycode_to_SDL(int keycode) default: return -1; - break; + /* break; -Wunreachable-code-break */ } /* This is here in case future generations, probably with six fingers per hand, @@ -179,7 +200,30 @@ keycode_to_SDL(int keycode) */ SDL_assert(button < ANDROID_MAX_NBUTTONS); return button; - +} + +static SDL_Scancode +button_to_scancode(int button) +{ + switch (button) { + case SDL_CONTROLLER_BUTTON_A: + return SDL_SCANCODE_RETURN; + case SDL_CONTROLLER_BUTTON_B: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_BACK: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_DPAD_UP: + return SDL_SCANCODE_UP; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: + return SDL_SCANCODE_DOWN; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: + return SDL_SCANCODE_LEFT; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: + return SDL_SCANCODE_RIGHT; + } + + /* Unsupported button */ + return SDL_SCANCODE_UNKNOWN; } int @@ -190,9 +234,11 @@ Android_OnPadDown(int device_id, int keycode) if (button >= 0) { item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickButton(item->joystick, button , SDL_PRESSED); - return 0; + SDL_PrivateJoystickButton(item->joystick, button, SDL_PRESSED); + } else { + SDL_SendKeyboardKey(SDL_PRESSED, button_to_scancode(button)); } + return 0; } return -1; @@ -207,8 +253,10 @@ Android_OnPadUp(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button, SDL_RELEASED); - return 0; + } else { + SDL_SendKeyboardKey(SDL_RELEASED, button_to_scancode(button)); } + return 0; } return -1; @@ -220,7 +268,7 @@ Android_OnJoy(int device_id, int axis, float value) /* Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0] */ SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value) ); + SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value)); } return 0; @@ -229,16 +277,43 @@ Android_OnJoy(int device_id, int axis, float value) int Android_OnHat(int device_id, int hat_id, int x, int y) { - const Uint8 position_map[3][3] = { - {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP}, - {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT}, - {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN} - }; + const int DPAD_UP_MASK = (1 << SDL_CONTROLLER_BUTTON_DPAD_UP); + const int DPAD_DOWN_MASK = (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN); + const int DPAD_LEFT_MASK = (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT); + const int DPAD_RIGHT_MASK = (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT); - if (x >= -1 && x <=1 && y >= -1 && y <= 1) { + if (x >= -1 && x <= 1 && y >= -1 && y <= 1) { SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1] ); + int dpad_state = 0; + int dpad_delta; + if (x < 0) { + dpad_state |= DPAD_LEFT_MASK; + } else if (x > 0) { + dpad_state |= DPAD_RIGHT_MASK; + } + if (y < 0) { + dpad_state |= DPAD_UP_MASK; + } else if (y > 0) { + dpad_state |= DPAD_DOWN_MASK; + } + + dpad_delta = (dpad_state ^ item->dpad_state); + if (dpad_delta) { + if (dpad_delta & DPAD_UP_MASK) { + SDL_PrivateJoystickButton(item->joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (dpad_state & DPAD_UP_MASK) ? SDL_PRESSED : SDL_RELEASED); + } + if (dpad_delta & DPAD_DOWN_MASK) { + SDL_PrivateJoystickButton(item->joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (dpad_state & DPAD_DOWN_MASK) ? SDL_PRESSED : SDL_RELEASED); + } + if (dpad_delta & DPAD_LEFT_MASK) { + SDL_PrivateJoystickButton(item->joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (dpad_state & DPAD_LEFT_MASK) ? SDL_PRESSED : SDL_RELEASED); + } + if (dpad_delta & DPAD_RIGHT_MASK) { + SDL_PrivateJoystickButton(item->joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (dpad_state & DPAD_RIGHT_MASK) ? SDL_PRESSED : SDL_RELEASED); + } + item->dpad_state = dpad_state; + } } return 0; } @@ -248,21 +323,84 @@ Android_OnHat(int device_id, int hat_id, int x, int y) int -Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs) +Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, SDL_bool is_accelerometer, int button_mask, int naxes, int nhats, int nballs) { - SDL_JoystickGUID guid; SDL_joylist_item *item; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif + SDL_JoystickGUID guid; + Uint16 *guid16 = (Uint16 *)guid.data; + int i; + int axis_mask; + + + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (naxes < 2 && nhats < 1) { + return -1; + } + } - if(JoystickByDeviceId(device_id) != NULL || name == NULL) { + if (JoystickByDeviceId(device_id) != NULL || name == NULL) { return -1; } - - /* the GUID is just the first 16 chars of the name for now */ - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); + +#ifdef SDL_JOYSTICK_HIDAPI + if (HIDAPI_IsDevicePresent(vendor_id, product_id, 0)) { + /* The HIDAPI driver is taking care of this device */ + return -1; + } +#endif + +#ifdef DEBUG_JOYSTICK + SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats\n", name, desc, vendor_id, product_id, naxes, nhats); +#endif + + /* Add the available buttons and axes + The axis mask should probably come from Java where there is more information about the axes... + */ + axis_mask = 0; + if (!is_accelerometer) { + if (naxes >= 2) { + axis_mask |= ((1 << SDL_CONTROLLER_AXIS_LEFTX) | (1 << SDL_CONTROLLER_AXIS_LEFTY)); + } + if (naxes >= 4) { + axis_mask |= ((1 << SDL_CONTROLLER_AXIS_RIGHTX) | (1 << SDL_CONTROLLER_AXIS_RIGHTY)); + } + if (naxes >= 6) { + axis_mask |= ((1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT) | (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)); + } + } + + if (nhats > 0) { + /* Hat is translated into DPAD buttons */ + button_mask |= ((1 << SDL_CONTROLLER_BUTTON_DPAD_UP) | + (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN) | + (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT) | + (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT)); + nhats = 0; + } + + SDL_memset(guid.data, 0, sizeof(guid.data)); + + /* We only need 16 bits for each of these; space them out to fill 128. */ + /* Byteswap so devices get same GUID on little/big endian platforms. */ + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH); + *guid16++ = 0; + + if (vendor_id && product_id) { + *guid16++ = SDL_SwapLE16(vendor_id); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product_id); + *guid16++ = 0; + } else { + Uint32 crc = crc32(desc, SDL_strlen(desc)); + SDL_memcpy(guid16, desc, SDL_min(2*sizeof(*guid16), SDL_strlen(desc))); + guid16 += 2; + *(Uint32 *)guid16 = SDL_SwapLE32(crc); + guid16 += 2; + } + + *guid16++ = SDL_SwapLE16(button_mask); + *guid16++ = SDL_SwapLE16(axis_mask); item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item)); if (item == NULL) { @@ -273,22 +411,25 @@ Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, item->guid = guid; item->device_id = device_id; item->name = SDL_strdup(name); - if ( item->name == NULL ) { + if (item->name == NULL) { SDL_free(item); return -1; } item->is_accelerometer = is_accelerometer; - if (nbuttons > -1) { - item->nbuttons = nbuttons; - } - else { + if (button_mask == 0xFFFFFFFF) { item->nbuttons = ANDROID_MAX_NBUTTONS; + } else { + for (i = 0; i < sizeof(button_mask)*8; ++i) { + if (button_mask & (1 << i)) { + item->nbuttons = i+1; + } + } } item->naxes = naxes; item->nhats = nhats; item->nballs = nballs; - item->device_instance = instance_counter++; + item->device_instance = SDL_GetNextJoystickInstanceID(); if (SDL_joylist_tail == NULL) { SDL_joylist = SDL_joylist_tail = item; } else { @@ -299,17 +440,7 @@ Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, /* Need to increment the joystick count before we post the event */ ++numjoysticks; -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEADDED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = (numjoysticks - 1); - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickAdded(item->device_instance); #ifdef DEBUG_JOYSTICK SDL_Log("Added joystick %s with device_id %d", name, device_id); @@ -323,9 +454,6 @@ Android_RemoveJoystick(int device_id) { SDL_joylist_item *item = SDL_joylist; SDL_joylist_item *prev = NULL; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif /* Don't call JoystickByDeviceId here or there'll be an infinite loop! */ while (item != NULL) { @@ -340,7 +468,6 @@ Android_RemoveJoystick(int device_id) return -1; } - const int retval = item->device_instance; if (item->joystick) { item->joystick->hwdata = NULL; } @@ -358,17 +485,7 @@ Android_RemoveJoystick(int device_id) /* Need to decrement the joystick count before we post the event */ --numjoysticks; -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = item->device_instance; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(item->device_instance); #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with device_id %d", device_id); @@ -376,39 +493,40 @@ Android_RemoveJoystick(int device_id) SDL_free(item->name); SDL_free(item); - return retval; + return numjoysticks; } -int -SDL_SYS_JoystickInit(void) +static void ANDROID_JoystickDetect(); + +static int +ANDROID_JoystickInit(void) { - const char *hint; - SDL_SYS_JoystickDetect(); + ANDROID_JoystickDetect(); - hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK); - if (!hint || SDL_atoi(hint)) { + if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ - Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0); + Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, ANDROID_ACCELEROMETER_NAME, 0, 0, SDL_TRUE, 0, 3, 0, 0); } - - return (numjoysticks); + return 0; } -int SDL_SYS_NumJoysticks() +static int +ANDROID_JoystickGetCount(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +static void +ANDROID_JoystickDetect(void) { /* Support for device connect/disconnect is API >= 16 only, * so we poll every three seconds * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html */ static Uint32 timeout = 0; - if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + if (!timeout || SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { timeout = SDL_GetTicks() + 3000; Android_JNI_PollInputDevices(); } @@ -445,7 +563,7 @@ JoystickByDeviceId(int device_id) } /* Joystick not found, try adding it */ - SDL_SYS_JoystickDetect(); + ANDROID_JoystickDetect(); while (item != NULL) { if (item->device_id == device_id) { @@ -457,30 +575,36 @@ JoystickByDeviceId(int device_id) return NULL; } -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +ANDROID_JoystickGetDeviceName(int device_index) { return JoystickByDevIndex(device_index)->name; } -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static int +ANDROID_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +ANDROID_JoystickGetDeviceGUID(int device_index) +{ + return JoystickByDevIndex(device_index)->guid; +} + +static SDL_JoystickID +ANDROID_JoystickGetDeviceInstanceID(int device_index) { return JoystickByDevIndex(device_index)->device_instance; } -/* Function to open a joystick for use. - The joystick to open is specified by the device index. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +ANDROID_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - if (item == NULL ) { + if (item == NULL) { return SDL_SetError("No such device"); } @@ -499,52 +623,57 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) return (0); } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) +static int +ANDROID_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - return joystick->hwdata != NULL; + return SDL_Unsupported(); } -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static void +ANDROID_JoystickUpdate(SDL_Joystick * joystick) { - int i; - Sint16 value; - float values[3]; - SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; - while (item) { - if (item->is_accelerometer) { - if (item->joystick) { - if (Android_JNI_GetAccelerometerValues(values)) { - for ( i = 0; i < 3; i++ ) { - if (values[i] > 1.0f) { - values[i] = 1.0f; - } else if (values[i] < -1.0f) { - values[i] = -1.0f; - } - - value = (Sint16)(values[i] * 32767.0f); - SDL_PrivateJoystickAxis(item->joystick, i, value); - } + if (item == NULL) { + return; + } + + if (item->is_accelerometer) { + int i; + Sint16 value; + float values[3]; + + if (Android_JNI_GetAccelerometerValues(values)) { + for (i = 0; i < 3; i++) { + if (values[i] > 1.0f) { + values[i] = 1.0f; + } else if (values[i] < -1.0f) { + values[i] = -1.0f; } + + value = (Sint16)(values[i] * 32767.0f); + SDL_PrivateJoystickAxis(item->joystick, i, value); } - break; } - item = item->next; } } -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +ANDROID_JoystickClose(SDL_Joystick * joystick) { + SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; + if (item) { + item->joystick = NULL; + } } -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +ANDROID_JoystickQuit(void) { +/* We don't have any way to scan for joysticks at init, so don't wipe the list + * of joysticks here in case this is a reinit. + */ +#if 0 SDL_joylist_item *item = NULL; SDL_joylist_item *next = NULL; @@ -557,25 +686,24 @@ SDL_SYS_JoystickQuit(void) SDL_joylist = SDL_joylist_tail = NULL; numjoysticks = 0; - instance_counter = 0; +#endif /* 0 */ } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +SDL_JoystickDriver SDL_ANDROID_JoystickDriver = { - return JoystickByDevIndex(device_index)->guid; -} - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) -{ - SDL_JoystickGUID guid; - - if (joystick->hwdata != NULL) { - return ((SDL_joylist_item*)joystick->hwdata)->guid; - } - - SDL_zero(guid); - return guid; -} + ANDROID_JoystickInit, + ANDROID_JoystickGetCount, + ANDROID_JoystickDetect, + ANDROID_JoystickGetDeviceName, + ANDROID_JoystickGetDevicePlayerIndex, + ANDROID_JoystickGetDeviceGUID, + ANDROID_JoystickGetDeviceInstanceID, + ANDROID_JoystickOpen, + ANDROID_JoystickRumble, + ANDROID_JoystickUpdate, + ANDROID_JoystickClose, + ANDROID_JoystickQuit, +}; #endif /* SDL_JOYSTICK_ANDROID */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick_c.h new file mode 100644 index 0000000000..20d73810d1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/android/SDL_sysjoystick_c.h @@ -0,0 +1,59 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_ANDROID + +#ifndef SDL_sysjoystick_c_h_ +#define SDL_sysjoystick_c_h_ + +#include "../SDL_sysjoystick.h" + +extern int Android_OnPadDown(int device_id, int keycode); +extern int Android_OnPadUp(int device_id, int keycode); +extern int Android_OnJoy(int device_id, int axisnum, float value); +extern int Android_OnHat(int device_id, int hat_id, int x, int y); +extern int Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, SDL_bool is_accelerometer, int button_mask, int naxes, int nhats, int nballs); +extern int Android_RemoveJoystick(int device_id); + +/* A linked list of available joysticks */ +typedef struct SDL_joylist_item +{ + int device_instance; + int device_id; /* Android's device id */ + char *name; /* "SideWinder 3D Pro" or whatever */ + SDL_JoystickGUID guid; + SDL_bool is_accelerometer; + SDL_Joystick *joystick; + int nbuttons, naxes, nhats, nballs; + int dpad_state; + + struct SDL_joylist_item *next; +} SDL_joylist_item; + +typedef SDL_joylist_item joystick_hwdata; + +#endif /* SDL_sysjoystick_c_h_ */ + +#endif /* SDL_JOYSTICK_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/bsd/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/bsd/SDL_sysjoystick.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/joystick/bsd/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/bsd/SDL_sysjoystick.c index 509d43f755..679b80c109 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/bsd/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -161,15 +161,18 @@ static void report_free(struct report *); #define REP_BUF_DATA(rep) ((rep)->buf->data) #endif -static int SDL_SYS_numjoysticks = 0; +static int numjoysticks = 0; -int -SDL_SYS_JoystickInit(void) +static int BSD_JoystickOpen(SDL_Joystick * joy, int device_index); +static void BSD_JoystickClose(SDL_Joystick * joy); + +static int +BSD_JoystickInit(void) { char s[16]; int i, fd; - SDL_SYS_numjoysticks = 0; + numjoysticks = 0; SDL_memset(joynames, 0, sizeof(joynames)); SDL_memset(joydevnames, 0, sizeof(joydevnames)); @@ -179,21 +182,21 @@ SDL_SYS_JoystickInit(void) SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i); - joynames[SDL_SYS_numjoysticks] = strdup(s); + joynames[numjoysticks] = SDL_strdup(s); - if (SDL_SYS_JoystickOpen(&nj, SDL_SYS_numjoysticks) == 0) { - SDL_SYS_JoystickClose(&nj); - SDL_SYS_numjoysticks++; + if (BSD_JoystickOpen(&nj, numjoysticks) == 0) { + BSD_JoystickClose(&nj); + numjoysticks++; } else { - SDL_free(joynames[SDL_SYS_numjoysticks]); - joynames[SDL_SYS_numjoysticks] = NULL; + SDL_free(joynames[numjoysticks]); + joynames[numjoysticks] = NULL; } } for (i = 0; i < MAX_JOY_JOYS; i++) { SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i); fd = open(s, O_RDONLY); if (fd != -1) { - joynames[SDL_SYS_numjoysticks++] = strdup(s); + joynames[numjoysticks++] = SDL_strdup(s); close(fd); } } @@ -201,20 +204,22 @@ SDL_SYS_JoystickInit(void) /* Read the default USB HID usage table. */ hid_init(NULL); - return (SDL_SYS_numjoysticks); + return (numjoysticks); } -int SDL_SYS_NumJoysticks() +static int +BSD_JoystickGetCount(void) { - return SDL_SYS_numjoysticks; + return numjoysticks; } -void SDL_SYS_JoystickDetect() +static void +BSD_JoystickDetect(void) { } -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +BSD_JoystickGetDeviceName(int device_index) { if (joydevnames[device_index] != NULL) { return (joydevnames[device_index]); @@ -222,8 +227,15 @@ SDL_SYS_JoystickNameForDeviceIndex(int device_index) return (joynames[device_index]); } +static int +BSD_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + /* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static SDL_JoystickID +BSD_JoystickGetDeviceInstanceID(int device_index) { return device_index; } @@ -279,8 +291,8 @@ hatval_to_sdl(Sint32 hatval) } -int -SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) +static int +BSD_JoystickOpen(SDL_Joystick * joy, int device_index) { char *path = joynames[device_index]; struct joystick_hwdata *hw; @@ -304,14 +316,14 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) } joy->hwdata = hw; hw->fd = fd; - hw->path = strdup(path); + hw->path = SDL_strdup(path); if (!SDL_strncmp(path, "/dev/joy", 8)) { hw->type = BSDJOY_JOY; joy->naxes = 2; joy->nbuttons = 2; joy->nhats = 0; joy->nballs = 0; - joydevnames[device_index] = strdup("Gameport joystick"); + joydevnames[device_index] = SDL_strdup("Gameport joystick"); goto usbend; } else { hw->type = BSDJOY_UHID; @@ -363,8 +375,8 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) str[i] = '\0'; asprintf(&new_name, "%s @ %s", str, path); if (new_name != NULL) { - free(joydevnames[SDL_SYS_numjoysticks]); - joydevnames[SDL_SYS_numjoysticks] = new_name; + SDL_free(joydevnames[numjoysticks]); + joydevnames[numjoysticks] = new_name; } } desc_failed: @@ -465,14 +477,8 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) return (-1); } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joy) +static void +BSD_JoystickUpdate(SDL_Joystick * joy) { struct hid_item hitem; struct hid_data *hdata; @@ -520,12 +526,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((ymax - ymin + 1) / 2); SDL_PrivateJoystickAxis(joy, 1, v); } - if (gameport.b1 != joy->buttons[0]) { - SDL_PrivateJoystickButton(joy, 0, gameport.b1); - } - if (gameport.b2 != joy->buttons[1]) { - SDL_PrivateJoystickButton(joy, 1, gameport.b2); - } + SDL_PrivateJoystickButton(joy, 0, gameport.b1); + SDL_PrivateJoystickButton(joy, 1, gameport.b2); } return; } @@ -561,9 +563,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((hitem.logical_maximum - hitem.logical_minimum + 1) / 2); - if (v != joy->axes[naxe]) { - SDL_PrivateJoystickAxis(joy, naxe, v); - } + SDL_PrivateJoystickAxis(joy, naxe, v); } else if (usage == HUG_HAT_SWITCH) { v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); SDL_PrivateJoystickHat(joy, 0, @@ -574,9 +574,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) } case HUP_BUTTON: v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); - if (joy->buttons[nbutton] != v) { - SDL_PrivateJoystickButton(joy, nbutton, v); - } + SDL_PrivateJoystickButton(joy, nbutton, v); nbutton++; break; default: @@ -592,8 +590,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) } /* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joy) +static void +BSD_JoystickClose(SDL_Joystick * joy) { if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) { report_free(&joy->hwdata->inreport); @@ -604,8 +602,8 @@ SDL_SYS_JoystickClose(SDL_Joystick * joy) SDL_free(joy->hwdata); } -void -SDL_SYS_JoystickQuit(void) +static void +BSD_JoystickQuit(void) { int i; @@ -617,21 +615,12 @@ SDL_SYS_JoystickQuit(void) return; } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) -{ - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index ); - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; -} - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +static SDL_JoystickGUID +BSD_JoystickGetDeviceGUID( int device_index ) { SDL_JoystickGUID guid; /* the GUID is just the first 16 chars of the name for now */ - const char *name = joystick->name; + const char *name = BSD_JoystickGetDeviceName( device_index ); SDL_zero( guid ); SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); return guid; @@ -692,6 +681,28 @@ report_free(struct report *r) r->status = SREPORT_UNINIT; } +static int +BSD_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_Unsupported(); +} + +SDL_JoystickDriver SDL_BSD_JoystickDriver = +{ + BSD_JoystickInit, + BSD_JoystickGetCount, + BSD_JoystickDetect, + BSD_JoystickGetDeviceName, + BSD_JoystickGetDevicePlayerIndex, + BSD_JoystickGetDeviceGUID, + BSD_JoystickGetDeviceInstanceID, + BSD_JoystickOpen, + BSD_JoystickRumble, + BSD_JoystickUpdate, + BSD_JoystickClose, + BSD_JoystickQuit, +}; + #endif /* SDL_JOYSTICK_USBHID */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/controller_type.h b/3rdparty/sdl2-2.0.9/src/joystick/controller_type.h new file mode 100644 index 0000000000..51ac20b4e1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/controller_type.h @@ -0,0 +1,427 @@ +/* + Copyright (C) Valve Corporation + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef CONTROLLER_TYPE_H +#define CONTROLLER_TYPE_H +#ifdef _WIN32 +#pragma once +#endif + +#ifndef __cplusplus +#define inline SDL_INLINE +#endif + +//----------------------------------------------------------------------------- +// Purpose: Steam Controller models +// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN A DATABASE +//----------------------------------------------------------------------------- +typedef enum +{ + k_eControllerType_None = -1, + k_eControllerType_Unknown = 0, + + // Steam Controllers + k_eControllerType_UnknownSteamController = 1, + k_eControllerType_SteamController = 2, + k_eControllerType_SteamControllerV2 = 3, + + // Other Controllers + k_eControllerType_UnknownNonSteamController = 30, + k_eControllerType_XBox360Controller = 31, + k_eControllerType_XBoxOneController = 32, + k_eControllerType_PS3Controller = 33, + k_eControllerType_PS4Controller = 34, + k_eControllerType_WiiController = 35, + k_eControllerType_AppleController = 36, + k_eControllerType_AndroidController = 37, + k_eControllerType_SwitchProController = 38, + k_eControllerType_SwitchJoyConLeft = 39, + k_eControllerType_SwitchJoyConRight = 40, + k_eControllerType_SwitchJoyConPair = 41, + k_eControllerType_SwitchInputOnlyController = 42, + k_eControllerType_MobileTouch = 43, + k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value + + // Keyboards and Mice + k_eControllertype_GenericKeyboard = 400, + k_eControllertype_GenericMouse = 800, +} EControllerType; + +static inline SDL_bool BIsSteamController( EControllerType eType ) +{ + return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 ); +} + +#define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( nVID << 16 | nPID ) +typedef struct +{ + unsigned int m_unDeviceID; + EControllerType m_eControllerType; +} ControllerDescription_t; + +static const ControllerDescription_t arrControllers[] = { + { MAKE_CONTROLLER_ID( 0x0079, 0x18d4 ), k_eControllerType_XBox360Controller }, // GPD Win 2 X-Box Controller + { MAKE_CONTROLLER_ID( 0x044f, 0xb326 ), k_eControllerType_XBox360Controller }, // Thrustmaster Gamepad GP XID + { MAKE_CONTROLLER_ID( 0x045e, 0x028e ), k_eControllerType_XBox360Controller }, // Microsoft X-Box 360 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x028f ), k_eControllerType_XBox360Controller }, // Microsoft X-Box 360 pad v2 + { MAKE_CONTROLLER_ID( 0x045e, 0x0291 ), k_eControllerType_XBox360Controller }, // Xbox 360 Wireless Receiver (XBOX) + { MAKE_CONTROLLER_ID( 0x045e, 0x02a0 ), k_eControllerType_XBox360Controller }, // Microsoft X-Box 360 Big Button IR + { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller }, // Microsoft X-Box 360 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One pad (Firmware 2015) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One Elite pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One S pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One Elite pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller }, // Xbox 360 Wireless Receiver + { MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F310 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F510 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21f ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F710 + { MAKE_CONTROLLER_ID( 0x046d, 0xc242 ), k_eControllerType_XBox360Controller }, // Logitech Chillstream Controller + + { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x0925, 0x0005 ), k_eControllerType_PS3Controller }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x1a34, 0x0836 ), k_eControllerType_PS3Controller }, // Afterglow ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006e ), k_eControllerType_PS3Controller }, // HORI horipad4 ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS3Controller }, // HORI horipad4 ps4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005f ), k_eControllerType_PS3Controller }, // HORI Fighting commander ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005e ), k_eControllerType_PS3Controller }, // HORI Fighting commander ps4 + //{ MAKE_CONTROLLER_ID( 0x0738, 0x3250 ), k_eControllerType_PS3Controller }, // madcats fightpad pro ps3 already in ps4 list.. does this work?? + { MAKE_CONTROLLER_ID( 0x0738, 0x8250 ), k_eControllerType_PS3Controller }, // madcats fightpad pro ps4 + { MAKE_CONTROLLER_ID( 0x0079, 0x181a ), k_eControllerType_PS3Controller }, // Venom Arcade Stick + { MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_PS3Controller }, // PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols + { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x0810, 0x0001 ), k_eControllerType_PS3Controller }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x0810, 0x0003 ), k_eControllerType_PS3Controller }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller }, // Digiflip GP006 + { MAKE_CONTROLLER_ID( 0x11ff, 0x3331 ), k_eControllerType_PS3Controller }, // SRXJ-PH2400 + { MAKE_CONTROLLER_ID( 0x20bc, 0x5500 ), k_eControllerType_PS3Controller }, // ShanWan PS3 + { MAKE_CONTROLLER_ID( 0x05b8, 0x1004 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller }, // Firestorm Dual Analog 3 + { MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad + { MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller }, // Horipad 3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller }, // HORI BDA GP1 + { MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller }, // Green Asia + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006a ), k_eControllerType_PS3Controller }, // Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011e ), k_eControllerType_PS3Controller }, // Rock Candy PS4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0214 ), k_eControllerType_PS3Controller }, // afterglow ps3 + { MAKE_CONTROLLER_ID( 0x0925, 0x8866 ), k_eControllerType_PS3Controller }, // PS2 maybe break out later + { MAKE_CONTROLLER_ID( 0x0e8f, 0x310d ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller }, // JC-U4113SBK + { MAKE_CONTROLLER_ID( 0x0738, 0x8838 ), k_eControllerType_PS3Controller }, // Madcatz Fightstick Pro + { MAKE_CONTROLLER_ID( 0x1a34, 0x0836 ), k_eControllerType_PS3Controller }, // Afterglow PS3 + { MAKE_CONTROLLER_ID( 0x0f30, 0x1100 ), k_eControllerType_PS3Controller }, // Quanba Q1 fight stick + { MAKE_CONTROLLER_ID( 0x1345, 0x6005 ), k_eControllerType_PS3Controller }, // ps2 maybe break out later + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0087 ), k_eControllerType_PS3Controller }, // HORI fighting mini stick + { MAKE_CONTROLLER_ID( 0x146b, 0x5500 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller }, // + { MAKE_CONTROLLER_ID( 0x8380, 0x0003 ), k_eControllerType_PS3Controller }, // BTP 2163 + { MAKE_CONTROLLER_ID( 0x1345, 0x1000 ), k_eControllerType_PS3Controller }, // PS2 ACME GA-D5 + { MAKE_CONTROLLER_ID( 0x0e8f, 0x3075 ), k_eControllerType_PS3Controller }, // SpeedLink Strike FX + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0128 ), k_eControllerType_PS3Controller }, // Rock Candy PS3 + { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS3Controller }, // Quanba Drone + { MAKE_CONTROLLER_ID( 0x06a3, 0xf622 ), k_eControllerType_PS3Controller }, // Cyborg V3 + { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller }, // Thrustmaster wireless 3-1 + { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller }, // gioteck vx2 + { MAKE_CONTROLLER_ID( 0x05b8, 0x1006 ), k_eControllerType_PS3Controller }, // JC-U3412SBK + { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller }, // Power A PS3 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller }, // From SDL + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller }, // PDP Afterglow Wireless PS3 controller + + { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller }, // Sony PS4 Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller }, // Sony PS4 Slim Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x0ba0 ), k_eControllerType_PS4Controller }, // Sony PS4 Controller (Wireless dongle) + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008a ), k_eControllerType_PS4Controller }, // HORI Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0055 ), k_eControllerType_PS4Controller }, // HORIPAD 4 FPS + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS4Controller }, // HORIPAD 4 FPS Plus + { MAKE_CONTROLLER_ID( 0x0738, 0x8384 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE S+ PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8250 ), k_eControllerType_PS4Controller }, // Mad Catz FightPad Pro PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x0E10 ), k_eControllerType_PS4Controller }, // Armor Armor 3 Pad PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x1CF6 ), k_eControllerType_PS4Controller }, // EMIO PS4 Elite Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller }, // Razer Raiju PS4 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller }, // Razer Panthera PS4 Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller }, // STRIKEPAD PS4 Grip Add-on + { MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller - has gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller v2 - has gyro + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller }, // HORI TAC4 mousething + { MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller }, // HORI TAC PRO mousething + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller }, // Hitbox Arcade Stick + { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller + { MAKE_CONTROLLER_ID( 0x0738, 0x3250 ), k_eControllerType_PS4Controller }, // Mad Catz FightPad PRO - controller shaped with 6 face buttons + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/ + { MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2+ PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2 PS4 + { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller }, // Armor 3 or Level Up Cobra - At least one variant has gyro + { MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller }, // Game:Pad 4 + { MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller }, // "PS4 Fun Controller" added from user log + + { MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Tournament edition USB- untested and added for razer + { MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Tournament edition BT - untested and added for razer + { MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate USB - untested and added for razer + { MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate BT - untested and added for razer + { MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller }, // Razer Panthera Evo Fightstick - untested and added for razer + + { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller }, // Elecom JC-U3613M + { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller }, // Saitek P3600 + { MAKE_CONTROLLER_ID( 0x0738, 0x4716 ), k_eControllerType_XBox360Controller }, // Mad Catz Wired Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4718 ), k_eControllerType_XBox360Controller }, // Mad Catz Street Fighter IV FightStick SE + { MAKE_CONTROLLER_ID( 0x0738, 0x4726 ), k_eControllerType_XBox360Controller }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4728 ), k_eControllerType_XBox360Controller }, // Mad Catz Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x0738, 0x4736 ), k_eControllerType_XBox360Controller }, // Mad Catz MicroCon Gamepad + { MAKE_CONTROLLER_ID( 0x0738, 0x4738 ), k_eControllerType_XBox360Controller }, // Mad Catz Wired Xbox 360 Controller (SFIV) + { MAKE_CONTROLLER_ID( 0x0738, 0x4740 ), k_eControllerType_XBox360Controller }, // Mad Catz Beat Pad + { MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController }, // Mad Catz FightStick TE 2 + { MAKE_CONTROLLER_ID( 0x0738, 0xb726 ), k_eControllerType_XBox360Controller }, // Mad Catz Xbox controller - MW2 + { MAKE_CONTROLLER_ID( 0x0738, 0xbeef ), k_eControllerType_XBox360Controller }, // Mad Catz JOYTECH NEO SE Advanced GamePad + { MAKE_CONTROLLER_ID( 0x0738, 0xcb02 ), k_eControllerType_XBox360Controller }, // Saitek Cyborg Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xcb03 ), k_eControllerType_XBox360Controller }, // Saitek P3200 Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xf738 ), k_eControllerType_XBox360Controller }, // Super SFIV FightStick TE S + { MAKE_CONTROLLER_ID( 0x0955, 0xb400 ), k_eControllerType_XBox360Controller }, // NVIDIA Shield streaming controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0105 ), k_eControllerType_XBox360Controller }, // HSM3 Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0113 ), k_eControllerType_XBox360Controller }, // Afterglow AX.1 Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011f ), k_eControllerType_XBox360Controller }, // Rock Candy Gamepad Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0131 ), k_eControllerType_XBox360Controller }, // PDP EA Sports Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0133 ), k_eControllerType_XBox360Controller }, // Xbox 360 Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController }, // Afterglow Prismatic Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x013a ), k_eControllerType_XBoxOneController }, // PDP Xbox One Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0146 ), k_eControllerType_XBoxOneController }, // Rock Candy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0147 ), k_eControllerType_XBoxOneController }, // PDP Marvel Xbox One Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015c ), k_eControllerType_XBoxOneController }, // PDP Xbox One Arcade Stick + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0161 ), k_eControllerType_XBoxOneController }, // PDP Xbox One Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0162 ), k_eControllerType_XBoxOneController }, // PDP Xbox One Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0163 ), k_eControllerType_XBoxOneController }, // PDP Xbox One Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0164 ), k_eControllerType_XBoxOneController }, // PDP Battlefield One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0165 ), k_eControllerType_XBoxOneController }, // PDP Titanfall 2 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0201 ), k_eControllerType_XBox360Controller }, // Pelican PL-3601 'TSZ' Wired Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0213 ), k_eControllerType_XBox360Controller }, // Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x021f ), k_eControllerType_XBox360Controller }, // Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0246 ), k_eControllerType_XBoxOneController }, // Rock Candy Gamepad for Xbox One 2015 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a0 ), k_eControllerType_XBox360Controller }, // Counterfeit 360Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0301 ), k_eControllerType_XBox360Controller }, // Logic3 Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0346 ), k_eControllerType_XBoxOneController }, // Rock Candy Gamepad for Xbox One 2016 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0401 ), k_eControllerType_XBox360Controller }, // Logic3 Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0413 ), k_eControllerType_XBox360Controller }, // Afterglow AX.1 Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0501 ), k_eControllerType_XBox360Controller }, // PDP Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0xf501 ), k_eControllerType_XBox360Controller }, // Counterfeit 360 Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0xf900 ), k_eControllerType_XBox360Controller }, // PDP Afterglow AX.1 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000a ), k_eControllerType_XBox360Controller }, // Hori Co. DOA4 FightStick + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000c ), k_eControllerType_XBox360Controller }, // Hori PadEX Turbo + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000d ), k_eControllerType_XBox360Controller }, // Hori Fighting Stick EX2 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0016 ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro.EX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x001b ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro VX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0063 ), k_eControllerType_XBoxOneController }, // Hori Real Arcade Pro Hayabusa (USA) Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0067 ), k_eControllerType_XBoxOneController }, // HORIPAD ONE + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0078 ), k_eControllerType_XBoxOneController }, // Hori Real Arcade Pro V Kai Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008c ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x11c9, 0x55f0 ), k_eControllerType_XBox360Controller }, // Nacon GC-100XF + { MAKE_CONTROLLER_ID( 0x12ab, 0x0004 ), k_eControllerType_XBox360Controller }, // Honey Bee Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x12ab, 0x0301 ), k_eControllerType_XBox360Controller }, // PDP AFTERGLOW AX.1 + { MAKE_CONTROLLER_ID( 0x12ab, 0x0303 ), k_eControllerType_XBox360Controller }, // Mortal Kombat Klassic FightStick + { MAKE_CONTROLLER_ID( 0x1430, 0x02a0 ), k_eControllerType_XBox360Controller }, // RedOctane Controller Adapter + { MAKE_CONTROLLER_ID( 0x1430, 0x4748 ), k_eControllerType_XBox360Controller }, // RedOctane Guitar Hero X-plorer + { MAKE_CONTROLLER_ID( 0x1430, 0xf801 ), k_eControllerType_XBox360Controller }, // RedOctane Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0601 ), k_eControllerType_XBox360Controller }, // BigBen Interactive XBOX 360 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x0037 ), k_eControllerType_XBox360Controller }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController }, // Razer Wildcat + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f00 ), k_eControllerType_XBox360Controller }, // Power A Mini Pro Elite + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f0a ), k_eControllerType_XBox360Controller }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f10 ), k_eControllerType_XBox360Controller }, // Batarang Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x162e, 0xbeef ), k_eControllerType_XBox360Controller }, // Joytech Neo-Se Take2 + { MAKE_CONTROLLER_ID( 0x1689, 0xfd00 ), k_eControllerType_XBox360Controller }, // Razer Onza Tournament Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfd01 ), k_eControllerType_XBox360Controller }, // Razer Onza Classic Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfe00 ), k_eControllerType_XBox360Controller }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x1bad, 0x0002 ), k_eControllerType_XBox360Controller }, // Harmonix Rock Band Guitar + { MAKE_CONTROLLER_ID( 0x1bad, 0x0003 ), k_eControllerType_XBox360Controller }, // Harmonix Rock Band Drumkit + { MAKE_CONTROLLER_ID( 0x1bad, 0xf016 ), k_eControllerType_XBox360Controller }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf018 ), k_eControllerType_XBox360Controller }, // Mad Catz Street Fighter IV SE Fighting Stick + { MAKE_CONTROLLER_ID( 0x1bad, 0xf019 ), k_eControllerType_XBox360Controller }, // Mad Catz Brawlstick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf021 ), k_eControllerType_XBox360Controller }, // Mad Cats Ghost Recon FS GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf023 ), k_eControllerType_XBox360Controller }, // MLG Pro Circuit Controller (Xbox) + { MAKE_CONTROLLER_ID( 0x1bad, 0xf025 ), k_eControllerType_XBox360Controller }, // Mad Catz Call Of Duty + { MAKE_CONTROLLER_ID( 0x1bad, 0xf027 ), k_eControllerType_XBox360Controller }, // Mad Catz FPS Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf028 ), k_eControllerType_XBox360Controller }, // Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf02e ), k_eControllerType_XBox360Controller }, // Mad Catz Fightpad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf036 ), k_eControllerType_XBox360Controller }, // Mad Catz MicroCon GamePad Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf038 ), k_eControllerType_XBox360Controller }, // Street Fighter IV FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf039 ), k_eControllerType_XBox360Controller }, // Mad Catz MvC2 TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03a ), k_eControllerType_XBox360Controller }, // Mad Catz SFxT Fightstick Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03d ), k_eControllerType_XBox360Controller }, // Street Fighter IV Arcade Stick TE - Chun Li + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03e ), k_eControllerType_XBox360Controller }, // Mad Catz MLG FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03f ), k_eControllerType_XBox360Controller }, // Mad Catz FightStick SoulCaliber + { MAKE_CONTROLLER_ID( 0x1bad, 0xf042 ), k_eControllerType_XBox360Controller }, // Mad Catz FightStick TES+ + { MAKE_CONTROLLER_ID( 0x1bad, 0xf080 ), k_eControllerType_XBox360Controller }, // Mad Catz FightStick TE2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf501 ), k_eControllerType_XBox360Controller }, // HoriPad EX2 Turbo + { MAKE_CONTROLLER_ID( 0x1bad, 0xf502 ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro.VX SA + { MAKE_CONTROLLER_ID( 0x1bad, 0xf503 ), k_eControllerType_XBox360Controller }, // Hori Fighting Stick VX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf504 ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro. EX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf505 ), k_eControllerType_XBox360Controller }, // Hori Fighting Stick EX2B + { MAKE_CONTROLLER_ID( 0x1bad, 0xf506 ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro.EX Premium VLX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf900 ), k_eControllerType_XBox360Controller }, // Harmonix Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf901 ), k_eControllerType_XBox360Controller }, // Gamestop Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf902 ), k_eControllerType_XBox360Controller }, // Mad Catz Gamepad2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf903 ), k_eControllerType_XBox360Controller }, // Tron Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf904 ), k_eControllerType_XBox360Controller }, // PDP Versus Fighting Pad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf906 ), k_eControllerType_XBox360Controller }, // MortalKombat FightStick + { MAKE_CONTROLLER_ID( 0x1bad, 0xfa01 ), k_eControllerType_XBox360Controller }, // MadCatz GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd00 ), k_eControllerType_XBox360Controller }, // Razer Onza TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd01 ), k_eControllerType_XBox360Controller }, // Razer Onza + { MAKE_CONTROLLER_ID( 0x24c6, 0x5000 ), k_eControllerType_XBox360Controller }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x5300 ), k_eControllerType_XBox360Controller }, // PowerA MINI PROEX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5303 ), k_eControllerType_XBox360Controller }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x530a ), k_eControllerType_XBox360Controller }, // Xbox 360 Pro EX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x531a ), k_eControllerType_XBox360Controller }, // PowerA Pro Ex + { MAKE_CONTROLLER_ID( 0x24c6, 0x5397 ), k_eControllerType_XBox360Controller }, // FUS1ON Tournament Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController }, // PowerA Xbox One Mini Wired Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController }, // Xbox ONE spectra + { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController }, // PowerA Xbox One wired controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5500 ), k_eControllerType_XBox360Controller }, // Hori XBOX 360 EX 2 with Turbo + { MAKE_CONTROLLER_ID( 0x24c6, 0x5501 ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro VX-SA + { MAKE_CONTROLLER_ID( 0x24c6, 0x5502 ), k_eControllerType_XBox360Controller }, // Hori Fighting Stick VX Alt + { MAKE_CONTROLLER_ID( 0x24c6, 0x5503 ), k_eControllerType_XBox360Controller }, // Hori Fighting Edge + { MAKE_CONTROLLER_ID( 0x24c6, 0x5506 ), k_eControllerType_XBox360Controller }, // Hori SOULCALIBUR V Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x5510 ), k_eControllerType_XBox360Controller }, // Hori Fighting Commander ONE + { MAKE_CONTROLLER_ID( 0x24c6, 0x550d ), k_eControllerType_XBox360Controller }, // Hori GEM Xbox controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x550e ), k_eControllerType_XBox360Controller }, // Hori Real Arcade Pro V Kai 360 + { MAKE_CONTROLLER_ID( 0x24c6, 0x551a ), k_eControllerType_XBoxOneController }, // PowerA FUSION Pro Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x561a ), k_eControllerType_XBoxOneController }, // PowerA FUSION Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b00 ), k_eControllerType_XBox360Controller }, // ThrustMaster Ferrari Italia 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b02 ), k_eControllerType_XBox360Controller }, // Thrustmaster, Inc. GPX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b03 ), k_eControllerType_XBox360Controller }, // Thrustmaster Ferrari 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5d04 ), k_eControllerType_XBox360Controller }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafa ), k_eControllerType_XBox360Controller }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafb ), k_eControllerType_XBox360Controller }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafc ), k_eControllerType_XBox360Controller }, // Afterglow Gamepad 1 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller }, // Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller }, // Afterglow Gamepad 3 + + // These have been added via Minidump for unrecognized Xinput controller assert + { MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x045e, 0x02a2 ), k_eControllerType_XBox360Controller }, // Unknown Controller - Microsoft VID + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1414 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0159 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfaff ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0086 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006d ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a4 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1832 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187f ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1883 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x03eb, 0xff01 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef8 ), k_eControllerType_XBox360Controller }, // Homemade fightstick based on brook pcb (with XInput driver??) + { MAKE_CONTROLLER_ID( 0x046d, 0x1000 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1345, 0x6006 ), k_eControllerType_XBox360Controller }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x056e, 0x2012 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ae ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x046d, 0x0401 ), k_eControllerType_XBox360Controller }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0301 ), k_eControllerType_XBox360Controller }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xcaa3 ), k_eControllerType_XBox360Controller }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xc261 ), k_eControllerType_XBox360Controller }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0291 ), k_eControllerType_XBox360Controller }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x0079, 0x18d3 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00b1 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0001, 0x0001 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1345, 0x6005 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x188e ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x18d4 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00b1 ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller }, // SteelSeries Nimbus/Stratus XL + + + //{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/ }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController }, // MFI Extended Gamepad (generic entry for iOS/tvOS) + { MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController }, // MFI Standard Gamepad (generic entry for iOS/tvOS) + + // We currently don't support using a pair of Switch Joy-Con's as a single + // controller and we don't want to support using them individually for the + // time being, so these should be disabled until one of the above is true + // { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft }, // Nintendo Switch Joy-Con (Left) + // { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight }, // Nintendo Switch Joy-Con (Right) + + // This same controller ID is spoofed by many 3rd-party Switch controllers. + // The ones we currently know of are: + // * Any 8bitdo controller with Switch support + // * ORTZ Gaming Wireless Pro Controller + // * ZhiXu Gamepad Wireless + // * Sunwaytek Wireless Motion Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController }, // Nintendo Switch Pro Controller + + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController }, // HORIPAD for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController }, // HORI Pokken Tournament DX Pro Pad + + + // Valve products - don't add to public list + { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch }, // Streaming mobile touch virtual controls + { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController }, // Valve Legacy Steam Controller (CHELL) + { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController }, // Valve wireless Steam Controller + { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (HEADCRAB) +}; + + +#if 0 /* these are currently unused, so #if 0'd out to prevent compiler warnings for now */ +static inline const ControllerDescription_t * GetControllerArray( int* nLength /* Out */) +{ + *nLength = sizeof( arrControllers ) / sizeof( arrControllers[0] ); + return arrControllers; +} +#endif + +static inline EControllerType GuessControllerType( int nVID, int nPID ) +{ + unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); + int iIndex; + for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) + { + if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) + { + return arrControllers[ iIndex ].m_eControllerType; + } + } +#undef MAKE_CONTROLLER_ID + + return k_eControllerType_UnknownNonSteamController; +} + +#endif // CONSTANTS_H + diff --git a/3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick.c similarity index 62% rename from 3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick.c index 6dd306aa8e..8af3b96109 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,32 +22,79 @@ #ifdef SDL_JOYSTICK_IOKIT -#include - -/* For force feedback testing. */ -#include -#include - +#include "SDL_events.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" #include "SDL_sysjoystick_c.h" -#include "SDL_events.h" +#include "../hidapi/SDL_hidapijoystick_c.h" #include "../../haptic/darwin/SDL_syshaptic_c.h" /* For haptic hot plugging */ -#if !SDL_EVENTS_DISABLED -#include "../../events/SDL_events_c.h" -#endif + #define SDL_JOYSTICK_RUNLOOP_MODE CFSTR("SDLJoystick") +#define CONVERT_MAGNITUDE(x) (((x)*10000) / 0x7FFF) + /* The base object of the HID Manager API */ static IOHIDManagerRef hidman = NULL; /* Linked list of all available devices */ static recDevice *gpDeviceList = NULL; -/* static incrementing counter for new joystick devices seen on the system. Devices should start with index 0 */ -static int s_joystick_instance_id = -1; +void FreeRumbleEffectData(FFEFFECT *effect) +{ + if (!effect) { + return; + } + SDL_free(effect->rgdwAxes); + SDL_free(effect->rglDirection); + SDL_free(effect->lpvTypeSpecificParams); + SDL_free(effect); +} + +FFEFFECT *CreateRumbleEffectData(Sint16 magnitude, Uint32 duration_ms) +{ + FFEFFECT *effect; + FFPERIODIC *periodic; + + /* Create the effect */ + effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect)); + if (!effect) { + return NULL; + } + effect->dwSize = sizeof(*effect); + effect->dwGain = 10000; + effect->dwFlags = FFEFF_OBJECTOFFSETS; + effect->dwDuration = duration_ms * 1000; /* In microseconds. */ + effect->dwTriggerButton = FFEB_NOTRIGGER; + + effect->cAxes = 2; + effect->rgdwAxes = (DWORD *)SDL_calloc(effect->cAxes, sizeof(DWORD)); + if (!effect->rgdwAxes) { + FreeRumbleEffectData(effect); + return NULL; + } + + effect->rglDirection = (LONG *)SDL_calloc(effect->cAxes, sizeof(LONG)); + if (!effect->rglDirection) { + FreeRumbleEffectData(effect); + return NULL; + } + effect->dwFlags |= FFEFF_CARTESIAN; + + periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic)); + if (!periodic) { + FreeRumbleEffectData(effect); + return NULL; + } + periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude); + periodic->dwPeriod = 1000000; + + effect->cbTypeSpecificParams = sizeof(*periodic); + effect->lpvTypeSpecificParams = periodic; + + return effect; +} static recDevice *GetDeviceForIndex(int device_index) { @@ -108,10 +155,11 @@ FreeDevice(recDevice *removeDevice) return pDeviceNext; } -static SInt32 -GetHIDElementState(recDevice *pDevice, recElement *pElement) +static SDL_bool +GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue) { SInt32 value = 0; + int returnValue = SDL_FALSE; if (pDevice && pElement) { IOHIDValueRef valueRef; @@ -125,50 +173,58 @@ GetHIDElementState(recDevice *pDevice, recElement *pElement) if (value > pElement->maxReport) { pElement->maxReport = value; } + *pValue = value; + + returnValue = SDL_TRUE; } } - - return value; + return returnValue; } -static SInt32 -GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max) +static SDL_bool +GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max, SInt32 *pValue) { const float deviceScale = max - min; const float readScale = pElement->maxReport - pElement->minReport; - const SInt32 value = GetHIDElementState(pDevice, pElement); - if (readScale == 0) { - return value; /* no scaling at all */ - } - return ((value - pElement->minReport) * deviceScale / readScale) + min; + int returnValue = SDL_FALSE; + if (GetHIDElementState(pDevice, pElement, pValue)) + { + if (readScale == 0) { + returnValue = SDL_TRUE; /* no scaling at all */ + } + else + { + *pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min; + returnValue = SDL_TRUE; + } + } + return returnValue; } - static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender) { recDevice *device = (recDevice *) ctx; device->removed = SDL_TRUE; device->deviceRef = NULL; // deviceRef was invalidated due to the remove + if (device->ffeffect_ref) { + FFDeviceReleaseEffect(device->ffdevice, device->ffeffect_ref); + device->ffeffect_ref = NULL; + } + if (device->ffeffect) { + FreeRumbleEffectData(device->ffeffect); + device->ffeffect = NULL; + } + if (device->ffdevice) { + FFReleaseDevice(device->ffdevice); + device->ffdevice = NULL; + device->ff_initialized = SDL_FALSE; + } #if SDL_HAPTIC_IOKIT MacHaptic_MaybeRemoveDevice(device->ffservice); #endif -/* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceRemoved()? */ -#if !SDL_EVENTS_DISABLED - { - SDL_Event event; - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = device->instance_id; - if ((SDL_EventOK == NULL) - || (*SDL_EventOK) (SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(device->instance_id); } @@ -249,6 +305,7 @@ AddHIDElement(const void *value, void *parameter) case kHIDUsage_GD_DPadLeft: case kHIDUsage_GD_Start: case kHIDUsage_GD_Select: + case kHIDUsage_GD_SystemMainMenu: if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) { element = (recElement *) SDL_calloc(1, sizeof (recElement)); if (element) { @@ -264,6 +321,8 @@ AddHIDElement(const void *value, void *parameter) switch (usage) { case kHIDUsage_Sim_Rudder: case kHIDUsage_Sim_Throttle: + case kHIDUsage_Sim_Accelerator: + case kHIDUsage_Sim_Brake: if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) { element = (recElement *) SDL_calloc(1, sizeof (recElement)); if (element) { @@ -337,9 +396,12 @@ AddHIDElement(const void *value, void *parameter) static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) { - Uint32 *guid32 = NULL; + Sint32 vendor = 0; + Sint32 product = 0; + Sint32 version = 0; CFTypeRef refCF = NULL; CFArrayRef array = NULL; + Uint16 *guid16 = (Uint16 *)pDevice->guid.data; /* get usage page and usage */ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey)); @@ -375,22 +437,39 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[0]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &vendor); } refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[8]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &product); + } + + refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVersionNumberKey)); + if (refCF) { + CFNumberGetValue(refCF, kCFNumberSInt32Type, &version); + } + +#ifdef SDL_JOYSTICK_HIDAPI + if (HIDAPI_IsDevicePresent(vendor, product, version)) { + /* The HIDAPI driver is taking care of this device */ + return 0; } +#endif + + SDL_memset(pDevice->guid.data, 0, sizeof(pDevice->guid.data)); - /* Check to make sure we have a vendor and product ID - If we don't, use the same algorithm as the Linux code for Bluetooth devices */ - guid32 = (Uint32*)pDevice->guid.data; - if (!guid32[0] && !guid32[1]) { - /* If we don't have a vendor and product ID this is probably a Bluetooth device */ - const Uint16 BUS_BLUETOOTH = 0x05; - Uint16 *guid16 = (Uint16 *)guid32; - *guid16++ = BUS_BLUETOOTH; + if (vendor && product) { + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)version); + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH); *guid16++ = 0; SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4); } @@ -422,6 +501,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic { recDevice *device; int device_index = 0; + io_service_t ioservice; if (res != kIOReturnSuccess) { return; @@ -432,7 +512,6 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic } device = (recDevice *) SDL_calloc(1, sizeof(recDevice)); - if (!device) { SDL_OutOfMemory(); return; @@ -443,30 +522,26 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic return; /* not a device we care about, probably. */ } + if (SDL_ShouldIgnoreJoystick(device->product, device->guid)) { + SDL_free(device); + return; + } + /* Get notified when this device is disconnected. */ IOHIDDeviceRegisterRemovalCallback(ioHIDDeviceObject, JoystickDeviceWasRemovedCallback, device); IOHIDDeviceScheduleWithRunLoop(ioHIDDeviceObject, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE); /* Allocate an instance ID for this device */ - device->instance_id = ++s_joystick_instance_id; + device->instance_id = SDL_GetNextJoystickInstanceID(); /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */ - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (IOHIDDeviceGetService != NULL) { /* weak reference: available in 10.6 and later. */ -#endif - - const io_service_t ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); + ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); + if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { + device->ffservice = ioservice; #if SDL_HAPTIC_IOKIT - if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { - device->ffservice = ioservice; - MacHaptic_MaybeAddDevice(ioservice); - } + MacHaptic_MaybeAddDevice(ioservice); #endif - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 } -#endif /* Add device to the end of the list */ if ( !gpDeviceList ) { @@ -483,21 +558,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic ++device_index; /* bump by one since we counted by pNext. */ } -/* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */ -#if !SDL_EVENTS_DISABLED - { - SDL_Event event; - event.type = SDL_JOYDEVICEADDED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = device_index; - if ((SDL_EventOK == NULL) - || (*SDL_EventOK) (SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickAdded(device->instance_id); } static SDL_bool @@ -582,13 +643,8 @@ CreateHIDManager(void) } -/* Function to scan the system for joysticks. - * Joystick 0 should be the system default joystick. - * This function should return the number of available joysticks, or -1 - * on an unrecoverable fatal error. - */ -int -SDL_SYS_JoystickInit(void) +static int +DARWIN_JoystickInit(void) { if (gpDeviceList) { return SDL_SetError("Joystick: Device list already inited."); @@ -598,12 +654,11 @@ SDL_SYS_JoystickInit(void) return SDL_SetError("Joystick: Couldn't initialize HID Manager"); } - return SDL_SYS_NumJoysticks(); + return 0; } -/* Function to return the number of joystick devices plugged in right now */ -int -SDL_SYS_NumJoysticks() +static int +DARWIN_JoystickGetCount(void) { recDevice *device = gpDeviceList; int nJoySticks = 0; @@ -618,10 +673,8 @@ SDL_SYS_NumJoysticks() return nJoySticks; } -/* Function to cause any queued joystick insertions to be processed - */ -void -SDL_SYS_JoystickDetect() +static void +DARWIN_JoystickDetect(void) { recDevice *device = gpDeviceList; while (device) { @@ -632,37 +685,49 @@ SDL_SYS_JoystickDetect() } } - // run this after the checks above so we don't set device->removed and delete the device before - // SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device - while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { - /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ - } + /* run this after the checks above so we don't set device->removed and delete the device before + DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */ + while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { + /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ + } } /* Function to get the device-dependent name of a joystick */ const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +DARWIN_JoystickGetDeviceName(int device_index) { recDevice *device = GetDeviceForIndex(device_index); return device ? device->product : "UNKNOWN"; } -/* Function to return the instance id of the joystick at device_index - */ -SDL_JoystickID -SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static int +DARWIN_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +DARWIN_JoystickGetDeviceGUID( int device_index ) +{ + recDevice *device = GetDeviceForIndex(device_index); + SDL_JoystickGUID guid; + if (device) { + guid = device->guid; + } else { + SDL_zero(guid); + } + return guid; +} + +static SDL_JoystickID +DARWIN_JoystickGetDeviceInstanceID(int device_index) { recDevice *device = GetDeviceForIndex(device_index); return device ? device->instance_id : 0; } -/* Function to open a joystick for use. - * The joystick to open is specified by the device index. - * This should fill the nbuttons and naxes fields of the joystick structure. - * It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +DARWIN_JoystickOpen(SDL_Joystick * joystick, int device_index) { recDevice *device = GetDeviceForIndex(device_index); @@ -677,22 +742,138 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) return 0; } -/* Function to query if the joystick is currently attached - * It returns SDL_TRUE if attached, SDL_FALSE otherwise. +/* + * Like strerror but for force feedback errors. */ -SDL_bool -SDL_SYS_JoystickAttached(SDL_Joystick * joystick) +static const char * +FFStrError(unsigned int err) { - return joystick->hwdata != NULL; + switch (err) { + case FFERR_DEVICEFULL: + return "device full"; + /* This should be valid, but for some reason isn't defined... */ + /* case FFERR_DEVICENOTREG: + return "device not registered"; */ + case FFERR_DEVICEPAUSED: + return "device paused"; + case FFERR_DEVICERELEASED: + return "device released"; + case FFERR_EFFECTPLAYING: + return "effect playing"; + case FFERR_EFFECTTYPEMISMATCH: + return "effect type mismatch"; + case FFERR_EFFECTTYPENOTSUPPORTED: + return "effect type not supported"; + case FFERR_GENERIC: + return "undetermined error"; + case FFERR_HASEFFECTS: + return "device has effects"; + case FFERR_INCOMPLETEEFFECT: + return "incomplete effect"; + case FFERR_INTERNAL: + return "internal fault"; + case FFERR_INVALIDDOWNLOADID: + return "invalid download id"; + case FFERR_INVALIDPARAM: + return "invalid parameter"; + case FFERR_MOREDATA: + return "more data"; + case FFERR_NOINTERFACE: + return "interface not supported"; + case FFERR_NOTDOWNLOADED: + return "effect is not downloaded"; + case FFERR_NOTINITIALIZED: + return "object has not been initialized"; + case FFERR_OUTOFMEMORY: + return "out of memory"; + case FFERR_UNPLUGGED: + return "device is unplugged"; + case FFERR_UNSUPPORTED: + return "function call unsupported"; + case FFERR_UNSUPPORTEDAXIS: + return "axis unsupported"; + + default: + return "unknown error"; + } } -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static int +DARWIN_JoystickInitRumble(recDevice *device, Sint16 magnitude, Uint32 duration_ms) +{ + HRESULT result; + + if (!device->ffdevice) { + result = FFCreateDevice(device->ffservice, &device->ffdevice); + if (result != FF_OK) { + return SDL_SetError("Unable to create force feedback device from service: %s", FFStrError(result)); + } + } + + /* Reset and then enable actuators */ + result = FFDeviceSendForceFeedbackCommand(device->ffdevice, FFSFFC_RESET); + if (result != FF_OK) { + return SDL_SetError("Unable to reset force feedback device: %s", FFStrError(result)); + } + + result = FFDeviceSendForceFeedbackCommand(device->ffdevice, FFSFFC_SETACTUATORSON); + if (result != FF_OK) { + return SDL_SetError("Unable to enable force feedback actuators: %s", FFStrError(result)); + } + + /* Create the effect */ + device->ffeffect = CreateRumbleEffectData(magnitude, duration_ms); + if (!device->ffeffect) { + return SDL_OutOfMemory(); + } + + result = FFDeviceCreateEffect(device->ffdevice, kFFEffectType_Sine_ID, + device->ffeffect, &device->ffeffect_ref); + if (result != FF_OK) { + return SDL_SetError("Haptic: Unable to create effect: %s", FFStrError(result)); + } + return 0; +} + +static int +DARWIN_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + HRESULT result; + recDevice *device = joystick->hwdata; + + /* Scale and average the two rumble strengths */ + Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2); + + if (!device->ffservice) { + return SDL_Unsupported(); + } + + if (device->ff_initialized) { + FFPERIODIC *periodic = ((FFPERIODIC *)device->ffeffect->lpvTypeSpecificParams); + device->ffeffect->dwDuration = duration_ms * 1000; /* In microseconds. */ + periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude); + + result = FFEffectSetParameters(device->ffeffect_ref, device->ffeffect, + (FFEP_DURATION | FFEP_TYPESPECIFICPARAMS)); + if (result != FF_OK) { + return SDL_SetError("Unable to update rumble effect: %s", FFStrError(result)); + } + } else { + if (DARWIN_JoystickInitRumble(device, magnitude, duration_ms) < 0) { + return -1; + } + device->ff_initialized = SDL_TRUE; + } + + result = FFEffectStart(device->ffeffect_ref, 1, 0); + if (result != FF_OK) { + return SDL_SetError("Unable to run the rumble effect: %s", FFStrError(result)); + } + return 0; +} + +static void +DARWIN_JoystickUpdate(SDL_Joystick * joystick) { recDevice *device = joystick->hwdata; recElement *element; @@ -713,11 +894,14 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstAxis; i = 0; + + int goodRead = SDL_FALSE; while (element) { - value = GetHIDScaledCalibratedState(device, element, -32768, 32767); - if (value != joystick->axes[i]) { + goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value); + if (goodRead) { SDL_PrivateJoystickAxis(joystick, i, value); } + element = element->pNext; ++i; } @@ -725,81 +909,82 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstButton; i = 0; while (element) { - value = GetHIDElementState(device, element); - if (value > 1) { /* handle pressure-sensitive buttons */ - value = 1; - } - if (value != joystick->buttons[i]) { + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + if (value > 1) { /* handle pressure-sensitive buttons */ + value = 1; + } SDL_PrivateJoystickButton(joystick, i, value); } + element = element->pNext; ++i; } element = device->firstHat; i = 0; + while (element) { Uint8 pos = 0; range = (element->max - element->min + 1); - value = GetHIDElementState(device, element) - element->min; - if (range == 4) { /* 4 position hatswitch - scale up value */ - value *= 2; - } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ - value = -1; - } - switch (value) { - case 0: - pos = SDL_HAT_UP; - break; - case 1: - pos = SDL_HAT_RIGHTUP; - break; - case 2: - pos = SDL_HAT_RIGHT; - break; - case 3: - pos = SDL_HAT_RIGHTDOWN; - break; - case 4: - pos = SDL_HAT_DOWN; - break; - case 5: - pos = SDL_HAT_LEFTDOWN; - break; - case 6: - pos = SDL_HAT_LEFT; - break; - case 7: - pos = SDL_HAT_LEFTUP; - break; - default: - /* Every other value is mapped to center. We do that because some - * joysticks use 8 and some 15 for this value, and apparently - * there are even more variants out there - so we try to be generous. - */ - pos = SDL_HAT_CENTERED; - break; - } + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + value -= element->min; + if (range == 4) { /* 4 position hatswitch - scale up value */ + value *= 2; + } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ + value = -1; + } + switch (value) { + case 0: + pos = SDL_HAT_UP; + break; + case 1: + pos = SDL_HAT_RIGHTUP; + break; + case 2: + pos = SDL_HAT_RIGHT; + break; + case 3: + pos = SDL_HAT_RIGHTDOWN; + break; + case 4: + pos = SDL_HAT_DOWN; + break; + case 5: + pos = SDL_HAT_LEFTDOWN; + break; + case 6: + pos = SDL_HAT_LEFT; + break; + case 7: + pos = SDL_HAT_LEFTUP; + break; + default: + /* Every other value is mapped to center. We do that because some + * joysticks use 8 and some 15 for this value, and apparently + * there are even more variants out there - so we try to be generous. + */ + pos = SDL_HAT_CENTERED; + break; + } - if (pos != joystick->hats[i]) { SDL_PrivateJoystickHat(joystick, i, pos); } - + element = element->pNext; ++i; } } -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +DARWIN_JoystickClose(SDL_Joystick * joystick) { } -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +DARWIN_JoystickQuit(void) { while (FreeDevice(gpDeviceList)) { /* spin */ @@ -813,23 +998,21 @@ SDL_SYS_JoystickQuit(void) } } - -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +SDL_JoystickDriver SDL_DARWIN_JoystickDriver = { - recDevice *device = GetDeviceForIndex(device_index); - SDL_JoystickGUID guid; - if (device) { - guid = device->guid; - } else { - SDL_zero(guid); - } - return guid; -} - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick) -{ - return joystick->hwdata->guid; -} + DARWIN_JoystickInit, + DARWIN_JoystickGetCount, + DARWIN_JoystickDetect, + DARWIN_JoystickGetDeviceName, + DARWIN_JoystickGetDevicePlayerIndex, + DARWIN_JoystickGetDeviceGUID, + DARWIN_JoystickGetDeviceInstanceID, + DARWIN_JoystickOpen, + DARWIN_JoystickRumble, + DARWIN_JoystickUpdate, + DARWIN_JoystickClose, + DARWIN_JoystickQuit, +}; #endif /* SDL_JOYSTICK_IOKIT */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick_c.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick_c.h index 1c317eca7a..2168f912e1 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ #define SDL_JOYSTICK_IOKIT_H #include +#include +#include struct recElement { @@ -45,6 +47,10 @@ struct joystick_hwdata { IOHIDDeviceRef deviceRef; /* HIDManager device handle */ io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ + FFDeviceObjectReference ffdevice; + FFEFFECT *ffeffect; + FFEffectObjectReference ffeffect_ref; + SDL_bool ff_initialized; char product[256]; /* name of product */ uint32_t usage; /* usage page from IOUSBHID Parser.h which defines general usage */ @@ -68,5 +74,6 @@ struct joystick_hwdata }; typedef struct joystick_hwdata recDevice; - #endif /* SDL_JOYSTICK_IOKIT_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/dummy/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/dummy/SDL_sysjoystick.c new file mode 100644 index 0000000000..ce0965daf0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/dummy/SDL_sysjoystick.c @@ -0,0 +1,120 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) + +/* This is the dummy implementation of the SDL joystick API */ + +#include "SDL_joystick.h" +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" + + +static int +DUMMY_JoystickInit(void) +{ + return 0; +} + +static int +DUMMY_JoystickGetCount(void) +{ + return 0; +} + +static void +DUMMY_JoystickDetect(void) +{ +} + +static const char * +DUMMY_JoystickGetDeviceName(int device_index) +{ + return NULL; +} + +static int +DUMMY_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +DUMMY_JoystickGetDeviceGUID(int device_index) +{ + SDL_JoystickGUID guid; + SDL_zero(guid); + return guid; +} + +static SDL_JoystickID +DUMMY_JoystickGetDeviceInstanceID(int device_index) +{ + return -1; +} + +static int +DUMMY_JoystickOpen(SDL_Joystick * joystick, int device_index) +{ + return SDL_SetError("Logic error: No joysticks available"); +} + +static int +DUMMY_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_Unsupported(); +} + +static void +DUMMY_JoystickUpdate(SDL_Joystick * joystick) +{ +} + +static void +DUMMY_JoystickClose(SDL_Joystick * joystick) +{ +} + +static void +DUMMY_JoystickQuit(void) +{ +} + +SDL_JoystickDriver SDL_DUMMY_JoystickDriver = +{ + DUMMY_JoystickInit, + DUMMY_JoystickGetCount, + DUMMY_JoystickDetect, + DUMMY_JoystickGetDeviceName, + DUMMY_JoystickGetDevicePlayerIndex, + DUMMY_JoystickGetDeviceGUID, + DUMMY_JoystickGetDeviceInstanceID, + DUMMY_JoystickOpen, + DUMMY_JoystickRumble, + DUMMY_JoystickUpdate, + DUMMY_JoystickClose, + DUMMY_JoystickQuit, +}; + +#endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick.c index e0c5833bfe..d551c8aa13 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/emscripten/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,7 @@ #include "SDL_error.h" #include "SDL_events.h" -#if !SDL_EVENTS_DISABLED -#include "../../events/SDL_events_c.h" -#endif - #include "SDL_joystick.h" -#include "SDL_hints.h" #include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_log.h" @@ -46,7 +41,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; static int instance_counter = 0; -EM_BOOL +static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { int i; @@ -57,10 +52,6 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa return 1; } -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif - item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item)); if (item == NULL) { return 1; @@ -105,20 +96,12 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa } ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + #ifdef DEBUG_JOYSTICK SDL_Log("Number of joysticks is %d", numjoysticks); #endif -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEADDED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = numjoysticks - 1; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ #ifdef DEBUG_JOYSTICK SDL_Log("Added joystick with index %d", item->index); @@ -127,14 +110,11 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa return 1; } -EM_BOOL +static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { SDL_joylist_item *item = SDL_joylist; SDL_joylist_item *prev = NULL; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif while (item != NULL) { if (item->index == gamepadEvent->index) { @@ -165,17 +145,7 @@ Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gam /* Need to decrement the joystick count before we post the event */ --numjoysticks; -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = item->device_instance; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(item->device_instance); #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with id %d", item->device_instance); @@ -186,11 +156,34 @@ Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gam return 1; } +/* Function to perform any system-specific joystick related cleanup */ +static void +EMSCRIPTEN_JoystickQuit(void) +{ + SDL_joylist_item *item = NULL; + SDL_joylist_item *next = NULL; + + for (item = SDL_joylist; item; item = next) { + next = item->next; + SDL_free(item->mapping); + SDL_free(item->name); + SDL_free(item); + } + + SDL_joylist = SDL_joylist_tail = NULL; + + numjoysticks = 0; + instance_counter = 0; + + emscripten_set_gamepadconnected_callback(NULL, 0, NULL); + emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL); +} + /* Function to scan the system for joysticks. * It should return 0, or -1 on an unrecoverable fatal error. */ -int -SDL_SYS_JoystickInit(void) +static int +EMSCRIPTEN_JoystickInit(void) { int retval, i, numjs; EmscriptenGamepadEvent gamepadState; @@ -220,7 +213,7 @@ SDL_SYS_JoystickInit(void) Emscripten_JoyStickConnected); if(retval != EMSCRIPTEN_RESULT_SUCCESS) { - SDL_SYS_JoystickQuit(); + EMSCRIPTEN_JoystickQuit(); return SDL_SetError("Could not set gamepad connect callback"); } @@ -228,7 +221,7 @@ SDL_SYS_JoystickInit(void) 0, Emscripten_JoyStickDisconnected); if(retval != EMSCRIPTEN_RESULT_SUCCESS) { - SDL_SYS_JoystickQuit(); + EMSCRIPTEN_JoystickQuit(); return SDL_SetError("Could not set gamepad disconnect callback"); } @@ -269,24 +262,31 @@ JoystickByIndex(int index) return item; } -int SDL_SYS_NumJoysticks() +static int +EMSCRIPTEN_JoystickGetCount(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +static void +EMSCRIPTEN_JoystickDetect(void) { } -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +EMSCRIPTEN_JoystickGetDeviceName(int device_index) { return JoystickByDeviceIndex(device_index)->name; } -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static int +EMSCRIPTEN_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickID +EMSCRIPTEN_JoystickGetDeviceInstanceID(int device_index) { return JoystickByDeviceIndex(device_index)->device_instance; } @@ -296,8 +296,8 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +EMSCRIPTEN_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDeviceIndex(device_index); @@ -323,19 +323,13 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) return (0); } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return joystick->hwdata != NULL; -} - /* Function to update the state of a joystick - called as a device poll. * This function shouldn't update the joystick structure directly, * but instead should call SDL_PrivateJoystick*() to deliver events * and update joystick device state. */ -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static void +EMSCRIPTEN_JoystickUpdate(SDL_Joystick * joystick) { EmscriptenGamepadEvent gamepadState; SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; @@ -358,7 +352,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) for(i = 0; i < item->naxes; i++) { if(item->axis[i] != gamepadState.axis[i]) { - // do we need to do conversion? + /* do we need to do conversion? */ SDL_PrivateJoystickAxis(item->joystick, i, (Sint16) (32767.*gamepadState.axis[i])); } @@ -374,54 +368,48 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) } /* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +EMSCRIPTEN_JoystickClose(SDL_Joystick * joystick) { -} - -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) -{ - SDL_joylist_item *item = NULL; - SDL_joylist_item *next = NULL; - - for (item = SDL_joylist; item; item = next) { - next = item->next; - SDL_free(item->mapping); - SDL_free(item->name); - SDL_free(item); + SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; + if (item) { + item->joystick = NULL; } - - SDL_joylist = SDL_joylist_tail = NULL; - - numjoysticks = 0; - instance_counter = 0; - - emscripten_set_gamepadconnected_callback(NULL, 0, NULL); - emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL); } -SDL_JoystickGUID -SDL_SYS_JoystickGetDeviceGUID(int device_index) +static SDL_JoystickGUID +EMSCRIPTEN_JoystickGetDeviceGUID(int device_index) { SDL_JoystickGUID guid; /* the GUID is just the first 16 chars of the name for now */ - const char *name = SDL_SYS_JoystickNameForDeviceIndex(device_index); + const char *name = EMSCRIPTEN_JoystickGetDeviceName(device_index); SDL_zero(guid); SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name))); return guid; } -SDL_JoystickGUID -SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +static int +EMSCRIPTEN_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = joystick->name; - SDL_zero(guid); - SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name))); - return guid; + return SDL_Unsupported(); } +SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver = +{ + EMSCRIPTEN_JoystickInit, + EMSCRIPTEN_JoystickGetCount, + EMSCRIPTEN_JoystickDetect, + EMSCRIPTEN_JoystickGetDeviceName, + EMSCRIPTEN_JoystickGetDevicePlayerIndex, + EMSCRIPTEN_JoystickGetDeviceGUID, + EMSCRIPTEN_JoystickGetDeviceInstanceID, + EMSCRIPTEN_JoystickOpen, + EMSCRIPTEN_JoystickRumble, + EMSCRIPTEN_JoystickUpdate, + EMSCRIPTEN_JoystickClose, + EMSCRIPTEN_JoystickQuit, +}; + #endif /* SDL_JOYSTICK_EMSCRIPTEN */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick_c.h new file mode 100644 index 0000000000..0c2be1db4a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_EMSCRIPTEN +#include "../SDL_sysjoystick.h" + + +#include + +/* A linked list of available joysticks */ +typedef struct SDL_joylist_item +{ + int index; + char *name; + char *mapping; + SDL_JoystickID device_instance; + SDL_Joystick *joystick; + int nbuttons; + int naxes; + double timestamp; + double axis[64]; + double analogButton[64]; + EM_BOOL digitalButton[64]; + + struct SDL_joylist_item *next; +} SDL_joylist_item; + +typedef SDL_joylist_item joystick_hwdata; + +#endif /* SDL_JOYSTICK_EMSCRIPTEN */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/haiku/SDL_haikujoystick.cc b/3rdparty/sdl2-2.0.9/src/joystick/haiku/SDL_haikujoystick.cc similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/joystick/haiku/SDL_haikujoystick.cc rename to 3rdparty/sdl2-2.0.9/src/joystick/haiku/SDL_haikujoystick.cc index 3ec9ae1078..9fa8ca9924 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/haiku/SDL_haikujoystick.cc +++ b/3rdparty/sdl2-2.0.9/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ /* This is the Haiku implementation of the SDL joystick API */ -#include -#include +#include +#include extern "C" { @@ -36,7 +36,7 @@ extern "C" /* The maximum number of joysticks we'll detect */ -#define MAX_JOYSTICKS 16 +#define MAX_JOYSTICKS 16 /* A list of available joysticks */ static char *SDL_joyport[MAX_JOYSTICKS]; @@ -50,13 +50,13 @@ extern "C" int16 *new_axes; }; - static int SDL_SYS_numjoysticks = 0; + static int numjoysticks = 0; /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ - int SDL_SYS_JoystickInit(void) + static int HAIKU_JoystickInit(void) { BJoystick joystick; int i; @@ -65,52 +65,59 @@ extern "C" /* Search for attached joysticks */ nports = joystick.CountDevices(); - SDL_SYS_numjoysticks = 0; + numjoysticks = 0; SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); - for (i = 0; (SDL_SYS_numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) + for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) { if (joystick.GetDeviceName(i, name) == B_OK) { if (joystick.Open(name) != B_ERROR) { BString stick_name; joystick.GetControllerName(&stick_name); - SDL_joyport[SDL_SYS_numjoysticks] = strdup(name); - SDL_joyname[SDL_SYS_numjoysticks] = strdup(stick_name.String()); - SDL_SYS_numjoysticks++; + SDL_joyport[numjoysticks] = SDL_strdup(name); + SDL_joyname[numjoysticks] = SDL_strdup(stick_name.String()); + numjoysticks++; joystick.Close(); } } } - return (SDL_SYS_numjoysticks); + return (numjoysticks); } - int SDL_SYS_NumJoysticks() + static int HAIKU_JoystickGetCount(void) { - return SDL_SYS_numjoysticks; + return numjoysticks; } - void SDL_SYS_JoystickDetect() + static void HAIKU_JoystickDetect(void) { } /* Function to get the device-dependent name of a joystick */ - const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index) + static const char *HAIKU_JoystickGetDeviceName(int device_index) { return SDL_joyname[device_index]; } + static int HAIKU_JoystickGetDevicePlayerIndex(int device_index) + { + return -1; + } + /* Function to perform the mapping from device index to the instance id for this index */ - SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) + static SDL_JoystickID HAIKU_JoystickGetDeviceInstanceID(int device_index) { return device_index; } + static void HAIKU_JoystickClose(SDL_Joystick * joystick); + /* Function to open a joystick for use. The joystick to open is specified by the device index. This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ - int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) + static int HAIKU_JoystickOpen(SDL_Joystick * joystick, int device_index) { BJoystick *stick; @@ -127,7 +134,7 @@ extern "C" /* Open the requested joystick for use */ if (stick->Open(SDL_joyport[device_index]) == B_ERROR) { - SDL_SYS_JoystickClose(joystick); + HAIKU_JoystickClose(joystick); return SDL_SetError("Unable to open joystick"); } @@ -144,18 +151,12 @@ extern "C" joystick->hwdata->new_hats = (uint8 *) SDL_malloc(joystick->nhats * sizeof(uint8)); if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) { - SDL_SYS_JoystickClose(joystick); + HAIKU_JoystickClose(joystick); return SDL_OutOfMemory(); } /* We're done! */ - return (0); - } - -/* Function to determine if this joystick is attached to the system right now */ - SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) - { - return SDL_TRUE; + return 0; } /* Function to update the state of a joystick - called as a device poll. @@ -163,7 +164,7 @@ extern "C" * but instead should call SDL_PrivateJoystick*() to deliver events * and update joystick device state. */ - void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) + static void HAIKU_JoystickUpdate(SDL_Joystick * joystick) { static const Uint8 hat_map[9] = { SDL_HAT_CENTERED, @@ -176,10 +177,9 @@ extern "C" SDL_HAT_LEFT, SDL_HAT_LEFTUP }; - const int JITTER = (32768 / 10); /* 10% jitter threshold (ok?) */ BJoystick *stick; - int i, change; + int i; int16 *axes; uint8 *hats; uint32 buttons; @@ -197,30 +197,23 @@ extern "C" /* Generate axis motion events */ for (i = 0; i < joystick->naxes; ++i) { - change = ((int32) axes[i] - joystick->axes[i]); - if ((change > JITTER) || (change < -JITTER)) { - SDL_PrivateJoystickAxis(joystick, i, axes[i]); - } + SDL_PrivateJoystickAxis(joystick, i, axes[i]); } /* Generate hat change events */ for (i = 0; i < joystick->nhats; ++i) { - if (hats[i] != joystick->hats[i]) { - SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); - } + SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); } /* Generate button events */ for (i = 0; i < joystick->nbuttons; ++i) { - if ((buttons & 0x01) != joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); - } + SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); buttons >>= 1; } } /* Function to close a joystick after use */ - void SDL_SYS_JoystickClose(SDL_Joystick * joystick) + static void HAIKU_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { joystick->hwdata->stick->Close(); @@ -232,42 +225,53 @@ extern "C" } /* Function to perform any system-specific joystick related cleanup */ - void SDL_SYS_JoystickQuit(void) + static void HAIKU_JoystickQuit(void) { int i; - for (i = 0; SDL_joyport[i]; ++i) { + for (i = 0; i < numjoysticks; ++i) { SDL_free(SDL_joyport[i]); } SDL_joyport[0] = NULL; - for (i = 0; SDL_joyname[i]; ++i) { + for (i = 0; i < numjoysticks; ++i) { SDL_free(SDL_joyname[i]); } SDL_joyname[0] = NULL; } - SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) + static SDL_JoystickGUID HAIKU_JoystickGetDeviceGUID( int device_index ) { SDL_JoystickGUID guid; /* the GUID is just the first 16 chars of the name for now */ - const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index ); + const char *name = HAIKU_JoystickGetDeviceName( device_index ); SDL_zero( guid ); SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); return guid; } - SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) + static int HAIKU_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - SDL_JoystickGUID guid; - /* the GUID is just the first 16 chars of the name for now */ - const char *name = joystick->name; - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; + return SDL_Unsupported(); } -}; // extern "C" + SDL_JoystickDriver SDL_HAIKU_JoystickDriver = + { + HAIKU_JoystickInit, + HAIKU_JoystickGetCount, + HAIKU_JoystickDetect, + HAIKU_JoystickGetDeviceName, + HAIKU_JoystickGetDevicePlayerIndex, + HAIKU_JoystickGetDeviceGUID, + HAIKU_JoystickGetDeviceInstanceID, + HAIKU_JoystickOpen, + HAIKU_JoystickRumble, + HAIKU_JoystickUpdate, + HAIKU_JoystickClose, + HAIKU_JoystickQuit, + }; + +} // extern "C" #endif /* SDL_JOYSTICK_HAIKU */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_ps4.c b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_ps4.c new file mode 100644 index 0000000000..cdd478a073 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -0,0 +1,566 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* This driver supports both simplified reports and the extended input reports enabled by Steam. + Code and logic contributed by Valve Corporation under the SDL zlib license. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_events.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" + + +#ifdef SDL_JOYSTICK_HIDAPI_PS4 + +#define SONY_USB_VID 0x054C +#define SONY_DS4_PID 0x05C4 +#define SONY_DS4_DONGLE_PID 0x0BA0 +#define SONY_DS4_SLIM_PID 0x09CC + +#define RAZER_USB_VID 0x1532 +#define RAZER_PANTHERA_PID 0X0401 +#define RAZER_PANTHERA_EVO_PID 0x1008 + +#define USB_PACKET_LENGTH 64 + +#define VOLUME_CHECK_INTERVAL_MS (10 * 1000) + +typedef enum +{ + k_EPS4ReportIdUsbState = 1, + k_EPS4ReportIdUsbEffects = 5, + k_EPS4ReportIdBluetoothState = 17, + k_EPS4ReportIdBluetoothEffects = 17, + k_EPS4ReportIdDisconnectMessage = 226, +} EPS4ReportId; + +typedef enum +{ + k_ePS4FeatureReportIdGyroCalibration_USB = 0x02, + k_ePS4FeatureReportIdGyroCalibration_BT = 0x05, + k_ePS4FeatureReportIdSerialNumber = 0x12, +} EPS4FeatureReportID; + +typedef struct +{ + Uint8 ucLeftJoystickX; + Uint8 ucLeftJoystickY; + Uint8 ucRightJoystickX; + Uint8 ucRightJoystickY; + Uint8 rgucButtonsHatAndCounter[ 3 ]; + Uint8 ucTriggerLeft; + Uint8 ucTriggerRight; + Uint8 _rgucPad0[ 3 ]; + Sint16 sGyroX; + Sint16 sGyroY; + Sint16 sGyroZ; + Sint16 sAccelX; + Sint16 sAccelY; + Sint16 sAccelZ; + Uint8 _rgucPad1[ 5 ]; + Uint8 ucBatteryLevel; + Uint8 _rgucPad2[ 4 ]; + Uint8 ucTrackpadCounter1; + Uint8 rgucTrackpadData1[ 3 ]; + Uint8 ucTrackpadCounter2; + Uint8 rgucTrackpadData2[ 3 ]; +} PS4StatePacket_t; + +typedef struct +{ + Uint8 ucRumbleRight; + Uint8 ucRumbleLeft; + Uint8 ucLedRed; + Uint8 ucLedGreen; + Uint8 ucLedBlue; + Uint8 ucLedDelayOn; + Uint8 ucLedDelayOff; + Uint8 _rgucPad0[ 8 ]; + Uint8 ucVolumeLeft; + Uint8 ucVolumeRight; + Uint8 ucVolumeMic; + Uint8 ucVolumeSpeaker; +} DS4EffectsState_t; + +typedef struct { + SDL_bool is_dongle; + SDL_bool is_bluetooth; + SDL_bool audio_supported; + SDL_bool rumble_supported; + Uint8 volume; + Uint32 last_volume_check; + Uint32 rumble_expiration; + PS4StatePacket_t last_state; +} SDL_DriverPS4_Context; + + +/* Public domain CRC implementation adapted from: + http://home.thep.lu.se/~bjorn/crc/crc32_simple.c +*/ +static Uint32 crc32_for_byte(Uint32 r) +{ + int i; + for(i = 0; i < 8; ++i) { + r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1; + } + return r ^ (Uint32)0xFF000000L; +} + +static Uint32 crc32(Uint32 crc, const void *data, int count) +{ + int i; + for(i = 0; i < count; ++i) { + crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8; + } + return crc; +} + +#if defined(__WIN32__) && defined(HAVE_ENDPOINTVOLUME_H) +#include "../../core/windows/SDL_windows.h" + +#ifndef NTDDI_VISTA +#define NTDDI_VISTA 0x06000000 +#endif +#ifndef _WIN32_WINNT_VISTA +#define _WIN32_WINNT_VISTA 0x0600 +#endif + +/* Define Vista for the Audio related includes below to work */ +#undef NTDDI_VERSION +#define NTDDI_VERSION NTDDI_VISTA +#undef _WIN32_WINNT +#define _WIN32_WINNT _WIN32_WINNT_VISTA +#define COBJMACROS +#include +#include +#include + +#undef DEFINE_GUID +#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} +DEFINE_GUID(SDL_CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); +DEFINE_GUID(SDL_IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); +DEFINE_GUID(SDL_IID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A); +#endif + + + +static float GetSystemVolume(void) +{ + float volume = -1.0f; /* Return this if we can't get system volume */ + +#if defined(__WIN32__) && defined(HAVE_ENDPOINTVOLUME_H) + HRESULT hr = WIN_CoInitialize(); + if (SUCCEEDED(hr)) { + IMMDeviceEnumerator *pEnumerator; + + /* This should gracefully fail on XP and succeed on everything Vista and above */ + hr = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &SDL_IID_IMMDeviceEnumerator, (LPVOID*)&pEnumerator); + if (SUCCEEDED(hr)) { + IMMDevice *pDevice; + + hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(pEnumerator, eRender, eConsole, &pDevice); + if (SUCCEEDED(hr)) { + IAudioEndpointVolume *pEndpointVolume; + + hr = IMMDevice_Activate(pDevice, &SDL_IID_IAudioEndpointVolume, CLSCTX_ALL, NULL, (LPVOID*)&pEndpointVolume); + if (SUCCEEDED(hr)) { + IAudioEndpointVolume_GetMasterVolumeLevelScalar(pEndpointVolume, &volume); + IUnknown_Release(pEndpointVolume); + } + IUnknown_Release(pDevice); + } + IUnknown_Release(pEnumerator); + } + WIN_CoUninitialize(); + } +#endif /* __WIN32__ */ + + return volume; +} + +static uint8_t GetPlaystationVolumeFromFloat(float fVolume) +{ + const int k_nVolumeFitRatio = 15; + const int k_nVolumeFitOffset = 9; + float fVolLog; + + if (fVolume > 1.0f || fVolume < 0.0f) { + fVolume = 0.30f; + } + fVolLog = SDL_logf(fVolume * 100); + + return (Uint8)((fVolLog * k_nVolumeFitRatio) + k_nVolumeFitOffset); +} + +static SDL_bool +HIDAPI_DriverPS4_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number) +{ + return SDL_IsJoystickPS4(vendor_id, product_id); +} + +static const char * +HIDAPI_DriverPS4_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +{ + if (vendor_id == SONY_USB_VID) { + return "PS4 Controller"; + } + return NULL; +} + +static SDL_bool ReadFeatureReport(hid_device *dev, Uint8 report_id, Uint8 *data, size_t size) +{ + Uint8 report[USB_PACKET_LENGTH + 1]; + + SDL_memset(report, 0, sizeof(report)); + report[0] = report_id; + if (hid_get_feature_report(dev, report, sizeof(report)) < 0) { + return SDL_FALSE; + } + SDL_memcpy(data, report, SDL_min(size, sizeof(report))); + return SDL_TRUE; +} + +static SDL_bool CheckUSBConnected(hid_device *dev) +{ + int i; + Uint8 data[16]; + + /* This will fail if we're on Bluetooth */ + if (ReadFeatureReport(dev, k_ePS4FeatureReportIdSerialNumber, data, sizeof(data))) { + for (i = 0; i < sizeof(data); ++i) { + if (data[i] != 0x00) { + return SDL_TRUE; + } + } + /* Maybe the dongle without a connected controller? */ + } + return SDL_FALSE; +} + +static SDL_bool HIDAPI_DriverPS4_CanRumble(Uint16 vendor_id, Uint16 product_id) +{ + /* The Razer Panthera fight stick hangs when trying to rumble */ + if (vendor_id == RAZER_USB_VID && + (product_id == RAZER_PANTHERA_PID || product_id == RAZER_PANTHERA_EVO_PID)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static int HIDAPI_DriverPS4_Rumble(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + +static SDL_bool +HIDAPI_DriverPS4_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, Uint16 product_id, void **context) +{ + SDL_DriverPS4_Context *ctx; + + ctx = (SDL_DriverPS4_Context *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + *context = ctx; + + /* Check for type of connection */ + ctx->is_dongle = (vendor_id == SONY_USB_VID && product_id == SONY_DS4_DONGLE_PID); + if (ctx->is_dongle) { + ctx->is_bluetooth = SDL_FALSE; + } else if (vendor_id == SONY_USB_VID) { + ctx->is_bluetooth = !CheckUSBConnected(dev); + } else { + /* Third party controllers appear to all be wired */ + ctx->is_bluetooth = SDL_FALSE; + } +#ifdef DEBUG_PS4 + SDL_Log("PS4 dongle = %s, bluetooth = %s\n", ctx->is_dongle ? "TRUE" : "FALSE", ctx->is_bluetooth ? "TRUE" : "FALSE"); +#endif + + /* Check to see if audio is supported */ + if (vendor_id == SONY_USB_VID && + (product_id == SONY_DS4_SLIM_PID || product_id == SONY_DS4_DONGLE_PID )) { + ctx->audio_supported = SDL_TRUE; + } + + if (HIDAPI_DriverPS4_CanRumble(vendor_id, product_id)) { + if (ctx->is_bluetooth) { + ctx->rumble_supported = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, SDL_FALSE); + } else { + ctx->rumble_supported = SDL_TRUE; + } + } + + /* Initialize LED and effect state */ + HIDAPI_DriverPS4_Rumble(joystick, dev, ctx, 0, 0, 0); + + /* Initialize the joystick capabilities */ + joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + + return SDL_TRUE; +} + +static int +HIDAPI_DriverPS4_Rumble(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + SDL_DriverPS4_Context *ctx = (SDL_DriverPS4_Context *)context; + DS4EffectsState_t *effects; + Uint8 data[78]; + int report_size, offset; + + if (!ctx->rumble_supported) { + return SDL_Unsupported(); + } + + /* In order to send rumble, we have to send a complete effect packet */ + SDL_memset(data, 0, sizeof(data)); + + if (ctx->is_bluetooth) { + data[0] = k_EPS4ReportIdBluetoothEffects; + data[1] = 0xC0 | 0x04; /* Magic value HID + CRC, also sets interval to 4ms for samples */ + data[3] = 0x03; /* 0x1 is rumble, 0x2 is lightbar, 0x4 is the blink interval */ + + report_size = 78; + offset = 6; + } else { + data[0] = k_EPS4ReportIdUsbEffects; + data[1] = 0x07; /* Magic value */ + + report_size = 32; + offset = 4; + } + effects = (DS4EffectsState_t *)&data[offset]; + + effects->ucRumbleLeft = (low_frequency_rumble >> 8); + effects->ucRumbleRight = (high_frequency_rumble >> 8); + + effects->ucLedRed = 0; + effects->ucLedGreen = 0; + effects->ucLedBlue = 80; + + if (ctx->audio_supported) { + Uint32 now = SDL_GetTicks(); + if (!ctx->last_volume_check || + SDL_TICKS_PASSED(now, ctx->last_volume_check + VOLUME_CHECK_INTERVAL_MS)) { + ctx->volume = GetPlaystationVolumeFromFloat(GetSystemVolume()); + ctx->last_volume_check = now; + } + + effects->ucVolumeRight = ctx->volume; + effects->ucVolumeLeft = ctx->volume; + effects->ucVolumeSpeaker = ctx->volume; + effects->ucVolumeMic = 0xFF; + } + + if (ctx->is_bluetooth) { + /* Bluetooth reports need a CRC at the end of the packet (at least on Linux) */ + Uint8 ubHdr = 0xA2; /* hidp header is part of the CRC calculation */ + Uint32 unCRC; + unCRC = crc32(0, &ubHdr, 1); + unCRC = crc32(unCRC, data, (Uint32)(report_size - sizeof(unCRC))); + SDL_memcpy(&data[report_size - sizeof(unCRC)], &unCRC, sizeof(unCRC)); + } + + if (hid_write(dev, data, report_size) != report_size) { + return SDL_SetError("Couldn't send rumble packet"); + } + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + ctx->rumble_expiration = SDL_GetTicks() + duration_ms; + } else { + ctx->rumble_expiration = 0; + } + return 0; +} + +static void +HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverPS4_Context *ctx, PS4StatePacket_t *packet) +{ + Sint16 axis; + + if (ctx->last_state.rgucButtonsHatAndCounter[0] != packet->rgucButtonsHatAndCounter[0]) { + { + Uint8 data = (packet->rgucButtonsHatAndCounter[0] >> 4); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + } + { + Uint8 data = (packet->rgucButtonsHatAndCounter[0] & 0x0F); + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (data) { + case 0: + dpad_up = SDL_TRUE; + break; + case 1: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 2: + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 4: + dpad_down = SDL_TRUE; + break; + case 5: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + break; + case 7: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + } + + if (ctx->last_state.rgucButtonsHatAndCounter[1] != packet->rgucButtonsHatAndCounter[1]) { + Uint8 data = packet->rgucButtonsHatAndCounter[1]; + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) { + Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + } + + axis = ((int)packet->ucTriggerLeft * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + axis = ((int)packet->ucTriggerRight * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + axis = ((int)packet->ucLeftJoystickX * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + axis = ((int)packet->ucLeftJoystickY * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + axis = ((int)packet->ucRightJoystickX * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + axis = ((int)packet->ucRightJoystickY * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + + if (packet->ucBatteryLevel & 0x10) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + } else { + /* Battery level ranges from 0 to 10 */ + int level = (packet->ucBatteryLevel & 0xF); + if (level == 0) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + } else if (level <= 2) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + } else if (level <= 7) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + } else { + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + } + } + + SDL_memcpy(&ctx->last_state, packet, sizeof(ctx->last_state)); +} + +static SDL_bool +HIDAPI_DriverPS4_Update(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_DriverPS4_Context *ctx = (SDL_DriverPS4_Context *)context; + Uint8 data[USB_PACKET_LENGTH]; + int size; + + while ((size = hid_read_timeout(dev, data, sizeof(data), 0)) > 0) { + switch (data[0]) { + case k_EPS4ReportIdUsbState: + HIDAPI_DriverPS4_HandleStatePacket(joystick, dev, ctx, (PS4StatePacket_t *)&data[1]); + break; + case k_EPS4ReportIdBluetoothState: + /* Bluetooth state packets have two additional bytes at the beginning */ + HIDAPI_DriverPS4_HandleStatePacket(joystick, dev, ctx, (PS4StatePacket_t *)&data[3]); + break; + default: +#ifdef DEBUG_JOYSTICK + SDL_Log("Unknown PS4 packet: 0x%.2x\n", data[0]); +#endif + break; + } + } + + if (ctx->rumble_expiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, ctx->rumble_expiration)) { + HIDAPI_DriverPS4_Rumble(joystick, dev, context, 0, 0, 0); + } + } + + return (size >= 0); +} + +static void +HIDAPI_DriverPS4_Quit(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_free(context); +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS4 = +{ + SDL_HINT_JOYSTICK_HIDAPI_PS4, + SDL_TRUE, + HIDAPI_DriverPS4_IsSupportedDevice, + HIDAPI_DriverPS4_GetDeviceName, + HIDAPI_DriverPS4_Init, + HIDAPI_DriverPS4_Rumble, + HIDAPI_DriverPS4_Update, + HIDAPI_DriverPS4_Quit +}; + +#endif /* SDL_JOYSTICK_HIDAPI_PS4 */ + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_switch.c b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_switch.c new file mode 100644 index 0000000000..16e4ea3c29 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_switch.c @@ -0,0 +1,905 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* This driver supports the Nintendo Switch Pro controller. + Code and logic contributed by Valve Corporation under the SDL zlib license. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_events.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" + + +#ifdef SDL_JOYSTICK_HIDAPI_SWITCH + +typedef enum { + k_eSwitchInputReportIDs_SubcommandReply = 0x21, + k_eSwitchInputReportIDs_FullControllerState = 0x30, + k_eSwitchInputReportIDs_SimpleControllerState = 0x3F, + k_eSwitchInputReportIDs_CommandAck = 0x81, +} ESwitchInputReportIDs; + +typedef enum { + k_eSwitchOutputReportIDs_RumbleAndSubcommand = 0x01, + k_eSwitchOutputReportIDs_Rumble = 0x10, + k_eSwitchOutputReportIDs_Proprietary = 0x80, +} ESwitchOutputReportIDs; + +typedef enum { + k_eSwitchSubcommandIDs_BluetoothManualPair = 0x01, + k_eSwitchSubcommandIDs_RequestDeviceInfo = 0x02, + k_eSwitchSubcommandIDs_SetInputReportMode = 0x03, + k_eSwitchSubcommandIDs_SetHCIState = 0x06, + k_eSwitchSubcommandIDs_SPIFlashRead = 0x10, + k_eSwitchSubcommandIDs_SetPlayerLights = 0x30, + k_eSwitchSubcommandIDs_SetHomeLight = 0x38, + k_eSwitchSubcommandIDs_EnableIMU = 0x40, + k_eSwitchSubcommandIDs_SetIMUSensitivity = 0x41, + k_eSwitchSubcommandIDs_EnableVibration = 0x48, +} ESwitchSubcommandIDs; + +typedef enum { + k_eSwitchProprietaryCommandIDs_Handshake = 0x02, + k_eSwitchProprietaryCommandIDs_HighSpeed = 0x03, + k_eSwitchProprietaryCommandIDs_ForceUSB = 0x04, + k_eSwitchProprietaryCommandIDs_ClearUSB = 0x05, + k_eSwitchProprietaryCommandIDs_ResetMCU = 0x06, +} ESwitchProprietaryCommandIDs; + +typedef enum { + k_eSwitchDeviceInfoControllerType_JoyConLeft = 0x1, + k_eSwitchDeviceInfoControllerType_JoyConRight = 0x2, + k_eSwitchDeviceInfoControllerType_ProController = 0x3, +} ESwitchDeviceInfoControllerType; + +#define k_unSwitchOutputPacketDataLength 49 +#define k_unSwitchMaxOutputPacketLength 64 +#define k_unSwitchBluetoothPacketLength k_unSwitchOutputPacketDataLength +#define k_unSwitchUSBPacketLength k_unSwitchMaxOutputPacketLength + +#define k_unSPIStickCalibrationStartOffset 0x603D +#define k_unSPIStickCalibrationEndOffset 0x604E +#define k_unSPIStickCalibrationLength (k_unSPIStickCalibrationEndOffset - k_unSPIStickCalibrationStartOffset + 1) + +#pragma pack(1) +typedef struct +{ + Uint8 rgucButtons[2]; + Uint8 ucStickHat; + Sint16 sJoystickLeft[2]; + Sint16 sJoystickRight[2]; +} SwitchSimpleStatePacket_t; + +typedef struct +{ + Uint8 ucCounter; + Uint8 ucBatteryAndConnection; + Uint8 rgucButtons[3]; + Uint8 rgucJoystickLeft[3]; + Uint8 rgucJoystickRight[3]; + Uint8 ucVibrationCode; +} SwitchControllerStatePacket_t; + +typedef struct +{ + SwitchControllerStatePacket_t controllerState; + + struct { + Sint16 sAccelX; + Sint16 sAccelY; + Sint16 sAccelZ; + + Sint16 sGyroX; + Sint16 sGyroY; + Sint16 sGyroZ; + } imuState[3]; +} SwitchStatePacket_t; + +typedef struct +{ + Uint32 unAddress; + Uint8 ucLength; +} SwitchSPIOpData_t; + +typedef struct +{ + SwitchControllerStatePacket_t m_controllerState; + + Uint8 ucSubcommandAck; + Uint8 ucSubcommandID; + + #define k_unSubcommandDataBytes 35 + union { + Uint8 rgucSubcommandData[ k_unSubcommandDataBytes ]; + + struct { + SwitchSPIOpData_t opData; + Uint8 rgucReadData[ k_unSubcommandDataBytes - sizeof(SwitchSPIOpData_t) ]; + } spiReadData; + + struct { + Uint8 rgucFirmwareVersion[2]; + Uint8 ucDeviceType; + Uint8 ucFiller1; + Uint8 rgucMACAddress[6]; + Uint8 ucFiller2; + Uint8 ucColorLocation; + } deviceInfo; + }; +} SwitchSubcommandInputPacket_t; + +typedef struct +{ + Uint8 rgucData[4]; +} SwitchRumbleData_t; + +typedef struct +{ + Uint8 ucPacketType; + Uint8 ucPacketNumber; + SwitchRumbleData_t rumbleData[2]; +} SwitchCommonOutputPacket_t; + +typedef struct +{ + SwitchCommonOutputPacket_t commonData; + + Uint8 ucSubcommandID; + Uint8 rgucSubcommandData[ k_unSwitchOutputPacketDataLength - sizeof(SwitchCommonOutputPacket_t) - 1 ]; +} SwitchSubcommandOutputPacket_t; + +typedef struct +{ + Uint8 ucPacketType; + Uint8 ucProprietaryID; + + Uint8 rgucProprietaryData[ k_unSwitchOutputPacketDataLength - 1 - 1 ]; +} SwitchProprietaryOutputPacket_t; +#pragma pack() + +typedef struct { + hid_device *dev; + SDL_bool m_bIsUsingBluetooth; + Uint8 m_nCommandNumber; + SwitchCommonOutputPacket_t m_RumblePacket; + Uint32 m_nRumbleExpiration; + Uint8 m_rgucReadBuffer[k_unSwitchMaxOutputPacketLength]; + SwitchSimpleStatePacket_t m_lastSimpleState; + SwitchStatePacket_t m_lastFullState; + + struct StickCalibrationData { + struct { + Sint16 sCenter; + Sint16 sMin; + Sint16 sMax; + } axis[2]; + } m_StickCalData[2]; + + struct StickExtents { + struct { + Sint16 sMin; + Sint16 sMax; + } axis[2]; + } m_StickExtents[2]; +} SDL_DriverSwitch_Context; + + +static SDL_bool +HIDAPI_DriverSwitch_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number) +{ + return SDL_IsJoystickNintendoSwitchPro(vendor_id, product_id); +} + +static const char * +HIDAPI_DriverSwitch_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +{ + /* Give a user friendly name for this controller */ + if (SDL_IsJoystickNintendoSwitchPro(vendor_id, product_id)) { + return "Nintendo Switch Pro Controller"; + } + return NULL; +} + +static int ReadInput(SDL_DriverSwitch_Context *ctx) +{ + return hid_read_timeout(ctx->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0); +} + +static int WriteOutput(SDL_DriverSwitch_Context *ctx, Uint8 *data, int size) +{ + return hid_write(ctx->dev, data, size); +} + +static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID) +{ + /* Average response time for messages is ~30ms */ + Uint32 TimeoutMs = 100; + Uint32 startTicks = SDL_GetTicks(); + + int nRead = 0; + while ((nRead = ReadInput(ctx)) != -1) { + if (nRead > 0) { + if (ctx->m_rgucReadBuffer[0] == k_eSwitchInputReportIDs_SubcommandReply) { + SwitchSubcommandInputPacket_t *reply = (SwitchSubcommandInputPacket_t *)&ctx->m_rgucReadBuffer[ 1 ]; + if (reply->ucSubcommandID == expectedID && (reply->ucSubcommandAck & 0x80)) { + return reply; + } + } + } else { + SDL_Delay(1); + } + + if (SDL_TICKS_PASSED(SDL_GetTicks(), startTicks + TimeoutMs)) { + break; + } + } + return NULL; +} + +static SDL_bool ReadProprietaryReply(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCommandIDs expectedID) +{ + /* Average response time for messages is ~30ms */ + Uint32 TimeoutMs = 100; + Uint32 startTicks = SDL_GetTicks(); + + int nRead = 0; + while ((nRead = ReadInput(ctx)) != -1) { + if (nRead > 0) { + if (ctx->m_rgucReadBuffer[0] == k_eSwitchInputReportIDs_CommandAck && ctx->m_rgucReadBuffer[ 1 ] == expectedID) { + return SDL_TRUE; + } + } else { + SDL_Delay(1); + } + + if (SDL_TICKS_PASSED(SDL_GetTicks(), startTicks + TimeoutMs)) { + break; + } + } + return SDL_FALSE; +} + +static void ConstructSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandOutputPacket_t *outPacket) +{ + SDL_memset(outPacket, 0, sizeof(*outPacket)); + + outPacket->commonData.ucPacketType = k_eSwitchOutputReportIDs_RumbleAndSubcommand; + outPacket->commonData.ucPacketNumber = ctx->m_nCommandNumber; + + SDL_memcpy(&outPacket->commonData.rumbleData, &ctx->m_RumblePacket.rumbleData, sizeof(ctx->m_RumblePacket.rumbleData)); + + outPacket->ucSubcommandID = ucCommandID; + SDL_memcpy(outPacket->rgucSubcommandData, pBuf, ucLen); + + ctx->m_nCommandNumber = (ctx->m_nCommandNumber + 1) & 0xF; +} + +static SDL_bool WritePacket(SDL_DriverSwitch_Context *ctx, void *pBuf, Uint8 ucLen) +{ + Uint8 rgucBuf[k_unSwitchMaxOutputPacketLength]; + const size_t unWriteSize = ctx->m_bIsUsingBluetooth ? k_unSwitchBluetoothPacketLength : k_unSwitchUSBPacketLength; + + if (ucLen > k_unSwitchOutputPacketDataLength) { + return SDL_FALSE; + } + + if (ucLen < unWriteSize) { + SDL_memcpy(rgucBuf, pBuf, ucLen); + SDL_memset(rgucBuf+ucLen, 0, unWriteSize-ucLen); + pBuf = rgucBuf; + ucLen = (Uint8)unWriteSize; + } + return (WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0); +} + +static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandInputPacket_t **ppReply) +{ + int nRetries = 5; + SwitchSubcommandInputPacket_t *reply = NULL; + + while (!reply && nRetries--) { + SwitchSubcommandOutputPacket_t commandPacket; + ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket); + + if (!WritePacket(ctx, &commandPacket, sizeof(commandPacket))) { + continue; + } + + reply = ReadSubcommandReply(ctx, ucCommandID); + } + + if (ppReply) { + *ppReply = reply; + } + return reply != NULL; +} + +static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCommandIDs ucCommand, Uint8 *pBuf, Uint8 ucLen, SDL_bool waitForReply) +{ + int nRetries = 5; + + while (nRetries--) { + SwitchProprietaryOutputPacket_t packet; + + if ((!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) { + return SDL_FALSE; + } + + packet.ucPacketType = k_eSwitchOutputReportIDs_Proprietary; + packet.ucProprietaryID = ucCommand; + SDL_memcpy(packet.rgucProprietaryData, pBuf, ucLen); + + if (!WritePacket(ctx, &packet, sizeof(packet))) { + continue; + } + + if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void SetNeutralRumble(SwitchRumbleData_t *pRumble) +{ + pRumble->rgucData[0] = 0x00; + pRumble->rgucData[1] = 0x01; + pRumble->rgucData[2] = 0x40; + pRumble->rgucData[3] = 0x40; +} + +static void EncodeRumble(SwitchRumbleData_t *pRumble, Uint16 usHighFreq, Uint8 ucHighFreqAmp, Uint8 ucLowFreq, Uint16 usLowFreqAmp) +{ + if (ucHighFreqAmp > 0 || usLowFreqAmp > 0) { + // High-band frequency and low-band amplitude are actually nine-bits each so they + // take a bit from the high-band amplitude and low-band frequency bytes respectively + pRumble->rgucData[0] = usHighFreq & 0xFF; + pRumble->rgucData[1] = ucHighFreqAmp | ((usHighFreq >> 8) & 0x01); + + pRumble->rgucData[2] = ucLowFreq | ((usLowFreqAmp >> 8) & 0x80); + pRumble->rgucData[3] = usLowFreqAmp & 0xFF; + +#ifdef DEBUG_RUMBLE + SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X\n", + usHighFreq & 0xFF, ((usHighFreq >> 8) & 0x01), ucLowFreq, + ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF); +#endif + } else { + SetNeutralRumble(pRumble); + } +} + +static SDL_bool WriteRumble(SDL_DriverSwitch_Context *ctx) +{ + /* Write into m_RumblePacket rather than a temporary buffer to allow the current rumble state + * to be retained for subsequent rumble or subcommand packets sent to the controller + */ + ctx->m_RumblePacket.ucPacketType = k_eSwitchOutputReportIDs_Rumble; + ctx->m_RumblePacket.ucPacketNumber = ctx->m_nCommandNumber; + ctx->m_nCommandNumber = (ctx->m_nCommandNumber + 1) & 0xF; + + return WritePacket(ctx, (Uint8 *)&ctx->m_RumblePacket, sizeof(ctx->m_RumblePacket)); +} + +static SDL_bool BTrySetupUSB(SDL_DriverSwitch_Context *ctx) +{ + /* We have to send a connection handshake to the controller when communicating over USB + * before we're able to send it other commands. Luckily this command is not supported + * over Bluetooth, so we can use the controller's lack of response as a way to + * determine if the connection is over USB or Bluetooth + */ + if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) { + return SDL_FALSE; + } + if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_HighSpeed, NULL, 0, SDL_TRUE)) { + return SDL_FALSE; + } + if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static SDL_bool SetVibrationEnabled(SDL_DriverSwitch_Context *ctx, Uint8 enabled) +{ + return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_EnableVibration, &enabled, sizeof(enabled), NULL); + +} +static SDL_bool SetInputMode(SDL_DriverSwitch_Context *ctx, Uint8 input_mode) +{ + return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetInputReportMode, &input_mode, 1, NULL); +} + +static SDL_bool SetHomeLED(SDL_DriverSwitch_Context *ctx, Uint8 brightness) +{ + Uint8 ucLedIntensity = 0; + Uint8 rgucBuffer[4]; + + if (brightness > 0) { + if (brightness < 65) { + ucLedIntensity = (brightness + 5) / 10; + } else { + ucLedIntensity = (Uint8)SDL_ceilf(0xF * SDL_powf((float)brightness / 100.f, 2.13f)); + } + } + + rgucBuffer[0] = (0x0 << 4) | 0x1; /* 0 mini cycles (besides first), cycle duration 8ms */ + rgucBuffer[1] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* LED start intensity (0x0-0xF), 0 cycles (LED stays on at start intensity after first cycle) */ + rgucBuffer[2] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* First cycle LED intensity, 0x0 intensity for second cycle */ + rgucBuffer[3] = (0x0 << 4) | 0x0; /* 8ms fade transition to first cycle, 8ms first cycle LED duration */ + + return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetHomeLight, rgucBuffer, sizeof(rgucBuffer), NULL); +} + +static SDL_bool SetSlotLED(SDL_DriverSwitch_Context *ctx, Uint8 slot) +{ + Uint8 led_data = (1 << slot); + return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetPlayerLights, &led_data, sizeof(led_data), NULL); +} + +static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx) +{ + Uint8 *pStickCal; + size_t stick, axis; + SwitchSubcommandInputPacket_t *reply = NULL; + + /* Read Calibration Info */ + SwitchSPIOpData_t readParams; + readParams.unAddress = k_unSPIStickCalibrationStartOffset; + readParams.ucLength = k_unSPIStickCalibrationLength; + + if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readParams, sizeof(readParams), &reply)) { + return SDL_FALSE; + } + + /* Stick calibration values are 12-bits each and are packed by bit + * For whatever reason the fields are in a different order for each stick + * Left: X-Max, Y-Max, X-Center, Y-Center, X-Min, Y-Min + * Right: X-Center, Y-Center, X-Min, Y-Min, X-Max, Y-Max + */ + pStickCal = reply->spiReadData.rgucReadData; + + /* Left stick */ + ctx->m_StickCalData[0].axis[0].sMax = ((pStickCal[1] << 8) & 0xF00) | pStickCal[0]; /* X Axis max above center */ + ctx->m_StickCalData[0].axis[1].sMax = (pStickCal[2] << 4) | (pStickCal[1] >> 4); /* Y Axis max above center */ + ctx->m_StickCalData[0].axis[0].sCenter = ((pStickCal[4] << 8) & 0xF00) | pStickCal[3]; /* X Axis center */ + ctx->m_StickCalData[0].axis[1].sCenter = (pStickCal[5] << 4) | (pStickCal[4] >> 4); /* Y Axis center */ + ctx->m_StickCalData[0].axis[0].sMin = ((pStickCal[7] << 8) & 0xF00) | pStickCal[6]; /* X Axis min below center */ + ctx->m_StickCalData[0].axis[1].sMin = (pStickCal[8] << 4) | (pStickCal[7] >> 4); /* Y Axis min below center */ + + /* Right stick */ + ctx->m_StickCalData[1].axis[0].sCenter = ((pStickCal[10] << 8) & 0xF00) | pStickCal[9]; /* X Axis center */ + ctx->m_StickCalData[1].axis[1].sCenter = (pStickCal[11] << 4) | (pStickCal[10] >> 4); /* Y Axis center */ + ctx->m_StickCalData[1].axis[0].sMin = ((pStickCal[13] << 8) & 0xF00) | pStickCal[12]; /* X Axis min below center */ + ctx->m_StickCalData[1].axis[1].sMin = (pStickCal[14] << 4) | (pStickCal[13] >> 4); /* Y Axis min below center */ + ctx->m_StickCalData[1].axis[0].sMax = ((pStickCal[16] << 8) & 0xF00) | pStickCal[15]; /* X Axis max above center */ + ctx->m_StickCalData[1].axis[1].sMax = (pStickCal[17] << 4) | (pStickCal[16] >> 4); /* Y Axis max above center */ + + /* Filter out any values that were uninitialized (0xFFF) in the SPI read */ + for (stick = 0; stick < 2; ++stick) { + for (axis = 0; axis < 2; ++axis) { + if (ctx->m_StickCalData[stick].axis[axis].sCenter == 0xFFF) { + ctx->m_StickCalData[stick].axis[axis].sCenter = 0; + } + if (ctx->m_StickCalData[stick].axis[axis].sMax == 0xFFF) { + ctx->m_StickCalData[stick].axis[axis].sMax = 0; + } + if (ctx->m_StickCalData[stick].axis[axis].sMin == 0xFFF) { + ctx->m_StickCalData[stick].axis[axis].sMin = 0; + } + } + } + + if (ctx->m_bIsUsingBluetooth) { + for (stick = 0; stick < 2; ++stick) { + for(axis = 0; axis < 2; ++axis) { + ctx->m_StickExtents[stick].axis[axis].sMin = (Sint16)(SDL_MIN_SINT16 * 0.5f); + ctx->m_StickExtents[stick].axis[axis].sMax = (Sint16)(SDL_MAX_SINT16 * 0.5f); + } + } + } else { + for (stick = 0; stick < 2; ++stick) { + for(axis = 0; axis < 2; ++axis) { + ctx->m_StickExtents[stick].axis[axis].sMin = -(Sint16)(ctx->m_StickCalData[stick].axis[axis].sMin * 0.7f); + ctx->m_StickExtents[stick].axis[axis].sMax = (Sint16)(ctx->m_StickCalData[stick].axis[axis].sMax * 0.7f); + } + } + } + return SDL_TRUE; +} + +static float fsel(float fComparand, float fValGE, float fLT) +{ + return fComparand >= 0 ? fValGE : fLT; +} + +static float RemapVal(float val, float A, float B, float C, float D) +{ + if (A == B) { + return fsel(val - B , D , C); + } + return C + (D - C) * (val - A) / (B - A); +} + +static Sint16 ApplyStickCalibrationCentered(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue, Sint16 sCenter) +{ + sRawValue -= sCenter; + + if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) { + ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue; + } + if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) { + ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue; + } + + if (sRawValue > 0) { + return (Sint16)(RemapVal(sRawValue, 0, ctx->m_StickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16)); + } else { + return (Sint16)(RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0)); + } +} + +static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue) +{ + return ApplyStickCalibrationCentered(ctx, nStick, nAxis, sRawValue, ctx->m_StickCalData[nStick].axis[nAxis].sCenter); +} + +static SDL_bool +HIDAPI_DriverSwitch_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, Uint16 product_id, void **context) +{ + SDL_DriverSwitch_Context *ctx; + Uint8 input_mode; + + ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + ctx->dev = dev; + + *context = ctx; + + /* Initialize rumble data */ + SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]); + SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]); + + /* Try setting up USB mode, and if that fails we're using Bluetooth */ + if (!BTrySetupUSB(ctx)) { + ctx->m_bIsUsingBluetooth = SDL_TRUE; + } + + if (!LoadStickCalibration(ctx)) { + SDL_SetError("Couldn't load stick calibration"); + SDL_free(ctx); + return SDL_FALSE; + } + + if (!SetVibrationEnabled(ctx, 1)) { + SDL_SetError("Couldn't enable vibration"); + SDL_free(ctx); + return SDL_FALSE; + } + + /* Set the desired input mode */ + if (ctx->m_bIsUsingBluetooth) { + input_mode = k_eSwitchInputReportIDs_SimpleControllerState; + } else { + input_mode = k_eSwitchInputReportIDs_FullControllerState; + } + if (!SetInputMode(ctx, input_mode)) { + SDL_SetError("Couldn't set input mode"); + SDL_free(ctx); + return SDL_FALSE; + } + + /* Start sending USB reports */ + if (!ctx->m_bIsUsingBluetooth) { + /* ForceUSB doesn't generate an ACK, so don't wait for a reply */ + if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_ForceUSB, NULL, 0, SDL_FALSE)) { + SDL_SetError("Couldn't start USB reports"); + SDL_free(ctx); + return SDL_FALSE; + } + } + + /* Set the LED state */ + SetHomeLED(ctx, 100); + SetSlotLED(ctx, (joystick->instance_id % 4)); + + /* Initialize the joystick capabilities */ + joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + + return SDL_TRUE; +} + +static int +HIDAPI_DriverSwitch_Rumble(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)context; + + /* Experimentally determined rumble values. These will only matter on some controllers as tested ones + * seem to disregard these and just use any non-zero rumble values as a binary flag for constant rumble + * + * More information about these values can be found here: + * https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md + */ + const Uint16 k_usHighFreq = 0x0074; + const Uint8 k_ucHighFreqAmp = 0xBE; + const Uint8 k_ucLowFreq = 0x3D; + const Uint16 k_usLowFreqAmp = 0x806F; + + if (low_frequency_rumble) { + EncodeRumble(&ctx->m_RumblePacket.rumbleData[0], k_usHighFreq, k_ucHighFreqAmp, k_ucLowFreq, k_usLowFreqAmp); + } else { + SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]); + } + + if (high_frequency_rumble) { + EncodeRumble(&ctx->m_RumblePacket.rumbleData[1], k_usHighFreq, k_ucHighFreqAmp, k_ucLowFreq, k_usLowFreqAmp); + } else { + SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]); + } + + if (!WriteRumble(ctx)) { + SDL_SetError("Couldn't send rumble packet"); + return -1; + } + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + ctx->m_nRumbleExpiration = SDL_GetTicks() + duration_ms; + } else { + ctx->m_nRumbleExpiration = 0; + } + return 0; +} + +static void HandleSimpleControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchSimpleStatePacket_t *packet) +{ + /* 0x8000 is the neutral value for all joystick axes */ + const Uint16 usJoystickCenter = 0x8000; + Sint16 axis; + + if (packet->rgucButtons[0] != ctx->m_lastSimpleState.rgucButtons[0]) { + Uint8 data = packet->rgucButtons[0]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + + axis = (data & 0x40) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + } + + if (packet->rgucButtons[1] != ctx->m_lastSimpleState.rgucButtons[1]) { + Uint8 data = packet->rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + } + + if (packet->ucStickHat != ctx->m_lastSimpleState.ucStickHat) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (packet->ucStickHat) { + case 0: + dpad_up = SDL_TRUE; + break; + case 1: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 2: + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 4: + dpad_down = SDL_TRUE; + break; + case 5: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + break; + case 7: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + + axis = ApplyStickCalibrationCentered(ctx, 0, 0, packet->sJoystickLeft[0], (Sint16)usJoystickCenter); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + + axis = ApplyStickCalibrationCentered(ctx, 0, 1, packet->sJoystickLeft[1], (Sint16)usJoystickCenter); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + + axis = ApplyStickCalibrationCentered(ctx, 1, 0, packet->sJoystickRight[0], (Sint16)usJoystickCenter); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + + axis = ApplyStickCalibrationCentered(ctx, 1, 1, packet->sJoystickRight[1], (Sint16)usJoystickCenter); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + + ctx->m_lastSimpleState = *packet; +} + +static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +{ + Sint16 axis; + + if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) { + Uint8 data = packet->controllerState.rgucButtons[0]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + } + + if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { + Uint8 data = packet->controllerState.rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + } + + if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) { + Uint8 data = packet->controllerState.rgucButtons[2]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + } + + axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 0, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + + axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4); + axis = ApplyStickCalibration(ctx, 0, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); + + axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 1, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + + axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4); + axis = ApplyStickCalibration(ctx, 1, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); + + /* High nibble of battery/connection byte is battery level, low nibble is connection status + * LSB of connection nibble is USB/Switch connection status + */ + if (packet->controllerState.ucBatteryAndConnection & 0x1) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + } else { + /* LSB of the battery nibble is used to report charging. + * The battery level is reported from 0(empty)-8(full) + */ + int level = (packet->controllerState.ucBatteryAndConnection & 0xE0) >> 4; + if (level == 0) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + } else if (level <= 2) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + } else if (level <= 6) { + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + } else { + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + } + } + + ctx->m_lastFullState = *packet; +} + +static SDL_bool +HIDAPI_DriverSwitch_Update(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)context; + int size; + + while ((size = ReadInput(ctx)) > 0) { + switch (ctx->m_rgucReadBuffer[0]) { + case k_eSwitchInputReportIDs_SimpleControllerState: + HandleSimpleControllerState(joystick, ctx, (SwitchSimpleStatePacket_t *)&ctx->m_rgucReadBuffer[1]); + break; + case k_eSwitchInputReportIDs_FullControllerState: + HandleFullControllerState(joystick, ctx, (SwitchStatePacket_t *)&ctx->m_rgucReadBuffer[1]); + break; + default: + break; + } + } + + if (ctx->m_nRumbleExpiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, ctx->m_nRumbleExpiration)) { + HIDAPI_DriverSwitch_Rumble(joystick, dev, context, 0, 0, 0); + } + } + + return (size >= 0); +} + +static void +HIDAPI_DriverSwitch_Quit(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)context; + + /* Restore simple input mode for other applications */ + SetInputMode(ctx, k_eSwitchInputReportIDs_SimpleControllerState); + + SDL_free(context); +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch = +{ + SDL_HINT_JOYSTICK_HIDAPI_SWITCH, + SDL_TRUE, + HIDAPI_DriverSwitch_IsSupportedDevice, + HIDAPI_DriverSwitch_GetDeviceName, + HIDAPI_DriverSwitch_Init, + HIDAPI_DriverSwitch_Rumble, + HIDAPI_DriverSwitch_Update, + HIDAPI_DriverSwitch_Quit +}; + +#endif /* SDL_JOYSTICK_HIDAPI_SWITCH */ + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xbox360.c b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xbox360.c new file mode 100644 index 0000000000..84c63c667a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -0,0 +1,787 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_events.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" + + +#ifdef SDL_JOYSTICK_HIDAPI_XBOX360 + +#ifdef __WIN32__ +#define SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT +/* This requires the Windows 10 SDK to build */ +/*#define SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT*/ +#endif + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT +#include "../../core/windows/SDL_xinput.h" +#endif + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT +#include "../../core/windows/SDL_windows.h" +#define COBJMACROS +#include "windows.gaming.input.h" +#endif + +#define USB_PACKET_LENGTH 64 + + +typedef struct { + Uint8 last_state[USB_PACKET_LENGTH]; + Uint32 rumble_expiration; +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT + SDL_bool xinput_enabled; + Uint8 xinput_slot; +#endif +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + SDL_bool coinitialized; + __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics *gamepad_statics; + __x_ABI_CWindows_CGaming_CInput_CIGamepad *gamepad; + struct __x_ABI_CWindows_CGaming_CInput_CGamepadVibration vibration; +#endif +} SDL_DriverXbox360_Context; + + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT +static Uint8 xinput_slots; + +static void +HIDAPI_DriverXbox360_MarkXInputSlotUsed(Uint8 xinput_slot) +{ + if (xinput_slot != XUSER_INDEX_ANY) { + xinput_slots |= (0x01 << xinput_slot); + } +} + +static void +HIDAPI_DriverXbox360_MarkXInputSlotFree(Uint8 xinput_slot) +{ + if (xinput_slot != XUSER_INDEX_ANY) { + xinput_slots &= ~(0x01 << xinput_slot); + } +} + +static SDL_bool +HIDAPI_DriverXbox360_MissingXInputSlot() +{ + return xinput_slots != 0x0F; +} + +static Uint8 +HIDAPI_DriverXbox360_GuessXInputSlot(WORD wButtons) +{ + DWORD user_index; + int match_count; + Uint8 match_slot; + + if (!XINPUTGETSTATE) { + return XUSER_INDEX_ANY; + } + + match_count = 0; + for (user_index = 0; user_index < XUSER_MAX_COUNT; ++user_index) { + XINPUT_STATE_EX xinput_state; + + if (XINPUTGETSTATE(user_index, &xinput_state) == ERROR_SUCCESS) { + if (xinput_state.Gamepad.wButtons == wButtons) { + ++match_count; + match_slot = (Uint8)user_index; + } + } + } + if (match_count == 1) { + return match_slot; + } + return XUSER_INDEX_ANY; +} + +#endif /* SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT */ + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + +static void +HIDAPI_DriverXbox360_InitWindowsGamingInput(SDL_DriverXbox360_Context *ctx) +{ + /* I think this takes care of RoInitialize() in a way that is compatible with the rest of SDL */ + if (FAILED(WIN_CoInitialize())) { + return; + } + ctx->coinitialized = SDL_TRUE; + + { + static const IID SDL_IID_IGamepadStatics = { 0x8BBCE529, 0xD49C, 0x39E9, { 0x95, 0x60, 0xE4, 0x7D, 0xDE, 0x96, 0xB7, 0xC8 } }; + HRESULT hr; + HMODULE hModule = LoadLibraryA("combase.dll"); + if (hModule != NULL) { + typedef HRESULT (WINAPI *WindowsCreateString_t)(PCNZWCH sourceString, UINT32 length, HSTRING* string); + typedef HRESULT (WINAPI *WindowsDeleteString_t)(HSTRING string); + typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory); + + WindowsCreateString_t WindowsCreateStringFunc = (WindowsCreateString_t)GetProcAddress(hModule, "WindowsCreateString"); + WindowsDeleteString_t WindowsDeleteStringFunc = (WindowsDeleteString_t)GetProcAddress(hModule, "WindowsDeleteString"); + RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory"); + if (WindowsCreateStringFunc && WindowsDeleteStringFunc && RoGetActivationFactoryFunc) { + LPTSTR pNamespace = L"Windows.Gaming.Input.Gamepad"; + HSTRING hNamespaceString; + + hr = WindowsCreateStringFunc(pNamespace, SDL_wcslen(pNamespace), &hNamespaceString); + if (SUCCEEDED(hr)) { + RoGetActivationFactoryFunc(hNamespaceString, &SDL_IID_IGamepadStatics, &ctx->gamepad_statics); + WindowsDeleteStringFunc(hNamespaceString); + } + } + FreeLibrary(hModule); + } + } +} + +static Uint8 +HIDAPI_DriverXbox360_GetGamepadButtonsForMatch(__x_ABI_CWindows_CGaming_CInput_CIGamepad *gamepad) +{ + HRESULT hr; + struct __x_ABI_CWindows_CGaming_CInput_CGamepadReading state; + Uint8 buttons = 0; + + hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_GetCurrentReading(gamepad, &state); + if (SUCCEEDED(hr)) { + if (state.Buttons & GamepadButtons_A) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_A); + } + if (state.Buttons & GamepadButtons_B) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_B); + } + if (state.Buttons & GamepadButtons_X) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_X); + } + if (state.Buttons & GamepadButtons_Y) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_Y); + } + } + return buttons; +} + +static void +HIDAPI_DriverXbox360_GuessGamepad(SDL_DriverXbox360_Context *ctx, Uint8 buttons) +{ + HRESULT hr; + __FIVectorView_1_Windows__CGaming__CInput__CGamepad *gamepads; + + hr = __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_get_Gamepads(ctx->gamepad_statics, &gamepads); + if (SUCCEEDED(hr)) { + unsigned int i, num_gamepads; + + hr = __FIVectorView_1_Windows__CGaming__CInput__CGamepad_get_Size(gamepads, &num_gamepads); + if (SUCCEEDED(hr)) { + int match_count; + unsigned int match_slot; + + match_count = 0; + for (i = 0; i < num_gamepads; ++i) { + __x_ABI_CWindows_CGaming_CInput_CIGamepad *gamepad; + + hr = __FIVectorView_1_Windows__CGaming__CInput__CGamepad_GetAt(gamepads, i, &gamepad); + if (SUCCEEDED(hr)) { + Uint8 gamepad_buttons = HIDAPI_DriverXbox360_GetGamepadButtonsForMatch(gamepad); + if (buttons == gamepad_buttons) { + ++match_count; + match_slot = i; + } + __x_ABI_CWindows_CGaming_CInput_CIGamepad_Release(gamepad); + } + } + if (match_count == 1) { + hr = __FIVectorView_1_Windows__CGaming__CInput__CGamepad_GetAt(gamepads, match_slot, &ctx->gamepad); + if (SUCCEEDED(hr)) { + } + } + } + __FIVectorView_1_Windows__CGaming__CInput__CGamepad_Release(gamepads); + } +} + +static void +HIDAPI_DriverXbox360_QuitWindowsGamingInput(SDL_DriverXbox360_Context *ctx) +{ + if (ctx->gamepad_statics) { + __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_Release(ctx->gamepad_statics); + ctx->gamepad_statics = NULL; + } + if (ctx->gamepad) { + __x_ABI_CWindows_CGaming_CInput_CIGamepad_Release(ctx->gamepad); + ctx->gamepad = NULL; + } + + if (ctx->coinitialized) { + WIN_CoUninitialize(); + ctx->coinitialized = SDL_FALSE; + } +} + +#endif /* SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT */ + +static SDL_bool +HIDAPI_DriverXbox360_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number) +{ +#if defined(__MACOSX__) || defined(__WIN32__) + if (vendor_id == 0x045e && product_id == 0x028e && version == 1) { + /* This is the Steam Virtual Gamepad, which isn't supported by this driver */ + return SDL_FALSE; + } + return SDL_IsJoystickXbox360(vendor_id, product_id) || SDL_IsJoystickXboxOne(vendor_id, product_id); +#else + return SDL_IsJoystickXbox360(vendor_id, product_id); +#endif +} + +static const char * +HIDAPI_DriverXbox360_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +{ + return HIDAPI_XboxControllerName(vendor_id, product_id); +} + +static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot) +{ + const Uint8 led_packet[] = { 0x01, 0x03, (2 + slot) }; + + if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static SDL_bool +HIDAPI_DriverXbox360_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, Uint16 product_id, void **context) +{ + SDL_DriverXbox360_Context *ctx; + + ctx = (SDL_DriverXbox360_Context *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + SDL_OutOfMemory(); + return SDL_FALSE; + } +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT + ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE); + if (ctx->xinput_enabled && WIN_LoadXInputDLL() < 0) { + ctx->xinput_enabled = SDL_FALSE; + } + ctx->xinput_slot = XUSER_INDEX_ANY; +#endif +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + HIDAPI_DriverXbox360_InitWindowsGamingInput(ctx); +#endif + *context = ctx; + + /* Set the controller LED */ + SetSlotLED(dev, (joystick->instance_id % 4)); + + /* Initialize the joystick capabilities */ + joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + + return SDL_TRUE; +} + +static int +HIDAPI_DriverXbox360_Rumble(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + SDL_DriverXbox360_Context *ctx = (SDL_DriverXbox360_Context *)context; + +#ifdef __WIN32__ + SDL_bool rumbled = SDL_FALSE; + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + if (!rumbled && ctx->gamepad) { + HRESULT hr; + + ctx->vibration.LeftMotor = (DOUBLE)low_frequency_rumble / SDL_MAX_UINT16; + ctx->vibration.RightMotor = (DOUBLE)high_frequency_rumble / SDL_MAX_UINT16; + hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_put_Vibration(ctx->gamepad, ctx->vibration); + if (SUCCEEDED(hr)) { + rumbled = SDL_TRUE; + } + } +#endif + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT + if (!rumbled && ctx->xinput_slot != XUSER_INDEX_ANY) { + XINPUT_VIBRATION XVibration; + + if (!XINPUTSETSTATE) { + return SDL_Unsupported(); + } + + XVibration.wLeftMotorSpeed = low_frequency_rumble; + XVibration.wRightMotorSpeed = high_frequency_rumble; + if (XINPUTSETSTATE(ctx->xinput_slot, &XVibration) == ERROR_SUCCESS) { + rumbled = SDL_TRUE; + } else { + return SDL_SetError("XInputSetState() failed"); + } + } +#endif /* SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT */ + +#else /* !__WIN32__ */ + +#ifdef __MACOSX__ + /* On Mac OS X the 360Controller driver uses this short report, + and we need to prefix it with a magic token so hidapi passes it through untouched + */ + Uint8 rumble_packet[] = { 'M', 'A', 'G', 'I', 'C', '0', 0x00, 0x04, 0x00, 0x00 }; + + rumble_packet[6+2] = (low_frequency_rumble >> 8); + rumble_packet[6+3] = (high_frequency_rumble >> 8); +#else + Uint8 rumble_packet[] = { 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + rumble_packet[3] = (low_frequency_rumble >> 8); + rumble_packet[4] = (high_frequency_rumble >> 8); +#endif + + if (hid_write(dev, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) { + return SDL_SetError("Couldn't send rumble packet"); + } +#endif /* __WIN32__ */ + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + ctx->rumble_expiration = SDL_GetTicks() + duration_ms; + } else { + ctx->rumble_expiration = 0; + } + return 0; +} + +#ifdef __WIN32__ + /* This is the packet format for Xbox 360 and Xbox One controllers on Windows, + however with this interface there is no rumble support, no guide button, + and the left and right triggers are tied together as a single axis. + + We use XInput and Windows.Gaming.Input to make up for these shortcomings. + */ +static void +HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size) +{ + Sint16 axis; + SDL_bool has_trigger_data = SDL_FALSE; + + if (ctx->last_state[10] != data[10]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[10] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[10] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[10] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[10] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[10] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[10] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[10] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[10] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[11] != data[11]) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[11] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[11] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + + switch (data[11] & 0x3C) { + case 4: + dpad_up = SDL_TRUE; + break; + case 8: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 12: + dpad_right = SDL_TRUE; + break; + case 16: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 20: + dpad_down = SDL_TRUE; + break; + case 24: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 28: + dpad_left = SDL_TRUE; + break; + case 32: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + + axis = (int)*(Uint16*)(&data[0]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + axis = (int)*(Uint16*)(&data[2]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + axis = (int)*(Uint16*)(&data[4]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + axis = (int)*(Uint16*)(&data[6]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + if (ctx->gamepad_statics && !ctx->gamepad) { + Uint8 buttons = 0; + + if (data[10] & 0x01) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_A); + } + if (data[10] & 0x02) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_B); + } + if (data[10] & 0x04) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_X); + } + if (data[10] & 0x08) { + buttons |= (1 << SDL_CONTROLLER_BUTTON_Y); + } + if (buttons != 0) { + HIDAPI_DriverXbox360_GuessGamepad(ctx, buttons); + } + } + + if (ctx->gamepad) { + HRESULT hr; + struct __x_ABI_CWindows_CGaming_CInput_CGamepadReading state; + + hr = __x_ABI_CWindows_CGaming_CInput_CIGamepad_GetCurrentReading(ctx->gamepad, &state); + if (SUCCEEDED(hr)) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (state.Buttons & 0x40000000) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, ((int)(state.LeftTrigger * SDL_MAX_UINT16)) - 32768); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, ((int)(state.RightTrigger * SDL_MAX_UINT16)) - 32768); + has_trigger_data = SDL_TRUE; + } + } +#endif /* SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT */ + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT + if (ctx->xinput_enabled) { + if (ctx->xinput_slot == XUSER_INDEX_ANY && HIDAPI_DriverXbox360_MissingXInputSlot()) { + WORD wButtons = 0; + + if (data[10] & 0x01) { + wButtons |= XINPUT_GAMEPAD_A; + } + if (data[10] & 0x02) { + wButtons |= XINPUT_GAMEPAD_B; + } + if (data[10] & 0x04) { + wButtons |= XINPUT_GAMEPAD_X; + } + if (data[10] & 0x08) { + wButtons |= XINPUT_GAMEPAD_Y; + } + if (wButtons != 0) { + Uint8 xinput_slot = HIDAPI_DriverXbox360_GuessXInputSlot(wButtons); + if (xinput_slot != XUSER_INDEX_ANY) { + HIDAPI_DriverXbox360_MarkXInputSlotUsed(xinput_slot); + ctx->xinput_slot = xinput_slot; + } + } + } + + if (!has_trigger_data && ctx->xinput_slot != XUSER_INDEX_ANY) { + XINPUT_STATE_EX xinput_state; + + if (XINPUTGETSTATE(ctx->xinput_slot, &xinput_state) == ERROR_SUCCESS) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (xinput_state.Gamepad.wButtons & XINPUT_GAMEPAD_GUIDE) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, ((int)xinput_state.Gamepad.bLeftTrigger * 257) - 32768); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, ((int)xinput_state.Gamepad.bRightTrigger * 257) - 32768); + has_trigger_data = SDL_TRUE; + } + } + } +#endif /* SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT */ + + if (!has_trigger_data) { + axis = (data[9] * 257) - 32768; + if (data[9] < 0x80) { + axis = -axis * 2 - 32769; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + } else if (data[9] > 0x80) { + axis = axis * 2 - 32767; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + } else { + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_MIN_SINT16); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_MIN_SINT16); + } + } + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} +#else + +static void +HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size) +{ + Sint16 axis; +#ifdef __MACOSX__ + const SDL_bool invert_y_axes = SDL_FALSE; +#else + const SDL_bool invert_y_axes = SDL_TRUE; +#endif + + if (ctx->last_state[2] != data[2]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[2] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[2] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[2] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[2] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[2] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[2] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[2] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[2] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[3] != data[3]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + axis = ((int)data[4] * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + axis = ((int)data[5] * 257) - 32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + axis = *(Sint16*)(&data[6]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + axis = *(Sint16*)(&data[8]); + if (invert_y_axes) { + axis = ~axis; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + axis = *(Sint16*)(&data[10]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + axis = *(Sint16*)(&data[12]); + if (invert_y_axes) { + axis = ~axis; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} +#endif /* __WIN32__ */ + +#ifdef __MACOSX__ +static void +HIDAPI_DriverXboxOneS_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size) +{ + Sint16 axis; + + if (ctx->last_state[14] != data[14]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[14] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[14] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[14] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[14] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[14] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[14] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[15] != data[15]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[15] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[15] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[15] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[16] != data[16]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[16] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[13] != data[13]) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (data[13]) { + case 1: + dpad_up = SDL_TRUE; + break; + case 2: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + break; + case 4: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 5: + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 7: + dpad_left = SDL_TRUE; + break; + case 8: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + + axis = (int)*(Uint16*)(&data[1]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + axis = (int)*(Uint16*)(&data[3]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + axis = (int)*(Uint16*)(&data[5]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + axis = (int)*(Uint16*)(&data[7]) - 0x8000; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + + axis = ((int)*(Sint16*)(&data[9]) * 64) - 32768; + if (axis == 32704) { + axis = 32767; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + + axis = ((int)*(Sint16*)(&data[11]) * 64) - 32768; + if (axis == 32704) { + axis = 32767; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} + +static void +HIDAPI_DriverXboxOneS_HandleGuidePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXbox360_Context *ctx, Uint8 *data, int size) +{ + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED); +} +#endif /* __MACOSX__ */ + +static SDL_bool +HIDAPI_DriverXbox360_Update(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_DriverXbox360_Context *ctx = (SDL_DriverXbox360_Context *)context; + Uint8 data[USB_PACKET_LENGTH]; + int size; + + while ((size = hid_read_timeout(dev, data, sizeof(data), 0)) > 0) { +#ifdef __WIN32__ + HIDAPI_DriverXbox360_HandleStatePacket(joystick, dev, ctx, data, size); +#else + switch (data[0]) { + case 0x00: + HIDAPI_DriverXbox360_HandleStatePacket(joystick, dev, ctx, data, size); + break; +#ifdef __MACOSX__ + case 0x01: + HIDAPI_DriverXboxOneS_HandleStatePacket(joystick, dev, ctx, data, size); + break; + case 0x02: + HIDAPI_DriverXboxOneS_HandleGuidePacket(joystick, dev, ctx, data, size); + break; +#endif + default: +#ifdef DEBUG_JOYSTICK + SDL_Log("Unknown Xbox 360 packet, size = %d\n", size); + SDL_Log("%.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], + data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16]); +#endif + break; + } +#endif /* __WIN32__ */ + } + + if (ctx->rumble_expiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, ctx->rumble_expiration)) { + HIDAPI_DriverXbox360_Rumble(joystick, dev, context, 0, 0, 0); + } + } + + return (size >= 0); +} + +static void +HIDAPI_DriverXbox360_Quit(SDL_Joystick *joystick, hid_device *dev, void *context) +{ +#if defined(SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT) || defined(SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT) + SDL_DriverXbox360_Context *ctx = (SDL_DriverXbox360_Context *)context; +#endif + +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_XINPUT + if (ctx->xinput_enabled) { + HIDAPI_DriverXbox360_MarkXInputSlotFree(ctx->xinput_slot); + WIN_UnloadXInputDLL(); + } +#endif +#ifdef SDL_JOYSTICK_HIDAPI_WINDOWS_GAMING_INPUT + HIDAPI_DriverXbox360_InitWindowsGamingInput(ctx); +#endif + SDL_free(context); +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360 = +{ + SDL_HINT_JOYSTICK_HIDAPI_XBOX, + SDL_TRUE, + HIDAPI_DriverXbox360_IsSupportedDevice, + HIDAPI_DriverXbox360_GetDeviceName, + HIDAPI_DriverXbox360_Init, + HIDAPI_DriverXbox360_Rumble, + HIDAPI_DriverXbox360_Update, + HIDAPI_DriverXbox360_Quit +}; + +#endif /* SDL_JOYSTICK_HIDAPI_XBOX360 */ + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xboxone.c b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xboxone.c new file mode 100644 index 0000000000..2cd593fb00 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -0,0 +1,324 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_events.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" + + +#ifdef SDL_JOYSTICK_HIDAPI_XBOXONE + +#define USB_PACKET_LENGTH 64 + +/* + * This packet is required for all Xbox One pads with 2015 + * or later firmware installed (or present from the factory). + */ +static const Uint8 xboxone_fw2015_init[] = { + 0x05, 0x20, 0x00, 0x01, 0x00 +}; + +/* + * This packet is required for the Titanfall 2 Xbox One pads + * (0x0e6f:0x0165) to finish initialization and for Hori pads + * (0x0f0d:0x0067) to make the analog sticks work. + */ +static const Uint8 xboxone_hori_init[] = { + 0x01, 0x20, 0x00, 0x09, 0x00, 0x04, 0x20, 0x3a, + 0x00, 0x00, 0x00, 0x80, 0x00 +}; + +/* + * This packet is required for some of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), + * (0x0e6f:0x02a4). + */ +static const Uint8 xboxone_pdp_init1[] = { + 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 +}; + +/* + * This packet is required for some of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), + * (0x0e6f:0x02a4). + */ +static const Uint8 xboxone_pdp_init2[] = { + 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 +}; + +/* + * A specific rumble packet is required for some PowerA pads to start + * sending input reports. One of those pads is (0x24c6:0x543a). + */ +static const Uint8 xboxone_rumblebegin_init[] = { + 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, + 0x1D, 0x1D, 0xFF, 0x00, 0x00 +}; + +/* + * A rumble packet with zero FF intensity will immediately + * terminate the rumbling required to init PowerA pads. + * This should happen fast enough that the motors don't + * spin up to enough speed to actually vibrate the gamepad. + */ +static const Uint8 xboxone_rumbleend_init[] = { + 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* + * This specifies the selection of init packets that a gamepad + * will be sent on init *and* the order in which they will be + * sent. The correct sequence number will be added when the + * packet is going to be sent. + */ +typedef struct { + Uint16 vendor_id; + Uint16 product_id; + const Uint8 *data; + int size; +} SDL_DriverXboxOne_InitPacket; + +static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = { + { 0x0e6f, 0x0165, xboxone_hori_init, sizeof(xboxone_hori_init) }, + { 0x0f0d, 0x0067, xboxone_hori_init, sizeof(xboxone_hori_init) }, + { 0x0000, 0x0000, xboxone_fw2015_init, sizeof(xboxone_fw2015_init) }, + { 0x0e6f, 0x0246, xboxone_pdp_init1, sizeof(xboxone_pdp_init1) }, + { 0x0e6f, 0x0246, xboxone_pdp_init2, sizeof(xboxone_pdp_init2) }, + { 0x0e6f, 0x02ab, xboxone_pdp_init1, sizeof(xboxone_pdp_init1) }, + { 0x0e6f, 0x02ab, xboxone_pdp_init2, sizeof(xboxone_pdp_init2) }, + { 0x0e6f, 0x02a4, xboxone_pdp_init1, sizeof(xboxone_pdp_init1) }, + { 0x0e6f, 0x02a4, xboxone_pdp_init2, sizeof(xboxone_pdp_init2) }, + { 0x24c6, 0x541a, xboxone_rumblebegin_init, sizeof(xboxone_rumblebegin_init) }, + { 0x24c6, 0x542a, xboxone_rumblebegin_init, sizeof(xboxone_rumblebegin_init) }, + { 0x24c6, 0x543a, xboxone_rumblebegin_init, sizeof(xboxone_rumblebegin_init) }, + { 0x24c6, 0x541a, xboxone_rumbleend_init, sizeof(xboxone_rumbleend_init) }, + { 0x24c6, 0x542a, xboxone_rumbleend_init, sizeof(xboxone_rumbleend_init) }, + { 0x24c6, 0x543a, xboxone_rumbleend_init, sizeof(xboxone_rumbleend_init) }, +}; + +typedef struct { + Uint8 sequence; + Uint8 last_state[USB_PACKET_LENGTH]; + Uint32 rumble_expiration; +} SDL_DriverXboxOne_Context; + + +static SDL_bool +HIDAPI_DriverXboxOne_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number) +{ + return SDL_IsJoystickXboxOne(vendor_id, product_id); +} + +static const char * +HIDAPI_DriverXboxOne_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +{ + return HIDAPI_XboxControllerName(vendor_id, product_id); +} + +static SDL_bool +HIDAPI_DriverXboxOne_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, Uint16 product_id, void **context) +{ + SDL_DriverXboxOne_Context *ctx; + int i; + Uint8 init_packet[USB_PACKET_LENGTH]; + + ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + *context = ctx; + + /* Send the controller init data */ + for (i = 0; i < SDL_arraysize(xboxone_init_packets); ++i) { + const SDL_DriverXboxOne_InitPacket *packet = &xboxone_init_packets[i]; + if (!packet->vendor_id || (vendor_id == packet->vendor_id && product_id == packet->product_id)) { + SDL_memcpy(init_packet, packet->data, packet->size); + init_packet[2] = ctx->sequence++; + if (hid_write(dev, init_packet, packet->size) != packet->size) { + SDL_SetError("Couldn't write Xbox One initialization packet"); + SDL_free(ctx); + return SDL_FALSE; + } + } + } + + /* Initialize the joystick capabilities */ + joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + + return SDL_TRUE; +} + +static int +HIDAPI_DriverXboxOne_Rumble(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)context; + Uint8 rumble_packet[] = { 0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF }; + + /* The Rock Candy Xbox One Controller limits the range of + low frequency rumble strength in the range of [0 - 0x99] + high frequency rumble strength in the range of [0 - 0x82] + + I think the valid range of rumble at the firmware level is [0 - 0x7F] + */ + rumble_packet[2] = ctx->sequence++; + rumble_packet[8] = (low_frequency_rumble >> 9); + rumble_packet[9] = (high_frequency_rumble >> 9); + + if (hid_write(dev, rumble_packet, sizeof(rumble_packet)) != sizeof(rumble_packet)) { + return SDL_SetError("Couldn't send rumble packet"); + } + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + ctx->rumble_expiration = SDL_GetTicks() + duration_ms; + } else { + ctx->rumble_expiration = 0; + } + return 0; +} + +static void +HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXboxOne_Context *ctx, Uint8 *data, int size) +{ + Sint16 axis; + + if (ctx->last_state[4] != data[4]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[4] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[4] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[4] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[4] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[4] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[4] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[5] != data[5]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data[5] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data[5] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data[5] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data[5] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[5] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[5] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[5] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[5] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + axis = ((int)*(Sint16*)(&data[6]) * 64) - 32768; + if (axis == 32704) { + axis = 32767; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + axis = ((int)*(Sint16*)(&data[8]) * 64) - 32768; + if (axis == 32704) { + axis = 32767; + } + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + axis = *(Sint16*)(&data[10]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + axis = *(Sint16*)(&data[12]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); + axis = *(Sint16*)(&data[14]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + axis = *(Sint16*)(&data[16]); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} + +static void +HIDAPI_DriverXboxOne_HandleModePacket(SDL_Joystick *joystick, hid_device *dev, SDL_DriverXboxOne_Context *ctx, Uint8 *data, int size) +{ + if (data[1] == 0x30) { + /* The Xbox One S controller needs acks for mode reports */ + const Uint8 seqnum = data[2]; + const Uint8 ack[] = { 0x01, 0x20, seqnum, 0x09, 0x00, 0x07, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 }; + hid_write(dev, ack, sizeof(ack)); + } + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED); +} + +static SDL_bool +HIDAPI_DriverXboxOne_Update(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_DriverXboxOne_Context *ctx = (SDL_DriverXboxOne_Context *)context; + Uint8 data[USB_PACKET_LENGTH]; + int size; + + while ((size = hid_read_timeout(dev, data, sizeof(data), 0)) > 0) { + switch (data[0]) { + case 0x20: + HIDAPI_DriverXboxOne_HandleStatePacket(joystick, dev, ctx, data, size); + break; + case 0x07: + HIDAPI_DriverXboxOne_HandleModePacket(joystick, dev, ctx, data, size); + break; + default: +#ifdef DEBUG_JOYSTICK + SDL_Log("Unknown Xbox One packet: 0x%.2x\n", data[0]); +#endif + break; + } + } + + if (ctx->rumble_expiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, ctx->rumble_expiration)) { + HIDAPI_DriverXboxOne_Rumble(joystick, dev, context, 0, 0, 0); + } + } + + return (size >= 0); +} + +static void +HIDAPI_DriverXboxOne_Quit(SDL_Joystick *joystick, hid_device *dev, void *context) +{ + SDL_free(context); +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXboxOne = +{ + SDL_HINT_JOYSTICK_HIDAPI_XBOX, + SDL_TRUE, + HIDAPI_DriverXboxOne_IsSupportedDevice, + HIDAPI_DriverXboxOne_GetDeviceName, + HIDAPI_DriverXboxOne_Init, + HIDAPI_DriverXboxOne_Rumble, + HIDAPI_DriverXboxOne_Update, + HIDAPI_DriverXboxOne_Quit +}; + +#endif /* SDL_JOYSTICK_HIDAPI_XBOXONE */ + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick.c new file mode 100644 index 0000000000..064cb82040 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick.c @@ -0,0 +1,1071 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_endian.h" +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_mutex.h" +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" + +#if defined(__WIN32__) +#include "../../core/windows/SDL_windows.h" +#endif + +#if defined(__MACOSX__) +#include +#include +#include +#include +#endif + +#if defined(__LINUX__) +#include "../../core/linux/SDL_udev.h" +#ifdef SDL_USE_LIBUDEV +#include +#endif +#endif + +struct joystick_hwdata +{ + SDL_HIDAPI_DeviceDriver *driver; + void *context; + + SDL_mutex *mutex; + hid_device *dev; +}; + +typedef struct _SDL_HIDAPI_Device +{ + SDL_JoystickID instance_id; + char *name; + char *path; + Uint16 vendor_id; + Uint16 product_id; + Uint16 version; + SDL_JoystickGUID guid; + int interface_number; /* Available on Windows and Linux */ + Uint16 usage_page; /* Available on Windows and Mac OS X */ + Uint16 usage; /* Available on Windows and Mac OS X */ + SDL_HIDAPI_DeviceDriver *driver; + + /* Used during scanning for device changes */ + SDL_bool seen; + + struct _SDL_HIDAPI_Device *next; +} SDL_HIDAPI_Device; + +static SDL_HIDAPI_DeviceDriver *SDL_HIDAPI_drivers[] = { +#ifdef SDL_JOYSTICK_HIDAPI_PS4 + &SDL_HIDAPI_DriverPS4, +#endif +#ifdef SDL_JOYSTICK_HIDAPI_STEAM + &SDL_HIDAPI_DriverSteam, +#endif +#ifdef SDL_JOYSTICK_HIDAPI_SWITCH + &SDL_HIDAPI_DriverSwitch, +#endif +#ifdef SDL_JOYSTICK_HIDAPI_XBOX360 + &SDL_HIDAPI_DriverXbox360, +#endif +#ifdef SDL_JOYSTICK_HIDAPI_XBOXONE + &SDL_HIDAPI_DriverXboxOne, +#endif +}; +static SDL_HIDAPI_Device *SDL_HIDAPI_devices; +static int SDL_HIDAPI_numjoysticks = 0; + +#if defined(SDL_USE_LIBUDEV) +static const SDL_UDEV_Symbols * usyms = NULL; +#endif + +static struct +{ + SDL_bool m_bHaveDevicesChanged; + SDL_bool m_bCanGetNotifications; + Uint32 m_unLastDetect; + +#if defined(__WIN32__) + SDL_threadID m_nThreadID; + WNDCLASSEXA m_wndClass; + HWND m_hwndMsg; + HDEVNOTIFY m_hNotify; + double m_flLastWin32MessageCheck; +#endif + +#if defined(__MACOSX__) + IONotificationPortRef m_notificationPort; + mach_port_t m_notificationMach; +#endif + +#if defined(SDL_USE_LIBUDEV) + struct udev *m_pUdev; + struct udev_monitor *m_pUdevMonitor; + int m_nUdevFd; +#endif +} SDL_HIDAPI_discovery; + + +#ifdef __WIN32__ +struct _DEV_BROADCAST_HDR +{ + DWORD dbch_size; + DWORD dbch_devicetype; + DWORD dbch_reserved; +}; + +typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A +{ + DWORD dbcc_size; + DWORD dbcc_devicetype; + DWORD dbcc_reserved; + GUID dbcc_classguid; + char dbcc_name[ 1 ]; +} DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A; + +typedef struct _DEV_BROADCAST_HDR DEV_BROADCAST_HDR; +#define DBT_DEVICEARRIVAL 0x8000 /* system detected a new device */ +#define DBT_DEVICEREMOVECOMPLETE 0x8004 /* device was removed from the system */ +#define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 /* device interface class */ +#define DBT_DEVNODES_CHANGED 0x0007 +#define DBT_CONFIGCHANGED 0x0018 +#define DBT_DEVICETYPESPECIFIC 0x8005 /* type specific event */ +#define DBT_DEVINSTSTARTED 0x8008 /* device installed and started */ + +#include +DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED); + +static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case WM_DEVICECHANGE: + switch (wParam) { + case DBT_DEVICEARRIVAL: + case DBT_DEVICEREMOVECOMPLETE: + if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; + } + break; + } + return TRUE; + } + + return DefWindowProc(hwnd, message, wParam, lParam); +} +#endif /* __WIN32__ */ + + +#if defined(__MACOSX__) +static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator) +{ + /* Must drain the iterator, or we won't receive new notifications */ + io_object_t entry; + while ((entry = IOIteratorNext(portIterator)) != 0) { + IOObjectRelease(entry); + *(SDL_bool*)context = SDL_TRUE; + } +} +#endif /* __MACOSX__ */ + +static void +HIDAPI_InitializeDiscovery() +{ + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; + SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_FALSE; + SDL_HIDAPI_discovery.m_unLastDetect = 0; + +#if defined(__WIN32__) + SDL_HIDAPI_discovery.m_nThreadID = SDL_ThreadID(); + + SDL_memset(&SDL_HIDAPI_discovery.m_wndClass, 0x0, sizeof(SDL_HIDAPI_discovery.m_wndClass)); + SDL_HIDAPI_discovery.m_wndClass.hInstance = GetModuleHandle(NULL); + SDL_HIDAPI_discovery.m_wndClass.lpszClassName = "SDL_HIDAPI_DEVICE_DETECTION"; + SDL_HIDAPI_discovery.m_wndClass.lpfnWndProc = ControllerWndProc; /* This function is called by windows */ + SDL_HIDAPI_discovery.m_wndClass.cbSize = sizeof(WNDCLASSEX); + + RegisterClassExA(&SDL_HIDAPI_discovery.m_wndClass); + SDL_HIDAPI_discovery.m_hwndMsg = CreateWindowExA(0, "SDL_HIDAPI_DEVICE_DETECTION", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); + + { + DEV_BROADCAST_DEVICEINTERFACE_A devBroadcast; + SDL_memset( &devBroadcast, 0x0, sizeof( devBroadcast ) ); + + devBroadcast.dbcc_size = sizeof( devBroadcast ); + devBroadcast.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; + devBroadcast.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE; + + /* DEVICE_NOTIFY_ALL_INTERFACE_CLASSES is important, makes GUID_DEVINTERFACE_USB_DEVICE ignored, + * but that seems to be necessary to get a notice after each individual usb input device actually + * installs, rather than just as the composite device is seen. + */ + SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification( SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES ); + SDL_HIDAPI_discovery.m_bCanGetNotifications = ( SDL_HIDAPI_discovery.m_hNotify != 0 ); + } +#endif /* __WIN32__ */ + +#if defined(__MACOSX__) + SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault); + if (SDL_HIDAPI_discovery.m_notificationPort) { + { + CFMutableDictionaryRef matchingDict = IOServiceMatching("IOUSBDevice"); + + /* Note: IOServiceAddMatchingNotification consumes the reference to matchingDict */ + io_iterator_t portIterator = 0; + io_object_t entry; + if (IOServiceAddMatchingNotification(SDL_HIDAPI_discovery.m_notificationPort, kIOMatchedNotification, matchingDict, CallbackIOServiceFunc, &SDL_HIDAPI_discovery.m_bHaveDevicesChanged, &portIterator) == 0) { + /* Must drain the existing iterator, or we won't receive new notifications */ + while ((entry = IOIteratorNext(portIterator)) != 0) { + IOObjectRelease(entry); + } + } else { + IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort); + SDL_HIDAPI_discovery.m_notificationPort = nil; + } + } + { + CFMutableDictionaryRef matchingDict = IOServiceMatching("IOBluetoothDevice"); + + /* Note: IOServiceAddMatchingNotification consumes the reference to matchingDict */ + io_iterator_t portIterator = 0; + io_object_t entry; + if (IOServiceAddMatchingNotification(SDL_HIDAPI_discovery.m_notificationPort, kIOMatchedNotification, matchingDict, CallbackIOServiceFunc, &SDL_HIDAPI_discovery.m_bHaveDevicesChanged, &portIterator) == 0) { + /* Must drain the existing iterator, or we won't receive new notifications */ + while ((entry = IOIteratorNext(portIterator)) != 0) { + IOObjectRelease(entry); + } + } else { + IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort); + SDL_HIDAPI_discovery.m_notificationPort = nil; + } + } + } + + SDL_HIDAPI_discovery.m_notificationMach = MACH_PORT_NULL; + if (SDL_HIDAPI_discovery.m_notificationPort) { + SDL_HIDAPI_discovery.m_notificationMach = IONotificationPortGetMachPort(SDL_HIDAPI_discovery.m_notificationPort); + } + + SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_notificationMach != MACH_PORT_NULL); + +#endif // __MACOSX__ + +#if defined(SDL_USE_LIBUDEV) + SDL_HIDAPI_discovery.m_pUdev = NULL; + SDL_HIDAPI_discovery.m_pUdevMonitor = NULL; + SDL_HIDAPI_discovery.m_nUdevFd = -1; + + usyms = SDL_UDEV_GetUdevSyms(); + if (usyms) { + SDL_HIDAPI_discovery.m_pUdev = usyms->udev_new(); + } + if (SDL_HIDAPI_discovery.m_pUdev) { + SDL_HIDAPI_discovery.m_pUdevMonitor = usyms->udev_monitor_new_from_netlink(SDL_HIDAPI_discovery.m_pUdev, "udev"); + if (SDL_HIDAPI_discovery.m_pUdevMonitor) { + usyms->udev_monitor_enable_receiving(SDL_HIDAPI_discovery.m_pUdevMonitor); + SDL_HIDAPI_discovery.m_nUdevFd = usyms->udev_monitor_get_fd(SDL_HIDAPI_discovery.m_pUdevMonitor); + SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_TRUE; + } + } + +#endif /* SDL_USE_LIBUDEV */ +} + +static void +HIDAPI_UpdateDiscovery() +{ + if (!SDL_HIDAPI_discovery.m_bCanGetNotifications) { + const Uint32 SDL_HIDAPI_DETECT_INTERVAL_MS = 3000; /* Update every 3 seconds */ + Uint32 now = SDL_GetTicks(); + if (!SDL_HIDAPI_discovery.m_unLastDetect || SDL_TICKS_PASSED(now, SDL_HIDAPI_discovery.m_unLastDetect + SDL_HIDAPI_DETECT_INTERVAL_MS)) { + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; + SDL_HIDAPI_discovery.m_unLastDetect = now; + } + return; + } + +#if defined(__WIN32__) +#if 0 /* just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan. */ + /* We'll only get messages on the same thread that created the window */ + if (SDL_ThreadID() == SDL_HIDAPI_discovery.m_nThreadID) { + MSG msg; + while (PeekMessage(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0, PM_NOREMOVE)) { + if (GetMessageA(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0) != 0) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + } +#endif +#endif /* __WIN32__ */ + +#if defined(__MACOSX__) + if (SDL_HIDAPI_discovery.m_notificationPort) { + struct { mach_msg_header_t hdr; char payload[ 4096 ]; } msg; + while (mach_msg(&msg.hdr, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, sizeof(msg), SDL_HIDAPI_discovery.m_notificationMach, 0, MACH_PORT_NULL) == KERN_SUCCESS) { + IODispatchCalloutFromMessage(NULL, &msg.hdr, SDL_HIDAPI_discovery.m_notificationPort); + } + } +#endif + +#if defined(SDL_USE_LIBUDEV) + if (SDL_HIDAPI_discovery.m_nUdevFd >= 0) { + /* Drain all notification events. + * We don't expect a lot of device notifications so just + * do a new discovery on any kind or number of notifications. + * This could be made more restrictive if necessary. + */ + for (;;) { + struct pollfd PollUdev; + struct udev_device *pUdevDevice; + + PollUdev.fd = SDL_HIDAPI_discovery.m_nUdevFd; + PollUdev.events = POLLIN; + if (poll(&PollUdev, 1, 0) != 1) { + break; + } + + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; + + pUdevDevice = usyms->udev_monitor_receive_device(SDL_HIDAPI_discovery.m_pUdevMonitor); + if (pUdevDevice) { + usyms->udev_device_unref(pUdevDevice); + } + } + } +#endif +} + +static void +HIDAPI_ShutdownDiscovery() +{ +#if defined(__WIN32__) + if (SDL_HIDAPI_discovery.m_hNotify) + UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify); + + if (SDL_HIDAPI_discovery.m_hwndMsg) { + DestroyWindow(SDL_HIDAPI_discovery.m_hwndMsg); + } + + UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance); +#endif + +#if defined(__MACOSX__) + if (SDL_HIDAPI_discovery.m_notificationPort) { + IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort); + } +#endif + +#if defined(SDL_USE_LIBUDEV) + if (usyms) { + if (SDL_HIDAPI_discovery.m_pUdevMonitor) { + usyms->udev_monitor_unref(SDL_HIDAPI_discovery.m_pUdevMonitor); + } + if (SDL_HIDAPI_discovery.m_pUdev) { + usyms->udev_unref(SDL_HIDAPI_discovery.m_pUdev); + } + SDL_UDEV_ReleaseUdevSyms(); + usyms = NULL; + } +#endif +} + + +const char * +HIDAPI_XboxControllerName(Uint16 vendor_id, Uint16 product_id) +{ + static struct + { + Uint32 vidpid; + const char *name; + } names[] = { + { MAKE_VIDPID(0x0079, 0x18d4), "GPD Win 2 X-Box Controller" }, + { MAKE_VIDPID(0x044f, 0xb326), "Thrustmaster Gamepad GP XID" }, + { MAKE_VIDPID(0x045e, 0x028e), "Microsoft X-Box 360 pad" }, + { MAKE_VIDPID(0x045e, 0x028f), "Microsoft X-Box 360 pad v2" }, + { MAKE_VIDPID(0x045e, 0x0291), "Xbox 360 Wireless Receiver (XBOX)" }, + { MAKE_VIDPID(0x045e, 0x02d1), "Microsoft X-Box One pad" }, + { MAKE_VIDPID(0x045e, 0x02dd), "Microsoft X-Box One pad (Firmware 2015)" }, + { MAKE_VIDPID(0x045e, 0x02e3), "Microsoft X-Box One Elite pad" }, + { MAKE_VIDPID(0x045e, 0x02ea), "Microsoft X-Box One S pad" }, + { MAKE_VIDPID(0x045e, 0x02ff), "Microsoft X-Box One pad" }, + { MAKE_VIDPID(0x045e, 0x0719), "Xbox 360 Wireless Receiver" }, + { MAKE_VIDPID(0x046d, 0xc21d), "Logitech Gamepad F310" }, + { MAKE_VIDPID(0x046d, 0xc21e), "Logitech Gamepad F510" }, + { MAKE_VIDPID(0x046d, 0xc21f), "Logitech Gamepad F710" }, + { MAKE_VIDPID(0x046d, 0xc242), "Logitech Chillstream Controller" }, + { MAKE_VIDPID(0x046d, 0xcaa3), "Logitech DriveFx Racing Wheel" }, + { MAKE_VIDPID(0x056e, 0x2004), "Elecom JC-U3613M" }, + { MAKE_VIDPID(0x06a3, 0xf51a), "Saitek P3600" }, + { MAKE_VIDPID(0x0738, 0x4716), "Mad Catz Wired Xbox 360 Controller" }, + { MAKE_VIDPID(0x0738, 0x4718), "Mad Catz Street Fighter IV FightStick SE" }, + { MAKE_VIDPID(0x0738, 0x4726), "Mad Catz Xbox 360 Controller" }, + { MAKE_VIDPID(0x0738, 0x4728), "Mad Catz Street Fighter IV FightPad" }, + { MAKE_VIDPID(0x0738, 0x4736), "Mad Catz MicroCon Gamepad" }, + { MAKE_VIDPID(0x0738, 0x4738), "Mad Catz Wired Xbox 360 Controller (SFIV)" }, + { MAKE_VIDPID(0x0738, 0x4740), "Mad Catz Beat Pad" }, + { MAKE_VIDPID(0x0738, 0x4758), "Mad Catz Arcade Game Stick" }, + { MAKE_VIDPID(0x0738, 0x4a01), "Mad Catz FightStick TE 2" }, + { MAKE_VIDPID(0x0738, 0x9871), "Mad Catz Portable Drum" }, + { MAKE_VIDPID(0x0738, 0xb726), "Mad Catz Xbox controller - MW2" }, + { MAKE_VIDPID(0x0738, 0xb738), "Mad Catz MVC2TE Stick 2" }, + { MAKE_VIDPID(0x0738, 0xbeef), "Mad Catz JOYTECH NEO SE Advanced GamePad" }, + { MAKE_VIDPID(0x0738, 0xcb02), "Saitek Cyborg Rumble Pad - PC/Xbox 360" }, + { MAKE_VIDPID(0x0738, 0xcb03), "Saitek P3200 Rumble Pad - PC/Xbox 360" }, + { MAKE_VIDPID(0x0738, 0xcb29), "Saitek Aviator Stick AV8R02" }, + { MAKE_VIDPID(0x0738, 0xf738), "Super SFIV FightStick TE S" }, + { MAKE_VIDPID(0x07ff, 0xffff), "Mad Catz GamePad" }, + { MAKE_VIDPID(0x0e6f, 0x0105), "HSM3 Xbox360 dancepad" }, + { MAKE_VIDPID(0x0e6f, 0x0113), "Afterglow AX.1 Gamepad for Xbox 360" }, + { MAKE_VIDPID(0x0e6f, 0x011f), "Rock Candy Gamepad Wired Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0131), "PDP EA Sports Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0133), "Xbox 360 Wired Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0139), "Afterglow Prismatic Wired Controller" }, + { MAKE_VIDPID(0x0e6f, 0x013a), "PDP Xbox One Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0146), "Rock Candy Wired Controller for Xbox One" }, + { MAKE_VIDPID(0x0e6f, 0x0147), "PDP Marvel Xbox One Controller" }, + { MAKE_VIDPID(0x0e6f, 0x015c), "PDP Xbox One Arcade Stick" }, + { MAKE_VIDPID(0x0e6f, 0x0161), "PDP Xbox One Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0162), "PDP Xbox One Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0163), "PDP Xbox One Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0164), "PDP Battlefield One" }, + { MAKE_VIDPID(0x0e6f, 0x0165), "PDP Titanfall 2" }, + { MAKE_VIDPID(0x0e6f, 0x0201), "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0213), "Afterglow Gamepad for Xbox 360" }, + { MAKE_VIDPID(0x0e6f, 0x021f), "Rock Candy Gamepad for Xbox 360" }, + { MAKE_VIDPID(0x0e6f, 0x0246), "Rock Candy Gamepad for Xbox One 2015" }, + { MAKE_VIDPID(0x0e6f, 0x02a4), "PDP Wired Controller for Xbox One - Stealth Series" }, + { MAKE_VIDPID(0x0e6f, 0x02ab), "PDP Controller for Xbox One" }, + { MAKE_VIDPID(0x0e6f, 0x0301), "Logic3 Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0346), "Rock Candy Gamepad for Xbox One 2016" }, + { MAKE_VIDPID(0x0e6f, 0x0401), "Logic3 Controller" }, + { MAKE_VIDPID(0x0e6f, 0x0413), "Afterglow AX.1 Gamepad for Xbox 360" }, + { MAKE_VIDPID(0x0e6f, 0x0501), "PDP Xbox 360 Controller" }, + { MAKE_VIDPID(0x0e6f, 0xf900), "PDP Afterglow AX.1" }, + { MAKE_VIDPID(0x0f0d, 0x000a), "Hori Co. DOA4 FightStick" }, + { MAKE_VIDPID(0x0f0d, 0x000c), "Hori PadEX Turbo" }, + { MAKE_VIDPID(0x0f0d, 0x000d), "Hori Fighting Stick EX2" }, + { MAKE_VIDPID(0x0f0d, 0x0016), "Hori Real Arcade Pro.EX" }, + { MAKE_VIDPID(0x0f0d, 0x001b), "Hori Real Arcade Pro VX" }, + { MAKE_VIDPID(0x0f0d, 0x0063), "Hori Real Arcade Pro Hayabusa (USA) Xbox One" }, + { MAKE_VIDPID(0x0f0d, 0x0067), "HORIPAD ONE" }, + { MAKE_VIDPID(0x0f0d, 0x0078), "Hori Real Arcade Pro V Kai Xbox One" }, + { MAKE_VIDPID(0x11c9, 0x55f0), "Nacon GC-100XF" }, + { MAKE_VIDPID(0x12ab, 0x0004), "Honey Bee Xbox360 dancepad" }, + { MAKE_VIDPID(0x12ab, 0x0301), "PDP AFTERGLOW AX.1" }, + { MAKE_VIDPID(0x12ab, 0x0303), "Mortal Kombat Klassic FightStick" }, + { MAKE_VIDPID(0x1430, 0x4748), "RedOctane Guitar Hero X-plorer" }, + { MAKE_VIDPID(0x1430, 0xf801), "RedOctane Controller" }, + { MAKE_VIDPID(0x146b, 0x0601), "BigBen Interactive XBOX 360 Controller" }, + { MAKE_VIDPID(0x1532, 0x0037), "Razer Sabertooth" }, + { MAKE_VIDPID(0x1532, 0x0a00), "Razer Atrox Arcade Stick" }, + { MAKE_VIDPID(0x1532, 0x0a03), "Razer Wildcat" }, + { MAKE_VIDPID(0x15e4, 0x3f00), "Power A Mini Pro Elite" }, + { MAKE_VIDPID(0x15e4, 0x3f0a), "Xbox Airflo wired controller" }, + { MAKE_VIDPID(0x15e4, 0x3f10), "Batarang Xbox 360 controller" }, + { MAKE_VIDPID(0x162e, 0xbeef), "Joytech Neo-Se Take2" }, + { MAKE_VIDPID(0x1689, 0xfd00), "Razer Onza Tournament Edition" }, + { MAKE_VIDPID(0x1689, 0xfd01), "Razer Onza Classic Edition" }, + { MAKE_VIDPID(0x1689, 0xfe00), "Razer Sabertooth" }, + { MAKE_VIDPID(0x1bad, 0x0002), "Harmonix Rock Band Guitar" }, + { MAKE_VIDPID(0x1bad, 0x0003), "Harmonix Rock Band Drumkit" }, + { MAKE_VIDPID(0x1bad, 0x0130), "Ion Drum Rocker" }, + { MAKE_VIDPID(0x1bad, 0xf016), "Mad Catz Xbox 360 Controller" }, + { MAKE_VIDPID(0x1bad, 0xf018), "Mad Catz Street Fighter IV SE Fighting Stick" }, + { MAKE_VIDPID(0x1bad, 0xf019), "Mad Catz Brawlstick for Xbox 360" }, + { MAKE_VIDPID(0x1bad, 0xf021), "Mad Cats Ghost Recon FS GamePad" }, + { MAKE_VIDPID(0x1bad, 0xf023), "MLG Pro Circuit Controller (Xbox)" }, + { MAKE_VIDPID(0x1bad, 0xf025), "Mad Catz Call Of Duty" }, + { MAKE_VIDPID(0x1bad, 0xf027), "Mad Catz FPS Pro" }, + { MAKE_VIDPID(0x1bad, 0xf028), "Street Fighter IV FightPad" }, + { MAKE_VIDPID(0x1bad, 0xf02e), "Mad Catz Fightpad" }, + { MAKE_VIDPID(0x1bad, 0xf030), "Mad Catz Xbox 360 MC2 MicroCon Racing Wheel" }, + { MAKE_VIDPID(0x1bad, 0xf036), "Mad Catz MicroCon GamePad Pro" }, + { MAKE_VIDPID(0x1bad, 0xf038), "Street Fighter IV FightStick TE" }, + { MAKE_VIDPID(0x1bad, 0xf039), "Mad Catz MvC2 TE" }, + { MAKE_VIDPID(0x1bad, 0xf03a), "Mad Catz SFxT Fightstick Pro" }, + { MAKE_VIDPID(0x1bad, 0xf03d), "Street Fighter IV Arcade Stick TE - Chun Li" }, + { MAKE_VIDPID(0x1bad, 0xf03e), "Mad Catz MLG FightStick TE" }, + { MAKE_VIDPID(0x1bad, 0xf03f), "Mad Catz FightStick SoulCaliber" }, + { MAKE_VIDPID(0x1bad, 0xf042), "Mad Catz FightStick TES+" }, + { MAKE_VIDPID(0x1bad, 0xf080), "Mad Catz FightStick TE2" }, + { MAKE_VIDPID(0x1bad, 0xf501), "HoriPad EX2 Turbo" }, + { MAKE_VIDPID(0x1bad, 0xf502), "Hori Real Arcade Pro.VX SA" }, + { MAKE_VIDPID(0x1bad, 0xf503), "Hori Fighting Stick VX" }, + { MAKE_VIDPID(0x1bad, 0xf504), "Hori Real Arcade Pro. EX" }, + { MAKE_VIDPID(0x1bad, 0xf505), "Hori Fighting Stick EX2B" }, + { MAKE_VIDPID(0x1bad, 0xf506), "Hori Real Arcade Pro.EX Premium VLX" }, + { MAKE_VIDPID(0x1bad, 0xf900), "Harmonix Xbox 360 Controller" }, + { MAKE_VIDPID(0x1bad, 0xf901), "Gamestop Xbox 360 Controller" }, + { MAKE_VIDPID(0x1bad, 0xf903), "Tron Xbox 360 controller" }, + { MAKE_VIDPID(0x1bad, 0xf904), "PDP Versus Fighting Pad" }, + { MAKE_VIDPID(0x1bad, 0xf906), "MortalKombat FightStick" }, + { MAKE_VIDPID(0x1bad, 0xfa01), "MadCatz GamePad" }, + { MAKE_VIDPID(0x1bad, 0xfd00), "Razer Onza TE" }, + { MAKE_VIDPID(0x1bad, 0xfd01), "Razer Onza" }, + { MAKE_VIDPID(0x24c6, 0x5000), "Razer Atrox Arcade Stick" }, + { MAKE_VIDPID(0x24c6, 0x5300), "PowerA MINI PROEX Controller" }, + { MAKE_VIDPID(0x24c6, 0x5303), "Xbox Airflo wired controller" }, + { MAKE_VIDPID(0x24c6, 0x530a), "Xbox 360 Pro EX Controller" }, + { MAKE_VIDPID(0x24c6, 0x531a), "PowerA Pro Ex" }, + { MAKE_VIDPID(0x24c6, 0x5397), "FUS1ON Tournament Controller" }, + { MAKE_VIDPID(0x24c6, 0x541a), "PowerA Xbox One Mini Wired Controller" }, + { MAKE_VIDPID(0x24c6, 0x542a), "Xbox ONE spectra" }, + { MAKE_VIDPID(0x24c6, 0x543a), "PowerA Xbox One wired controller" }, + { MAKE_VIDPID(0x24c6, 0x5500), "Hori XBOX 360 EX 2 with Turbo" }, + { MAKE_VIDPID(0x24c6, 0x5501), "Hori Real Arcade Pro VX-SA" }, + { MAKE_VIDPID(0x24c6, 0x5502), "Hori Fighting Stick VX Alt" }, + { MAKE_VIDPID(0x24c6, 0x5503), "Hori Fighting Edge" }, + { MAKE_VIDPID(0x24c6, 0x5506), "Hori SOULCALIBUR V Stick" }, + { MAKE_VIDPID(0x24c6, 0x550d), "Hori GEM Xbox controller" }, + { MAKE_VIDPID(0x24c6, 0x550e), "Hori Real Arcade Pro V Kai 360" }, + { MAKE_VIDPID(0x24c6, 0x551a), "PowerA FUSION Pro Controller" }, + { MAKE_VIDPID(0x24c6, 0x561a), "PowerA FUSION Controller" }, + { MAKE_VIDPID(0x24c6, 0x5b00), "ThrustMaster Ferrari 458 Racing Wheel" }, + { MAKE_VIDPID(0x24c6, 0x5b02), "Thrustmaster, Inc. GPX Controller" }, + { MAKE_VIDPID(0x24c6, 0x5b03), "Thrustmaster Ferrari 458 Racing Wheel" }, + { MAKE_VIDPID(0x24c6, 0x5d04), "Razer Sabertooth" }, + { MAKE_VIDPID(0x24c6, 0xfafe), "Rock Candy Gamepad for Xbox 360" }, + }; + int i; + Uint32 vidpid = MAKE_VIDPID(vendor_id, product_id); + + for (i = 0; i < SDL_arraysize(names); ++i) { + if (vidpid == names[i].vidpid) { + return names[i].name; + } + } + return NULL; +} + +static SDL_bool +HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version) +{ + int i; + + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + if (driver->enabled && driver->IsSupportedDevice(vendor_id, product_id, version, -1)) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_HIDAPI_DeviceDriver * +HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device) +{ + const Uint16 USAGE_PAGE_GENERIC_DESKTOP = 0x0001; + const Uint16 USAGE_JOYSTICK = 0x0004; + const Uint16 USAGE_GAMEPAD = 0x0005; + const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008; + int i; + + if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) { + return NULL; + } + + if (device->usage_page && device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) { + return NULL; + } + if (device->usage && device->usage != USAGE_JOYSTICK && device->usage != USAGE_GAMEPAD && device->usage != USAGE_MULTIAXISCONTROLLER) { + return NULL; + } + + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + if (driver->enabled && driver->IsSupportedDevice(device->vendor_id, device->product_id, device->version, device->interface_number)) { + return driver; + } + } + return NULL; +} + +static SDL_HIDAPI_Device * +HIDAPI_GetJoystickByIndex(int device_index) +{ + SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; + while (device) { + if (device->driver) { + if (device_index == 0) { + break; + } + --device_index; + } + device = device->next; + } + return device; +} + +static SDL_HIDAPI_Device * +HIDAPI_GetJoystickByInfo(const char *path, Uint16 vendor_id, Uint16 product_id) +{ + SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; + while (device) { + if (device->vendor_id == vendor_id && device->product_id == product_id && + SDL_strcmp(device->path, path) == 0) { + break; + } + device = device->next; + } + return device; +} + +static void SDLCALL +SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + int i; + SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; + SDL_bool enabled = (!hint || !*hint || ((*hint != '0') && (SDL_strcasecmp(hint, "false") != 0))); + + if (SDL_strcmp(name, SDL_HINT_JOYSTICK_HIDAPI) == 0) { + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + driver->enabled = SDL_GetHintBoolean(driver->hint, enabled); + } + } else { + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + if (SDL_strcmp(name, driver->hint) == 0) { + driver->enabled = enabled; + break; + } + } + } + + /* Update device list if driver availability changes */ + while (device) { + if (device->driver) { + if (!device->driver->enabled) { + device->driver = NULL; + + --SDL_HIDAPI_numjoysticks; + + SDL_PrivateJoystickRemoved(device->instance_id); + } + } else { + device->driver = HIDAPI_GetDeviceDriver(device); + if (device->driver) { + device->instance_id = SDL_GetNextJoystickInstanceID(); + + ++SDL_HIDAPI_numjoysticks; + + SDL_PrivateJoystickAdded(device->instance_id); + } + } + device = device->next; + } +} + +static void HIDAPI_JoystickDetect(void); + +static int +HIDAPI_JoystickInit(void) +{ + int i; + + if (hid_init() < 0) { + SDL_SetError("Couldn't initialize hidapi"); + return -1; + } + + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + SDL_AddHintCallback(driver->hint, SDL_HIDAPIDriverHintChanged, NULL); + } + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI, + SDL_HIDAPIDriverHintChanged, NULL); + HIDAPI_InitializeDiscovery(); + HIDAPI_JoystickDetect(); + return 0; +} + +static int +HIDAPI_JoystickGetCount(void) +{ + return SDL_HIDAPI_numjoysticks; +} + +static void +HIDAPI_AddDevice(struct hid_device_info *info) +{ + SDL_HIDAPI_Device *device; + SDL_HIDAPI_Device *curr, *last = NULL; + + for (curr = SDL_HIDAPI_devices, last = NULL; curr; last = curr, curr = curr->next) { + continue; + } + + device = (SDL_HIDAPI_Device *)SDL_calloc(1, sizeof(*device)); + if (!device) { + return; + } + device->instance_id = -1; + device->seen = SDL_TRUE; + device->vendor_id = info->vendor_id; + device->product_id = info->product_id; + device->version = info->release_number; + device->interface_number = info->interface_number; + device->usage_page = info->usage_page; + device->usage = info->usage; + { + /* FIXME: Is there any way to tell whether this is a Bluetooth device? */ + const Uint16 vendor = device->vendor_id; + const Uint16 product = device->product_id; + const Uint16 version = device->version; + Uint16 *guid16 = (Uint16 *)device->guid.data; + + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + + /* Note that this is a HIDAPI device for special handling elsewhere */ + device->guid.data[14] = 'h'; + device->guid.data[15] = 0; + } + + /* Need the device name before getting the driver to know whether to ignore this device */ + if (!device->name && info->manufacturer_string && info->product_string) { + char *manufacturer_string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)info->manufacturer_string, (SDL_wcslen(info->manufacturer_string)+1)*sizeof(wchar_t)); + char *product_string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)info->product_string, (SDL_wcslen(info->product_string)+1)*sizeof(wchar_t)); + if (!manufacturer_string && !product_string) { + if (sizeof(wchar_t) == sizeof(Uint16)) { + manufacturer_string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)info->manufacturer_string, (SDL_wcslen(info->manufacturer_string)+1)*sizeof(wchar_t)); + product_string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)info->product_string, (SDL_wcslen(info->product_string)+1)*sizeof(wchar_t)); + } else if (sizeof(wchar_t) == sizeof(Uint32)) { + manufacturer_string = SDL_iconv_string("UTF-8", "UCS-4-INTERNAL", (char*)info->manufacturer_string, (SDL_wcslen(info->manufacturer_string)+1)*sizeof(wchar_t)); + product_string = SDL_iconv_string("UTF-8", "UCS-4-INTERNAL", (char*)info->product_string, (SDL_wcslen(info->product_string)+1)*sizeof(wchar_t)); + } + } + if (manufacturer_string && product_string) { + size_t name_size = (SDL_strlen(manufacturer_string) + 1 + SDL_strlen(product_string) + 1); + device->name = (char *)SDL_malloc(name_size); + if (device->name) { + SDL_snprintf(device->name, name_size, "%s %s", manufacturer_string, product_string); + } + } + if (manufacturer_string) { + SDL_free(manufacturer_string); + } + if (product_string) { + SDL_free(product_string); + } + } + if (!device->name) { + size_t name_size = (6 + 1 + 6 + 1); + device->name = (char *)SDL_malloc(name_size); + if (!device->name) { + SDL_free(device); + return; + } + SDL_snprintf(device->name, name_size, "0x%.4x/0x%.4x", info->vendor_id, info->product_id); + } + + device->driver = HIDAPI_GetDeviceDriver(device); + + if (device->driver) { + const char *name = device->driver->GetDeviceName(device->vendor_id, device->product_id); + if (name) { + SDL_free(device->name); + device->name = SDL_strdup(name); + } + } + + device->path = SDL_strdup(info->path); + if (!device->path) { + SDL_free(device->name); + SDL_free(device); + return; + } + +#ifdef DEBUG_HIDAPI + SDL_Log("Adding HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, interface %d, usage page 0x%.4x, usage 0x%.4x, driver = %s\n", device->name, device->vendor_id, device->product_id, device->version, device->interface_number, device->usage_page, device->usage, device->driver ? device->driver->hint : "NONE"); +#endif + + /* Add it to the list */ + if (last) { + last->next = device; + } else { + SDL_HIDAPI_devices = device; + } + + if (device->driver) { + /* It's a joystick! */ + device->instance_id = SDL_GetNextJoystickInstanceID(); + + ++SDL_HIDAPI_numjoysticks; + + SDL_PrivateJoystickAdded(device->instance_id); + } +} + + +static void +HIDAPI_DelDevice(SDL_HIDAPI_Device *device, SDL_bool send_event) +{ + SDL_HIDAPI_Device *curr, *last; + for (curr = SDL_HIDAPI_devices, last = NULL; curr; last = curr, curr = curr->next) { + if (curr == device) { + if (last) { + last->next = curr->next; + } else { + SDL_HIDAPI_devices = curr->next; + } + + if (device->driver && send_event) { + /* Need to decrement the joystick count before we post the event */ + --SDL_HIDAPI_numjoysticks; + + SDL_PrivateJoystickRemoved(device->instance_id); + } + + SDL_free(device->name); + SDL_free(device->path); + SDL_free(device); + return; + } + } +} + +static void +HIDAPI_UpdateDeviceList(void) +{ + SDL_HIDAPI_Device *device; + struct hid_device_info *devs, *info; + + /* Prepare the existing device list */ + device = SDL_HIDAPI_devices; + while (device) { + device->seen = SDL_FALSE; + device = device->next; + } + + /* Enumerate the devices */ + devs = hid_enumerate(0, 0); + if (devs) { + for (info = devs; info; info = info->next) { + device = HIDAPI_GetJoystickByInfo(info->path, info->vendor_id, info->product_id); + if (device) { + device->seen = SDL_TRUE; + } else { + HIDAPI_AddDevice(info); + } + } + hid_free_enumeration(devs); + } + + /* Remove any devices that weren't seen */ + device = SDL_HIDAPI_devices; + while (device) { + SDL_HIDAPI_Device *next = device->next; + + if (!device->seen) { + HIDAPI_DelDevice(device, SDL_TRUE); + } + device = next; + } +} + +SDL_bool +HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version) +{ + SDL_HIDAPI_Device *device; + + /* Don't update the device list for devices we know aren't supported */ + if (!HIDAPI_IsDeviceSupported(vendor_id, product_id, version)) { + return SDL_FALSE; + } + + /* Make sure the device list is completely up to date when we check for device presence */ + HIDAPI_UpdateDeviceList(); + + device = SDL_HIDAPI_devices; + while (device) { + if (device->vendor_id == vendor_id && device->product_id == product_id && device->driver) { + return SDL_TRUE; + } + device = device->next; + } + return SDL_FALSE; +} + +static void +HIDAPI_JoystickDetect(void) +{ + HIDAPI_UpdateDiscovery(); + if (SDL_HIDAPI_discovery.m_bHaveDevicesChanged) { + /* FIXME: We probably need to schedule an update in a few seconds as well */ + HIDAPI_UpdateDeviceList(); + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_FALSE; + } +} + +static const char * +HIDAPI_JoystickGetDeviceName(int device_index) +{ + return HIDAPI_GetJoystickByIndex(device_index)->name; +} + +static int +HIDAPI_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +HIDAPI_JoystickGetDeviceGUID(int device_index) +{ + return HIDAPI_GetJoystickByIndex(device_index)->guid; +} + +static SDL_JoystickID +HIDAPI_JoystickGetDeviceInstanceID(int device_index) +{ + return HIDAPI_GetJoystickByIndex(device_index)->instance_id; +} + +static int +HIDAPI_JoystickOpen(SDL_Joystick * joystick, int device_index) +{ + SDL_HIDAPI_Device *device = HIDAPI_GetJoystickByIndex(device_index); + struct joystick_hwdata *hwdata; + + hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata)); + if (!hwdata) { + return SDL_OutOfMemory(); + } + + hwdata->driver = device->driver; + hwdata->dev = hid_open_path(device->path, 0); + if (!hwdata->dev) { + SDL_free(hwdata); + return SDL_SetError("Couldn't open HID device %s", device->path); + } + hwdata->mutex = SDL_CreateMutex(); + + if (!device->driver->Init(joystick, hwdata->dev, device->vendor_id, device->product_id, &hwdata->context)) { + hid_close(hwdata->dev); + SDL_free(hwdata); + return -1; + } + + joystick->hwdata = hwdata; + return 0; +} + +static int +HIDAPI_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + SDL_HIDAPI_DeviceDriver *driver = hwdata->driver; + int result; + + SDL_LockMutex(hwdata->mutex); + result = driver->Rumble(joystick, hwdata->dev, hwdata->context, low_frequency_rumble, high_frequency_rumble, duration_ms); + SDL_UnlockMutex(hwdata->mutex); + return result; +} + +static void +HIDAPI_JoystickUpdate(SDL_Joystick * joystick) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + SDL_HIDAPI_DeviceDriver *driver = hwdata->driver; + SDL_bool succeeded; + + SDL_LockMutex(hwdata->mutex); + succeeded = driver->Update(joystick, hwdata->dev, hwdata->context); + SDL_UnlockMutex(hwdata->mutex); + + if (!succeeded) { + SDL_HIDAPI_Device *device; + for (device = SDL_HIDAPI_devices; device; device = device->next) { + if (device->instance_id == joystick->instance_id) { + HIDAPI_DelDevice(device, SDL_TRUE); + break; + } + } + } +} + +static void +HIDAPI_JoystickClose(SDL_Joystick * joystick) +{ + struct joystick_hwdata *hwdata = joystick->hwdata; + SDL_HIDAPI_DeviceDriver *driver = hwdata->driver; + driver->Quit(joystick, hwdata->dev, hwdata->context); + + hid_close(hwdata->dev); + SDL_DestroyMutex(hwdata->mutex); + SDL_free(hwdata); + joystick->hwdata = NULL; +} + +static void +HIDAPI_JoystickQuit(void) +{ + int i; + + HIDAPI_ShutdownDiscovery(); + + while (SDL_HIDAPI_devices) { + HIDAPI_DelDevice(SDL_HIDAPI_devices, SDL_FALSE); + } + for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { + SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; + SDL_DelHintCallback(driver->hint, SDL_HIDAPIDriverHintChanged, NULL); + } + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI, + SDL_HIDAPIDriverHintChanged, NULL); + SDL_HIDAPI_numjoysticks = 0; + + hid_exit(); +} + +SDL_JoystickDriver SDL_HIDAPI_JoystickDriver = +{ + HIDAPI_JoystickInit, + HIDAPI_JoystickGetCount, + HIDAPI_JoystickDetect, + HIDAPI_JoystickGetDeviceName, + HIDAPI_JoystickGetDevicePlayerIndex, + HIDAPI_JoystickGetDeviceGUID, + HIDAPI_JoystickGetDeviceInstanceID, + HIDAPI_JoystickOpen, + HIDAPI_JoystickRumble, + HIDAPI_JoystickUpdate, + HIDAPI_JoystickClose, + HIDAPI_JoystickQuit, +}; + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick_c.h new file mode 100644 index 0000000000..18a448339e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -0,0 +1,74 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_JOYSTICK_HIDAPI_H +#define SDL_JOYSTICK_HIDAPI_H + +#include "../../hidapi/hidapi/hidapi.h" + +/* This is the full set of HIDAPI drivers available */ +#define SDL_JOYSTICK_HIDAPI_PS4 +#define SDL_JOYSTICK_HIDAPI_SWITCH +#define SDL_JOYSTICK_HIDAPI_XBOX360 +#define SDL_JOYSTICK_HIDAPI_XBOXONE + +#ifdef __WINDOWS__ +/* On Windows, Xbox One controllers are handled by the Xbox 360 driver */ +#undef SDL_JOYSTICK_HIDAPI_XBOXONE +/* It turns out HIDAPI for Xbox controllers doesn't allow background input */ +#undef SDL_JOYSTICK_HIDAPI_XBOX360 +#endif + +#ifdef __MACOSX__ +/* On Mac OS X, Xbox One controllers are handled by the Xbox 360 driver */ +#undef SDL_JOYSTICK_HIDAPI_XBOXONE +#endif + +typedef struct _SDL_HIDAPI_DeviceDriver +{ + const char *hint; + SDL_bool enabled; + SDL_bool (*IsSupportedDevice)(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number); + const char *(*GetDeviceName)(Uint16 vendor_id, Uint16 product_id); + SDL_bool (*Init)(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor_id, Uint16 product_id, void **context); + int (*Rumble)(SDL_Joystick *joystick, hid_device *dev, void *context, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + SDL_bool (*Update)(SDL_Joystick *joystick, hid_device *dev, void *context); + void (*Quit)(SDL_Joystick *joystick, hid_device *dev, void *context); + +} SDL_HIDAPI_DeviceDriver; + +/* HIDAPI device support */ +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS4; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteam; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXboxOne; + +/* Return true if a HID device is present and supported as a joystick */ +extern SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version); + +/* Return the name of an Xbox 360 or Xbox One controller */ +extern const char *HIDAPI_XboxControllerName(Uint16 vendor_id, Uint16 product_id); + +#endif /* SDL_JOYSTICK_HIDAPI_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick.m b/3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick.m similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick.m rename to 3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick.m index c8a42af05c..d85efad33e 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,17 +26,22 @@ /* needed for SDL_IPHONE_MAX_GFORCE macro */ #include "SDL_config_iphoneos.h" +#include "SDL_assert.h" +#include "SDL_events.h" #include "SDL_joystick.h" #include "SDL_hints.h" #include "SDL_stdinc.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" + #if !SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #endif +#if !TARGET_OS_TV #import +#endif #ifdef SDL_JOYSTICK_MFI #import @@ -45,13 +50,15 @@ static id disconnectObserver = nil; #endif /* SDL_JOYSTICK_MFI */ +#if !TARGET_OS_TV static const char *accelerometerName = "iOS Accelerometer"; static CMMotionManager *motionManager = nil; +#endif /* !TARGET_OS_TV */ static SDL_JoystickDeviceItem *deviceList = NULL; static int numjoysticks = 0; -static SDL_JoystickID instancecounter = 0; +int SDL_AppleTVRemoteOpenedAsJoystick = 0; static SDL_JoystickDeviceItem * GetDeviceForIndex(int device_index) @@ -71,9 +78,16 @@ } static void -SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) +IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { #ifdef SDL_JOYSTICK_MFI + const Uint16 VENDOR_APPLE = 0x05AC; + Uint16 *guid16 = (Uint16 *)device->guid.data; + Uint16 vendor = 0; + Uint16 product = 0; + Uint16 version = 0; + Uint8 subtype = 0; + const char *name = NULL; /* Explicitly retain the controller because SDL_JoystickDeviceItem is a * struct, and ARC doesn't work with structs. */ @@ -89,46 +103,68 @@ device->name = SDL_strdup(name); - device->guid.data[0] = 'M'; - device->guid.data[1] = 'F'; - device->guid.data[2] = 'i'; - device->guid.data[3] = 'G'; - device->guid.data[4] = 'a'; - device->guid.data[5] = 'm'; - device->guid.data[6] = 'e'; - device->guid.data[7] = 'p'; - device->guid.data[8] = 'a'; - device->guid.data[9] = 'd'; - - if (controller.extendedGamepad) { - device->guid.data[10] = 1; - } else if (controller.gamepad) { - device->guid.data[10] = 2; - } - if (controller.extendedGamepad) { + vendor = VENDOR_APPLE; + product = 1; + subtype = 1; device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->nhats = 1; /* d-pad */ device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */ } else if (controller.gamepad) { + vendor = VENDOR_APPLE; + product = 2; + subtype = 2; device->naxes = 0; /* no traditional analog inputs */ device->nhats = 1; /* d-pad */ device->nbuttons = 7; /* ABXY, shoulder buttons, pause button */ } - /* TODO: Handle micro profiles on tvOS. */ +#if TARGET_OS_TV + else if (controller.microGamepad) { + vendor = VENDOR_APPLE; + product = 3; + subtype = 3; + device->naxes = 2; /* treat the touch surface as two axes */ + device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */ + device->nbuttons = 3; /* AX, pause button */ + + controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE); + } +#endif /* TARGET_OS_TV */ + + /* We only need 16 bits for each of these; space them out to fill 128. */ + /* Byteswap so devices get same GUID on little/big endian platforms. */ + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + + /* Note that this is an MFI controller and what subtype it is */ + device->guid.data[14] = 'm'; + device->guid.data[15] = subtype; /* This will be set when the first button press of the controller is * detected. */ controller.playerIndex = -1; -#endif + +#endif /* SDL_JOYSTICK_MFI */ } static void -SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) +IOS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) { SDL_JoystickDeviceItem *device = deviceList; -#if !SDL_EVENTS_DISABLED - SDL_Event event; + +#if TARGET_OS_TV + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) { + return; + } + } #endif while (device != NULL) { @@ -138,17 +174,19 @@ device = device->next; } - device = (SDL_JoystickDeviceItem *) SDL_malloc(sizeof(SDL_JoystickDeviceItem)); + device = (SDL_JoystickDeviceItem *) SDL_calloc(1, sizeof(SDL_JoystickDeviceItem)); if (device == NULL) { return; } - SDL_zerop(device); - device->accelerometer = accelerometer; - device->instance_id = instancecounter++; + device->instance_id = SDL_GetNextJoystickInstanceID(); if (accelerometer) { +#if TARGET_OS_TV + SDL_free(device); + return; +#else device->name = SDL_strdup(accelerometerName); device->naxes = 3; /* Device acceleration in the x, y, and z axes. */ device->nhats = 0; @@ -156,8 +194,9 @@ /* Use the accelerometer name as a GUID. */ SDL_memcpy(&device->guid.data, device->name, SDL_min(sizeof(SDL_JoystickGUID), SDL_strlen(device->name))); +#endif /* TARGET_OS_TV */ } else if (controller) { - SDL_SYS_AddMFIJoystickDevice(device, controller); + IOS_AddMFIJoystickDevice(device, controller); } if (deviceList == NULL) { @@ -172,28 +211,15 @@ ++numjoysticks; -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEADDED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = numjoysticks - 1; - if ((SDL_EventOK == NULL) || - (*SDL_EventOK)(SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickAdded(device->instance_id); } static SDL_JoystickDeviceItem * -SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) +IOS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) { SDL_JoystickDeviceItem *prev = NULL; SDL_JoystickDeviceItem *next = NULL; SDL_JoystickDeviceItem *item = deviceList; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif if (device == NULL) { return NULL; @@ -234,17 +260,7 @@ --numjoysticks; -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = device->instance_id; - if ((SDL_EventOK == NULL) || - (*SDL_EventOK)(SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(device->instance_id); SDL_free(device->name); SDL_free(device); @@ -252,38 +268,56 @@ return next; } -/* Function to scan the system for joysticks. - * Joystick 0 should be the system default joystick. - * It should return 0, or -1 on an unrecoverable fatal error. - */ -int -SDL_SYS_JoystickInit(void) +#if TARGET_OS_TV +static void SDLCALL +SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue) +{ + BOOL allowRotation = newValue != NULL && *newValue != '0'; + + @autoreleasepool { + for (GCController *controller in [GCController controllers]) { + if (controller.microGamepad) { + controller.microGamepad.allowsRotation = allowRotation; + } + } + } +} +#endif /* TARGET_OS_TV */ + +static int +IOS_JoystickInit(void) { @autoreleasepool { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK); - if (!hint || SDL_atoi(hint)) { +#if !TARGET_OS_TV + if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ - SDL_SYS_AddJoystickDevice(nil, SDL_TRUE); + IOS_AddJoystickDevice(nil, SDL_TRUE); } +#endif /* !TARGET_OS_TV */ #ifdef SDL_JOYSTICK_MFI /* GameController.framework was added in iOS 7. */ if (![GCController class]) { - return numjoysticks; + return 0; } for (GCController *controller in [GCController controllers]) { - SDL_SYS_AddJoystickDevice(controller, SDL_FALSE); + IOS_AddJoystickDevice(controller, SDL_FALSE); } +#if TARGET_OS_TV + SDL_AddHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, + SDL_AppleTVRemoteRotationHintChanged, NULL); +#endif /* TARGET_OS_TV */ + connectObserver = [center addObserverForName:GCControllerDidConnectNotification object:nil queue:nil usingBlock:^(NSNotification *note) { GCController *controller = note.object; - SDL_SYS_AddJoystickDevice(controller, SDL_FALSE); + IOS_AddJoystickDevice(controller, SDL_FALSE); }]; disconnectObserver = [center addObserverForName:GCControllerDidDisconnectNotification @@ -294,7 +328,7 @@ SDL_JoystickDeviceItem *device = deviceList; while (device != NULL) { if (device->controller == controller) { - SDL_SYS_RemoveJoystickDevice(device); + IOS_RemoveJoystickDevice(device); break; } device = device->next; @@ -303,40 +337,55 @@ #endif /* SDL_JOYSTICK_MFI */ } - return numjoysticks; + return 0; } -int SDL_SYS_NumJoysticks() +static int +IOS_JoystickGetCount(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +static void +IOS_JoystickDetect(void) { } -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +IOS_JoystickGetDeviceName(int device_index) { SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); return device ? device->name : "Unknown"; } -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static int +IOS_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +IOS_JoystickGetDeviceGUID( int device_index ) +{ + SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); + SDL_JoystickGUID guid; + if (device) { + guid = device->guid; + } else { + SDL_zero(guid); + } + return guid; +} + +static SDL_JoystickID +IOS_JoystickGetDeviceInstanceID(int device_index) { SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); - return device ? device->instance_id : 0; + return device ? device->instance_id : -1; } -/* Function to open a joystick for use. - The joystick to open is specified by the device index. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +IOS_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); if (device == NULL) { @@ -355,6 +404,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) @autoreleasepool { if (device->accelerometer) { +#if !TARGET_OS_TV if (motionManager == nil) { motionManager = [[CMMotionManager alloc] init]; } @@ -362,6 +412,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) /* Shorter times between updates can significantly increase CPU usage. */ motionManager.accelerometerUpdateInterval = 0.1; [motionManager startAccelerometerUpdates]; +#endif /* !TARGET_OS_TV */ } else { #ifdef SDL_JOYSTICK_MFI GCController *controller = device->controller; @@ -373,20 +424,17 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) #endif /* SDL_JOYSTICK_MFI */ } } + if (device->remote) { + ++SDL_AppleTVRemoteOpenedAsJoystick; + } return 0; } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool -SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return joystick->hwdata != NULL; -} - static void -SDL_SYS_AccelerometerUpdate(SDL_Joystick * joystick) +IOS_AccelerometerUpdate(SDL_Joystick * joystick) { +#if !TARGET_OS_TV const float maxgforce = SDL_IPHONE_MAX_GFORCE; const SInt16 maxsint16 = 0x7FFF; CMAcceleration accel; @@ -424,11 +472,12 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) SDL_PrivateJoystickAxis(joystick, 0, (accel.x / maxgforce) * maxsint16); SDL_PrivateJoystickAxis(joystick, 1, -(accel.y / maxgforce) * maxsint16); SDL_PrivateJoystickAxis(joystick, 2, (accel.z / maxgforce) * maxsint16); +#endif /* !TARGET_OS_TV */ } #ifdef SDL_JOYSTICK_MFI static Uint8 -SDL_SYS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad) +IOS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad) { Uint8 hat = 0; @@ -453,9 +502,9 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) #endif static void -SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) +IOS_MFIJoystickUpdate(SDL_Joystick * joystick) { -#ifdef SDL_JOYSTICK_MFI +#if SDL_JOYSTICK_MFI @autoreleasepool { GCController *controller = joystick->hwdata->controller; Uint8 hatstate = SDL_HAT_CENTERED; @@ -483,14 +532,14 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) gamepad.rightShoulder.isPressed, }; - hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); + hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); for (i = 0; i < SDL_arraysize(axes); i++) { /* The triggers (axes 2 and 5) are resting at -32768 but SDL * initializes its values to 0. We only want to make sure the * player index is up to date if the user actually moves an axis. */ if ((i != 2 && i != 5) || axes[i] != -32768) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); } SDL_PrivateJoystickAxis(joystick, i, axes[i]); } @@ -510,14 +559,38 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) gamepad.rightShoulder.isPressed, }; - hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); + hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); for (i = 0; i < SDL_arraysize(buttons); i++) { updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } } - /* TODO: Handle micro profiles on tvOS. */ +#if TARGET_OS_TV + else if (controller.microGamepad) { + GCMicroGamepad *gamepad = controller.microGamepad; + + Sint16 axes[] = { + (Sint16) (gamepad.dpad.xAxis.value * 32767), + (Sint16) (gamepad.dpad.yAxis.value * -32767), + }; + + for (i = 0; i < SDL_arraysize(axes); i++) { + updateplayerindex |= (joystick->axes[i].value != axes[i]); + SDL_PrivateJoystickAxis(joystick, i, axes[i]); + } + + Uint8 buttons[] = { + gamepad.buttonA.isPressed, + gamepad.buttonX.isPressed, + }; + + for (i = 0; i < SDL_arraysize(buttons); i++) { + updateplayerindex |= (joystick->buttons[i] != buttons[i]); + SDL_PrivateJoystickButton(joystick, i, buttons[i]); + } + } +#endif /* TARGET_OS_TV */ if (joystick->nhats > 0) { updateplayerindex |= (joystick->hats[0] != hatstate); @@ -525,15 +598,11 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) } for (i = 0; i < joystick->hwdata->num_pause_presses; i++) { - /* The pause button is always last. */ - Uint8 pausebutton = joystick->nbuttons - 1; - + const Uint8 pausebutton = joystick->nbuttons - 1; /* The pause button is always last. */ SDL_PrivateJoystickButton(joystick, pausebutton, SDL_PRESSED); SDL_PrivateJoystickButton(joystick, pausebutton, SDL_RELEASED); - updateplayerindex = YES; } - joystick->hwdata->num_pause_presses = 0; if (updateplayerindex && controller.playerIndex == -1) { @@ -557,33 +626,33 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) } } } -#endif +#endif /* SDL_JOYSTICK_MFI */ } -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static int +IOS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_Unsupported(); +} + +static void +IOS_JoystickUpdate(SDL_Joystick * joystick) { SDL_JoystickDeviceItem *device = joystick->hwdata; if (device == NULL) { return; } - + if (device->accelerometer) { - SDL_SYS_AccelerometerUpdate(joystick); + IOS_AccelerometerUpdate(joystick); } else if (device->controller) { - SDL_SYS_MFIJoystickUpdate(joystick); + IOS_MFIJoystickUpdate(joystick); } } -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +IOS_JoystickClose(SDL_Joystick * joystick) { SDL_JoystickDeviceItem *device = joystick->hwdata; @@ -595,7 +664,9 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) @autoreleasepool { if (device->accelerometer) { +#if !TARGET_OS_TV [motionManager stopAccelerometerUpdates]; +#endif /* !TARGET_OS_TV */ } else if (device->controller) { #ifdef SDL_JOYSTICK_MFI GCController *controller = device->controller; @@ -604,11 +675,13 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) #endif } } + if (device->remote) { + --SDL_AppleTVRemoteOpenedAsJoystick; + } } -/* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +IOS_JoystickQuit(void) { @autoreleasepool { #ifdef SDL_JOYSTICK_MFI @@ -623,41 +696,39 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) [center removeObserver:disconnectObserver name:GCControllerDidDisconnectNotification object:nil]; disconnectObserver = nil; } + +#if TARGET_OS_TV + SDL_DelHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, + SDL_AppleTVRemoteRotationHintChanged, NULL); +#endif /* TARGET_OS_TV */ #endif /* SDL_JOYSTICK_MFI */ while (deviceList != NULL) { - SDL_SYS_RemoveJoystickDevice(deviceList); + IOS_RemoveJoystickDevice(deviceList); } +#if !TARGET_OS_TV motionManager = nil; +#endif /* !TARGET_OS_TV */ } numjoysticks = 0; } -SDL_JoystickGUID -SDL_SYS_JoystickGetDeviceGUID( int device_index ) +SDL_JoystickDriver SDL_IOS_JoystickDriver = { - SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); - SDL_JoystickGUID guid; - if (device) { - guid = device->guid; - } else { - SDL_zero(guid); - } - return guid; -} - -SDL_JoystickGUID -SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) -{ - SDL_JoystickGUID guid; - if (joystick->hwdata) { - guid = joystick->hwdata->guid; - } else { - SDL_zero(guid); - } - return guid; -} + IOS_JoystickInit, + IOS_JoystickGetCount, + IOS_JoystickDetect, + IOS_JoystickGetDeviceName, + IOS_JoystickGetDevicePlayerIndex, + IOS_JoystickGetDeviceGUID, + IOS_JoystickGetDeviceInstanceID, + IOS_JoystickOpen, + IOS_JoystickRumble, + IOS_JoystickUpdate, + IOS_JoystickClose, + IOS_JoystickQuit, +}; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick_c.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick_c.h index be0ddf068a..12aa296b19 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/iphoneos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,11 @@ typedef struct joystick_hwdata { SDL_bool accelerometer; + SDL_bool remote; GCController __unsafe_unretained *controller; int num_pause_presses; + Uint32 pause_button_down_time; char *name; SDL_Joystick *joystick; diff --git a/3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick.c similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick.c index 8c73859ea8..06a2d9a215 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,23 +29,22 @@ /* This is the Linux implementation of the SDL joystick API */ #include -#include +#include /* errno, strerror */ #include -#include #include /* For the definition of PATH_MAX */ +#include +#include #include #include "SDL_assert.h" #include "SDL_joystick.h" #include "SDL_endian.h" +#include "../../events/SDL_events_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "../steam/SDL_steamcontroller.h" #include "SDL_sysjoystick_c.h" - -/* !!! FIXME: move this somewhere else. */ -#if !SDL_EVENTS_DISABLED -#include "../../events/SDL_events_c.h" -#endif +#include "../hidapi/SDL_hidapijoystick_c.h" /* This isn't defined in older Linux kernel headers */ #ifndef SYN_DROPPED @@ -57,7 +56,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -71,12 +70,15 @@ typedef struct SDL_joylist_item dev_t devnum; struct joystick_hwdata *hwdata; struct SDL_joylist_item *next; + + /* Steam Controller support */ + SDL_bool m_bSteamController; } SDL_joylist_item; static SDL_joylist_item *SDL_joylist = NULL; static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; -static int instance_counter = 0; + #define test_bit(nr, addr) \ (((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0) @@ -85,8 +87,102 @@ static int instance_counter = 0; static int IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid) { + /* This list is taken from: + https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py + */ + static Uint32 joystick_blacklist[] = { + /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */ + /* Microsoft Wireless Desktop - Comfort Edition */ + MAKE_VIDPID(0x045e, 0x009d), + + /* Microsoft Microsoft® Digital Media Pro Keyboard */ + /* Microsoft Corp. Digital Media Pro Keyboard */ + MAKE_VIDPID(0x045e, 0x00b0), + + /* Microsoft Microsoft® Digital Media Keyboard */ + /* Microsoft Corp. Digital Media Keyboard 1.0A */ + MAKE_VIDPID(0x045e, 0x00b4), + + /* Microsoft Microsoft® Digital Media Keyboard 3000 */ + MAKE_VIDPID(0x045e, 0x0730), + + /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */ + /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */ + /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */ + /* Microsoft Wireless Mobile Mouse 1000 */ + /* Microsoft Wireless Desktop 3000 */ + MAKE_VIDPID(0x045e, 0x0745), + + /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */ + MAKE_VIDPID(0x045e, 0x0748), + + /* Microsoft Corp. Wired Keyboard 600 */ + MAKE_VIDPID(0x045e, 0x0750), + + /* Microsoft Corp. Sidewinder X4 keyboard */ + MAKE_VIDPID(0x045e, 0x0768), + + /* Microsoft Corp. Arc Touch Mouse Transceiver */ + MAKE_VIDPID(0x045e, 0x0773), + + /* Microsoft® 2.4GHz Transceiver v9.0 */ + /* Microsoft® Nano Transceiver v2.1 */ + /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */ + MAKE_VIDPID(0x045e, 0x07a5), + + /* Microsoft® Nano Transceiver v1.0 */ + /* Microsoft Wireless Keyboard 800 */ + MAKE_VIDPID(0x045e, 0x07b2), + + /* Microsoft® Nano Transceiver v2.0 */ + MAKE_VIDPID(0x045e, 0x0800), + + /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */ + MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */ + MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */ + MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */ + MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */ + MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */ + MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire 4 6x8 */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun 4x5 */ + MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */ + MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */ + MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */ + + MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */ + MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */ + MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */ + MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */ + MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */ + MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */ + MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */ + MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */ + MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */ + MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */ + MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */ + MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */ + MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */ + + MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */ + + MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */ + + MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */ + + MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */ + MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */ + }; struct input_id inpid; - Uint16 *guid16 = (Uint16 *) ((char *) &guid->data); + int i; + Uint32 id; + Uint16 *guid16 = (Uint16 *)guid->data; #if !SDL_USE_LIBUDEV /* When udev is enabled we only get joystick devices here, so there's no need to test them */ @@ -114,33 +210,51 @@ IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *gui return 0; } +#ifdef SDL_JOYSTICK_HIDAPI + if (HIDAPI_IsDevicePresent(inpid.vendor, inpid.product, inpid.version)) { + /* The HIDAPI driver is taking care of this device */ + return 0; + } +#endif + + /* Check the joystick blacklist */ + id = MAKE_VIDPID(inpid.vendor, inpid.product); + for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) { + if (id == joystick_blacklist[i]) { + return 0; + } + } + #ifdef DEBUG_JOYSTICK - printf("Joystick: %s, bustype = %d, vendor = 0x%x, product = 0x%x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); + printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); #endif SDL_memset(guid->data, 0, sizeof(guid->data)); /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ - *(guid16++) = SDL_SwapLE16(inpid.bustype); - *(guid16++) = 0; - - if (inpid.vendor && inpid.product && inpid.version) { - *(guid16++) = SDL_SwapLE16(inpid.vendor); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.product); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.version); - *(guid16++) = 0; + *guid16++ = SDL_SwapLE16(inpid.bustype); + *guid16++ = 0; + + if (inpid.vendor && inpid.product) { + *guid16++ = SDL_SwapLE16(inpid.vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.version); + *guid16++ = 0; } else { SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4); } + if (SDL_ShouldIgnoreJoystick(namebuf, *guid)) { + return 0; + } return 1; } #if SDL_USE_LIBUDEV -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL) { return; @@ -176,9 +290,6 @@ MaybeAddDevice(const char *path) char namebuf[128]; SDL_JoystickGUID guid; SDL_joylist_item *item; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif if (path == NULL) { return -1; @@ -221,14 +332,14 @@ MaybeAddDevice(const char *path) item->name = SDL_strdup(namebuf); item->guid = guid; - if ( (item->path == NULL) || (item->name == NULL) ) { + if ((item->path == NULL) || (item->name == NULL)) { SDL_free(item->path); SDL_free(item->name); SDL_free(item); return -1; } - item->device_instance = instance_counter++; + item->device_instance = SDL_GetNextJoystickInstanceID(); if (SDL_joylist_tail == NULL) { SDL_joylist = SDL_joylist_tail = item; } else { @@ -239,18 +350,7 @@ MaybeAddDevice(const char *path) /* Need to increment the joystick count before we post the event */ ++numjoysticks; - /* !!! FIXME: Move this to an SDL_PrivateJoyDeviceAdded() function? */ -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEADDED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = (numjoysticks - 1); - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickAdded(item->device_instance); return numjoysticks; } @@ -262,9 +362,6 @@ MaybeRemoveDevice(const char *path) { SDL_joylist_item *item; SDL_joylist_item *prev = NULL; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif if (path == NULL) { return -1; @@ -290,18 +387,7 @@ MaybeRemoveDevice(const char *path) /* Need to decrement the joystick count before we post the event */ --numjoysticks; - /* !!! FIXME: Move this to an SDL_PrivateJoyDeviceRemoved() function? */ -#if !SDL_EVENTS_DISABLED - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = item->device_instance; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(item->device_instance); SDL_free(item->path); SDL_free(item->name); @@ -315,6 +401,7 @@ MaybeRemoveDevice(const char *path) } #endif +#if ! SDL_USE_LIBUDEV static int JoystickInitWithoutUdev(void) { @@ -329,9 +416,9 @@ JoystickInitWithoutUdev(void) MaybeAddDevice(path); } - return numjoysticks; + return 0; } - +#endif #if SDL_USE_LIBUDEV static int @@ -350,12 +437,83 @@ JoystickInitWithUdev(void) /* Force a scan to build the initial device list */ SDL_UDEV_Scan(); - return numjoysticks; + return 0; } #endif -int -SDL_SYS_JoystickInit(void) +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_joylist_item *item; + + item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item)); + if (item == NULL) { + return SDL_FALSE; + } + + item->path = SDL_strdup(""); + item->name = SDL_strdup(name); + item->guid = guid; + item->m_bSteamController = SDL_TRUE; + + if ((item->path == NULL) || (item->name == NULL)) { + SDL_free(item->path); + SDL_free(item->name); + SDL_free(item); + return SDL_FALSE; + } + + *device_instance = item->device_instance = SDL_GetNextJoystickInstanceID(); + if (SDL_joylist_tail == NULL) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(item->device_instance); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_joylist_item *item; + SDL_joylist_item *prev = NULL; + + for (item = SDL_joylist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (item->device_instance == device_instance) { + if (item->hwdata) { + item->hwdata->item = NULL; + } + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->name); + SDL_free(item); + return; + } + prev = item; + } +} + +static int +LINUX_JoystickInit(void) { /* First see if the user specified one or more joysticks to use */ if (SDL_getenv("SDL_JOYSTICK_DEVICE") != NULL) { @@ -373,24 +531,30 @@ SDL_SYS_JoystickInit(void) SDL_free(envcopy); } + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + #if SDL_USE_LIBUDEV return JoystickInitWithUdev(); -#endif - +#else return JoystickInitWithoutUdev(); +#endif } -int SDL_SYS_NumJoysticks() +static int +LINUX_JoystickGetCount(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +static void +LINUX_JoystickDetect(void) { #if SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif - + + SDL_UpdateSteamControllers(); } static SDL_joylist_item * @@ -412,14 +576,27 @@ JoystickByDevIndex(int device_index) } /* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +LINUX_JoystickGetDeviceName(int device_index) { return JoystickByDevIndex(device_index)->name; } +static int +LINUX_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +static SDL_JoystickGUID +LINUX_JoystickGetDeviceGUID( int device_index ) +{ + return JoystickByDevIndex(device_index)->guid; +} + /* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static SDL_JoystickID +LINUX_JoystickGetDeviceInstanceID(int device_index) { return JoystickByDevIndex(device_index)->device_instance; } @@ -467,6 +644,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) unsigned long keybit[NBITS(KEY_MAX)] = { 0 }; unsigned long absbit[NBITS(ABS_MAX)] = { 0 }; unsigned long relbit[NBITS(REL_MAX)] = { 0 }; + unsigned long ffbit[NBITS(FF_MAX)] = { 0 }; /* See if this device uses the new unified event API */ if ((ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) && @@ -479,16 +657,16 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } - for (i = BTN_MISC; i < BTN_JOYSTICK; ++i) { + for (i = 0; i < BTN_JOYSTICK; ++i) { if (test_bit(i, keybit)) { #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } @@ -562,6 +740,15 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) } } } + + if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(ffbit)), ffbit) >= 0) { + if (test_bit(FF_RUMBLE, ffbit)) { + joystick->hwdata->ff_rumble = SDL_TRUE; + } + if (test_bit(FF_SINE, ffbit)) { + joystick->hwdata->ff_sine = SDL_TRUE; + } + } } @@ -570,61 +757,100 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +LINUX_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - char *fname = NULL; - int fd = -1; if (item == NULL) { return SDL_SetError("No such device"); } - fname = item->path; - fd = open(fname, O_RDONLY, 0); - if (fd < 0) { - return SDL_SetError("Unable to open %s", fname); - } - joystick->instance_id = item->device_instance; joystick->hwdata = (struct joystick_hwdata *) - SDL_malloc(sizeof(*joystick->hwdata)); + SDL_calloc(1, sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { - close(fd); return SDL_OutOfMemory(); } - SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); joystick->hwdata->item = item; joystick->hwdata->guid = item->guid; - joystick->hwdata->fd = fd; - joystick->hwdata->fname = SDL_strdup(item->path); - if (joystick->hwdata->fname == NULL) { - SDL_free(joystick->hwdata); - joystick->hwdata = NULL; - close(fd); - return SDL_OutOfMemory(); + joystick->hwdata->effect.id = -1; + joystick->hwdata->m_bSteamController = item->m_bSteamController; + + if (item->m_bSteamController) { + joystick->hwdata->fd = -1; + SDL_GetSteamControllerInputs(&joystick->nbuttons, + &joystick->naxes, + &joystick->nhats); + } else { + int fd = open(item->path, O_RDWR, 0); + if (fd < 0) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + return SDL_SetError("Unable to open %s", item->path); + } + + joystick->hwdata->fd = fd; + joystick->hwdata->fname = SDL_strdup(item->path); + if (joystick->hwdata->fname == NULL) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + close(fd); + return SDL_OutOfMemory(); + } + + /* Set the joystick to non-blocking read mode */ + fcntl(fd, F_SETFL, O_NONBLOCK); + + /* Get the number of buttons and axes on the joystick */ + ConfigJoystick(joystick, fd); } SDL_assert(item->hwdata == NULL); item->hwdata = joystick->hwdata; - /* Set the joystick to non-blocking read mode */ - fcntl(fd, F_SETFL, O_NONBLOCK); - - /* Get the number of buttons and axes on the joystick */ - ConfigJoystick(joystick, fd); - /* mark joystick as fresh and ready */ joystick->hwdata->fresh = 1; return (0); } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) +static int +LINUX_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - return joystick->hwdata->item != NULL; + struct input_event event; + + if (joystick->hwdata->ff_rumble) { + struct ff_effect *effect = &joystick->hwdata->effect; + + effect->type = FF_RUMBLE; + effect->replay.length = SDL_min(duration_ms, 32767); + effect->u.rumble.strong_magnitude = low_frequency_rumble; + effect->u.rumble.weak_magnitude = high_frequency_rumble; + } else if (joystick->hwdata->ff_sine) { + /* Scale and average the two rumble strengths */ + Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2); + struct ff_effect *effect = &joystick->hwdata->effect; + + effect->type = FF_PERIODIC; + effect->replay.length = SDL_min(duration_ms, 32767); + effect->u.periodic.waveform = FF_SINE; + effect->u.periodic.magnitude = magnitude; + } else { + return SDL_Unsupported(); + } + + if (ioctl(joystick->hwdata->fd, EVIOCSFF, &joystick->hwdata->effect) < 0) { + return SDL_SetError("Couldn't update rumble effect: %s", strerror(errno)); + } + + event.type = EV_FF; + event.code = joystick->hwdata->effect.id; + event.value = 1; + if (write(joystick->hwdata->fd, &event, sizeof(event)) < 0) { + return SDL_SetError("Couldn't start rumble effect: %s", strerror(errno)); + } + return 0; } static SDL_INLINE void @@ -745,12 +971,9 @@ HandleInputEvents(SDL_Joystick * joystick) code = events[i].code; switch (events[i].type) { case EV_KEY: - if (code >= BTN_MISC) { - code -= BTN_MISC; - SDL_PrivateJoystickButton(joystick, - joystick->hwdata->key_map[code], - events[i].value); - } + SDL_PrivateJoystickButton(joystick, + joystick->hwdata->key_map[code], + events[i].value); break; case EV_ABS: switch (code) { @@ -803,11 +1026,16 @@ HandleInputEvents(SDL_Joystick * joystick) } } -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static void +LINUX_JoystickUpdate(SDL_Joystick * joystick) { int i; + if (joystick->hwdata->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } + HandleInputEvents(joystick); /* Deliver ball motion updates */ @@ -825,11 +1053,17 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) } /* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +LINUX_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { - close(joystick->hwdata->fd); + if (joystick->hwdata->effect.id >= 0) { + ioctl(joystick->hwdata->fd, EVIOCRMFF, joystick->hwdata->effect.id); + joystick->hwdata->effect.id = -1; + } + if (joystick->hwdata->fd >= 0) { + close(joystick->hwdata->fd); + } if (joystick->hwdata->item) { joystick->hwdata->item->hwdata = NULL; } @@ -841,8 +1075,8 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) } /* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +LINUX_JoystickQuit(void) { SDL_joylist_item *item = NULL; SDL_joylist_item *next = NULL; @@ -857,23 +1091,30 @@ SDL_SYS_JoystickQuit(void) SDL_joylist = SDL_joylist_tail = NULL; numjoysticks = 0; - instance_counter = 0; #if SDL_USE_LIBUDEV SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit(); #endif -} -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) -{ - return JoystickByDevIndex(device_index)->guid; + SDL_QuitSteamControllers(); } -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +SDL_JoystickDriver SDL_LINUX_JoystickDriver = { - return joystick->hwdata->guid; -} + LINUX_JoystickInit, + LINUX_JoystickGetCount, + LINUX_JoystickDetect, + LINUX_JoystickGetDeviceName, + LINUX_JoystickGetDevicePlayerIndex, + LINUX_JoystickGetDeviceGUID, + LINUX_JoystickGetDeviceInstanceID, + LINUX_JoystickOpen, + LINUX_JoystickRumble, + LINUX_JoystickUpdate, + LINUX_JoystickClose, + LINUX_JoystickQuit, +}; #endif /* SDL_JOYSTICK_LINUX */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick_c.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick_c.h index ee77178399..83d593760b 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/linux/SDL_sysjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_sysjoystick_c_h_ +#define SDL_sysjoystick_c_h_ + #include struct SDL_joylist_item; @@ -31,6 +34,10 @@ struct joystick_hwdata SDL_JoystickGUID guid; char *fname; /* Used in haptic subsystem */ + SDL_bool ff_rumble; + SDL_bool ff_sine; + struct ff_effect effect; + /* The current Linux joystick driver maps hats to two axes */ struct hwdata_hat { @@ -43,7 +50,7 @@ struct joystick_hwdata } *balls; /* Support for the Linux 2.4 unified input interface */ - Uint8 key_map[KEY_MAX - BTN_MISC]; + Uint8 key_map[KEY_MAX]; Uint8 abs_map[ABS_MAX]; struct axis_correct { @@ -52,6 +59,11 @@ struct joystick_hwdata } abs_correct[ABS_MAX]; int fresh; + + /* Steam Controller support */ + SDL_bool m_bSteamController; }; +#endif /* SDL_sysjoystick_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/psp/SDL_sysjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/psp/SDL_sysjoystick.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/joystick/psp/SDL_sysjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/psp/SDL_sysjoystick.c index e5247254f0..262da858eb 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/psp/SDL_sysjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,9 +34,9 @@ #include "SDL_events.h" #include "SDL_error.h" -#include "SDL_thread.h" #include "SDL_mutex.h" #include "SDL_timer.h" +#include "../../thread/SDL_systhread.h" /* Current pad state */ static SceCtrlData pad = { .Lx = 0, .Ly = 0, .Buttons = 0 }; @@ -116,7 +116,7 @@ int SDL_SYS_JoystickInit(void) return SDL_SetError("Can't create input semaphore"); } running = 1; - if((thread = SDL_CreateThread(JoystickUpdate, "JoySitckThread",NULL)) == NULL) { + if((thread = SDL_CreateThreadInternal(JoystickUpdate, "JoystickThread", 4096, NULL)) == NULL) { return SDL_SetError("Can't create input thread"); } @@ -132,12 +132,12 @@ int SDL_SYS_JoystickInit(void) return 1; } -int SDL_SYS_NumJoysticks() +int SDL_SYS_NumJoysticks(void) { return 1; } -void SDL_SYS_JoystickDetect() +void SDL_SYS_JoystickDetect(void) { } @@ -177,12 +177,6 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index) return 0; } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - /* Function to update the state of a joystick - called as a device poll. * This function shouldn't update the joystick structure directly, * but instead should call SDL_PrivateJoystick*() to deliver events diff --git a/3rdparty/sdl2-2.0.4/src/joystick/sort_controllers.py b/3rdparty/sdl2-2.0.9/src/joystick/sort_controllers.py similarity index 77% rename from 3rdparty/sdl2-2.0.4/src/joystick/sort_controllers.py rename to 3rdparty/sdl2-2.0.9/src/joystick/sort_controllers.py index af95d65134..32f065a9e9 100755 --- a/3rdparty/sdl2-2.0.4/src/joystick/sort_controllers.py +++ b/3rdparty/sdl2-2.0.9/src/joystick/sort_controllers.py @@ -27,15 +27,28 @@ def save_controller(line): def write_controllers(): global controllers global controller_guids - for entry in sorted(controllers, key=lambda entry: entry[2]): - line = "".join(entry) + "\n" - if not line.endswith(",\n") and not line.endswith("*/\n"): - print("Warning: '%s' is missing a comma at the end of the line" % (line)) + # Check for duplicates + for entry in controllers: if (entry[1] in controller_guids): - print("Warning: entry '%s' is duplicate of entry '%s'" % (entry[2], controller_guids[entry[1]][2])) + current_name = entry[2] + existing_name = controller_guids[entry[1]][2] + print("Warning: entry '%s' is duplicate of entry '%s'" % (current_name, existing_name)) + + if (not current_name.startswith("(DUPE)")): + entry[2] = "(DUPE) " + current_name + + if (not existing_name.startswith("(DUPE)")): + controller_guids[entry[1]][2] = "(DUPE) " + existing_name + controller_guids[entry[1]] = entry + for entry in sorted(controllers, key=lambda entry: entry[2]+"-"+entry[1]): + line = "".join(entry) + "\n" + line = line.replace("\t", " ") + if not line.endswith(",\n") and not line.endswith("*/\n"): + print("Warning: '%s' is missing a comma at the end of the line" % (line)) output.write(line) + controllers = [] controller_guids = {} diff --git a/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.c b/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.c new file mode 100644 index 0000000000..1edaa94ab6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.c @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" +#include "SDL_steamcontroller.h" + + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback) +{ +} + +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats) +{ + *nbuttons = 0; + *naxes = 0; + *nhats = 0; +} + +void SDL_UpdateSteamControllers(void) +{ +} + +void SDL_UpdateSteamController(SDL_Joystick *joystick) +{ +} + +void SDL_QuitSteamControllers(void) +{ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.h b/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.h new file mode 100644 index 0000000000..81b8879736 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/steam/SDL_steamcontroller.h @@ -0,0 +1,39 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_steamcontroller_h_ +#define SDL_steamcontroller_h_ + +#include "../../SDL_internal.h" + +typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_JoystickGUID guid, int *device_instance); +typedef void (*SteamControllerDisconnectedCallback_t)(int device_instance); + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback); +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats); +void SDL_UpdateSteamControllers(void); +void SDL_UpdateSteamController(SDL_Joystick *joystick); +void SDL_QuitSteamControllers(void); + +#endif /* SDL_steamcontroller_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick.c new file mode 100644 index 0000000000..67d7d25cda --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick.c @@ -0,0 +1,1155 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "../SDL_sysjoystick.h" + +#if SDL_JOYSTICK_DINPUT + +#include "SDL_windowsjoystick_c.h" +#include "SDL_dinputjoystick_c.h" +#include "SDL_xinputjoystick_c.h" +#include "../hidapi/SDL_hidapijoystick_c.h" + +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif + +#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ +#define JOY_AXIS_THRESHOLD (((SDL_JOYSTICK_AXIS_MAX)-(SDL_JOYSTICK_AXIS_MIN))/100) /* 1% motion */ + +#define CONVERT_MAGNITUDE(x) (((x)*10000) / 0x7FFF) + +/* external variables referenced. */ +extern HWND SDL_HelperWindow; + +/* local variables */ +static SDL_bool coinitialized = SDL_FALSE; +static LPDIRECTINPUT8 dinput = NULL; +static PRAWINPUTDEVICELIST SDL_RawDevList = NULL; +static UINT SDL_RawDevListCount = 0; + +/* Taken from Wine - Thanks! */ +static DIOBJECTDATAFORMAT dfDIJoystick2[] = { + { &GUID_XAxis, DIJOFS_X, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_YAxis, DIJOFS_Y, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_ZAxis, DIJOFS_Z, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RxAxis, DIJOFS_RX, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RyAxis, DIJOFS_RY, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RzAxis, DIJOFS_RZ, DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, DIJOFS_SLIDER(0), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, DIJOFS_SLIDER(1), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_POV, DIJOFS_POV(0), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, + { &GUID_POV, DIJOFS_POV(1), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, + { &GUID_POV, DIJOFS_POV(2), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, + { &GUID_POV, DIJOFS_POV(3), DIDFT_OPTIONAL | DIDFT_POV | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(0), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(1), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(2), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(3), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(4), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(5), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(6), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(7), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(8), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(9), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(10), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(11), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(12), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(13), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(14), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(15), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(16), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(17), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(18), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(19), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(20), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(21), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(22), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(23), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(24), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(25), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(26), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(27), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(28), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(29), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(30), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(31), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(32), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(33), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(34), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(35), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(36), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(37), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(38), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(39), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(40), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(41), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(42), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(43), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(44), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(45), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(46), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(47), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(48), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(49), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(50), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(51), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(52), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(53), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(54), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(55), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(56), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(57), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(58), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(59), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(60), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(61), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(62), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(63), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(64), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(65), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(66), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(67), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(68), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(69), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(70), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(71), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(72), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(73), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(74), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(75), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(76), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(77), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(78), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(79), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(80), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(81), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(82), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(83), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(84), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(85), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(86), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(87), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(88), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(89), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(90), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(91), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(92), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(93), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(94), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(95), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(96), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(97), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(98), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(99), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(100), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(101), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(102), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(103), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(104), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(105), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(106), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(107), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(108), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(109), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(110), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(111), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(112), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(113), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(114), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(115), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(116), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(117), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(118), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(119), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(120), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(121), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(122), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(123), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(124), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(125), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(126), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { NULL, DIJOFS_BUTTON(127), DIDFT_OPTIONAL | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0 }, + { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lVX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lVY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lVZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lVRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lVRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lVRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglVSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lAX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lAY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lAZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lARx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lARy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lARz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglASlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_XAxis, FIELD_OFFSET(DIJOYSTATE2, lFX), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_YAxis, FIELD_OFFSET(DIJOYSTATE2, lFY), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_ZAxis, FIELD_OFFSET(DIJOYSTATE2, lFZ), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RxAxis, FIELD_OFFSET(DIJOYSTATE2, lFRx), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RyAxis, FIELD_OFFSET(DIJOYSTATE2, lFRy), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_RzAxis, FIELD_OFFSET(DIJOYSTATE2, lFRz), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[0]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, + { &GUID_Slider, FIELD_OFFSET(DIJOYSTATE2, rglFSlider[1]), DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0 }, +}; + +const DIDATAFORMAT SDL_c_dfDIJoystick2 = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_ABSAXIS, + sizeof(DIJOYSTATE2), + SDL_arraysize(dfDIJoystick2), + dfDIJoystick2 +}; + +/* Convert a DirectInput return code to a text message */ +static int +SetDIerror(const char *function, HRESULT code) +{ + /* + return SDL_SetError("%s() [%s]: %s", function, + DXGetErrorString9A(code), DXGetErrorDescription9A(code)); + */ + return SDL_SetError("%s() DirectX error 0x%8.8lx", function, code); +} + +static SDL_bool +SDL_IsXInputDevice(const GUID* pGuidProductFromDirectInput) +{ + static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneWiredGamepad = { MAKELONG(0x045E, 0x02FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneWirelessGamepad = { MAKELONG(0x045E, 0x02DD), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneNewWirelessGamepad = { MAKELONG(0x045E, 0x02D1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneSWirelessGamepad = { MAKELONG(0x045E, 0x02EA), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneSBluetoothGamepad = { MAKELONG(0x045E, 0x02E0), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_XOneEliteWirelessGamepad = { MAKELONG(0x045E, 0x02E3), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + + static const GUID *s_XInputProductGUID[] = { + &IID_ValveStreamingGamepad, + &IID_X360WiredGamepad, /* Microsoft's wired X360 controller for Windows. */ + &IID_X360WirelessGamepad, /* Microsoft's wireless X360 controller for Windows. */ + &IID_XOneWiredGamepad, /* Microsoft's wired Xbox One controller for Windows. */ + &IID_XOneWirelessGamepad, /* Microsoft's wireless Xbox One controller for Windows. */ + &IID_XOneNewWirelessGamepad, /* Microsoft's updated wireless Xbox One controller (w/ 3.5 mm jack) for Windows. */ + &IID_XOneSWirelessGamepad, /* Microsoft's wireless Xbox One S controller for Windows. */ + &IID_XOneSBluetoothGamepad, /* Microsoft's Bluetooth Xbox One S controller for Windows. */ + &IID_XOneEliteWirelessGamepad /* Microsoft's wireless Xbox One Elite controller for Windows. */ + }; + + size_t iDevice; + UINT i; + + if (!SDL_XINPUT_Enabled()) { + return SDL_FALSE; + } + + /* Check for well known XInput device GUIDs */ + /* This lets us skip RAWINPUT for popular devices. Also, we need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. */ + for (iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice) { + if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) { + return SDL_TRUE; + } + } + + /* Go through RAWINPUT (WinXP and later) to find HID devices. */ + /* Cache this if we end up using it. */ + if (SDL_RawDevList == NULL) { + if ((GetRawInputDeviceList(NULL, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) || (!SDL_RawDevListCount)) { + return SDL_FALSE; /* oh well. */ + } + + SDL_RawDevList = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * SDL_RawDevListCount); + if (SDL_RawDevList == NULL) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + + if (GetRawInputDeviceList(SDL_RawDevList, &SDL_RawDevListCount, sizeof(RAWINPUTDEVICELIST)) == -1) { + SDL_free(SDL_RawDevList); + SDL_RawDevList = NULL; + return SDL_FALSE; /* oh well. */ + } + } + + for (i = 0; i < SDL_RawDevListCount; i++) { + RID_DEVICE_INFO rdi; + char devName[128]; + UINT rdiSize = sizeof(rdi); + UINT nameSize = SDL_arraysize(devName); + + rdi.cbSize = sizeof(rdi); + if ((SDL_RawDevList[i].dwType == RIM_TYPEHID) && + (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) && + (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)pGuidProductFromDirectInput->Data1)) && + (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) && + (SDL_strstr(devName, "IG_") != NULL)) { + return SDL_TRUE; + } + } + + return SDL_FALSE; +} + +void FreeRumbleEffectData(DIEFFECT *effect) +{ + if (!effect) { + return; + } + SDL_free(effect->rgdwAxes); + SDL_free(effect->rglDirection); + SDL_free(effect->lpvTypeSpecificParams); + SDL_free(effect); +} + +DIEFFECT *CreateRumbleEffectData(Sint16 magnitude, Uint32 duration_ms) +{ + DIEFFECT *effect; + DIPERIODIC *periodic; + + /* Create the effect */ + effect = (DIEFFECT *)SDL_calloc(1, sizeof(*effect)); + if (!effect) { + return NULL; + } + effect->dwSize = sizeof(*effect); + effect->dwGain = 10000; + effect->dwFlags = DIEFF_OBJECTOFFSETS; + effect->dwDuration = duration_ms * 1000; /* In microseconds. */ + effect->dwTriggerButton = DIEB_NOTRIGGER; + + effect->cAxes = 2; + effect->rgdwAxes = (DWORD *)SDL_calloc(effect->cAxes, sizeof(DWORD)); + if (!effect->rgdwAxes) { + FreeRumbleEffectData(effect); + return NULL; + } + + effect->rglDirection = (LONG *)SDL_calloc(effect->cAxes, sizeof(LONG)); + if (!effect->rglDirection) { + FreeRumbleEffectData(effect); + return NULL; + } + effect->dwFlags |= DIEFF_CARTESIAN; + + periodic = (DIPERIODIC *)SDL_calloc(1, sizeof(*periodic)); + if (!periodic) { + FreeRumbleEffectData(effect); + return NULL; + } + periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude); + periodic->dwPeriod = 1000000; + + effect->cbTypeSpecificParams = sizeof(*periodic); + effect->lpvTypeSpecificParams = periodic; + + return effect; +} + +int +SDL_DINPUT_JoystickInit(void) +{ + HRESULT result; + HINSTANCE instance; + + result = WIN_CoInitialize(); + if (FAILED(result)) { + return SetDIerror("CoInitialize", result); + } + + coinitialized = SDL_TRUE; + + result = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectInput8, (LPVOID)&dinput); + + if (FAILED(result)) { + return SetDIerror("CoCreateInstance", result); + } + + /* Because we used CoCreateInstance, we need to Initialize it, first. */ + instance = GetModuleHandle(NULL); + if (instance == NULL) { + return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError()); + } + result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION); + + if (FAILED(result)) { + return SetDIerror("IDirectInput::Initialize", result); + } + return 0; +} + +/* helper function for direct input, gets called for each connected joystick */ +static BOOL CALLBACK +EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) +{ + JoyStick_DeviceData *pNewJoystick; + JoyStick_DeviceData *pPrevJoystick = NULL; + const DWORD devtype = (pdidInstance->dwDevType & 0xFF); + Uint16 *guid16; + Uint16 vendor = 0; + Uint16 product = 0; + Uint16 version = 0; + WCHAR hidPath[MAX_PATH]; + + if (devtype == DI8DEVTYPE_SUPPLEMENTAL) { + /* Add any supplemental devices that should be ignored here */ +#define MAKE_TABLE_ENTRY(VID, PID) ((((DWORD)PID)<<16)|VID) + static DWORD ignored_devices[] = { + MAKE_TABLE_ENTRY(0, 0) + }; +#undef MAKE_TABLE_ENTRY + unsigned int i; + + for (i = 0; i < SDL_arraysize(ignored_devices); ++i) { + if (pdidInstance->guidProduct.Data1 == ignored_devices[i]) { + return DIENUM_CONTINUE; + } + } + } + + if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) { + return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */ + } + + { + HRESULT result; + LPDIRECTINPUTDEVICE8 device; + LPDIRECTINPUTDEVICE8 InputDevice; + DIPROPGUIDANDPATH dipdw2; + + result = IDirectInput8_CreateDevice(dinput, &(pdidInstance->guidInstance), &device, NULL); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Now get the IDirectInputDevice8 interface, instead. */ + result = IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8, (LPVOID *)&InputDevice); + /* We are done with this object. Use the stored one from now on. */ + IDirectInputDevice8_Release(device); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + dipdw2.diph.dwSize = sizeof(dipdw2); + dipdw2.diph.dwHeaderSize = sizeof(dipdw2.diph); + dipdw2.diph.dwObj = 0; // device property + dipdw2.diph.dwHow = DIPH_DEVICE; + + result = IDirectInputDevice8_GetProperty(InputDevice, DIPROP_GUIDANDPATH, &dipdw2.diph); + IDirectInputDevice8_Release(InputDevice); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Get device path, compare that instead of GUID, additionally update GUIDs of joysticks with matching paths, in case they're not open yet. */ + SDL_wcslcpy(hidPath, dipdw2.wszPath, SDL_arraysize(hidPath)); + } + + pNewJoystick = *(JoyStick_DeviceData **)pContext; + while (pNewJoystick) { + if (SDL_wcscmp(pNewJoystick->hidPath, hidPath) == 0) { + /* if we are replacing the front of the list then update it */ + if (pNewJoystick == *(JoyStick_DeviceData **)pContext) { + *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext; + } else if (pPrevJoystick) { + pPrevJoystick->pNext = pNewJoystick->pNext; + } + + // Update with new guid/etc, if it has changed + pNewJoystick->dxdevice = *pdidInstance; + + pNewJoystick->pNext = SYS_Joystick; + SYS_Joystick = pNewJoystick; + + return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */ + } + + pPrevJoystick = pNewJoystick; + pNewJoystick = pNewJoystick->pNext; + } + + pNewJoystick = (JoyStick_DeviceData *)SDL_malloc(sizeof(JoyStick_DeviceData)); + if (!pNewJoystick) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + SDL_zerop(pNewJoystick); + SDL_wcslcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath)); + pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName); + if (!pNewJoystick->joystickname) { + SDL_free(pNewJoystick); + return DIENUM_CONTINUE; /* better luck next time? */ + } + + SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, + sizeof(DIDEVICEINSTANCE)); + + SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data)); + + guid16 = (Uint16 *)pNewJoystick->guid.data; + if (SDL_memcmp(&pdidInstance->guidProduct.Data4[2], "PIDVID", 6) == 0) { + vendor = (Uint16)LOWORD(pdidInstance->guidProduct.Data1); + product = (Uint16)HIWORD(pdidInstance->guidProduct.Data1); + version = 0; + + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH); + *guid16++ = 0; + SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4); + } + + if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return DIENUM_CONTINUE; + } + +#ifdef SDL_JOYSTICK_HIDAPI + if (HIDAPI_IsDevicePresent(vendor, product, 0)) { + /* The HIDAPI driver is taking care of this device */ + SDL_free(pNewJoystick); + return DIENUM_CONTINUE; + } +#endif + + WINDOWS_AddJoystickDevice(pNewJoystick); + + return DIENUM_CONTINUE; /* get next device, please */ +} + +void +SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) +{ + IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, pContext, DIEDFL_ATTACHEDONLY); + + if (SDL_RawDevList) { + SDL_free(SDL_RawDevList); /* in case we used this in DirectInput detection */ + SDL_RawDevList = NULL; + } + SDL_RawDevListCount = 0; +} + +static BOOL CALLBACK +EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) +{ + SDL_Joystick *joystick = (SDL_Joystick *)pvRef; + HRESULT result; + input_t *in = &joystick->hwdata->Inputs[joystick->hwdata->NumInputs]; + + if (dev->dwType & DIDFT_BUTTON) { + in->type = BUTTON; + in->num = joystick->nbuttons; + in->ofs = DIJOFS_BUTTON(in->num); + joystick->nbuttons++; + } else if (dev->dwType & DIDFT_POV) { + in->type = HAT; + in->num = joystick->nhats; + in->ofs = DIJOFS_POV(in->num); + joystick->nhats++; + } else if (dev->dwType & DIDFT_AXIS) { + DIPROPRANGE diprg; + DIPROPDWORD dilong; + + in->type = AXIS; + in->num = joystick->naxes; + if (!SDL_memcmp(&dev->guidType, &GUID_XAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_X; + else if (!SDL_memcmp(&dev->guidType, &GUID_YAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_Y; + else if (!SDL_memcmp(&dev->guidType, &GUID_ZAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_Z; + else if (!SDL_memcmp(&dev->guidType, &GUID_RxAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_RX; + else if (!SDL_memcmp(&dev->guidType, &GUID_RyAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_RY; + else if (!SDL_memcmp(&dev->guidType, &GUID_RzAxis, sizeof(dev->guidType))) + in->ofs = DIJOFS_RZ; + else if (!SDL_memcmp(&dev->guidType, &GUID_Slider, sizeof(dev->guidType))) { + in->ofs = DIJOFS_SLIDER(joystick->hwdata->NumSliders); + ++joystick->hwdata->NumSliders; + } else { + return DIENUM_CONTINUE; /* not an axis we can grok */ + } + + diprg.diph.dwSize = sizeof(diprg); + diprg.diph.dwHeaderSize = sizeof(diprg.diph); + diprg.diph.dwObj = dev->dwType; + diprg.diph.dwHow = DIPH_BYID; + diprg.lMin = SDL_JOYSTICK_AXIS_MIN; + diprg.lMax = SDL_JOYSTICK_AXIS_MAX; + + result = + IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, + DIPROP_RANGE, &diprg.diph); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* don't use this axis */ + } + + /* Set dead zone to 0. */ + dilong.diph.dwSize = sizeof(dilong); + dilong.diph.dwHeaderSize = sizeof(dilong.diph); + dilong.diph.dwObj = dev->dwType; + dilong.diph.dwHow = DIPH_BYID; + dilong.dwData = 0; + result = + IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, + DIPROP_DEADZONE, &dilong.diph); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* don't use this axis */ + } + + joystick->naxes++; + } else { + /* not supported at this time */ + return DIENUM_CONTINUE; + } + + joystick->hwdata->NumInputs++; + + if (joystick->hwdata->NumInputs == MAX_INPUTS) { + return DIENUM_STOP; /* too many */ + } + + return DIENUM_CONTINUE; +} + +/* Sort using the data offset into the DInput struct. + * This gives a reasonable ordering for the inputs. + */ +static int +SortDevFunc(const void *a, const void *b) +{ + const input_t *inputA = (const input_t*)a; + const input_t *inputB = (const input_t*)b; + + if (inputA->ofs < inputB->ofs) + return -1; + if (inputA->ofs > inputB->ofs) + return 1; + return 0; +} + +/* Sort the input objects and recalculate the indices for each input. */ +static void +SortDevObjects(SDL_Joystick *joystick) +{ + input_t *inputs = joystick->hwdata->Inputs; + int nButtons = 0; + int nHats = 0; + int nAxis = 0; + int n; + + SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc); + + for (n = 0; n < joystick->hwdata->NumInputs; n++) { + switch (inputs[n].type) { + case BUTTON: + inputs[n].num = nButtons; + nButtons++; + break; + + case HAT: + inputs[n].num = nHats; + nHats++; + break; + + case AXIS: + inputs[n].num = nAxis; + nAxis++; + break; + } + } +} + +int +SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice) +{ + HRESULT result; + LPDIRECTINPUTDEVICE8 device; + DIPROPDWORD dipdw; + + joystick->hwdata->buffered = SDL_TRUE; + joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS); + + SDL_zero(dipdw); + dipdw.diph.dwSize = sizeof(DIPROPDWORD); + dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); + + result = + IDirectInput8_CreateDevice(dinput, + &(joystickdevice->dxdevice.guidInstance), &device, NULL); + if (FAILED(result)) { + return SetDIerror("IDirectInput::CreateDevice", result); + } + + /* Now get the IDirectInputDevice8 interface, instead. */ + result = IDirectInputDevice8_QueryInterface(device, + &IID_IDirectInputDevice8, + (LPVOID *)& joystick-> + hwdata->InputDevice); + /* We are done with this object. Use the stored one from now on. */ + IDirectInputDevice8_Release(device); + + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::QueryInterface", result); + } + + /* Acquire shared access. Exclusive access is required for forces, + * though. */ + result = + IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata-> + InputDevice, SDL_HelperWindow, + DISCL_EXCLUSIVE | + DISCL_BACKGROUND); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result); + } + + /* Use the extended data structure: DIJOYSTATE2. */ + result = + IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice, + &SDL_c_dfDIJoystick2); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SetDataFormat", result); + } + + /* Get device capabilities */ + result = + IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice, + &joystick->hwdata->Capabilities); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::GetCapabilities", result); + } + + /* Force capable? */ + if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { + result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::Acquire", result); + } + + /* reset all actuators. */ + result = + IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata-> + InputDevice, + DISFFC_RESET); + + /* Not necessarily supported, ignore if not supported. + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result); + } + */ + + result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); + + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::Unacquire", result); + } + + /* Turn on auto-centering for a ForceFeedback device (until told + * otherwise). */ + dipdw.diph.dwObj = 0; + dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = DIPROPAUTOCENTER_ON; + + result = + IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, + DIPROP_AUTOCENTER, &dipdw.diph); + + /* Not necessarily supported, ignore if not supported. + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SetProperty", result); + } + */ + } + + /* What buttons and axes does it have? */ + IDirectInputDevice8_EnumObjects(joystick->hwdata->InputDevice, + EnumDevObjectsCallback, joystick, + DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV); + + /* Reorder the input objects. Some devices do not report the X axis as + * the first axis, for example. */ + SortDevObjects(joystick); + + dipdw.diph.dwObj = 0; + dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = INPUT_QSIZE; + + /* Set the buffer size */ + result = + IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, + DIPROP_BUFFERSIZE, &dipdw.diph); + + if (result == DI_POLLEDDEVICE) { + /* This device doesn't support buffering, so we're forced + * to use less reliable polling. */ + joystick->hwdata->buffered = SDL_FALSE; + } else if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SetProperty", result); + } + return 0; +} + +static int +SDL_DINPUT_JoystickInitRumble(SDL_Joystick * joystick, Sint16 magnitude, Uint32 duration_ms) +{ + HRESULT result; + + /* Reset and then enable actuators */ + result = IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->InputDevice, DISFFC_RESET); + if (result == DIERR_INPUTLOST || result == DIERR_NOTEXCLUSIVEACQUIRED) { + result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + if (SUCCEEDED(result)) { + result = IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->InputDevice, DISFFC_RESET); + } + } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand(DISFFC_RESET)", result); + } + + result = IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->InputDevice, DISFFC_SETACTUATORSON); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand(DISFFC_SETACTUATORSON)", result); + } + + /* Create the effect */ + joystick->hwdata->ffeffect = CreateRumbleEffectData(magnitude, duration_ms); + if (!joystick->hwdata->ffeffect) { + return SDL_OutOfMemory(); + } + + result = IDirectInputDevice8_CreateEffect(joystick->hwdata->InputDevice, &GUID_Sine, + joystick->hwdata->ffeffect, &joystick->hwdata->ffeffect_ref, NULL); + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::CreateEffect", result); + } + return 0; +} + +int +SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + HRESULT result; + + /* Scale and average the two rumble strengths */ + Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2); + + if (!(joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK)) { + return SDL_Unsupported(); + } + + if (joystick->hwdata->ff_initialized) { + DIPERIODIC *periodic = ((DIPERIODIC *)joystick->hwdata->ffeffect->lpvTypeSpecificParams); + joystick->hwdata->ffeffect->dwDuration = duration_ms * 1000; /* In microseconds. */ + periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude); + + result = IDirectInputEffect_SetParameters(joystick->hwdata->ffeffect_ref, joystick->hwdata->ffeffect, (DIEP_DURATION | DIEP_TYPESPECIFICPARAMS)); + if (result == DIERR_INPUTLOST) { + result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + if (SUCCEEDED(result)) { + result = IDirectInputEffect_SetParameters(joystick->hwdata->ffeffect_ref, joystick->hwdata->ffeffect, (DIEP_DURATION | DIEP_TYPESPECIFICPARAMS)); + } + } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SetParameters", result); + } + } else { + if (SDL_DINPUT_JoystickInitRumble(joystick, magnitude, duration_ms) < 0) { + return -1; + } + joystick->hwdata->ff_initialized = SDL_TRUE; + } + + result = IDirectInputEffect_Start(joystick->hwdata->ffeffect_ref, 1, 0); + if (result == DIERR_INPUTLOST || result == DIERR_NOTEXCLUSIVEACQUIRED) { + result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + if (SUCCEEDED(result)) { + result = IDirectInputEffect_Start(joystick->hwdata->ffeffect_ref, 1, 0); + } + } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::Start", result); + } + return 0; +} + +static Uint8 +TranslatePOV(DWORD value) +{ + const int HAT_VALS[] = { + SDL_HAT_UP, + SDL_HAT_UP | SDL_HAT_RIGHT, + SDL_HAT_RIGHT, + SDL_HAT_DOWN | SDL_HAT_RIGHT, + SDL_HAT_DOWN, + SDL_HAT_DOWN | SDL_HAT_LEFT, + SDL_HAT_LEFT, + SDL_HAT_UP | SDL_HAT_LEFT + }; + + if (LOWORD(value) == 0xFFFF) + return SDL_HAT_CENTERED; + + /* Round the value up: */ + value += 4500 / 2; + value %= 36000; + value /= 4500; + + if (value >= 8) + return SDL_HAT_CENTERED; /* shouldn't happen */ + + return HAT_VALS[value]; +} + +static void +UpdateDINPUTJoystickState_Buffered(SDL_Joystick * joystick) +{ + int i; + HRESULT result; + DWORD numevents; + DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; + + numevents = INPUT_QSIZE; + result = + IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice, + sizeof(DIDEVICEOBJECTDATA), evtbuf, + &numevents, 0); + if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { + IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + result = + IDirectInputDevice8_GetDeviceData(joystick->hwdata->InputDevice, + sizeof(DIDEVICEOBJECTDATA), + evtbuf, &numevents, 0); + } + + /* Handle the events or punt */ + if (FAILED(result)) { + return; + } + + for (i = 0; i < (int)numevents; ++i) { + int j; + + for (j = 0; j < joystick->hwdata->NumInputs; ++j) { + const input_t *in = &joystick->hwdata->Inputs[j]; + + if (evtbuf[i].dwOfs != in->ofs) + continue; + + switch (in->type) { + case AXIS: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)evtbuf[i].dwData); + break; + case BUTTON: + SDL_PrivateJoystickButton(joystick, in->num, + (Uint8)(evtbuf[i].dwData ? SDL_PRESSED : SDL_RELEASED)); + break; + case HAT: + { + Uint8 pos = TranslatePOV(evtbuf[i].dwData); + SDL_PrivateJoystickHat(joystick, in->num, pos); + } + break; + } + } + } +} + +/* Function to update the state of a joystick - called as a device poll. + * This function shouldn't update the joystick structure directly, + * but instead should call SDL_PrivateJoystick*() to deliver events + * and update joystick device state. + */ +static void +UpdateDINPUTJoystickState_Polled(SDL_Joystick * joystick) +{ + DIJOYSTATE2 state; + HRESULT result; + int i; + + result = + IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice, + sizeof(DIJOYSTATE2), &state); + if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { + IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + result = + IDirectInputDevice8_GetDeviceState(joystick->hwdata->InputDevice, + sizeof(DIJOYSTATE2), &state); + } + + if (result != DI_OK) { + return; + } + + /* Set each known axis, button and POV. */ + for (i = 0; i < joystick->hwdata->NumInputs; ++i) { + const input_t *in = &joystick->hwdata->Inputs[i]; + + switch (in->type) { + case AXIS: + switch (in->ofs) { + case DIJOFS_X: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lX); + break; + case DIJOFS_Y: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lY); + break; + case DIJOFS_Z: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lZ); + break; + case DIJOFS_RX: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRx); + break; + case DIJOFS_RY: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRy); + break; + case DIJOFS_RZ: + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.lRz); + break; + case DIJOFS_SLIDER(0): + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[0]); + break; + case DIJOFS_SLIDER(1): + SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)state.rglSlider[1]); + break; + } + break; + + case BUTTON: + SDL_PrivateJoystickButton(joystick, in->num, + (Uint8)(state.rgbButtons[in->ofs - DIJOFS_BUTTON0] ? SDL_PRESSED : SDL_RELEASED)); + break; + case HAT: + { + Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs - DIJOFS_POV(0)]); + SDL_PrivateJoystickHat(joystick, in->num, pos); + break; + } + } + } +} + +void +SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick) +{ + HRESULT result; + + result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); + if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { + IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); + } + + if (joystick->hwdata->buffered) { + UpdateDINPUTJoystickState_Buffered(joystick); + } else { + UpdateDINPUTJoystickState_Polled(joystick); + } +} + +void +SDL_DINPUT_JoystickClose(SDL_Joystick * joystick) +{ + if (joystick->hwdata->ffeffect_ref) { + IDirectInputEffect_Unload(joystick->hwdata->ffeffect_ref); + joystick->hwdata->ffeffect_ref = NULL; + } + if (joystick->hwdata->ffeffect) { + FreeRumbleEffectData(joystick->hwdata->ffeffect); + joystick->hwdata->ffeffect = NULL; + } + IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); + IDirectInputDevice8_Release(joystick->hwdata->InputDevice); + joystick->hwdata->ff_initialized = SDL_FALSE; +} + +void +SDL_DINPUT_JoystickQuit(void) +{ + if (dinput != NULL) { + IDirectInput8_Release(dinput); + dinput = NULL; + } + + if (coinitialized) { + WIN_CoUninitialize(); + coinitialized = SDL_FALSE; + } +} + +#else /* !SDL_JOYSTICK_DINPUT */ + +typedef struct JoyStick_DeviceData JoyStick_DeviceData; + +int +SDL_DINPUT_JoystickInit(void) +{ + return 0; +} + +void +SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) +{ +} + +int +SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice) +{ + return SDL_Unsupported(); +} + +int +SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_Unsupported(); +} + +void +SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick) +{ +} + +void +SDL_DINPUT_JoystickClose(SDL_Joystick * joystick) +{ +} + +void +SDL_DINPUT_JoystickQuit(void) +{ +} + +#endif /* SDL_JOYSTICK_DINPUT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick_c.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick_c.h index 7e4ff3e194..9f29fc7519 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ extern int SDL_DINPUT_JoystickInit(void); extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext); extern int SDL_DINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice); +extern int SDL_DINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); extern void SDL_DINPUT_JoystickUpdate(SDL_Joystick * joystick); extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick); extern void SDL_DINPUT_JoystickQuit(void); diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_mmjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_mmjoystick.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_mmjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_mmjoystick.c index 3746181811..60e3fcb31b 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_mmjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,10 +41,6 @@ #define MAX_JOYSTICKS 16 #define MAX_AXES 6 /* each joystick can have up to 6 axes */ #define MAX_BUTTONS 32 /* and 32 buttons */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -/* limit axis to 256 possible positions to filter out noise */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256) #define JOY_BUTTON_FLAG(n) (1<hwdata->id = SYS_JoystickID[index]; for (i = 0; i < MAX_AXES; ++i) { if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) { - joystick->hwdata->transaxis[i].offset = AXIS_MIN - axis_min[i]; + joystick->hwdata->transaxis[i].offset = SDL_JOYSTICK_AXIS_MIN - axis_min[i]; joystick->hwdata->transaxis[i].scale = - (float) (AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]); + (float) (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) / (axis_max[i] - axis_min[i]); } else { joystick->hwdata->transaxis[i].offset = 0; joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */ @@ -271,12 +279,6 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) return (0); } -/* Function to determine if this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - static Uint8 TranslatePOV(DWORD value) { @@ -315,7 +317,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) }; DWORD pos[MAX_AXES]; struct _transaxis *transaxis; - int value, change; + int value; JOYINFOEX joyinfo; joyinfo.dwSize = sizeof(joyinfo); @@ -340,14 +342,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) transaxis = joystick->hwdata->transaxis; for (i = 0; i < joystick->naxes; i++) { if (joyinfo.dwFlags & flags[i]) { - value = - (int) (((float) pos[i] + - transaxis[i].offset) * transaxis[i].scale); - change = (value - joystick->axes[i]); - if ((change < -JOY_AXIS_THRESHOLD) - || (change > JOY_AXIS_THRESHOLD)) { - SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); - } + value = (int) (((float) pos[i] + transaxis[i].offset) * transaxis[i].scale); + SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); } } @@ -355,27 +351,16 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) if (joyinfo.dwFlags & JOY_RETURNBUTTONS) { for (i = 0; i < joystick->nbuttons; ++i) { if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) { - if (!joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_PRESSED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_PRESSED); } else { - if (joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_RELEASED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_RELEASED); } } } /* joystick hat events */ if (joyinfo.dwFlags & JOY_RETURNPOV) { - Uint8 pos; - - pos = TranslatePOV(joyinfo.dwPOV); - if (pos != joystick->hats[0]) { - SDL_PrivateJoystickHat(joystick, 0, pos); - } + SDL_PrivateJoystickHat(joystick, 0, TranslatePOV(joyinfo.dwPOV)); } } diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick.c similarity index 73% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick.c index 7123c6151b..71b72e6103 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,16 +35,11 @@ #include "SDL_error.h" #include "SDL_assert.h" #include "SDL_events.h" -#include "SDL_thread.h" #include "SDL_timer.h" #include "SDL_mutex.h" -#include "SDL_events.h" -#include "SDL_hints.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" -#if !SDL_EVENTS_DISABLED -#include "../../events/SDL_events_c.h" -#endif +#include "../../thread/SDL_systhread.h" #include "../../core/windows/SDL_windows.h" #if !defined(__WINRT__) #include @@ -66,7 +61,6 @@ /* local variables */ static SDL_bool s_bDeviceAdded = SDL_FALSE; static SDL_bool s_bDeviceRemoved = SDL_FALSE; -static SDL_JoystickID s_nInstanceID = -1; static SDL_cond *s_condJoystickThread = NULL; static SDL_mutex *s_mutexJoyStickEnum = NULL; static SDL_Thread *s_threadJoystick = NULL; @@ -94,9 +88,10 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { + return SDL_FALSE; } #else /* !__WINRT__ */ @@ -109,6 +104,8 @@ typedef struct HDEVNOTIFY hNotify; } SDL_DeviceNotificationData; +#define IDT_SDL_DEVICE_CHANGE_TIMER_1 1200 +#define IDT_SDL_DEVICE_CHANGE_TIMER_2 1201 /* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal */ static LRESULT CALLBACK @@ -118,17 +115,19 @@ SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_DEVICECHANGE: switch (wParam) { case DBT_DEVICEARRIVAL: - if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; - } - break; case DBT_DEVICEREMOVECOMPLETE: if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; + /* notify 300ms and 2 seconds later to ensure all APIs have updated status */ + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_1, 300, NULL); + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_2, 2000, NULL); } break; } return 0; + case WM_TIMER: + KillTimer(hwnd, wParam); + s_bWindowsDeviceChanged = SDL_TRUE; + return 0; } return DefWindowProc (hwnd, message, wParam, lParam); @@ -192,21 +191,26 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { MSG msg; + int lastret = 1; if (!data->messageWindow) { - return; + return SDL_FALSE; /* device notifications require a window */ } - while (PeekMessage(&msg, data->messageWindow, 0, 0, PM_NOREMOVE)) { - if (GetMessage(&msg, data->messageWindow, 0, 0) != 0) { + SDL_UnlockMutex(mutex); + while (lastret > 0 && s_bWindowsDeviceChanged == SDL_FALSE) { + lastret = GetMessage(&msg, NULL, 0, 0); /* WM_QUIT causes return value of 0 */ + if (lastret > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } } + SDL_LockMutex(mutex); + return (lastret != -1) ? SDL_TRUE : SDL_FALSE; } #endif /* __WINRT__ */ @@ -230,31 +234,30 @@ SDL_JoystickThread(void *_data) while (s_bJoystickThreadQuit == SDL_FALSE) { SDL_bool bXInputChanged = SDL_FALSE; - SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 300); - - SDL_CheckDeviceNotification(¬ification_data); - + if (SDL_WaitForDeviceNotification(¬ification_data, s_mutexJoyStickEnum) == SDL_FALSE) { #if SDL_JOYSTICK_XINPUT - if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { - /* scan for any change in XInput devices */ - Uint8 userId; - for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { - XINPUT_CAPABILITIES capabilities; - const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); - const SDL_bool available = (result == ERROR_SUCCESS); - if (bOpenedXInputDevices[userId] != available) { - bXInputChanged = SDL_TRUE; - bOpenedXInputDevices[userId] = available; + /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ + SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); + if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { + /* scan for any change in XInput devices */ + Uint8 userId; + for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { + XINPUT_CAPABILITIES capabilities; + const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); + const SDL_bool available = (result == ERROR_SUCCESS); + if (bOpenedXInputDevices[userId] != available) { + bXInputChanged = SDL_TRUE; + bOpenedXInputDevices[userId] = available; + } } } - } +#else + /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */ + break; #endif /* SDL_JOYSTICK_XINPUT */ + } if (s_bWindowsDeviceChanged || bXInputChanged) { - SDL_UnlockMutex(s_mutexJoyStickEnum); /* let main thread go while we SDL_Delay(). */ - SDL_Delay(300); /* wait for direct input to find out about this device */ - SDL_LockMutex(s_mutexJoyStickEnum); - s_bDeviceRemoved = SDL_TRUE; s_bDeviceAdded = SDL_TRUE; s_bWindowsDeviceChanged = SDL_FALSE; @@ -267,30 +270,33 @@ SDL_JoystickThread(void *_data) return 1; } -void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device) +void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device) { device->send_add_event = SDL_TRUE; - device->nInstanceID = ++s_nInstanceID; + device->nInstanceID = SDL_GetNextJoystickInstanceID(); device->pNext = SYS_Joystick; SYS_Joystick = device; s_bDeviceAdded = SDL_TRUE; } +static void WINDOWS_JoystickDetect(void); +static void WINDOWS_JoystickQuit(void); + /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ -int -SDL_SYS_JoystickInit(void) +static int +WINDOWS_JoystickInit(void) { if (SDL_DINPUT_JoystickInit() < 0) { - SDL_SYS_JoystickQuit(); + WINDOWS_JoystickQuit(); return -1; } if (SDL_XINPUT_JoystickInit() < 0) { - SDL_SYS_JoystickQuit(); + WINDOWS_JoystickQuit(); return -1; } @@ -298,28 +304,19 @@ SDL_SYS_JoystickInit(void) s_condJoystickThread = SDL_CreateCond(); s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */ - SDL_SYS_JoystickDetect(); + WINDOWS_JoystickDetect(); if (!s_threadJoystick) { - s_bJoystickThreadQuit = SDL_FALSE; /* spin up the thread to detect hotplug of devices */ -#if defined(__WIN32__) && !defined(HAVE_LIBC) -#undef SDL_CreateThread -#if SDL_DYNAMIC_API - s_threadJoystick= SDL_CreateThread_REAL(SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL); -#else - s_threadJoystick= SDL_CreateThread(SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL); -#endif -#else - s_threadJoystick = SDL_CreateThread(SDL_JoystickThread, "SDL_joystick", NULL); -#endif + s_bJoystickThreadQuit = SDL_FALSE; + s_threadJoystick = SDL_CreateThreadInternal(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL); } - return SDL_SYS_NumJoysticks(); + return 0; } /* return the number of joysticks that are connected right now */ -int -SDL_SYS_NumJoysticks() +static int +WINDOWS_JoystickGetCount(void) { int nJoysticks = 0; JoyStick_DeviceData *device = SYS_Joystick; @@ -332,13 +329,10 @@ SDL_SYS_NumJoysticks() } /* detect any new joysticks being inserted into the system */ -void -SDL_SYS_JoystickDetect() +static void +WINDOWS_JoystickDetect(void) { JoyStick_DeviceData *pCurList = NULL; -#if !SDL_EVENTS_DISABLED - SDL_Event event; -#endif /* only enum the devices if the joystick thread told us something changed */ if (!s_bDeviceAdded && !s_bDeviceRemoved) { @@ -370,17 +364,7 @@ SDL_SYS_JoystickDetect() SDL_DINPUT_MaybeRemoveDevice(&pCurList->dxdevice); } -#if !SDL_EVENTS_DISABLED - SDL_zero(event); - event.type = SDL_JOYDEVICEREMOVED; - - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = pCurList->nInstanceID; - if ((!SDL_EventOK) || (*SDL_EventOK) (SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ + SDL_PrivateJoystickRemoved(pCurList->nInstanceID); pListNext = pCurList->pNext; SDL_free(pCurList->joystickname); @@ -401,17 +385,8 @@ SDL_SYS_JoystickDetect() SDL_DINPUT_MaybeAddDevice(&pNewJoystick->dxdevice); } -#if !SDL_EVENTS_DISABLED - SDL_zero(event); - event.type = SDL_JOYDEVICEADDED; + SDL_PrivateJoystickAdded(pNewJoystick->nInstanceID); - if (SDL_GetEventState(event.type) == SDL_ENABLE) { - event.jdevice.which = device_index; - if ((!SDL_EventOK) || (*SDL_EventOK) (SDL_EventOKParam, &event)) { - SDL_PushEvent(&event); - } - } -#endif /* !SDL_EVENTS_DISABLED */ pNewJoystick->send_add_event = SDL_FALSE; } device_index++; @@ -421,8 +396,8 @@ SDL_SYS_JoystickDetect() } /* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) +static const char * +WINDOWS_JoystickGetDeviceName(int device_index) { JoyStick_DeviceData *device = SYS_Joystick; @@ -432,9 +407,34 @@ SDL_SYS_JoystickNameForDeviceIndex(int device_index) return device->joystickname; } +static int +WINDOWS_JoystickGetDevicePlayerIndex(int device_index) +{ + JoyStick_DeviceData *device = SYS_Joystick; + int index; + + for (index = device_index; index > 0; index--) + device = device->pNext; + + return device->bXInputDevice ? (int)device->XInputUserId : -1; +} + +/* return the stable device guid for this device index */ +static SDL_JoystickGUID +WINDOWS_JoystickGetDeviceGUID(int device_index) +{ + JoyStick_DeviceData *device = SYS_Joystick; + int index; + + for (index = device_index; index > 0; index--) + device = device->pNext; + + return device->guid; +} + /* Function to perform the mapping between current device instance and this joysticks instance id */ -SDL_JoystickID -SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +static SDL_JoystickID +WINDOWS_JoystickGetDeviceInstanceID(int device_index) { JoyStick_DeviceData *device = SYS_Joystick; int index; @@ -450,8 +450,8 @@ SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) +static int +WINDOWS_JoystickOpen(SDL_Joystick * joystick, int device_index) { JoyStick_DeviceData *joystickdevice = SYS_Joystick; @@ -475,17 +475,20 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) } } -/* return true if this joystick is plugged in right now */ -SDL_bool -SDL_SYS_JoystickAttached(SDL_Joystick * joystick) +static int +WINDOWS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) { - return joystick->hwdata && !joystick->hwdata->removed; + if (joystick->hwdata->bXInputDevice) { + return SDL_XINPUT_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); + } else { + return SDL_DINPUT_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); + } } -void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) +static void +WINDOWS_JoystickUpdate(SDL_Joystick * joystick) { - if (!joystick->hwdata || joystick->hwdata->removed) { + if (!joystick->hwdata) { return; } @@ -494,15 +497,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) } else { SDL_DINPUT_JoystickUpdate(joystick); } - - if (joystick->hwdata->removed) { - joystick->force_recentering = SDL_TRUE; - } } /* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) +static void +WINDOWS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata->bXInputDevice) { SDL_XINPUT_JoystickClose(joystick); @@ -514,8 +513,8 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) } /* Function to perform any system-specific joystick related cleanup */ -void -SDL_SYS_JoystickQuit(void) +static void +WINDOWS_JoystickQuit(void) { JoyStick_DeviceData *device = SYS_Joystick; @@ -532,6 +531,9 @@ SDL_SYS_JoystickQuit(void) s_bJoystickThreadQuit = SDL_TRUE; SDL_CondBroadcast(s_condJoystickThread); /* signal the joystick thread to quit */ SDL_UnlockMutex(s_mutexJoyStickEnum); +#ifndef __WINRT__ + PostThreadMessage(SDL_GetThreadID(s_threadJoystick), WM_QUIT, 0, 0); +#endif SDL_WaitThread(s_threadJoystick, NULL); /* wait for it to bugger off */ SDL_DestroyMutex(s_mutexJoyStickEnum); @@ -543,26 +545,26 @@ SDL_SYS_JoystickQuit(void) SDL_DINPUT_JoystickQuit(); SDL_XINPUT_JoystickQuit(); -} -/* return the stable device guid for this device index */ -SDL_JoystickGUID -SDL_SYS_JoystickGetDeviceGUID(int device_index) -{ - JoyStick_DeviceData *device = SYS_Joystick; - int index; - - for (index = device_index; index > 0; index--) - device = device->pNext; - - return device->guid; + s_bDeviceAdded = SDL_FALSE; + s_bDeviceRemoved = SDL_FALSE; } -SDL_JoystickGUID -SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) +SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = { - return joystick->hwdata->guid; -} + WINDOWS_JoystickInit, + WINDOWS_JoystickGetCount, + WINDOWS_JoystickDetect, + WINDOWS_JoystickGetDeviceName, + WINDOWS_JoystickGetDevicePlayerIndex, + WINDOWS_JoystickGetDeviceGUID, + WINDOWS_JoystickGetDeviceInstanceID, + WINDOWS_JoystickOpen, + WINDOWS_JoystickRumble, + WINDOWS_JoystickUpdate, + WINDOWS_JoystickClose, + WINDOWS_JoystickQuit, +}; #endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick_c.h index ab946b4f7e..611f7e6203 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ typedef struct JoyStick_DeviceData BYTE SubType; Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; + WCHAR hidPath[MAX_PATH]; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; @@ -65,8 +66,7 @@ typedef struct input_t struct joystick_hwdata { SDL_JoystickGUID guid; - SDL_bool removed; - SDL_bool send_remove_event; + Uint32 rumble_expiration; #if SDL_JOYSTICK_DINPUT LPDIRECTINPUTDEVICE8 InputDevice; @@ -75,6 +75,9 @@ struct joystick_hwdata input_t Inputs[MAX_INPUTS]; int NumInputs; int NumSliders; + SDL_bool ff_initialized; + DIEFFECT *ffeffect; + LPDIRECTINPUTEFFECT ffeffect_ref; #endif SDL_bool bXInputDevice; /* SDL_TRUE if this device supports using the xinput API rather than DirectInput */ @@ -83,6 +86,10 @@ struct joystick_hwdata DWORD dwPacketNumber; }; -extern void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device); +#if SDL_JOYSTICK_DINPUT +extern const DIDATAFORMAT SDL_c_dfDIJoystick2; +#endif + +extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick.c b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick.c similarity index 63% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick.c rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick.c index 2f27c47dc2..6bbe475750 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick.c +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,24 +26,32 @@ #include "SDL_assert.h" #include "SDL_hints.h" +#include "SDL_timer.h" #include "SDL_windowsjoystick_c.h" #include "SDL_xinputjoystick_c.h" +#include "../hidapi/SDL_hidapijoystick_c.h" /* * Internal stuff. */ static SDL_bool s_bXInputEnabled = SDL_TRUE; +static char *s_arrXInputDevicePath[XUSER_MAX_COUNT]; static SDL_bool SDL_XInputUseOldJoystickMapping() { +#ifdef __WINRT__ + /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + /* FIXME: Why are Win8/10 different here? -flibit */ + return (NTDDI_VERSION < NTDDI_WIN10); +#else static int s_XInputUseOldJoystickMapping = -1; if (s_XInputUseOldJoystickMapping < 0) { - const char *hint = SDL_GetHint(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING); - s_XInputUseOldJoystickMapping = (hint && *hint == '1') ? 1 : 0; + s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE); } return (s_XInputUseOldJoystickMapping > 0); +#endif } SDL_bool SDL_XINPUT_Enabled(void) @@ -54,10 +62,7 @@ SDL_bool SDL_XINPUT_Enabled(void) int SDL_XINPUT_JoystickInit(void) { - const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED); - if (env && !SDL_atoi(env)) { - s_bXInputEnabled = SDL_FALSE; - } + s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE); if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) { s_bXInputEnabled = SDL_FALSE; /* oh well. */ @@ -108,9 +113,84 @@ GetXInputName(const Uint8 userid, BYTE SubType) return SDL_strdup(name); } +/* We can't really tell what device is being used for XInput, but we can guess + and we'll be correct for the case where only one device is connected. + */ static void -AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) +GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) { +#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + + PRAWINPUTDEVICELIST devices = NULL; + UINT i, j, device_count = 0; + + if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!device_count)) { + return; /* oh well. */ + } + + devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count); + if (devices == NULL) { + return; + } + + if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { + SDL_free(devices); + return; /* oh well. */ + } + + for (i = 0; i < device_count; i++) { + RID_DEVICE_INFO rdi; + char devName[128]; + UINT rdiSize = sizeof(rdi); + UINT nameSize = SDL_arraysize(devName); + + rdi.cbSize = sizeof(rdi); + if ((devices[i].dwType == RIM_TYPEHID) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) && + (SDL_strstr(devName, "IG_") != NULL)) { + SDL_bool found = SDL_FALSE; + for (j = 0; j < SDL_arraysize(s_arrXInputDevicePath); ++j) { + if (j == userid) { + continue; + } + if (!s_arrXInputDevicePath[j]) { + continue; + } + if (SDL_strcmp(devName, s_arrXInputDevicePath[j]) == 0) { + found = SDL_TRUE; + break; + } + } + if (found) { + /* We already have this device in our XInput device list */ + continue; + } + + /* We don't actually know if this is the right device for this + * userid, but we'll record it so we'll at least be consistent + * when the raw device list changes. + */ + *pVID = (Uint16)rdi.hid.dwVendorId; + *pPID = (Uint16)rdi.hid.dwProductId; + *pVersion = (Uint16)rdi.hid.dwVersionNumber; + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + } + s_arrXInputDevicePath[userid] = SDL_strdup(devName); + break; + } + } + SDL_free(devices); +#endif /* ifndef __WINRT__ */ +} + +static void +AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) +{ + Uint16 vendor = 0; + Uint16 product = 0; + Uint16 version = 0; JoyStick_DeviceData *pPrevJoystick = NULL; JoyStick_DeviceData *pNewJoystick = *pContext; @@ -154,17 +234,49 @@ AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext if (SDL_XInputUseOldJoystickMapping()) { SDL_zero(pNewJoystick->guid); } else { - pNewJoystick->guid.data[0] = 'x'; - pNewJoystick->guid.data[1] = 'i'; - pNewJoystick->guid.data[2] = 'n'; - pNewJoystick->guid.data[3] = 'p'; - pNewJoystick->guid.data[4] = 'u'; - pNewJoystick->guid.data[5] = 't'; - pNewJoystick->guid.data[6] = SubType; + Uint16 *guid16 = (Uint16 *)pNewJoystick->guid.data; + + GuessXInputDevice(userid, &vendor, &product, &version); + + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + + /* Note that this is an XInput device and what subtype it is */ + pNewJoystick->guid.data[14] = 'x'; + pNewJoystick->guid.data[15] = SubType; } pNewJoystick->SubType = SubType; pNewJoystick->XInputUserId = userid; - SDL_SYS_AddJoystickDevice(pNewJoystick); + + if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return; + } + +#ifdef SDL_JOYSTICK_HIDAPI + if (HIDAPI_IsDevicePresent(vendor, product, version)) { + /* The HIDAPI driver is taking care of this device */ + SDL_free(pNewJoystick); + return; + } +#endif + + WINDOWS_AddJoystickDevice(pNewJoystick); +} + +static void +DelXInputDevice(Uint8 userid) +{ + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + s_arrXInputDevicePath[userid] = NULL; + } } void @@ -182,6 +294,8 @@ SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext) XINPUT_CAPABILITIES capabilities; if (XINPUTGETCAPABILITIES(userid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS) { AddXInputDevice(userid, capabilities.SubType, pContext); + } else { + DelXInputDevice(userid); } } } @@ -198,6 +312,8 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde SDL_assert(XINPUTSETSTATE); SDL_assert(userId < XUSER_MAX_COUNT); + joystick->player_index = userId; + joystick->hwdata->bXInputDevice = SDL_TRUE; if (XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities) != ERROR_SUCCESS) { @@ -224,14 +340,12 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde static void UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { - if ( pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN ) - { + if (pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) { ePowerLevel = SDL_JOYSTICK_POWER_WIRED; } else { - switch ( pBatteryInformation->BatteryLevel ) - { + switch (pBatteryInformation->BatteryLevel) { case BATTERY_LEVEL_EMPTY: ePowerLevel = SDL_JOYSTICK_POWER_EMPTY; break; @@ -248,7 +362,7 @@ UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_I } } - SDL_PrivateJoystickBatteryLevel( joystick, ePowerLevel ); + SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel); } } @@ -276,7 +390,7 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED); } - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } static void @@ -292,12 +406,12 @@ UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState Uint8 button; Uint8 hat = SDL_HAT_CENTERED; - SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX); - SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY))); - SDL_PrivateJoystickAxis(joystick, 2, (Sint16)(((int)pXInputState->Gamepad.bLeftTrigger * 65535 / 255) - 32768)); - SDL_PrivateJoystickAxis(joystick, 3, (Sint16)pXInputState->Gamepad.sThumbRX); - SDL_PrivateJoystickAxis(joystick, 4, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbRY))); - SDL_PrivateJoystickAxis(joystick, 5, (Sint16)(((int)pXInputState->Gamepad.bRightTrigger * 65535 / 255) - 32768)); + SDL_PrivateJoystickAxis(joystick, 0, pXInputState->Gamepad.sThumbLX); + SDL_PrivateJoystickAxis(joystick, 1, ~pXInputState->Gamepad.sThumbLY); + SDL_PrivateJoystickAxis(joystick, 2, ((int)pXInputState->Gamepad.bLeftTrigger * 257) - 32768); + SDL_PrivateJoystickAxis(joystick, 3, pXInputState->Gamepad.sThumbRX); + SDL_PrivateJoystickAxis(joystick, 4, ~pXInputState->Gamepad.sThumbRY); + SDL_PrivateJoystickAxis(joystick, 5, ((int)pXInputState->Gamepad.bRightTrigger * 257) - 32768); for (button = 0; button < SDL_arraysize(s_XInputButtons); ++button) { SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED); @@ -317,7 +431,30 @@ UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState } SDL_PrivateJoystickHat(joystick, 0, hat); - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); +} + +int +SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + XINPUT_VIBRATION XVibration; + + if (!XINPUTSETSTATE) { + return SDL_Unsupported(); + } + + XVibration.wLeftMotorSpeed = low_frequency_rumble; + XVibration.wRightMotorSpeed = high_frequency_rumble; + if (XINPUTSETSTATE(joystick->hwdata->userid, &XVibration) != ERROR_SUCCESS) { + return SDL_SetError("XInputSetState() failed"); + } + + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + joystick->hwdata->rumble_expiration = SDL_GetTicks() + duration_ms; + } else { + joystick->hwdata->rumble_expiration = 0; + } + return 0; } void @@ -332,15 +469,12 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState); if (result == ERROR_DEVICE_NOT_CONNECTED) { - joystick->hwdata->send_remove_event = SDL_TRUE; - joystick->hwdata->removed = SDL_TRUE; return; } - SDL_zero( XBatteryInformation ); - if ( XINPUTGETBATTERYINFORMATION ) - { - result = XINPUTGETBATTERYINFORMATION( joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation ); + SDL_zero(XBatteryInformation); + if (XINPUTGETBATTERYINFORMATION) { + result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation); } /* only fire events if the data changed from last time */ @@ -352,6 +486,13 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) } joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber; } + + if (joystick->hwdata->rumble_expiration) { + Uint32 now = SDL_GetTicks(); + if (SDL_TICKS_PASSED(now, joystick->hwdata->rumble_expiration)) { + SDL_XINPUT_JoystickRumble(joystick, 0, 0, 0); + } + } } void @@ -367,18 +508,6 @@ SDL_XINPUT_JoystickQuit(void) } } -SDL_bool -SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index) -{ - JoyStick_DeviceData *device = SYS_Joystick; - int index; - - for (index = device_index; index > 0; index--) - device = device->pNext; - - return (device->SubType == XINPUT_DEVSUBTYPE_GAMEPAD); -} - #else /* !SDL_JOYSTICK_XINPUT */ typedef struct JoyStick_DeviceData JoyStick_DeviceData; @@ -405,6 +534,12 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde return SDL_Unsupported(); } +int +SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms) +{ + return SDL_Unsupported(); +} + void SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) { diff --git a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick_c.h b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick_c.h rename to 3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick_c.h index b3ba8c02e5..8d57b62f68 100644 --- a/3rdparty/sdl2-2.0.4/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/3rdparty/sdl2-2.0.9/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ extern SDL_bool SDL_XINPUT_Enabled(void); extern int SDL_XINPUT_JoystickInit(void); extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext); extern int SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickdevice); +extern int SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); extern void SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick); extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick); extern void SDL_XINPUT_JoystickQuit(void); diff --git a/3rdparty/sdl2-2.0.4/src/libm/e_atan2.c b/3rdparty/sdl2-2.0.9/src/libm/e_atan2.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/libm/e_atan2.c rename to 3rdparty/sdl2-2.0.9/src/libm/e_atan2.c index f7b91a3e1b..32b9725701 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/e_atan2.c +++ b/3rdparty/sdl2-2.0.9/src/libm/e_atan2.c @@ -81,8 +81,8 @@ double attribute_hidden __ieee754_atan2(double y, double x) switch(m) { case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0*pi_o_4+tiny;/* atan(+INF,-INF) */ - case 3: return -3.0*pi_o_4-tiny;/* atan(-INF,-INF) */ + case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ } } else { switch(m) { @@ -114,3 +114,21 @@ double attribute_hidden __ieee754_atan2(double y, double x) return (z-pi_lo)-pi;/* atan(-,-) */ } } + +/* + * wrapper atan2(y,x) + */ +#ifndef _IEEE_LIBM +double atan2(double y, double x) +{ + double z = __ieee754_atan2(y, x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || isnan(y)) + return z; + if (x == 0.0 && y == 0.0) + return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */ + return z; +} +#else +strong_alias(__ieee754_atan2, atan2) +#endif +libm_hidden_def(atan2) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_exp.c b/3rdparty/sdl2-2.0.9/src/libm/e_exp.c new file mode 100644 index 0000000000..d8cd4a47af --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_exp.c @@ -0,0 +1,187 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_exp(x) + * Returns the exponential of x. + * + * Method + * 1. Argument reduction: + * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658. + * Given x, find r and integer k such that + * + * x = k*ln2 + r, |r| <= 0.5*ln2. + * + * Here r will be represented as r = hi-lo for better + * accuracy. + * + * 2. Approximation of exp(r) by a special rational function on + * the interval [0,0.34658]: + * Write + * R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ... + * We use a special Reme algorithm on [0,0.34658] to generate + * a polynomial of degree 5 to approximate R. The maximum error + * of this polynomial approximation is bounded by 2**-59. In + * other words, + * R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5 + * (where z=r*r, and the values of P1 to P5 are listed below) + * and + * | 5 | -59 + * | 2.0+P1*z+...+P5*z - R(z) | <= 2 + * | | + * The computation of exp(r) thus becomes + * 2*r + * exp(r) = 1 + ------- + * R - r + * r*R1(r) + * = 1 + r + ----------- (for better accuracy) + * 2 - R1(r) + * where + * 2 4 10 + * R1(r) = r - (P1*r + P2*r + ... + P5*r ). + * + * 3. Scale back to obtain exp(x): + * From step 1, we have + * exp(x) = 2^k * exp(r) + * + * Special cases: + * exp(INF) is INF, exp(NaN) is NaN; + * exp(-INF) is 0, and + * for finite argument, only exp(0)=1 is exact. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Misc. info. + * For IEEE double + * if x > 7.09782712893383973096e+02 then exp(x) overflow + * if x < -7.45133219101941108420e+02 then exp(x) underflow + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double +one = 1.0, +halF[2] = {0.5,-0.5,}, +huge = 1.0e+300, +twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/ +o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ +u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */ +ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */ + -6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */ +ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */ + -1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */ +invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ + +double __ieee754_exp(double x) /* default IEEE double exp */ +{ + double y; + double hi = 0.0; + double lo = 0.0; + double c; + double t; + int32_t k=0; + int32_t xsb; + u_int32_t hx; + + GET_HIGH_WORD(hx,x); + xsb = (hx>>31)&1; /* sign bit of x */ + hx &= 0x7fffffff; /* high word of |x| */ + + /* filter out non-finite argument */ + if(hx >= 0x40862E42) { /* if |x|>=709.78... */ + if(hx>=0x7ff00000) { + u_int32_t lx; + GET_LOW_WORD(lx,x); + if(((hx&0xfffff)|lx)!=0) + return x+x; /* NaN */ + else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ + } + #if 1 + if(x > o_threshold) return huge*huge; /* overflow */ + #else /* !!! FIXME: check this: "huge * huge" is a compiler warning, maybe they wanted +Inf? */ + if(x > o_threshold) return INFINITY; /* overflow */ + #endif + + if(x < u_threshold) return twom1000*twom1000; /* underflow */ + } + + /* argument reduction */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ + hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; + } else { + k = (int32_t) (invln2*x+halF[xsb]); + t = k; + hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ + lo = t*ln2LO[0]; + } + x = hi - lo; + } + else if(hx < 0x3e300000) { /* when |x|<2**-28 */ + if(huge+x>one) return one+x;/* trigger inexact */ + } + else k = 0; + + /* x is now in primary range */ + t = x*x; + c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + if(k==0) return one-((x*c)/(c-2.0)-x); + else y = one-((lo-(x*c)/(2.0-c))-hi); + if(k >= -1021) { + u_int32_t hy; + GET_HIGH_WORD(hy,y); + SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */ + return y; + } else { + u_int32_t hy; + GET_HIGH_WORD(hy,y); + SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */ + return y*twom1000; + } +} + +/* + * wrapper exp(x) + */ +#ifndef _IEEE_LIBM +double exp(double x) +{ + static const double o_threshold = 7.09782712893383973096e+02; /* 0x40862E42, 0xFEFA39EF */ + static const double u_threshold = -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ + + double z = __ieee754_exp(x); + if (_LIB_VERSION == _IEEE_) + return z; + if (isfinite(x)) { + if (x > o_threshold) + return __kernel_standard(x, x, 6); /* exp overflow */ + if (x < u_threshold) + return __kernel_standard(x, x, 7); /* exp underflow */ + } + return z; +} +#else +strong_alias(__ieee754_exp, exp) +#endif +libm_hidden_def(exp) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_fmod.c b/3rdparty/sdl2-2.0.9/src/libm/e_fmod.c new file mode 100644 index 0000000000..fd8bacb2b7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_fmod.c @@ -0,0 +1,144 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __ieee754_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double one = 1.0, Zero[] = {0.0, -0.0,}; + +double attribute_hidden __ieee754_fmod(double x, double y) +{ + int32_t n,hx,hy,hz,ix,iy,sx,i; + u_int32_t lx,ly,lz; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ + ((hy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x00100000) { /* subnormal x */ + if(hx==0) { + for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } + } else ix = (hx>>20)-1023; + + /* determine iy = ilogb(y) */ + if(hy<0x00100000) { /* subnormal y */ + if(hy==0) { + for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } + } else iy = (hy>>20)-1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -1022) + hx = 0x00100000|(0x000fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + if(n<=31) { + hx = (hx<>(32-n)); + lx <<= n; + } else { + hx = lx<<(n-32); + lx = 0; + } + } + if(iy >= -1022) + hy = 0x00100000|(0x000fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + if(n<=31) { + hy = (hy<>(32-n)); + ly <<= n; + } else { + hy = ly<<(n-32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + hx = hz+hz+(lz>>31); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=0) {hx=hz;lx=lz;} + + /* convert back to floating value and restore the sign */ + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + while(hx<0x00100000) { /* normalize x */ + hx = hx+hx+(lx>>31); lx = lx+lx; + iy -= 1; + } + if(iy>= -1022) { /* normalize output */ + hx = ((hx-0x00100000)|((iy+1023)<<20)); + INSERT_WORDS(x,hx|sx,lx); + } else { /* subnormal output */ + n = -1022 - iy; + if(n<=20) { + lx = (lx>>n)|((u_int32_t)hx<<(32-n)); + hx >>= n; + } else if (n<=31) { + lx = (hx<<(32-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-32); hx = sx; + } + INSERT_WORDS(x,hx|sx,lx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} + +/* + * wrapper fmod(x,y) + */ +#ifndef _IEEE_LIBM +double fmod(double x, double y) +{ + double z = __ieee754_fmod(x, y); + if (_LIB_VERSION == _IEEE_ || isnan(y) || isnan(x)) + return z; + if (y == 0.0) + return __kernel_standard(x, y, 27); /* fmod(x,0) */ + return z; +} +#else +strong_alias(__ieee754_fmod, fmod) +#endif +libm_hidden_def(fmod) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_log.c b/3rdparty/sdl2-2.0.9/src/libm/e_log.c new file mode 100644 index 0000000000..208df815c3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_log.c @@ -0,0 +1,152 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) +#endif + +/* __ieee754_log(x) + * Return the logrithm of x + * + * Method : + * 1. Argument Reduction: find k and f such that + * x = 2^k * (1+f), + * where sqrt(2)/2 < 1+f < sqrt(2) . + * + * 2. Approximation of log(1+f). + * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) + * = 2s + 2/3 s**3 + 2/5 s**5 + ....., + * = 2s + s*R + * We use a special Reme algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error + * of this polynomial approximation is bounded by 2**-58.45. In + * other words, + * 2 4 6 8 10 12 14 + * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s + * (the values of Lg1 to Lg7 are listed in the program) + * and + * | 2 14 | -58.45 + * | Lg1*s +...+Lg7*s - R(z) | <= 2 + * | | + * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. + * In order to guarantee error in log below 1ulp, we compute log + * by + * log(1+f) = f - s*(f - R) (if f is not too large) + * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) + * + * 3. Finally, log(x) = k*ln2 + log(1+f). + * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) + * Here ln2 is split into two floating point number: + * ln2_hi + ln2_lo, + * where n*ln2_hi is always exact for |n| < 2000. + * + * Special cases: + * log(x) is NaN with signal if x < 0 (including -INF) ; + * log(+INF) is +INF; log(0) is -INF with signal; + * log(NaN) is that NaN with no signal. + * + * Accuracy: + * according to an error analysis, the error is always less than + * 1 ulp (unit in the last place). + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ +Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ +Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ +Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ +Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ +Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ +Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ +Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ + +static const double zero = 0.0; + +double attribute_hidden __ieee754_log(double x) +{ + double hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,hx,i,j; + u_int32_t lx; + + EXTRACT_WORDS(hx,lx,x); + + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + hx &= 0x000fffff; + i = (hx+0x95f64)&0x100000; + SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ + k += (i>>20); + f = x-1.0; + if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ + if(f==zero) {if(k==0) return zero; else {dk=(double)k; + return dk*ln2_hi+dk*ln2_lo;} + } + R = f*f*(0.5-0.33333333333333333*f); + if(k==0) return f-R; else {dk=(double)k; + return dk*ln2_hi-((R-dk*ln2_lo)-f);} + } + s = f/(2.0+f); + dk = (double)k; + z = s*s; + i = hx-0x6147a; + w = z*z; + j = 0x6b851-hx; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=0.5*f*f; + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) return f-s*(f-R); else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } +} + +/* + * wrapper log(x) + */ +#ifndef _IEEE_LIBM +double log(double x) +{ + double z = __ieee754_log(x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) + return z; + if (x == 0.0) + return __kernel_standard(x, x, 16); /* log(0) */ + return __kernel_standard(x, x, 17); /* log(x<0) */ +} +#else +strong_alias(__ieee754_log, log) +#endif +libm_hidden_def(log) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_log10.c b/3rdparty/sdl2-2.0.9/src/libm/e_log10.c new file mode 100644 index 0000000000..a30ba54e64 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_log10.c @@ -0,0 +1,106 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) +#endif + +/* __ieee754_log10(x) + * Return the base 10 logarithm of x + * + * Method : + * Let log10_2hi = leading 40 bits of log10(2) and + * log10_2lo = log10(2) - log10_2hi, + * ivln10 = 1/log(10) rounded. + * Then + * n = ilogb(x), + * if(n<0) n = n+1; + * x = scalbn(x,-n); + * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) + * + * Note 1: + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * mode must set to Round-to-Nearest. + * Note 2: + * [1/log(10)] rounded to 53 bits has error .198 ulps; + * log10 is monotonic at all binary break points. + * + * Special cases: + * log10(x) is NaN with signal if x < 0; + * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; + * log10(NaN) is that NaN with no signal; + * log10(10**N) = N for N=0,1,...,22. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */ +log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ +log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */ + +static const double zero = 0.0; + +double attribute_hidden __ieee754_log10(double x) +{ + double y,z; + int32_t i,k,hx; + u_int32_t lx; + + EXTRACT_WORDS(hx,lx,x); + + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + i = ((u_int32_t)k&0x80000000)>>31; + hx = (hx&0x000fffff)|((0x3ff-i)<<20); + y = (double)(k+i); + SET_HIGH_WORD(x,hx); + z = y*log10_2lo + ivln10*__ieee754_log(x); + return z+y*log10_2hi; +} + +/* + * wrapper log10(X) + */ +#ifndef _IEEE_LIBM +double log10(double x) +{ + double z = __ieee754_log10(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x <= 0.0) { + if(x == 0.0) + return __kernel_standard(x, x, 18); /* log10(0) */ + return __kernel_standard(x, x, 19); /* log10(x<0) */ + } + return z; +} +#else +strong_alias(__ieee754_log10, log10) +#endif +libm_hidden_def(log10) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_pow.c b/3rdparty/sdl2-2.0.9/src/libm/e_pow.c new file mode 100644 index 0000000000..cfd1dbfbeb --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_pow.c @@ -0,0 +1,343 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_pow(x,y) return x**y + * + * n + * Method: Let x = 2 * (1+f) + * 1. Compute and return log2(x) in two pieces: + * log2(x) = w1 + w2, + * where w1 has 53-24 = 29 bit trailing zeros. + * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * arithmetic, where |y'|<=0.5. + * 3. Return x**y = 2**n*exp(y'*log2) + * + * Special cases: + * 1. +-1 ** anything is 1.0 + * 2. +-1 ** +-INF is 1.0 + * 3. (anything) ** 0 is 1 + * 4. (anything) ** 1 is itself + * 5. (anything) ** NAN is NAN + * 6. NAN ** (anything except 0) is NAN + * 7. +-(|x| > 1) ** +INF is +INF + * 8. +-(|x| > 1) ** -INF is +0 + * 9. +-(|x| < 1) ** +INF is +0 + * 10 +-(|x| < 1) ** -INF is +INF + * 11. +0 ** (+anything except 0, NAN) is +0 + * 12. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 13. +0 ** (-anything except 0, NAN) is +INF + * 14. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 15. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 16. +INF ** (+anything except 0,NAN) is +INF + * 17. +INF ** (-anything except 0,NAN) is +0 + * 18. -INF ** (anything) = -0 ** (-anything) + * 19. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 20. (-anything except 0 and inf) ** (non-integer) is NAN + * + * Accuracy: + * pow(x,y) returns x**y nearly rounded. In particular + * pow(integer,integer) + * always returns the correct integer provided it is + * representable. + * + * Constants : + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4756: overflow in constant arithmetic */ +#pragma warning ( disable : 4756 ) +#endif + +static const double +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ +huge = 1.0e300, +tiny = 1.0e-300, + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ +L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ +L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ +L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ +L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ +L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ +lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ +lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ +ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ +cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ +cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ +cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ +ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ +ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ +ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ + +double attribute_hidden __ieee754_pow(double x, double y) +{ + double z,ax,z_h,z_l,p_h,p_l; + double y1,t1,t2,r,s,t,u,v,w; + int32_t i,j,k,yisint,n; + int32_t hx,hy,ix,iy; + u_int32_t lx,ly; + + EXTRACT_WORDS(hx,lx,x); + /* x==1: 1**y = 1 (even if y is NaN) */ + if (hx==0x3ff00000 && lx==0) { + return x; + } + ix = hx&0x7fffffff; + + EXTRACT_WORDS(hy,ly,y); + iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if((iy|ly)==0) return one; + + /* +-NaN return x+y */ + if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x43400000) yisint = 2; /* even integer y */ + else if(iy>=0x3ff00000) { + k = (iy>>20)-0x3ff; /* exponent */ + if(k>20) { + j = ly>>(52-k); + if((j<<(52-k))==ly) yisint = 2-(j&1); + } else if(ly==0) { + j = iy>>(20-k); + if((j<<(20-k))==iy) yisint = 2-(j&1); + } + } + } + + /* special value of y */ + if(ly==0) { + if (iy==0x7ff00000) { /* y is +-inf */ + if (((ix-0x3ff00000)|lx)==0) + return one; /* +-1**+-inf is 1 (yes, weird rule) */ + if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ + return (hy>=0) ? y : zero; + /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0) ? -y : zero; + } + if(iy==0x3ff00000) { /* y is +-1 */ + if(hy<0) return one/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3fe00000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return __ieee754_sqrt(x); + } + } + + ax = fabs(x); + /* special value of x */ + if(lx==0) { + if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3ff00000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x41e00000) { /* if |y| > 2**31 */ + if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ + if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + } + /* over/underflow if x is not close to one */ + if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + SET_LOW_WORD(t1,0); + t2 = v-(t1-u); + } else { + double s2,s_h,s_l,t_h,t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00100000) + {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); } + n += ((ix)>>20)-0x3ff; + j = ix&0x000fffff; + /* determine interval */ + ix = j|0x3ff00000; /* normalize ix */ + if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = 3.0+s2+r; + SET_LOW_WORD(t_h,0); + t_l = r-((t_h-3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + SET_LOW_WORD(p_h,0); + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + SET_LOW_WORD(t1,0); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) + s = -one;/* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + SET_LOW_WORD(y1,0); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + EXTRACT_WORDS(j,i,z); + if (j>=0x40900000) { /* z >= 1024 */ + if(((j-0x40900000)|i)!=0) /* if z > 1024 */ + return s*huge*huge; /* overflow */ + else { + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ + if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ + return s*tiny*tiny; /* underflow */ + else { + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>20)-0x3ff; + n = 0; + if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00100000>>(k+1)); + k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ + t = zero; + SET_HIGH_WORD(t,n&~(0x000fffff>>k)); + n = ((n&0x000fffff)|0x00100000)>>(20-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + SET_LOW_WORD(t,0); + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + GET_HIGH_WORD(j,z); + j += (n<<20); + if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ + else SET_HIGH_WORD(z,j); + return s*z; +} + +/* + * wrapper pow(x,y) return x**y + */ +#ifndef _IEEE_LIBM +double pow(double x, double y) +{ + double z = __ieee754_pow(x, y); + if (_LIB_VERSION == _IEEE_|| isnan(y)) + return z; + if (isnan(x)) { + if (y == 0.0) + return __kernel_standard(x, y, 42); /* pow(NaN,0.0) */ + return z; + } + if (x == 0.0) { + if (y == 0.0) + return __kernel_standard(x, y, 20); /* pow(0.0,0.0) */ + if (isfinite(y) && y < 0.0) + return __kernel_standard(x,y,23); /* pow(0.0,negative) */ + return z; + } + if (!isfinite(z)) { + if (isfinite(x) && isfinite(y)) { + if (isnan(z)) + return __kernel_standard(x, y, 24); /* pow neg**non-int */ + return __kernel_standard(x, y, 21); /* pow overflow */ + } + } + if (z == 0.0 && isfinite(x) && isfinite(y)) + return __kernel_standard(x, y, 22); /* pow underflow */ + return z; +} +#else +strong_alias(__ieee754_pow, pow) +#endif +libm_hidden_def(pow) diff --git a/3rdparty/sdl2-2.0.9/src/libm/e_rem_pio2.c b/3rdparty/sdl2-2.0.9/src/libm/e_rem_pio2.c new file mode 100644 index 0000000000..5e055d627c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/e_rem_pio2.c @@ -0,0 +1,161 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_rem_pio2(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2() + */ + +#include "math_libm.h" +#include "math_private.h" + +/* + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + */ +static const int32_t two_over_pi[] = { +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; + +static const int32_t npio2_hw[] = { +0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, +0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, +0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, +0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, +0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, +0x404858EB, 0x404921FB, +}; + +/* + * invpio2: 53 bits of 2/pi + * pio2_1: first 33 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 33 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 33 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +static const double +zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ +pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ +pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ +pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ +pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ +pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ +pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ + +int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y) +{ + double z=0.0,w,t,r,fn; + double tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + u_int32_t low; + + GET_HIGH_WORD(hx,x); /* high word of x */ + ix = hx&0x7fffffff; + if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int32_t) (t*invpio2+half); + fn = (double)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 85 bit */ + if(n<32&&ix!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>20; + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>16) { /* 2nd iteration needed, good to 118 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7ff00000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + /* set z = scalbn(|x|,ilogb(x)-23) */ + GET_LOW_WORD(low,x); + SET_LOW_WORD(z,low); + e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ + SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20))); + for(i=0;i<2;i++) { + tx[i] = (double)((int32_t)(z)); + z = (z-tx[i])*two24; + } + tx[2] = z; + nx = 3; + while((nx > 0) && tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; +} diff --git a/3rdparty/sdl2-2.0.4/src/libm/e_sqrt.c b/3rdparty/sdl2-2.0.9/src/libm/e_sqrt.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/libm/e_sqrt.c rename to 3rdparty/sdl2-2.0.9/src/libm/e_sqrt.c index b8b8bec6fa..39c83e1f33 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/e_sqrt.c +++ b/3rdparty/sdl2-2.0.9/src/libm/e_sqrt.c @@ -1,4 +1,3 @@ -/* @(#)e_sqrt.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_sqrt.c,v 1.8 1995/05/10 20:46:17 jtc Exp $"; -#endif - /* __ieee754_sqrt(x) * Return correctly rounded sqrt. * ------------------------------------------ @@ -88,124 +82,123 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, tiny = 1.0e-300; -#else -static double one = 1.0, tiny = 1.0e-300; -#endif -#ifdef __STDC__ -double attribute_hidden -__ieee754_sqrt(double x) -#else -double attribute_hidden -__ieee754_sqrt(x) - double x; -#endif +double attribute_hidden __ieee754_sqrt(double x) { - double z; - int32_t sign = (int) 0x80000000; - int32_t ix0, s0, q, m, t, i; - u_int32_t r, t1, s1, ix1, q1; + double z; + int32_t sign = (int)0x80000000; + int32_t ix0,s0,q,m,t,i; + u_int32_t r,t1,s1,ix1,q1; - EXTRACT_WORDS(ix0, ix1, x); + EXTRACT_WORDS(ix0,ix1,x); /* take care of Inf and NaN */ - if ((ix0 & 0x7ff00000) == 0x7ff00000) { - return x * x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } + if((ix0&0x7ff00000)==0x7ff00000) { + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } /* take care of zero */ - if (ix0 <= 0) { - if (((ix0 & (~sign)) | ix1) == 0) - return x; /* sqrt(+-0) = +-0 */ - else if (ix0 < 0) - return (x - x) / (x - x); /* sqrt(-ve) = sNaN */ - } + if(ix0<=0) { + if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix0<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } /* normalize x */ - m = (ix0 >> 20); - if (m == 0) { /* subnormal x */ - while (ix0 == 0) { - m -= 21; - ix0 |= (ix1 >> 11); - ix1 <<= 21; - } - for (i = 0; (ix0 & 0x00100000) == 0; i++) - ix0 <<= 1; - m -= i - 1; - ix0 |= (ix1 >> (32 - i)); - ix1 <<= i; - } - m -= 1023; /* unbias exponent */ - ix0 = (ix0 & 0x000fffff) | 0x00100000; - if (m & 1) { /* odd m, double x to make it even */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - } - m >>= 1; /* m = [m/2] */ + m = (ix0>>20); + if(m==0) { /* subnormal x */ + while(ix0==0) { + m -= 21; + ix0 |= (ix1>>11); ix1 <<= 21; + } + for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; + m -= i-1; + ix0 |= (ix1>>(32-i)); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if(m&1){ /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ /* generate sqrt(x) bit by bit */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ - r = 0x00200000; /* r = moving bit from right to left */ - - while (r != 0) { - t = s0 + r; - if (t <= ix0) { - s0 = t + r; - ix0 -= t; - q += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } - - r = sign; - while (r != 0) { - t1 = s1 + r; - t = s0; - if ((t < ix0) || ((t == ix0) && (t1 <= ix1))) { - s1 = t1 + r; - if (((t1 & sign) == sign) && (s1 & sign) == 0) - s0 += 1; - ix0 -= t; - if (ix1 < t1) - ix0 -= 1; - ix1 -= t1; - q1 += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ + + while(r!=0) { + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r>>=1; + } + + r = sign; + while(r!=0) { + t1 = s1+r; + t = s0; + if((t>31); + ix1 += ix1; + r>>=1; + } /* use floating add to find out rounding direction */ - if ((ix0 | ix1) != 0) { - z = one - tiny; /* trigger inexact flag */ - if (z >= one) { - z = one + tiny; - if (q1 == (u_int32_t) 0xffffffff) { - q1 = 0; - q += 1; - } else if (z > one) { - if (q1 == (u_int32_t) 0xfffffffe) - q += 1; - q1 += 2; - } else - q1 += (q1 & 1); - } - } - ix0 = (q >> 1) + 0x3fe00000; - ix1 = q1 >> 1; - if ((q & 1) == 1) - ix1 |= sign; - ix0 += (m << 20); - INSERT_WORDS(z, ix0, ix1); - return z; + if((ix0|ix1)!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} + else if (z>one) { + if (q1==(u_int32_t)0xfffffffe) q+=1; + q1+=2; + } else + q1 += (q1&1); + } + } + ix0 = (q>>1)+0x3fe00000; + ix1 = q1>>1; + if ((q&1)==1) ix1 |= sign; + ix0 += (m <<20); + INSERT_WORDS(z,ix0,ix1); + return z; } +/* + * wrapper sqrt(x) + */ +#ifndef _IEEE_LIBM +double sqrt(double x) +{ + double z = __ieee754_sqrt(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x < 0.0) + return __kernel_standard(x, x, 26); /* sqrt(negative) */ + return z; +} +#else +strong_alias(__ieee754_sqrt, sqrt) +#endif +libm_hidden_def(sqrt) + + /* Other methods (use floating-point arithmetic) ------------- diff --git a/3rdparty/sdl2-2.0.4/src/libm/k_cos.c b/3rdparty/sdl2-2.0.9/src/libm/k_cos.c similarity index 53% rename from 3rdparty/sdl2-2.0.4/src/libm/k_cos.c rename to 3rdparty/sdl2-2.0.9/src/libm/k_cos.c index 64c50e3fb9..e1326fa64b 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/k_cos.c +++ b/3rdparty/sdl2-2.0.9/src/libm/k_cos.c @@ -1,4 +1,3 @@ -/* @(#)k_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_cos.c,v 1.8 1995/05/10 20:46:22 jtc Exp $"; -#endif - /* * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 @@ -53,48 +47,36 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ - C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ - C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ - C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ - C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ - C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ +C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ +C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ +C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ +C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ +C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ -#ifdef __STDC__ -double attribute_hidden -__kernel_cos(double x, double y) -#else -double attribute_hidden -__kernel_cos(x, y) - double x, y; -#endif +double attribute_hidden __kernel_cos(double x, double y) { - double a, hz, z, r, qx; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* ix = |x|'s high word */ - if (ix < 0x3e400000) { /* if x < 2**27 */ - if (((int) x) == 0) - return one; /* generate inexact */ - } - z = x * x; - r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6))))); - if (ix < 0x3FD33333) /* if |x| < 0.3 */ - return one - (0.5 * z - (z * r - x * y)); - else { - if (ix > 0x3fe90000) { /* x > 0.78125 */ - qx = 0.28125; - } else { - INSERT_WORDS(qx, ix - 0x00200000, 0); /* x/4 */ - } - hz = 0.5 * z - qx; - a = one - qx; - return a - (hz - (z * r - x * y)); - } + double a,hz,z,r,qx; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x3e400000) { /* if x < 2**27 */ + if(((int)x)==0) return one; /* generate inexact */ + } + z = x*x; + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); + if(ix < 0x3FD33333) /* if |x| < 0.3 */ + return one - (0.5*z - (z*r - x*y)); + else { + if(ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ + } + hz = 0.5*z-qx; + a = one-qx; + return a - (hz - (z*r-x*y)); + } } diff --git a/3rdparty/sdl2-2.0.9/src/libm/k_rem_pio2.c b/3rdparty/sdl2-2.0.9/src/libm/k_rem_pio2.c new file mode 100644 index 0000000000..393db541d1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/k_rem_pio2.c @@ -0,0 +1,317 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + * double x[],y[]; int e0,nx,prec; int ipio2[]; + * + * __kernel_rem_pio2 return the last three digits of N with + * y = x - N*pi/2 + * so that |y| < pi/2. + * + * The method is to compute the integer (mod 8) and fraction parts of + * (2/pi)*x without doing the full multiplication. In general we + * skip the part of the product that are known to be a huge integer ( + * more accurately, = 0 mod 8 ). Thus the number of operations are + * independent of the exponent of the input. + * + * (2/pi) is represented by an array of 24-bit integers in ipio2[]. + * + * Input parameters: + * x[] The input value (must be positive) is broken into nx + * pieces of 24-bit integers in double precision format. + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * match x's up to 24 bits. + * + * Example of breaking a double positive z into x[0]+x[1]+x[2]: + * e0 = ilogb(z)-23 + * z = scalbn(z,-e0) + * for i = 0,1,2 + * x[i] = floor(z) + * z = (z-x[i])*2**24 + * + * + * y[] ouput result in an array of double precision numbers. + * The dimension of y[] is: + * 24-bit precision 1 + * 53-bit precision 2 + * 64-bit precision 2 + * 113-bit precision 3 + * The actual value is the sum of them. Thus for 113-bit + * precison, one may have to do something like: + * + * long double t,w,r_head, r_tail; + * t = (long double)y[2] + (long double)y[1]; + * w = (long double)y[0]; + * r_head = t+w; + * r_tail = w - (r_head - t); + * + * e0 The exponent of x[0] + * + * nx dimension of x[] + * + * prec an integer indicating the precision: + * 0 24 bits (single) + * 1 53 bits (double) + * 2 64 bits (extended) + * 3 113 bits (quad) + * + * ipio2[] + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding + * floating value is + * + * ipio2[i] * 2^(-24(i+1)). + * + * External function: + * double scalbn(), floor(); + * + * + * Here is the description of some local variables: + * + * jk jk+1 is the initial number of terms of ipio2[] needed + * in the computation. The recommended value is 2,3,4, + * 6 for single, double, extended,and quad. + * + * jz local integer variable indicating the number of + * terms of ipio2[] used. + * + * jx nx - 1 + * + * jv index for pointing to the suitable ipio2[] for the + * computation. In general, we want + * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 + * is an integer. Thus + * e0-3-24*jv >= 0 or (e0-3)/24 >= jv + * Hence jv = max(0,(e0-3)/24). + * + * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. + * + * q[] double array with integral value, representing the + * 24-bits chunk of the product of x and 2/pi. + * + * q0 the corresponding exponent of q[0]. Note that the + * exponent for q[i] would be q0-24*i. + * + * PIo2[] double precision array, obtained by cutting pi/2 + * into 24 bits chunks. + * + * f[] ipio2[] in floating point + * + * iq[] integer array by breaking up q[] in 24-bits chunk. + * + * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] + * + * ih integer. If >0 it indicates q[] is >= 0.5, hence + * it also indicates the *sign* of the result. + * + */ + + +/* + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +#include "SDL_assert.h" + +static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ + +static const double PIo2[] = { + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ +}; + +static const double +zero = 0.0, +one = 1.0, +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ + +int32_t attribute_hidden __kernel_rem_pio2(double *x, double *y, int e0, int nx, const unsigned int prec, const int32_t *ipio2) +{ + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + double z,fw,f[20],fq[20],q[20]; + + if (nx < 1) { + return 0; + } + + /* initialize jk*/ + SDL_assert(prec < SDL_arraysize(init_jk)); + jk = init_jk[prec]; + SDL_assert(jk > 0); + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx-1; + jv = (e0-3)/24; if(jv<0) jv=0; + q0 = e0-24*(jv+1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; + if ((m+1) < SDL_arraysize(f)) { + SDL_memset(&f[m+1], 0, sizeof (f) - ((m+1) * sizeof (f[0]))); + } + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (double)((int32_t)(twon24* z)); + iq[i] = (int32_t)(z-two24*fw); + z = q[j-1]+fw; + } + if (jz < SDL_arraysize(iq)) { + SDL_memset(&iq[jz], 0, sizeof (q) - (jz * sizeof (iq[0]))); + } + + /* compute n */ + z = scalbn(z,q0); /* actual value of z */ + z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (double)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(24-q0)); n += i; + iq[jz-1] -= i<<(24-q0); + ih = iq[jz-1]>>(23-q0); + } + else if(q0==0) ih = iq[jz-1]>>23; + else if(z>=0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7fffff; break; + case 2: + iq[jz-1] &= 0x3fffff; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= scalbn(one,q0); + } + } + + /* check if recomputation is needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ + + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (double) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if(z==0.0) { + jz -= 1; q0 -= 24; + SDL_assert(jz >= 0); + while(iq[jz]==0) { jz--; SDL_assert(jz >= 0); q0-=24;} + } else { /* break z into 24-bit if necessary */ + z = scalbn(z,-q0); + if(z>=two24) { + fw = (double)((int32_t)(twon24*z)); + iq[jz] = (int32_t)(z-two24*fw); + jz += 1; q0 += 24; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } + + /* convert integer "bit" chunk to floating-point value */ + fw = scalbn(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(double)iq[i]; fw*=twon24; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } + if ((jz+1) < SDL_arraysize(f)) { + SDL_memset(&fq[jz+1], 0, sizeof (fq) - ((jz+1) * sizeof (fq[0]))); + } + + /* compress fq[] into y[] */ + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; +} diff --git a/3rdparty/sdl2-2.0.4/src/libm/k_sin.c b/3rdparty/sdl2-2.0.9/src/libm/k_sin.c similarity index 50% rename from 3rdparty/sdl2-2.0.4/src/libm/k_sin.c rename to 3rdparty/sdl2-2.0.9/src/libm/k_sin.c index 60881575a5..3520d6b4c6 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/k_sin.c +++ b/3rdparty/sdl2-2.0.9/src/libm/k_sin.c @@ -1,4 +1,3 @@ -/* @(#)k_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $"; -#endif - /* __kernel_sin( x, y, iy) * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. @@ -46,42 +40,26 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ - S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ - S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ - S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ - S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ - S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ +S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ +S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ +S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ +S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ +S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ -#ifdef __STDC__ -double attribute_hidden -__kernel_sin(double x, double y, int iy) -#else -double attribute_hidden -__kernel_sin(x, y, iy) - double x, y; - int iy; /* iy=0 if y is zero */ -#endif +double attribute_hidden __kernel_sin(double x, double y, int iy) { - double z, r, v; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* high word of x */ - if (ix < 0x3e400000) { /* |x| < 2**-27 */ - if ((int) x == 0) - return x; - } /* generate inexact */ - z = x * x; - v = z * x; - r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6))); - if (iy == 0) - return x + v * (S1 + z * r); - else - return x - ((z * (half * y - v * r) - y) - v * S1); + double z,r,v; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x3e400000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); } diff --git a/3rdparty/sdl2-2.0.4/src/libm/k_tan.c b/3rdparty/sdl2-2.0.9/src/libm/k_tan.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/libm/k_tan.c rename to 3rdparty/sdl2-2.0.9/src/libm/k_tan.c index 27e6639b0c..47b4e3dcdb 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/k_tan.c +++ b/3rdparty/sdl2-2.0.9/src/libm/k_tan.c @@ -66,7 +66,7 @@ T[] = { 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ }; -double __kernel_tan(double x, double y, int iy) +double attribute_hidden __kernel_tan(double x, double y, int iy) { double z,r,v,w,s; int32_t ix,hx; diff --git a/3rdparty/sdl2-2.0.4/src/libm/math_libm.h b/3rdparty/sdl2-2.0.9/src/libm/math_libm.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/libm/math_libm.h rename to 3rdparty/sdl2-2.0.9/src/libm/math_libm.h index 3fe1727a3b..3c751c5ed7 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/math_libm.h +++ b/3rdparty/sdl2-2.0.9/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef math_libm_h_ +#define math_libm_h_ + #include "../SDL_internal.h" /* Math routines from uClibc: http://www.uclibc.org */ @@ -26,13 +30,18 @@ double SDL_uclibc_atan(double x); double SDL_uclibc_atan2(double y, double x); double SDL_uclibc_copysign(double x, double y); double SDL_uclibc_cos(double x); +double SDL_uclibc_exp(double x); double SDL_uclibc_fabs(double x); double SDL_uclibc_floor(double x); +double SDL_uclibc_fmod(double x, double y); double SDL_uclibc_log(double x); +double SDL_uclibc_log10(double x); double SDL_uclibc_pow(double x, double y); double SDL_uclibc_scalbn(double x, int n); double SDL_uclibc_sin(double x); double SDL_uclibc_sqrt(double x); double SDL_uclibc_tan(double x); +#endif /* math_libm_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/libm/math_private.h b/3rdparty/sdl2-2.0.9/src/libm/math_private.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/libm/math_private.h rename to 3rdparty/sdl2-2.0.9/src/libm/math_private.h index 74c8b3d45f..d0ef66a6db 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/math_private.h +++ b/3rdparty/sdl2-2.0.9/src/libm/math_private.h @@ -21,9 +21,11 @@ #include "SDL_endian.h" /* #include */ +#define _IEEE_LIBM #define attribute_hidden #define libm_hidden_proto(x) #define libm_hidden_def(x) +#define strong_alias(x, y) #ifndef __HAIKU__ /* already defined in a system header. */ typedef unsigned int u_int32_t; @@ -33,10 +35,14 @@ typedef unsigned int u_int32_t; #define __ieee754_atan2 SDL_uclibc_atan2 #define copysign SDL_uclibc_copysign #define cos SDL_uclibc_cos +#define __ieee754_exp SDL_uclibc_exp #define fabs SDL_uclibc_fabs #define floor SDL_uclibc_floor +#define __ieee754_fmod SDL_uclibc_fmod #define __ieee754_log SDL_uclibc_log +#define __ieee754_log10 SDL_uclibc_log10 #define __ieee754_pow SDL_uclibc_pow +#define scalbln SDL_uclibc_scalbln #define scalbn SDL_uclibc_scalbn #define sin SDL_uclibc_sin #define __ieee754_sqrt SDL_uclibc_sqrt @@ -201,7 +207,7 @@ __ieee754_sqrt(double) extern double __ieee754_jn(int, double) attribute_hidden; extern double __ieee754_yn(int, double) attribute_hidden; extern double __ieee754_remainder(double, double) attribute_hidden; - extern int __ieee754_rem_pio2(double, double *) attribute_hidden; + extern int32_t __ieee754_rem_pio2(double, double *) attribute_hidden; #if defined(_SCALB_INT) extern double __ieee754_scalb(double, int) attribute_hidden; #else @@ -215,7 +221,7 @@ __ieee754_sqrt(double) extern double __kernel_sin(double, double, int) attribute_hidden; extern double __kernel_cos(double, double) attribute_hidden; extern double __kernel_tan(double, double, int) attribute_hidden; - extern int __kernel_rem_pio2(double *, double *, int, int, int, - const int *) attribute_hidden; + extern int32_t __kernel_rem_pio2(double *, double *, int, int, const unsigned int, + const int32_t *) attribute_hidden; #endif /* _MATH_PRIVATE_H_ */ diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_atan.c b/3rdparty/sdl2-2.0.9/src/libm/s_atan.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/libm/s_atan.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_atan.c index 970ea4dbfa..f664f0eb3d 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/s_atan.c +++ b/3rdparty/sdl2-2.0.9/src/libm/s_atan.c @@ -112,4 +112,3 @@ double atan(double x) } } libm_hidden_def(atan) - diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_copysign.c b/3rdparty/sdl2-2.0.9/src/libm/s_copysign.c similarity index 55% rename from 3rdparty/sdl2-2.0.4/src/libm/s_copysign.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_copysign.c index afd43e9a72..a2f275bf7b 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/s_copysign.c +++ b/3rdparty/sdl2-2.0.9/src/libm/s_copysign.c @@ -1,4 +1,3 @@ -/* @(#)s_copysign.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $"; -#endif - /* * copysign(double x, double y) * copysign(x,y) returns a value with the magnitude of x and @@ -24,19 +18,12 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(copysign) -#ifdef __STDC__ - double copysign(double x, double y) -#else - double copysign(x, y) - double x, y; -#endif +double copysign(double x, double y) { - u_int32_t hx, hy; - GET_HIGH_WORD(hx, x); - GET_HIGH_WORD(hy, y); - SET_HIGH_WORD(x, (hx & 0x7fffffff) | (hy & 0x80000000)); - return x; + u_int32_t hx,hy; + GET_HIGH_WORD(hx,x); + GET_HIGH_WORD(hy,y); + SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); + return x; } - libm_hidden_def(copysign) diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_cos.c b/3rdparty/sdl2-2.0.9/src/libm/s_cos.c similarity index 64% rename from 3rdparty/sdl2-2.0.4/src/libm/s_cos.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_cos.c index 66b156c9f5..5540260538 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/s_cos.c +++ b/3rdparty/sdl2-2.0.9/src/libm/s_cos.c @@ -1,4 +1,3 @@ -/* @(#)s_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; -#endif - /* cos(x) * Return cosine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(cos) -#ifdef __STDC__ - double cos(double x) -#else - double cos(x) - double x; -#endif +double cos(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_cos(x, z); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_cos(x,z); /* cos(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_cos(y[0], y[1]); - case 1: - return -__kernel_sin(y[0], y[1], 1); - case 2: - return -__kernel_cos(y[0], y[1]); - default: - return __kernel_sin(y[0], y[1], 1); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_cos(y[0],y[1]); + case 1: return -__kernel_sin(y[0],y[1],1); + case 2: return -__kernel_cos(y[0],y[1]); + default: + return __kernel_sin(y[0],y[1],1); + } + } } - libm_hidden_def(cos) diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_fabs.c b/3rdparty/sdl2-2.0.9/src/libm/s_fabs.c similarity index 56% rename from 3rdparty/sdl2-2.0.4/src/libm/s_fabs.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_fabs.c index 5cf0c3977b..9ee943c40f 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/s_fabs.c +++ b/3rdparty/sdl2-2.0.9/src/libm/s_fabs.c @@ -1,4 +1,3 @@ -/* @(#)s_fabs.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,30 +9,21 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; -#endif - /* * fabs(x) returns the absolute value of x. */ +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(fabs) -#ifdef __STDC__ - double fabs(double x) -#else - double fabs(x) - double x; -#endif +double fabs(double x) { - u_int32_t high; - GET_HIGH_WORD(high, x); - SET_HIGH_WORD(x, high & 0x7fffffff); - return x; + u_int32_t high; + GET_HIGH_WORD(high,x); + SET_HIGH_WORD(x,high&0x7fffffff); + return x; } - libm_hidden_def(fabs) diff --git a/3rdparty/sdl2-2.0.9/src/libm/s_floor.c b/3rdparty/sdl2-2.0.9/src/libm/s_floor.c new file mode 100644 index 0000000000..3f9a5cead5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/s_floor.c @@ -0,0 +1,71 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * floor(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES +#include "math_libm.h" +#include "math_private.h" + +static const double huge = 1.0e300; + +double floor(double x) +{ + int32_t i0,i1,j0; + u_int32_t i,j; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==20) i0+=1; + else { + j = i1+(1<<(52-j0)); + if(j<(u_int32_t)i1) i0 +=1 ; /* got a carry */ + i1=j; + } + } + i1 &= (~i); + } + } + INSERT_WORDS(x,i0,i1); + return x; +} +libm_hidden_def(floor) diff --git a/3rdparty/sdl2-2.0.9/src/libm/s_scalbn.c b/3rdparty/sdl2-2.0.9/src/libm/s_scalbn.c new file mode 100644 index 0000000000..6bb719223b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/libm/s_scalbn.c @@ -0,0 +1,69 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * scalbln(double x, long n) + * scalbln(x,n) returns x * 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "math_libm.h" +#include "math_private.h" +#include + +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; + +double scalbln(double x, long n) +{ + int32_t k, hx, lx; + + EXTRACT_WORDS(hx, lx, x); + k = (hx & 0x7ff00000) >> 20; /* extract exponent */ + if (k == 0) { /* 0 or subnormal x */ + if ((lx | (hx & 0x7fffffff)) == 0) + return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx, x); + k = ((hx & 0x7ff00000) >> 20) - 54; + } + if (k == 0x7ff) + return x + x; /* NaN or Inf */ + k = k + n; + if (k > 0x7fe) + return huge * copysign(huge, x); /* overflow */ + if (n < -50000) + return tiny * copysign(tiny, x); /* underflow */ + if (k > 0) { /* normal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x; + } + if (k <= -54) { + if (n > 50000) /* in case integer overflow in n+k */ + return huge * copysign(huge, x); /* overflow */ + return tiny * copysign(tiny, x); /* underflow */ + } + k += 54; /* subnormal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x * twom54; +} +libm_hidden_def(scalbln) + + +double scalbn(double x, int n) +{ + return scalbln(x, n); +} +libm_hidden_def(scalbn) diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_sin.c b/3rdparty/sdl2-2.0.9/src/libm/s_sin.c similarity index 64% rename from 3rdparty/sdl2-2.0.4/src/libm/s_sin.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_sin.c index 771176619f..b3cd7a0e33 100644 --- a/3rdparty/sdl2-2.0.4/src/libm/s_sin.c +++ b/3rdparty/sdl2-2.0.9/src/libm/s_sin.c @@ -1,4 +1,3 @@ -/* @(#)s_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; -#endif - /* sin(x) * Return sine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(sin) -#ifdef __STDC__ - double sin(double x) -#else - double sin(x) - double x; -#endif +double sin(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_sin(x, z, 0); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); /* sin(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_sin(y[0], y[1], 1); - case 1: - return __kernel_cos(y[0], y[1]); - case 2: - return -__kernel_sin(y[0], y[1], 1); - default: - return -__kernel_cos(y[0], y[1]); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_sin(y[0],y[1],1); + case 1: return __kernel_cos(y[0],y[1]); + case 2: return -__kernel_sin(y[0],y[1],1); + default: + return -__kernel_cos(y[0],y[1]); + } + } } - libm_hidden_def(sin) diff --git a/3rdparty/sdl2-2.0.4/src/libm/s_tan.c b/3rdparty/sdl2-2.0.9/src/libm/s_tan.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/src/libm/s_tan.c rename to 3rdparty/sdl2-2.0.9/src/libm/s_tan.c diff --git a/3rdparty/sdl2-2.0.4/src/loadso/dlopen/SDL_sysloadso.c b/3rdparty/sdl2-2.0.9/src/loadso/dlopen/SDL_sysloadso.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/loadso/dlopen/SDL_sysloadso.c rename to 3rdparty/sdl2-2.0.9/src/loadso/dlopen/SDL_sysloadso.c index 03ffae1299..18b4b84369 100644 --- a/3rdparty/sdl2-2.0.4/src/loadso/dlopen/SDL_sysloadso.c +++ b/3rdparty/sdl2-2.0.9/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,11 +30,25 @@ #include "SDL_loadso.h" +#if SDL_VIDEO_DRIVER_UIKIT +#include "../../video/uikit/SDL_uikitvideo.h" +#endif + void * SDL_LoadObject(const char *sofile) { - void *handle = dlopen(sofile, RTLD_NOW|RTLD_LOCAL); - const char *loaderror = (char *) dlerror(); + void *handle; + const char *loaderror; + +#if SDL_VIDEO_DRIVER_UIKIT + if (!UIKit_IsSystemVersionAtLeast(8.0)) { + SDL_SetError("SDL_LoadObject requires iOS 8+"); + return NULL; + } +#endif + + handle = dlopen(sofile, RTLD_NOW|RTLD_LOCAL); + loaderror = (char *) dlerror(); if (handle == NULL) { SDL_SetError("Failed loading %s: %s", sofile, loaderror); } diff --git a/3rdparty/sdl2-2.0.4/src/loadso/dummy/SDL_sysloadso.c b/3rdparty/sdl2-2.0.9/src/loadso/dummy/SDL_sysloadso.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/loadso/dummy/SDL_sysloadso.c rename to 3rdparty/sdl2-2.0.9/src/loadso/dummy/SDL_sysloadso.c index 4f132f9f50..291c08b810 100644 --- a/3rdparty/sdl2-2.0.4/src/loadso/dummy/SDL_sysloadso.c +++ b/3rdparty/sdl2-2.0.9/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/loadso/windows/SDL_sysloadso.c b/3rdparty/sdl2-2.0.9/src/loadso/windows/SDL_sysloadso.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/loadso/windows/SDL_sysloadso.c rename to 3rdparty/sdl2-2.0.9/src/loadso/windows/SDL_sysloadso.c index bdb2b9874f..351570f92f 100644 --- a/3rdparty/sdl2-2.0.4/src/loadso/windows/SDL_sysloadso.c +++ b/3rdparty/sdl2-2.0.9/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/src/main/android/SDL_android_main.c b/3rdparty/sdl2-2.0.9/src/main/android/SDL_android_main.c new file mode 100644 index 0000000000..054738a9aa --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/main/android/SDL_android_main.c @@ -0,0 +1,7 @@ +/* + SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14 + + As of SDL 2.0.6 this file is no longer necessary. +*/ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/main/dummy/SDL_dummy_main.c b/3rdparty/sdl2-2.0.9/src/main/dummy/SDL_dummy_main.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/src/main/dummy/SDL_dummy_main.c rename to 3rdparty/sdl2-2.0.9/src/main/dummy/SDL_dummy_main.c diff --git a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BApp.h b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BApp.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BApp.h rename to 3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BApp.h index 157c236352..7adbd007d3 100644 --- a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BApp.h +++ b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,9 @@ #define SDL_BAPP_H #include +#if SDL_VIDEO_OPENGL #include +#endif #include "../../video/haiku/SDL_bkeyboard.h" @@ -37,7 +39,6 @@ extern "C" { /* Local includes */ #include "../../events/SDL_events_c.h" -#include "../../video/haiku/SDL_bkeyboard.h" #include "../../video/haiku/SDL_bframebuffer.h" #ifdef __cplusplus @@ -81,7 +82,9 @@ class SDL_BApp : public BApplication { public: SDL_BApp(const char* signature) : BApplication(signature) { +#if SDL_VIDEO_OPENGL _current_context = NULL; +#endif } @@ -189,12 +192,16 @@ class SDL_BApp : public BApplication { return _window_map[winID]; } +#if SDL_VIDEO_OPENGL void SetCurrentContext(BGLView *newContext) { if(_current_context) _current_context->UnlockGL(); _current_context = newContext; - _current_context->LockGL(); + if (_current_context) + _current_context->LockGL(); } +#endif + private: /* Event management */ void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) { @@ -224,7 +231,7 @@ class SDL_BApp : public BApplication { SDL_SendMouseMotion(win, 0, 0, x, y); /* Tell the application that the mouse passed over, redraw needed */ - BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); + HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1); } void _HandleMouseButton(BMessage *msg) { @@ -267,11 +274,22 @@ class SDL_BApp : public BApplication { } /* Make sure this isn't a repeated event (key pressed and held) */ - if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) { + if(state == SDL_PRESSED && HAIKU_GetKeyState(scancode) == SDL_PRESSED) { return; } - BE_SetKeyState(scancode, state); - SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode)); + HAIKU_SetKeyState(scancode, state); + SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode)); + + if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { + const int8 *keyUtf8; + ssize_t count; + if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) { + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; + SDL_zero(text); + SDL_memcpy(text, keyUtf8, count); + SDL_SendKeyboardText(text); + } + } } void _HandleMouseFocus(BMessage *msg) { @@ -373,8 +391,9 @@ class SDL_BApp : public BApplication { /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ - display_mode *_saved_mode; +#if SDL_VIDEO_OPENGL BGLView *_current_context; +#endif }; #endif diff --git a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.cc b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.cc similarity index 74% rename from 3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.cc rename to 3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.cc index 36c2a1ab8b..cbd21293b7 100644 --- a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.cc +++ b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,13 +25,14 @@ /* Handle the BeApp specific portions of the application */ #include +#include #include #include +#include #include -#include "SDL_BApp.h" /* SDL_BApp class definition */ +#include "SDL_BApp.h" /* SDL_BApp class definition */ #include "SDL_BeApp.h" -#include "SDL_thread.h" #include "SDL_timer.h" #include "SDL_error.h" @@ -40,8 +41,11 @@ #ifdef __cplusplus extern "C" { #endif + +#include "../../thread/SDL_systhread.h" + /* Flag to tell whether or not the Be application is active or not */ -int SDL_BeAppActive = 0; +static int SDL_BeAppActive = 0; static SDL_Thread *SDL_AppThread = NULL; static int @@ -49,7 +53,24 @@ StartBeApp(void *unused) { BApplication *App; - App = new SDL_BApp("application/x-SDL-executable"); + // default application signature + const char *signature = "application/x-SDL-executable"; + // dig resources for correct signature + image_info info; + int32 cookie = 0; + if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + BFile f(info.name, O_RDONLY); + if (f.InitCheck() == B_OK) { + BAppFileInfo app_info(&f); + if (app_info.InitCheck() == B_OK) { + char sig[B_MIME_TYPE_LENGTH]; + if (app_info.GetSignature(sig) == B_OK) + signature = strndup(sig, B_MIME_TYPE_LENGTH); + } + } + } + + App = new SDL_BApp(signature); App->Run(); delete App; @@ -62,7 +83,7 @@ SDL_InitBeApp(void) { /* Create the BApplication that handles appserver interaction */ if (SDL_BeAppActive <= 0) { - SDL_AppThread = SDL_CreateThread(StartBeApp, "SDLApplication", NULL); + SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL); if (SDL_AppThread == NULL) { return SDL_SetError("Couldn't create BApplication thread"); } @@ -123,12 +144,12 @@ SDL_QuitBeApp(void) /* SDL_BApp functions */ void SDL_BApp::ClearID(SDL_BWin *bwin) { - _SetSDLWindow(NULL, bwin->GetID()); - int32 i = _GetNumWindowSlots() - 1; - while(i >= 0 && GetSDLWindow(i) == NULL) { - _PopBackWindow(); - --i; - } + _SetSDLWindow(NULL, bwin->GetID()); + int32 i = _GetNumWindowSlots() - 1; + while(i >= 0 && GetSDLWindow(i) == NULL) { + _PopBackWindow(); + --i; + } } #endif /* __HAIKU__ */ diff --git a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.h b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.h rename to 3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.h index 6700a3be9d..83a2beb34e 100644 --- a/3rdparty/sdl2-2.0.4/src/main/haiku/SDL_BeApp.h +++ b/3rdparty/sdl2-2.0.9/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,8 +31,6 @@ extern int SDL_InitBeApp(void); /* Quit the Be Application, if there's nothing left to do */ extern void SDL_QuitBeApp(void); -/* Flag to tell whether the app is active or not */ -extern int SDL_BeAppActive; /* vi: set ts=4 sw=4 expandtab: */ #ifdef __cplusplus diff --git a/3rdparty/sdl2-2.0.4/src/main/nacl/SDL_nacl_main.c b/3rdparty/sdl2-2.0.9/src/main/nacl/SDL_nacl_main.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/main/nacl/SDL_nacl_main.c rename to 3rdparty/sdl2-2.0.9/src/main/nacl/SDL_nacl_main.c index 4c01d0fba8..af66bdb7d3 100644 --- a/3rdparty/sdl2-2.0.4/src/main/nacl/SDL_nacl_main.c +++ b/3rdparty/sdl2-2.0.9/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/main/psp/SDL_psp_main.c b/3rdparty/sdl2-2.0.9/src/main/psp/SDL_psp_main.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/src/main/psp/SDL_psp_main.c rename to 3rdparty/sdl2-2.0.9/src/main/psp/SDL_psp_main.c diff --git a/3rdparty/sdl2-2.0.4/src/main/windows/SDL_windows_main.c b/3rdparty/sdl2-2.0.9/src/main/windows/SDL_windows_main.c similarity index 66% rename from 3rdparty/sdl2-2.0.4/src/main/windows/SDL_windows_main.c rename to 3rdparty/sdl2-2.0.9/src/main/windows/SDL_windows_main.c index e6378081f9..32f672760e 100644 --- a/3rdparty/sdl2-2.0.4/src/main/windows/SDL_windows_main.c +++ b/3rdparty/sdl2-2.0.9/src/main/windows/SDL_windows_main.c @@ -51,7 +51,7 @@ ParseCommandLine(char *cmdline, char **argv) argc = last_argc = 0; for (bufp = cmdline; *bufp;) { /* Skip leading whitespace */ - while (SDL_isspace(*bufp)) { + while (*bufp == ' ' || *bufp == '\t') { ++bufp; } /* Skip over argument */ @@ -77,7 +77,7 @@ ParseCommandLine(char *cmdline, char **argv) ++argc; } /* Skip over word */ - while (*bufp && !SDL_isspace(*bufp)) { + while (*bufp && (*bufp != ' ' && *bufp != '\t')) { ++bufp; } } @@ -116,22 +116,75 @@ OutOfMemory(void) # endif #endif -/* WinMain, main, and wmain eventually call into here. */ +/* Gets the arguments with GetCommandLine, converts them to argc and argv + and calls SDL_main */ static int -main_utf8(int argc, char *argv[]) +main_getcmdline() { + char **argv; + int argc; + char *cmdline = NULL; + int retval = 0; + int cmdalloc = 0; + const TCHAR *text = GetCommandLine(); + const TCHAR *ptr; + int argc_guess = 2; /* space for NULL and initial argument. */ + int rc; + + /* make a rough guess of command line arguments. Overestimates if there + are quoted things. */ + for (ptr = text; *ptr; ptr++) { + if ((*ptr == ' ') || (*ptr == '\t')) { + argc_guess++; + } + } + +#if UNICODE + rc = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL); + if (rc > 0) { + cmdalloc = rc + (sizeof (char *) * argc_guess); + argv = (char **) VirtualAlloc(NULL, cmdalloc, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + if (argv) { + int rc2; + cmdline = (char *) (argv + argc_guess); + rc2 = WideCharToMultiByte(CP_UTF8, 0, text, -1, cmdline, rc, NULL, NULL); + SDL_assert(rc2 == rc); + } + } +#else + /* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */ + rc = ((int) SDL_strlen(text)) + 1; + cmdalloc = rc + (sizeof (char *) * argc_guess); + argv = (char **) VirtualAlloc(NULL, cmdalloc, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + if (argv) { + cmdline = (char *) (argv + argc_guess); + SDL_strcpy(cmdline, text); + } +#endif + if (cmdline == NULL) { + return OutOfMemory(); + } + + /* Parse it into argv and argc */ + SDL_assert(ParseCommandLine(cmdline, NULL) <= argc_guess); + argc = ParseCommandLine(cmdline, argv); + SDL_SetMainReady(); /* Run the application main() code */ - return SDL_main(argc, argv); + retval = SDL_main(argc, argv); + + VirtualFree(argv, cmdalloc, MEM_DECOMMIT); + VirtualFree(argv, 0, MEM_RELEASE); + + return retval; } /* This is where execution begins [console apps, ansi] */ int console_ansi_main(int argc, char *argv[]) { - /* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */ - return main_utf8(argc, argv); + return main_getcmdline(); } @@ -140,20 +193,7 @@ console_ansi_main(int argc, char *argv[]) int console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp) { - int retval = 0; - char **argv = SDL_stack_alloc(char*, argc); - int i; - - for (i = 0; i < argc; ++i) { - argv[i] = WIN_StringToUTF8(wargv[i]); - } - - retval = main_utf8(argc, argv); - - /* !!! FIXME: we are leaking all the elements of argv we allocated. */ - SDL_stack_free(argv); - - return retval; + return main_getcmdline(); } #endif @@ -161,39 +201,7 @@ console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp) int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) { - char **argv; - int argc; - char *cmdline; - - /* Grab the command line */ - TCHAR *text = GetCommandLine(); -#if UNICODE - cmdline = WIN_StringToUTF8(text); -#else - /* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */ - cmdline = SDL_strdup(text); -#endif - if (cmdline == NULL) { - return OutOfMemory(); - } - - /* Parse it into argv and argc */ - argc = ParseCommandLine(cmdline, NULL); - argv = SDL_stack_alloc(char *, argc + 1); - if (argv == NULL) { - return OutOfMemory(); - } - ParseCommandLine(cmdline, argv); - - /* Run the main program */ - main_utf8(argc, argv); - - SDL_stack_free(argv); - - SDL_free(cmdline); - - /* Hush little compiler, don't you cry... */ - return 0; + return main_getcmdline(); } #endif /* __WIN32__ */ diff --git a/3rdparty/sdl2-2.0.4/src/main/windows/version.rc b/3rdparty/sdl2-2.0.9/src/main/windows/version.rc similarity index 74% rename from 3rdparty/sdl2-2.0.4/src/main/windows/version.rc rename to 3rdparty/sdl2-2.0.9/src/main/windows/version.rc index b4f79b23e8..808d11139d 100644 --- a/3rdparty/sdl2-2.0.4/src/main/windows/version.rc +++ b/3rdparty/sdl2-2.0.9/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,4,0 - PRODUCTVERSION 2,0,4,0 + FILEVERSION 2,0,9,0 + PRODUCTVERSION 2,0,9,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 4, 0\0" + VALUE "FileVersion", "2, 0, 9, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright 2016 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright 2018 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 4, 0\0" + VALUE "ProductVersion", "2, 0, 9, 0\0" END END BLOCK "VarFileInfo" diff --git a/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur new file mode 100644 index 0000000000..c6556b8a72 Binary files /dev/null and b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur differ diff --git a/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResources.rc b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResources.rc new file mode 100644 index 0000000000..ce8549f2d2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL2-WinRTResources.rc @@ -0,0 +1,3 @@ +#include "winres.h" +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +5000 CURSOR "SDL2-WinRTResource_BlankCursor.cur" diff --git a/3rdparty/sdl2-2.0.4/src/main/winrt/SDL_winrt_main_NonXAML.cpp b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL_winrt_main_NonXAML.cpp similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/main/winrt/SDL_winrt_main_NonXAML.cpp rename to 3rdparty/sdl2-2.0.9/src/main/winrt/SDL_winrt_main_NonXAML.cpp index ce5e824739..19d22504c5 100644 --- a/3rdparty/sdl2-2.0.4/src/main/winrt/SDL_winrt_main_NonXAML.cpp +++ b/3rdparty/sdl2-2.0.9/src/main/winrt/SDL_winrt_main_NonXAML.cpp @@ -50,10 +50,5 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { - if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { - return 1; - } - - SDL_WinRTRunApp(SDL_main, NULL); - return 0; + return SDL_WinRTRunApp(SDL_main, NULL); } diff --git a/3rdparty/sdl2-2.0.4/src/power/SDL_power.c b/3rdparty/sdl2-2.0.9/src/power/SDL_power.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/power/SDL_power.c rename to 3rdparty/sdl2-2.0.9/src/power/SDL_power.c index 016013b97c..de77c0951a 100644 --- a/3rdparty/sdl2-2.0.4/src/power/SDL_power.c +++ b/3rdparty/sdl2-2.0.9/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../SDL_internal.h" #include "SDL_power.h" +#include "SDL_syspower.h" /* * Returns SDL_TRUE if we have a definitive answer. @@ -29,18 +30,6 @@ typedef SDL_bool (*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds, int *percent); -SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); - #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_HARDWIRED /* This is for things that _never_ have a battery */ @@ -53,12 +42,10 @@ SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent) return SDL_TRUE; } #endif -#endif - static SDL_GetPowerInfo_Impl implementations[] = { -#ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */ + SDL_GetPowerInfo_Linux_org_freedesktop_upower, SDL_GetPowerInfo_Linux_sys_class_power_supply, SDL_GetPowerInfo_Linux_proc_acpi, SDL_GetPowerInfo_Linux_proc_apm, @@ -91,31 +78,34 @@ static SDL_GetPowerInfo_Impl implementations[] = { #ifdef SDL_POWER_HARDWIRED SDL_GetPowerInfo_Hardwired, #endif -#endif }; +#endif SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent) { +#ifndef SDL_POWER_DISABLED const int total = sizeof(implementations) / sizeof(implementations[0]); - int _seconds, _percent; SDL_PowerState retval = SDL_POWERSTATE_UNKNOWN; int i; +#endif + int _seconds, _percent; /* Make these never NULL for platform-specific implementations. */ if (seconds == NULL) { seconds = &_seconds; } - if (percent == NULL) { percent = &_percent; } +#ifndef SDL_POWER_DISABLED for (i = 0; i < total; i++) { if (implementations[i](&retval, seconds, percent)) { return retval; } } +#endif /* nothing was definitive. */ *seconds = -1; diff --git a/3rdparty/sdl2-2.0.9/src/power/SDL_syspower.h b/3rdparty/sdl2-2.0.9/src/power/SDL_syspower.h new file mode 100644 index 0000000000..afd6268fb1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/power/SDL_syspower.h @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* These are functions that need to be implemented by a port of SDL */ + +#ifndef SDL_syspower_h_ +#define SDL_syspower_h_ + +#include "SDL_power.h" + +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); + +/* this one is static in SDL_power.c */ +/* SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);*/ + +#endif /* SDL_syspower_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/power/android/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/android/SDL_syspower.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/power/android/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/android/SDL_syspower.c index 5a4b0fc144..f0f492de30 100644 --- a/3rdparty/sdl2-2.0.4/src/power/android/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #if SDL_POWER_ANDROID #include "SDL_power.h" +#include "../SDL_syspower.h" #include "../../core/android/SDL_android.h" diff --git a/3rdparty/sdl2-2.0.4/src/power/emscripten/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/emscripten/SDL_syspower.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/power/emscripten/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/emscripten/SDL_syspower.c index 307f79742b..9b921685b3 100644 --- a/3rdparty/sdl2-2.0.4/src/power/emscripten/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/power/haiku/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/haiku/SDL_syspower.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/power/haiku/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/haiku/SDL_syspower.c index cfda8c9622..47961bb2a0 100644 --- a/3rdparty/sdl2-2.0.4/src/power/haiku/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,9 @@ */ #include "../../SDL_internal.h" +/* uses BeOS euc.jp apm driver. */ /* !!! FIXME: does this thing even work on Haiku? */ + #ifndef SDL_POWER_DISABLED #if SDL_POWER_HAIKU diff --git a/3rdparty/sdl2-2.0.4/src/power/linux/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/linux/SDL_syspower.c similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/power/linux/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/linux/SDL_syspower.c index 793e266695..e6c0c1c3df 100644 --- a/3rdparty/sdl2-2.0.4/src/power/linux/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,9 @@ #include #include "SDL_power.h" +#include "../SDL_syspower.h" + +#include "../../core/linux/SDL_dbus.h" static const char *proc_apm_path = "/proc/apm"; static const char *proc_acpi_battery_path = "/proc/acpi/battery"; @@ -425,8 +428,6 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state, return SDL_TRUE; } -/* !!! FIXME: implement d-bus queries to org.freedesktop.UPower. */ - SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent) { @@ -459,6 +460,16 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second continue; /* we don't care about UPS and such. */ } + /* if the scope is "device," it might be something like a PS4 + controller reporting its own battery, and not something that powers + the system. Most system batteries don't list a scope at all; we + assume it's a system battery if not specified. */ + if (read_power_file(base, name, "scope", str, sizeof (str))) { + if (SDL_strcmp(str, "device\n") == 0) { + continue; /* skip external devices with their own batteries. */ + } + } + /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */ if (read_power_file(base, name, "present", str, sizeof (str)) && (SDL_strcmp(str, "0\n") == 0)) { st = SDL_POWERSTATE_NO_BATTERY; @@ -513,6 +524,118 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second return SDL_TRUE; /* don't look any further. */ } + +/* d-bus queries to org.freedesktop.UPower. */ +#if SDL_USE_LIBDBUS +#define UPOWER_DBUS_NODE "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DEVICE_DBUS_INTERFACE "org.freedesktop.UPower.Device" + +static void +check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool choose = SDL_FALSE; + SDL_PowerState st; + int secs; + int pct; + Uint32 ui32 = 0; + Sint64 si64 = 0; + double d = 0.0; + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Type", DBUS_TYPE_UINT32, &ui32)) { + return; /* Don't know _what_ we're looking at. Give up on it. */ + } else if (ui32 != 2) { /* 2==Battery*/ + return; /* we don't care about UPS and such. */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "PowerSupply", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + return; /* we don't care about random devices with batteries, like wireless controllers, etc */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + st = SDL_POWERSTATE_NO_BATTERY; + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } else if (ui32 == 1) { /* 1 == charging */ + st = SDL_POWERSTATE_CHARGING; + } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + st = SDL_POWERSTATE_ON_BATTERY; + } else if (ui32 == 4) { /* 4 == full */ + st = SDL_POWERSTATE_CHARGED; + } else { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) { + pct = -1; /* some old/cheap batteries don't set this property. */ + } else { + pct = (int) d; + pct = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "TimeToEmpty", DBUS_TYPE_INT64, &si64)) { + secs = -1; + } else { + secs = (int) si64; + secs = (secs <= 0) ? -1 : secs; /* 0 == unknown */ + } + + /* + * We pick the battery that claims to have the most minutes left. + * (failing a report of minutes, we'll take the highest percent.) + */ + if ((secs < 0) && (*seconds < 0)) { + if ((pct < 0) && (*percent < 0)) { + choose = SDL_TRUE; /* at least we know there's a battery. */ + } else if (pct > *percent) { + choose = SDL_TRUE; + } + } else if (secs > *seconds) { + choose = SDL_TRUE; + } + + if (choose) { + *seconds = secs; + *percent = pct; + *state = st; + } +} +#endif + +SDL_bool +SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool retval = SDL_FALSE; + +#if SDL_USE_LIBDBUS + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + char **paths = NULL; + int i, numpaths = 0; + + if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", + DBUS_TYPE_INVALID, + DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) { + return SDL_FALSE; /* try a different approach than UPower. */ + } + + retval = SDL_TRUE; /* Clearly we can use this interface. */ + *state = SDL_POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ + *seconds = -1; + *percent = -1; + + for (i = 0; i < numpaths; i++) { + check_upower_device(dbus->system_conn, paths[i], state, seconds, percent); + } + + if (dbus) { + dbus->free_string_array(paths); + } +#endif /* SDL_USE_LIBDBUS */ + + return retval; +} + #endif /* SDL_POWER_LINUX */ #endif /* SDL_POWER_DISABLED */ diff --git a/3rdparty/sdl2-2.0.4/src/power/macosx/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/macosx/SDL_syspower.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/power/macosx/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/macosx/SDL_syspower.c index f865d59ef6..f28b6c8b57 100644 --- a/3rdparty/sdl2-2.0.4/src/power/macosx/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/power/psp/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/psp/SDL_syspower.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/power/psp/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/psp/SDL_syspower.c index 76c21b9477..74585b2a62 100644 --- a/3rdparty/sdl2-2.0.4/src/power/psp/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.h b/3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.h rename to 3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.h index 4cfa5c974a..4a42fd2350 100644 --- a/3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.h +++ b/3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.m b/3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.m similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.m rename to 3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.m index 14ce3576a9..cb8a252822 100644 --- a/3rdparty/sdl2-2.0.4/src/power/uikit/SDL_syspower.m +++ b/3rdparty/sdl2-2.0.9/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,7 @@ #include "SDL_assert.h" #include "SDL_syspower.h" +#if !TARGET_OS_TV /* turn off the battery monitor if it's been more than X ms since last check. */ static const int BATTERY_MONITORING_TIMEOUT = 3000; static Uint32 SDL_UIKitLastPowerInfoQuery = 0; @@ -46,10 +47,22 @@ } } } +#else +void +SDL_UIKit_UpdateBatteryMonitoring(void) +{ + /* Do nothing. */ +} +#endif /* !TARGET_OS_TV */ SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent) { +#if TARGET_OS_TV + *state = SDL_POWERSTATE_NO_BATTERY; + *seconds = -1; + *percent = -1; +#else /* TARGET_OS_TV */ @autoreleasepool { UIDevice *uidev = [UIDevice currentDevice]; @@ -88,8 +101,10 @@ const float level = uidev.batteryLevel; *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) ); - return SDL_TRUE; /* always the definitive answer on iOS. */ } +#endif /* TARGET_OS_TV */ + + return SDL_TRUE; /* always the definitive answer on iOS. */ } #endif /* SDL_POWER_UIKIT */ diff --git a/3rdparty/sdl2-2.0.4/src/power/windows/SDL_syspower.c b/3rdparty/sdl2-2.0.9/src/power/windows/SDL_syspower.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/power/windows/SDL_syspower.c rename to 3rdparty/sdl2-2.0.9/src/power/windows/SDL_syspower.c index ff3784ccf6..be6c9d3c0e 100644 --- a/3rdparty/sdl2-2.0.4/src/power/windows/SDL_syspower.c +++ b/3rdparty/sdl2-2.0.9/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/power/winrt/SDL_syspower.cpp b/3rdparty/sdl2-2.0.9/src/power/winrt/SDL_syspower.cpp similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/power/winrt/SDL_syspower.cpp rename to 3rdparty/sdl2-2.0.9/src/power/winrt/SDL_syspower.cpp index 94e5a28536..9f2c2ad63d 100644 --- a/3rdparty/sdl2-2.0.4/src/power/winrt/SDL_syspower.cpp +++ b/3rdparty/sdl2-2.0.9/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.c b/3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.c new file mode 100644 index 0000000000..47eafb2f83 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.c @@ -0,0 +1,136 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED +#include "SDL_stdinc.h" + +#include "SDL_d3dmath.h" + +/* Direct3D matrix math functions */ + +Float4X4 MatrixIdentity() +{ + Float4X4 m; + SDL_zero(m); + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; + return m; +} + +Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2) +{ + Float4X4 m; + m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41; + m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42; + m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43; + m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44; + m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41; + m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42; + m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43; + m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44; + m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41; + m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42; + m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43; + m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44; + m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41; + m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42; + m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43; + m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44; + return m; +} + +Float4X4 MatrixScaling(float x, float y, float z) +{ + Float4X4 m; + SDL_zero(m); + m.v._11 = x; + m.v._22 = y; + m.v._33 = z; + m.v._44 = 1.0f; + return m; +} + +Float4X4 MatrixTranslation(float x, float y, float z) +{ + Float4X4 m; + SDL_zero(m); + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; + m.v._41 = x; + m.v._42 = y; + m.v._43 = z; + return m; +} + +Float4X4 MatrixRotationX(float r) +{ + float sinR = SDL_sinf(r); + float cosR = SDL_cosf(r); + Float4X4 m; + SDL_zero(m); + m.v._11 = 1.0f; + m.v._22 = cosR; + m.v._23 = sinR; + m.v._32 = -sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; + return m; +} + +Float4X4 MatrixRotationY(float r) +{ + float sinR = SDL_sinf(r); + float cosR = SDL_cosf(r); + Float4X4 m; + SDL_zero(m); + m.v._11 = cosR; + m.v._13 = -sinR; + m.v._22 = 1.0f; + m.v._31 = sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; + return m; +} + +Float4X4 MatrixRotationZ(float r) +{ + float sinR = SDL_sinf(r); + float cosR = SDL_cosf(r); + Float4X4 m; + SDL_zero(m); + m.v._11 = cosR; + m.v._12 = sinR; + m.v._21 = -sinR; + m.v._22 = cosR; + m.v._33 = 1.0f; + m.v._44 = 1.0f; + return m; + +} + +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.h b/3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.h similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.h rename to 3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.h index 87c44c7a33..8555a170b6 100644 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_d3dmath.h +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ typedef struct float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; - }; + } v; float m[4][4]; }; } Float4X4; diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_render.c b/3rdparty/sdl2-2.0.9/src/render/SDL_render.c similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/render/SDL_render.c rename to 3rdparty/sdl2-2.0.9/src/render/SDL_render.c index 923973ec78..4985b16ba2 100644 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_render.c +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,17 +33,44 @@ #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" #define CHECK_RENDERER_MAGIC(renderer, retval) \ + SDL_assert(renderer && renderer->magic == &renderer_magic); \ if (!renderer || renderer->magic != &renderer_magic) { \ SDL_SetError("Invalid renderer"); \ return retval; \ } #define CHECK_TEXTURE_MAGIC(texture, retval) \ + SDL_assert(texture && texture->magic == &texture_magic); \ if (!texture || texture->magic != &texture_magic) { \ SDL_SetError("Invalid texture"); \ return retval; \ } +/* Predefined blend modes */ +#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \ + srcAlphaFactor, dstAlphaFactor, alphaOperation) \ + (SDL_BlendMode)(((Uint32)colorOperation << 0) | \ + ((Uint32)srcColorFactor << 4) | \ + ((Uint32)dstColorFactor << 8) | \ + ((Uint32)alphaOperation << 16) | \ + ((Uint32)srcAlphaFactor << 20) | \ + ((Uint32)dstAlphaFactor << 24)) + +#define SDL_BLENDMODE_NONE_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_BLEND_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_ADD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_MOD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) #if !SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { @@ -65,6 +92,9 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif +#if SDL_VIDEO_RENDER_METAL + &METAL_RenderDriver, +#endif #if SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif @@ -102,7 +132,17 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) #endif } -static int +static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_Rect *viewport, SDL_FPoint *scale) +{ + SDL_LockMutex(renderer->target_mutex); + *logical_w = renderer->target ? renderer->logical_w_backup : renderer->logical_w; + *logical_h = renderer->target ? renderer->logical_h_backup : renderer->logical_h; + *viewport = renderer->target ? renderer->viewport_backup : renderer->viewport; + *scale = renderer->target ? renderer->scale_backup : renderer->scale; + SDL_UnlockMutex(renderer->target_mutex); +} + +static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) { SDL_Renderer *renderer = (SDL_Renderer *)userdata; @@ -167,32 +207,76 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } } else if (event->type == SDL_MOUSEMOTION) { SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); - if (renderer->logical_w && window == renderer->window) { - event->motion.x -= renderer->viewport.x; - event->motion.y -= renderer->viewport.y; - event->motion.x = (int)(event->motion.x / renderer->scale.x); - event->motion.y = (int)(event->motion.y / renderer->scale.y); - if (event->motion.xrel > 0) { - event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / renderer->scale.x)); - } else if (event->motion.xrel < 0) { - event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / renderer->scale.x)); - } - if (event->motion.yrel > 0) { - event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / renderer->scale.y)); - } else if (event->motion.yrel < 0) { - event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / renderer->scale.y)); + if (window == renderer->window) { + int logical_w, logical_h; + SDL_Rect viewport; + SDL_FPoint scale; + GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); + if (logical_w) { + event->motion.x -= (int)(viewport.x * renderer->dpi_scale.x); + event->motion.y -= (int)(viewport.y * renderer->dpi_scale.y); + event->motion.x = (int)(event->motion.x / (scale.x * renderer->dpi_scale.x)); + event->motion.y = (int)(event->motion.y / (scale.y * renderer->dpi_scale.y)); + if (event->motion.xrel > 0) { + event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (scale.x * renderer->dpi_scale.x))); + } else if (event->motion.xrel < 0) { + event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (scale.x * renderer->dpi_scale.x))); + } + if (event->motion.yrel > 0) { + event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (scale.y * renderer->dpi_scale.y))); + } else if (event->motion.yrel < 0) { + event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (scale.y * renderer->dpi_scale.y))); + } } } } else if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEBUTTONUP) { SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); - if (renderer->logical_w && window == renderer->window) { - event->button.x -= renderer->viewport.x; - event->button.y -= renderer->viewport.y; - event->button.x = (int)(event->button.x / renderer->scale.x); - event->button.y = (int)(event->button.y / renderer->scale.y); + if (window == renderer->window) { + int logical_w, logical_h; + SDL_Rect viewport; + SDL_FPoint scale; + GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); + if (logical_w) { + event->button.x -= (int)(viewport.x * renderer->dpi_scale.x); + event->button.y -= (int)(viewport.y * renderer->dpi_scale.y); + event->button.x = (int)(event->button.x / (scale.x * renderer->dpi_scale.x)); + event->button.y = (int)(event->button.y / (scale.y * renderer->dpi_scale.y)); + } + } + } else if (event->type == SDL_FINGERDOWN || + event->type == SDL_FINGERUP || + event->type == SDL_FINGERMOTION) { + int logical_w, logical_h; + SDL_Rect viewport; + SDL_FPoint scale; + GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); + if (logical_w) { + int w = 1; + int h = 1; + SDL_GetRendererOutputSize(renderer, &w, &h); + + event->tfinger.x *= (w - 1); + event->tfinger.y *= (h - 1); + + event->tfinger.x -= (viewport.x * renderer->dpi_scale.x); + event->tfinger.y -= (viewport.y * renderer->dpi_scale.y); + event->tfinger.x = (event->tfinger.x / (scale.x * renderer->dpi_scale.x)); + event->tfinger.y = (event->tfinger.y / (scale.y * renderer->dpi_scale.y)); + + if (logical_w > 1) { + event->tfinger.x = event->tfinger.x / (logical_w - 1); + } else { + event->tfinger.x = 0.5f; + } + if (logical_h > 1) { + event->tfinger.y = event->tfinger.y / (logical_h - 1); + } else { + event->tfinger.y = 0.5f; + } } } + return 0; } @@ -234,12 +318,11 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) return NULL; } - hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC); - if (hint) { - if (*hint == '0') { - flags &= ~SDL_RENDERER_PRESENTVSYNC; - } else { + if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) { + if (SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE)) { flags |= SDL_RENDERER_PRESENTVSYNC; + } else { + flags &= ~SDL_RENDERER_PRESENTVSYNC; } } @@ -288,8 +371,21 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) if (renderer) { renderer->magic = &renderer_magic; renderer->window = window; + renderer->target_mutex = SDL_CreateMutex(); renderer->scale.x = 1.0f; renderer->scale.y = 1.0f; + renderer->dpi_scale.x = 1.0f; + renderer->dpi_scale.y = 1.0f; + + if (window && renderer->GetOutputSize) { + int window_w, window_h; + int output_w, output_h; + if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { + SDL_GetWindowSize(renderer->window, &window_w, &window_h); + renderer->dpi_scale.x = (float)window_w / output_w; + renderer->dpi_scale.y = (float)window_h / output_h; + } + } if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { renderer->hidden = SDL_TRUE; @@ -323,6 +419,7 @@ SDL_CreateSoftwareRenderer(SDL_Surface * surface) if (renderer) { renderer->magic = &renderer_magic; + renderer->target_mutex = SDL_CreateMutex(); renderer->scale.x = 1.0f; renderer->scale.y = 1.0f; @@ -368,6 +465,23 @@ SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h) } } +static SDL_bool +IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + switch (blendMode) + { + /* These are required to be supported by all renderers */ + case SDL_BLENDMODE_NONE: + case SDL_BLENDMODE_BLEND: + case SDL_BLENDMODE_ADD: + case SDL_BLENDMODE_MOD: + return SDL_TRUE; + + default: + return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode); + } +} + static SDL_bool IsSupportedFormat(SDL_Renderer * renderer, Uint32 format) { @@ -407,6 +521,22 @@ GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format) return renderer->info.texture_formats[0]; } + +static SDL_ScaleMode SDL_GetScaleMode(void) +{ + const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); + + if (!hint || SDL_strcasecmp(hint, "nearest") == 0) { + return SDL_ScaleModeNearest; + } else if (SDL_strcasecmp(hint, "linear") == 0) { + return SDL_ScaleModeLinear; + } else if (SDL_strcasecmp(hint, "best") == 0) { + return SDL_ScaleModeBest; + } else { + return (SDL_ScaleMode)SDL_atoi(hint); + } +} + SDL_Texture * SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h) { @@ -448,6 +578,7 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int texture->g = 255; texture->b = 255; texture->a = 255; + texture->scaleMode = SDL_GetScaleMode(); texture->renderer = renderer; texture->next = renderer->textures; if (renderer->textures) { @@ -519,7 +650,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) /* See what the best texture format is */ fmt = surface->format; - if (fmt->Amask || SDL_GetColorKey(surface, NULL) == 0) { + if (fmt->Amask || SDL_HasColorKey(surface)) { needAlpha = SDL_TRUE; } else { needAlpha = SDL_FALSE; @@ -578,7 +709,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) SDL_GetSurfaceAlphaMod(surface, &a); SDL_SetTextureAlphaMod(texture, a); - if (SDL_GetColorKey(surface, NULL) == 0) { + if (SDL_HasColorKey(surface)) { /* We converted to a texture with alpha format */ SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); } else { @@ -695,6 +826,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode) CHECK_TEXTURE_MAGIC(texture, -1); renderer = texture->renderer; + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } texture->blendMode = blendMode; if (texture->native) { return SDL_SetTextureBlendMode(texture->native, blendMode); @@ -735,8 +869,8 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -746,18 +880,18 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -768,10 +902,14 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, { SDL_Texture *native = texture->native; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -782,19 +920,19 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_ConvertPixels(rect->w, rect->h, + texture->format, pixels, pitch, + native->format, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_ConvertPixels(rect->w, rect->h, - texture->format, pixels, pitch, - native->format, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -854,10 +992,14 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, full_rect.h = texture->h; rect = &full_rect; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -867,18 +1009,18 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -925,6 +1067,10 @@ int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, rect = &full_rect; } + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->yuv) { return SDL_UpdateTextureYUVPlanar(texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); } else { @@ -1086,6 +1232,8 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) } } + SDL_LockMutex(renderer->target_mutex); + if (texture && !renderer->target) { /* Make a backup of the viewport */ renderer->viewport_backup = renderer->viewport; @@ -1098,6 +1246,7 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) renderer->target = texture; if (renderer->SetRenderTarget(renderer, texture) < 0) { + SDL_UnlockMutex(renderer->target_mutex); return -1; } @@ -1106,6 +1255,8 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) renderer->viewport.y = 0; renderer->viewport.w = texture->w; renderer->viewport.h = texture->h; + SDL_zero(renderer->clip_rect); + renderer->clipping_enabled = SDL_FALSE; renderer->scale.x = 1.0f; renderer->scale.y = 1.0f; renderer->logical_w = texture->w; @@ -1118,6 +1269,9 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) renderer->logical_w = renderer->logical_w_backup; renderer->logical_h = renderer->logical_h_backup; } + + SDL_UnlockMutex(renderer->target_mutex); + if (renderer->UpdateViewport(renderer) < 0) { return -1; } @@ -1143,37 +1297,99 @@ UpdateLogicalSize(SDL_Renderer *renderer) float real_aspect; float scale; SDL_Rect viewport; + /* 0 is for letterbox, 1 is for overscan */ + int scale_policy = 0; + const char *hint; + if (!renderer->logical_w || !renderer->logical_h) { + return 0; + } if (SDL_GetRendererOutputSize(renderer, &w, &h) < 0) { return -1; } + hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE); + if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) { +#if SDL_VIDEO_RENDER_D3D + SDL_bool overscan_supported = SDL_TRUE; + /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers + which the overscan implementation relies on. + */ + if (SDL_strcasecmp(SDL_GetCurrentVideoDriver(), "direct3d") == 0) { + overscan_supported = SDL_FALSE; + } + if (overscan_supported) { + scale_policy = 1; + } +#else + scale_policy = 1; +#endif + } + want_aspect = (float)renderer->logical_w / renderer->logical_h; real_aspect = (float)w / h; /* Clear the scale because we're setting viewport in output coordinates */ SDL_RenderSetScale(renderer, 1.0f, 1.0f); - if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { + if (renderer->integer_scale) { + if (want_aspect > real_aspect) { + scale = (float)(w / renderer->logical_w); + } else { + scale = (float)(h / renderer->logical_h); + } + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + + SDL_RenderSetViewport(renderer, &viewport); + } else if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { /* The aspect ratios are the same, just scale appropriately */ scale = (float)w / renderer->logical_w; SDL_RenderSetViewport(renderer, NULL); } else if (want_aspect > real_aspect) { - /* We want a wider aspect ratio than is available - letterbox it */ - scale = (float)w / renderer->logical_w; - viewport.x = 0; - viewport.w = w; - viewport.h = (int)SDL_ceil(renderer->logical_h * scale); - viewport.y = (h - viewport.h) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a wider aspect ratio than is available - + zoom so logical height matches the real height + and the width will grow off the screen + */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a wider aspect ratio than is available - letterbox it */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } else { - /* We want a narrower aspect ratio than is available - use side-bars */ - scale = (float)h / renderer->logical_h; - viewport.y = 0; - viewport.h = h; - viewport.w = (int)SDL_ceil(renderer->logical_w * scale); - viewport.x = (w - viewport.w) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a narrower aspect ratio than is available - + zoom so logical width matches the real width + and the height will grow off the screen + */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a narrower aspect ratio than is available - use side-bars */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } /* Set the new scale */ @@ -1215,6 +1431,24 @@ SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h) } } +int +SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable) +{ + CHECK_RENDERER_MAGIC(renderer, -1); + + renderer->integer_scale = enable; + + return UpdateLogicalSize(renderer); +} + +SDL_bool +SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, SDL_FALSE); + + return renderer->integer_scale; +} + int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) { @@ -1348,6 +1582,9 @@ SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { CHECK_RENDERER_MAGIC(renderer, -1); + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } renderer->blendMode = blendMode; return 0; } @@ -1425,6 +1662,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, if (count < 1) { return 0; } + /* Don't draw while we're hidden */ if (renderer->hidden) { return 0; @@ -1534,6 +1772,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, if (count < 2) { return 0; } + /* Don't draw while we're hidden */ if (renderer->hidden) { return 0; @@ -1607,6 +1846,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer, if (renderer->hidden) { return 0; } + for (i = 0; i < count; ++i) { if (SDL_RenderDrawRect(renderer, &rects[i]) < 0) { return -1; @@ -1648,6 +1888,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer, if (count < 1) { return 0; } + /* Don't draw while we're hidden */ if (renderer->hidden) { return 0; @@ -1686,6 +1927,11 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return SDL_SetError("Texture was not created with this renderer"); } + /* Don't draw while we're hidden */ + if (renderer->hidden) { + return 0; + } + real_srcrect.x = 0; real_srcrect.y = 0; real_srcrect.w = texture->w; @@ -1710,11 +1956,6 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, texture = texture->native; } - /* Don't draw while we're hidden */ - if (renderer->hidden) { - return 0; - } - frect.x = real_dstrect.x * renderer->scale.x; frect.y = real_dstrect.y * renderer->scale.y; frect.w = real_dstrect.w * renderer->scale.x; @@ -1735,7 +1976,7 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, SDL_FRect frect; SDL_FPoint fcenter; - if (flip == SDL_FLIP_NONE && angle == 0) { /* fast path when we don't need rotation or flipping */ + if (flip == SDL_FLIP_NONE && (int)(angle/360) == angle/360) { /* fast path when we don't need rotation or flipping */ return SDL_RenderCopy(renderer, texture, srcrect, dstrect); } @@ -1749,6 +1990,11 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return SDL_SetError("Renderer does not support RenderCopyEx"); } + /* Don't draw while we're hidden */ + if (renderer->hidden) { + return 0; + } + real_srcrect.x = 0; real_srcrect.y = 0; real_srcrect.w = texture->w; @@ -1772,8 +2018,9 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, texture = texture->native; } - if(center) real_center = *center; - else { + if (center) { + real_center = *center; + } else { real_center.x = real_dstrect.w/2; real_center.y = real_dstrect.h/2; } @@ -1882,7 +2129,9 @@ SDL_DestroyRenderer(SDL_Renderer * renderer) /* Free existing textures for this renderer */ while (renderer->textures) { + SDL_Texture *tex = renderer->textures; (void) tex; SDL_DestroyTexture(renderer->textures); + SDL_assert(tex != renderer->textures); /* satisfy static analysis. */ } if (renderer->window) { @@ -1892,6 +2141,10 @@ SDL_DestroyRenderer(SDL_Renderer * renderer) /* It's no longer magical... */ renderer->magic = NULL; + /* Free the target mutex */ + SDL_DestroyMutex(renderer->target_mutex); + renderer->target_mutex = NULL; + /* Free the renderer instance */ renderer->DestroyRenderer(renderer); } @@ -1926,4 +2179,115 @@ int SDL_GL_UnbindTexture(SDL_Texture *texture) return SDL_Unsupported(); } +void * +SDL_RenderGetMetalLayer(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalLayer) { + return renderer->GetMetalLayer(renderer); + } + return NULL; +} + +void * +SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalCommandEncoder) { + return renderer->GetMetalCommandEncoder(renderer); + } + return NULL; +} + +static SDL_BlendMode +SDL_GetShortBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE_FULL) { + return SDL_BLENDMODE_NONE; + } + if (blendMode == SDL_BLENDMODE_BLEND_FULL) { + return SDL_BLENDMODE_BLEND; + } + if (blendMode == SDL_BLENDMODE_ADD_FULL) { + return SDL_BLENDMODE_ADD; + } + if (blendMode == SDL_BLENDMODE_MOD_FULL) { + return SDL_BLENDMODE_MOD; + } + return blendMode; +} + +static SDL_BlendMode +SDL_GetLongBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE) { + return SDL_BLENDMODE_NONE_FULL; + } + if (blendMode == SDL_BLENDMODE_BLEND) { + return SDL_BLENDMODE_BLEND_FULL; + } + if (blendMode == SDL_BLENDMODE_ADD) { + return SDL_BLENDMODE_ADD_FULL; + } + if (blendMode == SDL_BLENDMODE_MOD) { + return SDL_BLENDMODE_MOD_FULL; + } + return blendMode; +} + +SDL_BlendMode +SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation) +{ + SDL_BlendMode blendMode = SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, + srcAlphaFactor, dstAlphaFactor, alphaOperation); + return SDL_GetShortBlendMode(blendMode); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 4) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 8) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 0) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 20) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 24) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_sysrender.h b/3rdparty/sdl2-2.0.9/src/render/SDL_sysrender.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/render/SDL_sysrender.h rename to 3rdparty/sdl2-2.0.9/src/render/SDL_sysrender.h index 19dfe8e641..940bebcc1d 100644 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_sysrender.h +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,17 +20,25 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysrender_h -#define _SDL_sysrender_h +#ifndef SDL_sysrender_h_ +#define SDL_sysrender_h_ #include "SDL_render.h" #include "SDL_events.h" +#include "SDL_mutex.h" #include "SDL_yuv_sw_c.h" /* The SDL 2D rendering system */ typedef struct SDL_RenderDriver SDL_RenderDriver; +typedef enum +{ + SDL_ScaleModeNearest, + SDL_ScaleModeLinear, + SDL_ScaleModeBest +} SDL_ScaleMode; + typedef struct { float x; @@ -55,6 +63,7 @@ struct SDL_Texture int h; /**< The height of the texture */ int modMode; /**< The texture modulation mode */ SDL_BlendMode blendMode; /**< The texture blend mode */ + SDL_ScaleMode scaleMode; /**< The texture scale mode */ Uint8 r, g, b, a; /**< Texture modulation values */ SDL_Renderer *renderer; @@ -79,6 +88,7 @@ struct SDL_Renderer void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event); int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h); + SDL_bool (*SupportsBlendMode)(SDL_Renderer * renderer, SDL_BlendMode blendMode); int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture); int (*SetTextureColorMod) (SDL_Renderer * renderer, SDL_Texture * texture); @@ -122,6 +132,9 @@ struct SDL_Renderer int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh); int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture); + void *(*GetMetalLayer) (SDL_Renderer * renderer); + void *(*GetMetalCommandEncoder) (SDL_Renderer * renderer); + /* The current renderer info */ SDL_RendererInfo info; @@ -135,6 +148,9 @@ struct SDL_Renderer int logical_w_backup; int logical_h_backup; + /* Whether or not to force the viewport to even integer intervals */ + SDL_bool integer_scale; + /* The drawable area within the window */ SDL_Rect viewport; SDL_Rect viewport_backup; @@ -151,9 +167,13 @@ struct SDL_Renderer SDL_FPoint scale; SDL_FPoint scale_backup; + /* The pixel to point coordinate scale */ + SDL_FPoint dpi_scale; + /* The list of textures */ SDL_Texture *textures; SDL_Texture *target; + SDL_mutex *target_mutex; Uint8 r, g, b, a; /**< Color for drawing operations values */ SDL_BlendMode blendMode; /**< The drawing blend mode */ @@ -170,33 +190,25 @@ struct SDL_RenderDriver SDL_RendererInfo info; }; -#if !SDL_RENDER_DISABLED - -#if SDL_VIDEO_RENDER_D3D +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern SDL_RenderDriver D3D_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_D3D11 extern SDL_RenderDriver D3D11_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL extern SDL_RenderDriver GL_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES2 extern SDL_RenderDriver GLES2_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES extern SDL_RenderDriver GLES_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_DIRECTFB extern SDL_RenderDriver DirectFB_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_PSP +extern SDL_RenderDriver METAL_RenderDriver; extern SDL_RenderDriver PSP_RenderDriver; -#endif extern SDL_RenderDriver SW_RenderDriver; -#endif /* !SDL_RENDER_DISABLED */ +/* Blend mode functions */ +extern SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode); -#endif /* _SDL_sysrender_h */ +#endif /* SDL_sysrender_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw.c b/3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw.c new file mode 100644 index 0000000000..c227cdc673 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw.c @@ -0,0 +1,414 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* This is the software implementation of the YUV texture support */ + +#include "SDL_assert.h" + +#include "SDL_yuv_sw_c.h" + + +SDL_SW_YUVTexture * +SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) +{ + SDL_SW_YUVTexture *swdata; + + switch (format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + break; + default: + SDL_SetError("Unsupported YUV format"); + return NULL; + } + + swdata = (SDL_SW_YUVTexture *) SDL_calloc(1, sizeof(*swdata)); + if (!swdata) { + SDL_OutOfMemory(); + return NULL; + } + + swdata->format = format; + swdata->target_format = SDL_PIXELFORMAT_UNKNOWN; + swdata->w = w; + swdata->h = h; + { + const int sz_plane = w * h; + const int sz_plane_chroma = ((w + 1) / 2) * ((h + 1) / 2); + const int sz_plane_packed = ((w + 1) / 2) * h; + int dst_size = 0; + switch(format) + { + case SDL_PIXELFORMAT_YV12: /**< Planar mode: Y + V + U (3 planes) */ + case SDL_PIXELFORMAT_IYUV: /**< Planar mode: Y + U + V (3 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + case SDL_PIXELFORMAT_YUY2: /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ + case SDL_PIXELFORMAT_UYVY: /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ + case SDL_PIXELFORMAT_YVYU: /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ + dst_size = 4 * sz_plane_packed; + break; + + case SDL_PIXELFORMAT_NV12: /**< Planar mode: Y + U/V interleaved (2 planes) */ + case SDL_PIXELFORMAT_NV21: /**< Planar mode: Y + V/U interleaved (2 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + default: + SDL_assert(0 && "We should never get here (caught above)"); + break; + } + swdata->pixels = (Uint8 *) SDL_malloc(dst_size); + if (!swdata->pixels) { + SDL_SW_DestroyYUVTexture(swdata); + SDL_OutOfMemory(); + return NULL; + } + } + + /* Find the pitch and offset values for the texture */ + switch (format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + swdata->pitches[0] = w; + swdata->pitches[1] = (swdata->pitches[0] + 1) / 2; + swdata->pitches[2] = (swdata->pitches[0] + 1) / 2; + swdata->planes[0] = swdata->pixels; + swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; + swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * ((h + 1) / 2); + break; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + swdata->pitches[0] = ((w + 1) / 2) * 4; + swdata->planes[0] = swdata->pixels; + break; + + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + swdata->pitches[0] = w; + swdata->pitches[1] = 2 * ((swdata->pitches[0] + 1) / 2); + swdata->planes[0] = swdata->pixels; + swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; + break; + + default: + SDL_assert(0 && "We should never get here (caught above)"); + break; + } + + /* We're all done.. */ + return (swdata); +} + +int +SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels, + int *pitch) +{ + *pixels = swdata->planes[0]; + *pitch = swdata->pitches[0]; + return 0; +} + +int +SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, + const void *pixels, int pitch) +{ + switch (swdata->format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + if (rect->x == 0 && rect->y == 0 && + rect->w == swdata->w && rect->h == swdata->h) { + SDL_memcpy(swdata->pixels, pixels, + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); + } else { + Uint8 *src, *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = (Uint8 *) pixels; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->w; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch; + dst = swdata->pixels + swdata->h * swdata->w; + dst += rect->y/2 * ((swdata->w + 1) / 2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch + ((rect->h + 1) / 2) * ((pitch + 1) / 2); + dst = swdata->pixels + swdata->h * swdata->w + + ((swdata->h + 1)/2) * ((swdata->w+1) / 2); + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; + } + } + break; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + { + Uint8 *src, *dst; + int row; + size_t length; + + src = (Uint8 *) pixels; + dst = + swdata->planes[0] + rect->y * swdata->pitches[0] + + rect->x * 2; + length = 4 * ((rect->w + 1) / 2); + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->pitches[0]; + } + } + break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) { + SDL_memcpy(swdata->pixels, pixels, + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); + } else { + + Uint8 *src, *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = (Uint8 *) pixels; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->w; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch; + dst = swdata->pixels + swdata->h * swdata->w; + dst += 2 * ((rect->y + 1)/2) * ((swdata->w + 1) / 2) + 2 * (rect->x/2); + length = 2 * ((rect->w + 1) / 2); + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += 2 * ((pitch + 1)/2); + dst += 2 * ((swdata->w + 1)/2); + } + } + } + } + return 0; +} + +int +SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch) +{ + const Uint8 *src; + Uint8 *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = Yplane; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += Ypitch; + dst += swdata->w; + } + + /* Copy the U plane */ + src = Uplane; + if (swdata->format == SDL_PIXELFORMAT_IYUV) { + dst = swdata->pixels + swdata->h * swdata->w; + } else { + dst = swdata->pixels + swdata->h * swdata->w + + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); + } + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += Upitch; + dst += (swdata->w + 1)/2; + } + + /* Copy the V plane */ + src = Vplane; + if (swdata->format == SDL_PIXELFORMAT_YV12) { + dst = swdata->pixels + swdata->h * swdata->w; + } else { + dst = swdata->pixels + swdata->h * swdata->w + + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); + } + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += Vpitch; + dst += (swdata->w + 1)/2; + } + return 0; +} + +int +SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, + void **pixels, int *pitch) +{ + switch (swdata->format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + if (rect + && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w + || rect->h != swdata->h)) { + return SDL_SetError + ("YV12, IYUV, NV12, NV21 textures only support full surface locks"); + } + break; + } + + if (rect) { + *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2; + } else { + *pixels = swdata->planes[0]; + } + *pitch = swdata->pitches[0]; + return 0; +} + +void +SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata) +{ +} + +int +SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, + Uint32 target_format, int w, int h, void *pixels, + int pitch) +{ + int stretch; + + /* Make sure we're set up to display in the desired format */ + if (target_format != swdata->target_format && swdata->display) { + SDL_FreeSurface(swdata->display); + swdata->display = NULL; + } + + stretch = 0; + if (srcrect->x || srcrect->y || srcrect->w < swdata->w || srcrect->h < swdata->h) { + /* The source rectangle has been clipped. + Using a scratch surface is easier than adding clipped + source support to all the blitters, plus that would + slow them down in the general unclipped case. + */ + stretch = 1; + } else if ((srcrect->w != w) || (srcrect->h != h)) { + stretch = 1; + } + if (stretch) { + int bpp; + Uint32 Rmask, Gmask, Bmask, Amask; + + if (swdata->display) { + swdata->display->w = w; + swdata->display->h = h; + swdata->display->pixels = pixels; + swdata->display->pitch = pitch; + } else { + /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */ + SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask, + &Bmask, &Amask); + swdata->display = + SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, + Gmask, Bmask, Amask); + if (!swdata->display) { + return (-1); + } + } + if (!swdata->stretch) { + /* This must have succeeded in SDL_SW_SetupYUVDisplay() earlier */ + SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask, + &Bmask, &Amask); + swdata->stretch = + SDL_CreateRGBSurface(0, swdata->w, swdata->h, bpp, Rmask, + Gmask, Bmask, Amask); + if (!swdata->stretch) { + return (-1); + } + } + pixels = swdata->stretch->pixels; + pitch = swdata->stretch->pitch; + } + if (SDL_ConvertPixels(swdata->w, swdata->h, swdata->format, + swdata->planes[0], swdata->pitches[0], + target_format, pixels, pitch) < 0) { + return -1; + } + if (stretch) { + SDL_Rect rect = *srcrect; + SDL_SoftStretch(swdata->stretch, &rect, swdata->display, NULL); + } + return 0; +} + +void +SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata) +{ + if (swdata) { + SDL_free(swdata->pixels); + SDL_FreeSurface(swdata->stretch); + SDL_FreeSurface(swdata->display); + SDL_free(swdata); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw_c.h b/3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw_c.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw_c.h rename to 3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw_c.h index 2752096f45..34322f24c2 100644 --- a/3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw_c.h +++ b/3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_yuv_sw_c_h_ +#define SDL_yuv_sw_c_h_ + #include "../SDL_internal.h" #include "SDL_video.h" @@ -30,16 +34,6 @@ struct SDL_SW_YUVTexture Uint32 target_format; int w, h; Uint8 *pixels; - int *colortab; - Uint32 *rgb_2_pix; - void (*Display1X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); - void (*Display2X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); /* These are just so we don't have to allocate them separately */ Uint16 pitches[3]; @@ -69,4 +63,11 @@ int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, int pitch); void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata); +/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */ +#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */ +#define USE_MMX_ASSEMBLY 1 +#endif + +#endif /* SDL_yuv_sw_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/direct3d/SDL_render_d3d.c b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_render_d3d.c similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/render/direct3d/SDL_render_d3d.c rename to 3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_render_d3d.c index 9d7564224e..69a9dff547 100644 --- a/3rdparty/sdl2-2.0.4/src/render/direct3d/SDL_render_d3d.c +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,85 +39,7 @@ #include #endif - -#ifdef ASSEMBLE_SHADER -#pragma comment(lib, "d3dx9.lib") - -/************************************************************************** - * ID3DXBuffer: - * ------------ - * The buffer object is used by D3DX to return arbitrary size data. - * - * GetBufferPointer - - * Returns a pointer to the beginning of the buffer. - * - * GetBufferSize - - * Returns the size of the buffer, in bytes. - **************************************************************************/ - -typedef interface ID3DXBuffer ID3DXBuffer; -typedef interface ID3DXBuffer *LPD3DXBUFFER; - -/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */ -DEFINE_GUID(IID_ID3DXBuffer, -0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); - -#undef INTERFACE -#define INTERFACE ID3DXBuffer - -typedef interface ID3DXBuffer { - const struct ID3DXBufferVtbl FAR* lpVtbl; -} ID3DXBuffer; -typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl; -const struct ID3DXBufferVtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* ID3DXBuffer */ - STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; - STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; -}; - -HRESULT WINAPI - D3DXAssembleShader( - LPCSTR pSrcData, - UINT SrcDataLen, - CONST LPVOID* pDefines, - LPVOID pInclude, - DWORD Flags, - LPD3DXBUFFER* ppShader, - LPD3DXBUFFER* ppErrorMsgs); - -static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) -{ - OutputDebugStringA("const DWORD shader_data[] = {\n\t"); - { - SDL_bool newline = SDL_FALSE; - unsigned i; - for (i = 0; i < shader_size / sizeof(DWORD); ++i) { - char dword[11]; - if (i > 0) { - if ((i%6) == 0) { - newline = SDL_TRUE; - } - if (newline) { - OutputDebugStringA(",\n "); - newline = SDL_FALSE; - } else { - OutputDebugStringA(", "); - } - } - SDL_snprintf(dword, sizeof(dword), "0x%8.8x", shader_data[i]); - OutputDebugStringA(dword); - } - OutputDebugStringA("\n};\n"); - } -} - -#endif /* ASSEMBLE_SHADER */ +#include "SDL_shaders_d3d.h" /* Direct3D renderer implementation */ @@ -125,6 +47,7 @@ static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, @@ -187,7 +110,7 @@ typedef struct IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *currentRenderTarget; void* d3dxDLL; - LPDIRECT3DPIXELSHADER9 ps_yuv; + LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; } D3D_RenderData; typedef struct @@ -196,6 +119,7 @@ typedef struct int w, h; DWORD usage; Uint32 format; + D3DFORMAT d3dfmt; IDirect3DTexture9 *texture; IDirect3DTexture9 *staging; } D3D_TextureRep; @@ -312,6 +236,8 @@ PixelFormatToD3DFMT(Uint32 format) return D3DFMT_A8R8G8B8; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: return D3DFMT_L8; default: return D3DFMT_UNKNOWN; @@ -512,7 +438,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) D3D_RenderData *data; SDL_SysWMinfo windowinfo; HRESULT result; - const char *hint; D3DPRESENT_PARAMETERS pparams; IDirect3DSwapChain9 *chain; D3DCAPS9 caps; @@ -543,6 +468,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D_WindowEvent; + renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; renderer->UpdateTextureYUV = D3D_UpdateTextureYUV; @@ -607,8 +533,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) device_flags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; } - hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D_THREADSAFE); - if (hint && SDL_atoi(hint)) { + if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_FALSE)) { device_flags |= D3DCREATE_MULTITHREADED; } @@ -661,136 +586,19 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) /* Set up parameters for rendering */ D3D_InitRenderState(data); - if (caps.MaxSimultaneousTextures >= 3) - { -#ifdef ASSEMBLE_SHADER - /* This shader was created by running the following HLSL through the fxc compiler - and then tuning the generated assembly. - - fxc /T fx_4_0 /O3 /Gfa /Fc yuv.fxc yuv.fx - - --- yuv.fx --- - Texture2D g_txY; - Texture2D g_txU; - Texture2D g_txV; - - SamplerState samLinear - { - Filter = ANISOTROPIC; - AddressU = Clamp; - AddressV = Clamp; - MaxAnisotropy = 1; - }; - - struct VS_OUTPUT - { - float2 TextureUV : TEXCOORD0; - }; - - struct PS_OUTPUT - { - float4 RGBAColor : SV_Target; - }; - - PS_OUTPUT YUV420( VS_OUTPUT In ) - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - PS_OUTPUT Output; - float2 TextureUV = In.TextureUV; - - float3 yuv; - yuv.x = g_txY.Sample( samLinear, TextureUV ).r; - yuv.y = g_txU.Sample( samLinear, TextureUV ).r; - yuv.z = g_txV.Sample( samLinear, TextureUV ).r; - - yuv += offset; - Output.RGBAColor.r = dot(yuv, Rcoeff); - Output.RGBAColor.g = dot(yuv, Gcoeff); - Output.RGBAColor.b = dot(yuv, Bcoeff); - Output.RGBAColor.a = 1.0f; - - return Output; - } - - technique10 RenderYUV420 - { - pass P0 - { - SetPixelShader( CompileShader( ps_4_0_level_9_0, YUV420() ) ); - } - } - */ - const char *shader_text = - "ps_2_0\n" - "def c0, -0.0627451017, -0.501960814, -0.501960814, 1\n" - "def c1, 1.16400003, 0, 1.59599996, 0\n" - "def c2, 1.16400003, -0.391000003, -0.813000023, 0\n" - "def c3, 1.16400003, 2.01799989, 0, 0\n" - "dcl t0.xy\n" - "dcl v0.xyzw\n" - "dcl_2d s0\n" - "dcl_2d s1\n" - "dcl_2d s2\n" - "texld r0, t0, s0\n" - "texld r1, t0, s1\n" - "texld r2, t0, s2\n" - "mov r0.y, r1.x\n" - "mov r0.z, r2.x\n" - "add r0.xyz, r0, c0\n" - "dp3 r1.x, r0, c1\n" - "dp3 r1.y, r0, c2\n" - "dp2add r1.z, r0, c3, c3.z\n" /* Logically this is "dp3 r1.z, r0, c3" but the optimizer did its magic */ - "mov r1.w, c0.w\n" - "mul r0, r1, v0\n" /* Not in the HLSL, multiply by vertex color */ - "mov oC0, r0\n" - ; - LPD3DXBUFFER pCode; - LPD3DXBUFFER pErrorMsgs; - LPDWORD shader_data = NULL; - DWORD shader_size = 0; - result = D3DXAssembleShader(shader_text, SDL_strlen(shader_text), NULL, NULL, 0, &pCode, &pErrorMsgs); - if (!FAILED(result)) { - shader_data = (DWORD*)pCode->lpVtbl->GetBufferPointer(pCode); - shader_size = pCode->lpVtbl->GetBufferSize(pCode); - PrintShaderData(shader_data, shader_size); - } else { - const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs); - SDL_SetError("Couldn't assemble shader: %s", error); - } -#else - const DWORD shader_data[] = { - 0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, - 0x3f800000, 0x05000051, 0xa00f0001, 0x3f94fdf4, 0x00000000, 0x3fcc49ba, - 0x00000000, 0x05000051, 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, - 0x00000000, 0x05000051, 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, - 0x00000000, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, - 0x900f0000, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, - 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, - 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0002, 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, - 0x80000001, 0x02000001, 0x80040000, 0x80000002, 0x03000002, 0x80070000, - 0x80e40000, 0xa0e40000, 0x03000008, 0x80010001, 0x80e40000, 0xa0e40001, - 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, - 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, - 0x03000005, 0x800f0000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800, - 0x80e40000, 0x0000ffff - }; -#endif - if (shader_data != NULL) { - result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv); - if (!FAILED(result)) { - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; - } else { + if (caps.MaxSimultaneousTextures >= 3) { + int i; + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]); + if (FAILED(result)) { D3D_SetError("CreatePixelShader()", result); } } + if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) { + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; + } } - return renderer; } @@ -804,20 +612,60 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -static D3DTEXTUREFILTERTYPE -GetScaleQuality(void) +static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) { - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3DBLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3DBLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3DBLEND_SRCCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3DBLEND_INVSRCCOLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3DBLEND_SRCALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3DBLEND_INVSRCALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3DBLEND_DESTCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3DBLEND_INVDESTCOLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3DBLEND_DESTALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3DBLEND_INVDESTALPHA; + default: + return (D3DBLEND)0; + } +} - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return D3DTEXF_POINT; - } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ { - return D3DTEXF_LINEAR; +static SDL_bool +D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) { + return SDL_FALSE; } + return SDL_TRUE; } static int -D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, int w, int h) +D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h) { HRESULT result; @@ -826,6 +674,7 @@ D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD us texture->h = h; texture->usage = usage; texture->format = format; + texture->d3dfmt = d3dfmt; result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage, PixelFormatToD3DFMT(format), @@ -844,8 +693,7 @@ D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture) if (texture->staging == NULL) { result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0, - PixelFormatToD3DFMT(texture->format), - D3DPOOL_SYSTEMMEM, &texture->staging, NULL); + texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL); if (FAILED(result)) { return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result); } @@ -881,7 +729,7 @@ D3D_BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD samp } static int -D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int w, int h) +D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture) { if (texture->texture) { IDirect3DTexture9_Release(texture->texture); @@ -895,7 +743,7 @@ D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 } static int -D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch) { RECT d3drect; D3DLOCKED_RECT locked; @@ -919,8 +767,8 @@ D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 f } src = (const Uint8 *)pixels; - dst = locked.pBits; - length = w * SDL_BYTESPERPIXEL(format); + dst = (Uint8 *)locked.pBits; + length = w * SDL_BYTESPERPIXEL(texture->format); if (length == pitch && length == locked.Pitch) { SDL_memcpy(dst, src, length*h); } else { @@ -969,7 +817,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!texturedata) { return SDL_OutOfMemory(); } - texturedata->scaleMode = GetScaleQuality(); + texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR; texture->driverdata = texturedata; @@ -979,7 +827,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) usage = 0; } - if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, texture->w, texture->h) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { return -1; } @@ -987,11 +835,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { texturedata->yuv = SDL_TRUE; - if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } - if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } } @@ -1004,16 +852,20 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) { + if (!texturedata) { + return 0; + } + + if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { return -1; } if (texturedata->yuv) { - if (D3D_RecreateTextureRep(data->device, &texturedata->utexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { return -1; } - if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) { return -1; } } @@ -1032,7 +884,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { return -1; } @@ -1040,13 +892,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, rect->x / 2, (rect->y + 1) / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } } @@ -1068,13 +920,13 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -1213,7 +1065,9 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture) static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { - D3D_ActivateRenderer(renderer); + if (D3D_ActivateRenderer(renderer) < 0) { + return -1; + } return D3D_SetRenderTargetInternal(renderer, texture); } @@ -1307,6 +1161,10 @@ D3D_RenderClear(SDL_Renderer * renderer) BackBufferHeight = data->pparams.BackBufferHeight; } + if (renderer->clipping_enabled) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE); + } + /* Don't reset the viewport if we don't have to! */ if (!renderer->viewport.x && !renderer->viewport.y && renderer->viewport.w == BackBufferWidth && @@ -1336,6 +1194,10 @@ D3D_RenderClear(SDL_Renderer * renderer) IDirect3DDevice9_SetViewport(data->device, &viewport); } + if (renderer->clipping_enabled) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, TRUE); + } + if (FAILED(result)) { return D3D_SetError("Clear()", result); } @@ -1343,55 +1205,22 @@ D3D_RenderClear(SDL_Renderer * renderer) } static void -D3D_SetBlendMode(D3D_RenderData * data, int blendMode) +D3D_SetBlendMode(D3D_RenderData * data, SDL_BlendMode blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - FALSE); - break; - case SDL_BLENDMODE_BLEND: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_INVSRCALPHA); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ONE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_INVSRCALPHA); - } - break; - case SDL_BLENDMODE_ADD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_ONE); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); - } - break; - case SDL_BLENDMODE_MOD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); + if (blendMode == SDL_BLENDMODE_NONE) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, FALSE); + } else { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, TRUE); IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_ZERO); + GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_SRCCOLOR); + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); if (data->enableSeparateAlphaBlend) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } - break; } } @@ -1573,17 +1402,68 @@ D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, u texturedata->scaleMode); IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MAGFILTER, texturedata->scaleMode); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSU, + D3DTADDRESS_CLAMP); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSV, + D3DTADDRESS_CLAMP); data->scaleMode[index] = texturedata->scaleMode; } } +static int +D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + D3D_TextureData *texturedata; + + *shader = NULL; + + texturedata = (D3D_TextureData *)texture->driverdata; + if (!texturedata) { + SDL_SetError("Texture is not currently available"); + return -1; + } + + D3D_UpdateTextureScaleMode(data, texturedata, 0); + + if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + return -1; + } + + if (texturedata->yuv) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + *shader = data->shaders[SHADER_YUV_JPEG]; + break; + case SDL_YUV_CONVERSION_BT601: + *shader = data->shaders[SHADER_YUV_BT601]; + break; + case SDL_YUV_CONVERSION_BT709: + *shader = data->shaders[SHADER_YUV_BT709]; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D_UpdateTextureScaleMode(data, texturedata, 1); + D3D_UpdateTextureScaleMode(data, texturedata, 2); + + if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { + return -1; + } + if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { + return -1; + } + } + return 0; +} + static int D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; - LPDIRECT3DPIXELSHADER9 shader = NULL; + LPDIRECT3DPIXELSHADER9 shader; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; DWORD color; @@ -1594,12 +1474,6 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - minx = dstrect->x - 0.5f; miny = dstrect->y - 0.5f; maxx = dstrect->x + dstrect->w - 0.5f; @@ -1642,45 +1516,25 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { return -1; } - - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { return D3D_SetError("SetShader()", result); } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } - return 0; + return FAILED(result) ? -1 : 0; } @@ -1690,7 +1544,6 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; LPDIRECT3DPIXELSHADER9 shader = NULL; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; @@ -1704,38 +1557,30 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - centerx = center->x; centery = center->y; - if (flip & SDL_FLIP_HORIZONTAL) { - minx = dstrect->w - centerx - 0.5f; - maxx = -centerx - 0.5f; - } - else { - minx = -centerx - 0.5f; - maxx = dstrect->w - centerx - 0.5f; - } - - if (flip & SDL_FLIP_VERTICAL) { - miny = dstrect->h - centery - 0.5f; - maxy = -centery - 0.5f; - } - else { - miny = -centery - 0.5f; - maxy = dstrect->h - centery - 0.5f; - } + minx = -centerx; + maxx = dstrect->w - centerx; + miny = -centery; + maxy = dstrect->h - centery; minu = (float) srcrect->x / texture->w; maxu = (float) (srcrect->x + srcrect->w) / texture->w; minv = (float) srcrect->y / texture->h; maxv = (float) (srcrect->y + srcrect->h) / texture->h; + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + color = D3DCOLOR_ARGB(texture->a, texture->r, texture->g, texture->b); vertices[0].x = minx; @@ -1768,55 +1613,37 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { + return -1; + } + /* Rotate and translate */ modelMatrix = MatrixMultiply( MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)), - MatrixTranslation(dstrect->x + center->x, dstrect->y + center->y, 0) -); + MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0)); IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { - return -1; - } - - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { - return D3D_SetError("SetShader()", result); + D3D_SetError("SetShader()", result); + goto done; } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } +done: if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } modelMatrix = MatrixIdentity(); IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - return 0; + + return FAILED(result) ? -1 : 0; } static int @@ -1926,6 +1753,8 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; if (data) { + int i; + /* Release the render target */ if (data->defaultRenderTarget) { IDirect3DSurface9_Release(data->defaultRenderTarget); @@ -1935,11 +1764,15 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } - if (data->ps_yuv) { - IDirect3DPixelShader9_Release(data->ps_yuv); + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + if (data->shaders[i]) { + IDirect3DPixelShader9_Release(data->shaders[i]); + data->shaders[i] = NULL; + } } if (data->device) { IDirect3DDevice9_Release(data->device); + data->device = NULL; } if (data->d3d) { IDirect3D9_Release(data->d3d); diff --git a/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.c b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.c new file mode 100644 index 0000000000..b95fddca89 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_render.h" +#include "SDL_system.h" + +#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED + +#include "../../core/windows/SDL_windows.h" + +#include + +#include "SDL_shaders_d3d.h" + +/* The shaders here were compiled with: + + fxc /T ps_2_0 /Fo"" "" + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' +*/ + +/* --- D3D9_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_JPEG[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT601[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT709[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + + +static const DWORD *D3D9_shaders[] = { + D3D9_PixelShader_YUV_JPEG, + D3D9_PixelShader_YUV_BT601, + D3D9_PixelShader_YUV_BT709, +}; + +HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader) +{ + return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader); +} + +#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.h b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.h new file mode 100644 index 0000000000..8549582772 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d/SDL_shaders_d3d.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D9 shader implementation */ + +typedef enum { + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + NUM_SHADERS +} D3D9_Shader; + +extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_d3d11.c b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_d3d11.c similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_d3d11.c rename to 3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_d3d11.c index a48eacee73..7a370392fa 100644 --- a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_d3d11.c +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,10 +29,10 @@ #include "SDL_syswm.h" #include "../SDL_sysrender.h" #include "../SDL_d3dmath.h" -/* #include "SDL_log.h" */ #include +#include "SDL_shaders_d3d11.h" #ifdef __WINRT__ @@ -51,6 +51,8 @@ extern ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNat #endif /* __WINRT__ */ +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + #define SAFE_RELEASE(X) if ((X)) { IUnknown_Release(SDL_static_cast(IUnknown*, X)); X = NULL; } @@ -86,11 +88,24 @@ typedef struct ID3D11ShaderResourceView *mainTextureResourceViewU; ID3D11Texture2D *mainTextureV; ID3D11ShaderResourceView *mainTextureResourceViewV; + + /* NV12 texture support */ + SDL_bool nv12; + ID3D11Texture2D *mainTextureNV; + ID3D11ShaderResourceView *mainTextureResourceViewNV; + Uint8 *pixels; int pitch; SDL_Rect locked_rect; } D3D11_TextureData; +/* Blend mode data */ +typedef struct +{ + SDL_BlendMode blendMode; + ID3D11BlendState *blendState; +} D3D11_BlendMode; + /* Private renderer data */ typedef struct { @@ -107,12 +122,9 @@ typedef struct ID3D11InputLayout *inputLayout; ID3D11Buffer *vertexBuffer; ID3D11VertexShader *vertexShader; - ID3D11PixelShader *colorPixelShader; - ID3D11PixelShader *texturePixelShader; - ID3D11PixelShader *yuvPixelShader; - ID3D11BlendState *blendModeBlend; - ID3D11BlendState *blendModeAdd; - ID3D11BlendState *blendModeMod; + ID3D11PixelShader *pixelShaders[NUM_SHADERS]; + int blendModesCount; + D3D11_BlendMode *blendModes; ID3D11SamplerState *nearestPixelSampler; ID3D11SamplerState *linearSampler; D3D_FEATURE_LEVEL featureLevel; @@ -136,560 +148,30 @@ typedef struct } D3D11_RenderData; -/* Defined here so we don't have to include uuid.lib */ -static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; -static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; -static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; -static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; -static const GUID IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } }; -static const GUID IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } }; -static const GUID IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } }; - -/* Direct3D 11.x shaders - - SDL's shaders are compiled into SDL itself, to simplify distribution. - - All Direct3D 11.x shaders were compiled with the following: - - fxc /E"main" /T "" /Fo"" "" - - Variables: - - : the type of shader. A table of utilized shader types is - listed below. - - : where to store compiled output - - : where to read shader source code from - - Shader types: - - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT - - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT - - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 - - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 - - - Shader object code was converted to a list of DWORDs via the following - *nix style command (available separately from Windows + MSVC): - - hexdump -v -e '6/4 "0x%08.8x, " "\n"' - */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 -#else -#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 -#endif - -/* The color-only-rendering pixel shader: - - --- D3D11_PixelShader_Colors.hlsl --- - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return input.color; - } +/* Define D3D GUIDs here so we don't have to include uuid.lib. +* +* Fix for SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3437: +* The extra 'SDL_' was added to the start of each IID's name, in order +* to prevent build errors on both MinGW-w64 and WinRT/UWP. +* (SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3336 led to +* linker errors in WinRT/UWP builds.) */ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'colors' pixel shader is not defined." -#endif - -/* The texture-rendering pixel shader: - --- D3D11_PixelShader_Textures.hlsl --- - Texture2D theTexture : register(t0); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return theTexture.Sample(theSampler, input.tex) * input.color; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'textures' pixel shader is not defined" +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-const-variable" #endif -/* The yuv-rendering pixel shader: - - --- D3D11_PixelShader_YUV.hlsl --- - Texture2D theTextureY : register(t0); - Texture2D theTextureU : register(t1); - Texture2D theTextureV : register(t2); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - float4 Output; +static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; +static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; +static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; +static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; +static const GUID SDL_IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } }; +static const GUID SDL_IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } }; +static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } }; - float3 yuv; - yuv.x = theTextureY.Sample(theSampler, input.tex).r; - yuv.y = theTextureU.Sample(theSampler, input.tex).r; - yuv.z = theTextureV.Sample(theSampler, input.tex).r; - - yuv += offset; - Output.r = dot(yuv, Rcoeff); - Output.g = dot(yuv, Gcoeff); - Output.b = dot(yuv, Bcoeff); - Output.a = 1.0f; - - return Output * input.color; - } - -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x2321c6c6, 0xf14df2d1, 0xc79d068d, 0x8e672abf, 0x00000001, - 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, - 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, - 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051, - 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, - 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, - 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, - 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, - 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, - 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, - 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, - 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, - 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, - 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, - 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, - 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, - 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, - 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, - 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, - 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba, - 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, - 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, - 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082, - 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, - 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, - 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, - 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, - 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, - 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, - 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x6ede7360, 0x45ff5f8a, 0x34ac92ba, 0xb865f5e0, 0x00000001, - 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, - 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, - 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, - 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, - 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, - 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, - 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, - 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, - 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, - 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, - 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, - 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, - 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, - 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, - 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, - 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, - 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, - 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, - 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, - 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, - 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, - 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, - 0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, - 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, - 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, - 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, - 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, - 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, - 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, - 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, - 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, - 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, - 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, - 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, - 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'yuv' pixel shader is not defined." -#endif - -/* The sole vertex shader: - - --- D3D11_VertexShader.hlsl --- - #pragma pack_matrix( row_major ) - - cbuffer VertexShaderConstants : register(b0) - { - matrix model; - matrix projectionAndView; - }; - - struct VertexShaderInput - { - float3 pos : POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - struct VertexShaderOutput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - VertexShaderOutput main(VertexShaderInput input) - { - VertexShaderOutput output; - float4 pos = float4(input.pos, 1.0f); - - // Transform the vertex position into projected space. - pos = mul(pos, model); - pos = mul(pos, projectionAndView); - output.pos = pos; - - // Pass through texture coordinates and color values without transformation - output.tex = input.tex; - output.color = input.color; - - return output; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#else -#error "An appropriate vertex shader is not defined." +#ifdef __GNUC__ +#pragma GCC diagnostic pop #endif @@ -697,6 +179,7 @@ static const DWORD D3D11_VertexShader[] = { static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *srcPixels, @@ -747,12 +230,14 @@ SDL_RenderDriver D3D11_RenderDriver = { SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE ), /* flags. see SDL_RendererFlags */ - 4, /* num_texture_formats */ + 6, /* num_texture_formats */ { /* texture_formats */ SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_YV12, - SDL_PIXELFORMAT_IYUV + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 }, 0, /* max_texture_width: will be filled in later */ 0 /* max_texture_height: will be filled in later */ @@ -761,7 +246,8 @@ SDL_RenderDriver D3D11_RenderDriver = { Uint32 -D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) { +D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) +{ switch (dxgiFormat) { case DXGI_FORMAT_B8G8R8A8_UNORM: return SDL_PIXELFORMAT_ARGB8888; @@ -782,6 +268,8 @@ SDLPixelFormatToDXGIFormat(Uint32 sdlFormat) return DXGI_FORMAT_B8G8R8X8_UNORM; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: /* For the Y texture */ + case SDL_PIXELFORMAT_NV21: /* For the Y texture */ return DXGI_FORMAT_R8_UNORM; default: return DXGI_FORMAT_UNKNOWN; @@ -807,6 +295,7 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D11_WindowEvent; + renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; renderer->UpdateTexture = D3D11_UpdateTexture; renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV; @@ -879,6 +368,8 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) /* Release/reset everything else */ if (data) { + int i; + SAFE_RELEASE(data->dxgiFactory); SAFE_RELEASE(data->dxgiAdapter); SAFE_RELEASE(data->d3dDevice); @@ -889,12 +380,17 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) SAFE_RELEASE(data->inputLayout); SAFE_RELEASE(data->vertexBuffer); SAFE_RELEASE(data->vertexShader); - SAFE_RELEASE(data->colorPixelShader); - SAFE_RELEASE(data->texturePixelShader); - SAFE_RELEASE(data->yuvPixelShader); - SAFE_RELEASE(data->blendModeBlend); - SAFE_RELEASE(data->blendModeAdd); - SAFE_RELEASE(data->blendModeMod); + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + SAFE_RELEASE(data->pixelShaders[i]); + } + if (data->blendModesCount > 0) { + for (i = 0; i < data->blendModesCount; ++i) { + SAFE_RELEASE(data->blendModes[i].blendState); + } + SDL_free(data->blendModes); + + data->blendModesCount = 0; + } SAFE_RELEASE(data->nearestPixelSampler); SAFE_RELEASE(data->linearSampler); SAFE_RELEASE(data->mainRasterizer); @@ -935,37 +431,96 @@ D3D11_DestroyRenderer(SDL_Renderer * renderer) SDL_free(renderer); } -static HRESULT -D3D11_CreateBlendMode(SDL_Renderer * renderer, - BOOL enableBlending, - D3D11_BLEND srcBlend, - D3D11_BLEND destBlend, - D3D11_BLEND srcBlendAlpha, - D3D11_BLEND destBlendAlpha, - ID3D11BlendState ** blendStateOutput) +static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3D11_BLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3D11_BLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3D11_BLEND_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3D11_BLEND_INV_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3D11_BLEND_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3D11_BLEND_INV_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3D11_BLEND_DEST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3D11_BLEND_INV_DEST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3D11_BLEND_DEST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3D11_BLEND_INV_DEST_ALPHA; + default: + return (D3D11_BLEND)0; + } +} + +static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return D3D11_BLEND_OP_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return D3D11_BLEND_OP_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return D3D11_BLEND_OP_REV_SUBTRACT; + case SDL_BLENDOPERATION_MINIMUM: + return D3D11_BLEND_OP_MIN; + case SDL_BLENDOPERATION_MAXIMUM: + return D3D11_BLEND_OP_MAX; + default: + return (D3D11_BLEND_OP)0; + } +} + +static SDL_bool +D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + ID3D11BlendState *blendState = NULL; + D3D11_BlendMode *blendModes; HRESULT result = S_OK; D3D11_BLEND_DESC blendDesc; SDL_zero(blendDesc); blendDesc.AlphaToCoverageEnable = FALSE; blendDesc.IndependentBlendEnable = FALSE; - blendDesc.RenderTarget[0].BlendEnable = enableBlending; - blendDesc.RenderTarget[0].SrcBlend = srcBlend; - blendDesc.RenderTarget[0].DestBlend = destBlend; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].SrcBlendAlpha = srcBlendAlpha; - blendDesc.RenderTarget[0].DestBlendAlpha = destBlendAlpha; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor); + blendDesc.RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor); + blendDesc.RenderTarget[0].BlendOp = GetBlendEquation(colorOperation); + blendDesc.RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor); + blendDesc.RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor); + blendDesc.RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation); blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, blendStateOutput); + result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, &blendState); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBlendState", result); - return result; + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result); + return SDL_FALSE; } - return S_OK; + blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes)); + if (!blendModes) { + SAFE_RELEASE(blendState); + SDL_OutOfMemory(); + return SDL_FALSE; + } + blendModes[data->blendModesCount].blendMode = blendMode; + blendModes[data->blendModesCount].blendState = blendState; + data->blendModes = blendModes; + ++data->blendModesCount; + + return SDL_TRUE; } /* Create resources that depend on the device. */ @@ -976,13 +531,12 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc; D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc; - IDXGIAdapter *d3dAdapter = NULL; ID3D11Device *d3dDevice = NULL; ID3D11DeviceContext *d3dContext = NULL; IDXGIDevice1 *dxgiDevice = NULL; HRESULT result = S_OK; UINT creationFlags; - const char *hint; + int i; /* This array defines the set of DirectX hardware feature levels this app will support. * Note the ordering should be preserved. @@ -1000,14 +554,6 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) D3D_FEATURE_LEVEL_9_1 }; - /* Declare how the input layout for SDL's vertex shader will be setup: */ - const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - D3D11_BUFFER_DESC constantBufferDesc; D3D11_SAMPLER_DESC samplerDesc; D3D11_RASTERIZER_DESC rasterDesc; @@ -1041,16 +587,16 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) } #endif /* __WINRT__ */ - result = CreateDXGIFactoryFunc(&IID_IDXGIFactory2, &data->dxgiFactory); + result = CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result); goto done; } /* FIXME: Should we use the default adapter? */ result = IDXGIFactory2_EnumAdapters(data->dxgiFactory, 0, &data->dxgiAdapter); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result); goto done; } @@ -1060,8 +606,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; /* Make sure Direct3D's debugging feature gets used, if the app requests it. */ - hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D11_DEBUG); - if (hint && SDL_atoi(hint) > 0) { + if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE)) { creationFlags |= D3D11_CREATE_DEVICE_DEBUG; } @@ -1079,25 +624,25 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) &d3dContext /* Returns the device immediate context. */ ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result); goto done; } - result = ID3D11Device_QueryInterface(d3dDevice, &IID_ID3D11Device1, &data->d3dDevice); + result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_ID3D11Device1, (void **)&data->d3dDevice); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to ID3D11Device1", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to ID3D11Device1"), result); goto done; } - result = ID3D11DeviceContext_QueryInterface(d3dContext, &IID_ID3D11DeviceContext1, &data->d3dContext); + result = ID3D11DeviceContext_QueryInterface(d3dContext, &SDL_IID_ID3D11DeviceContext1, (void **)&data->d3dContext); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext to ID3D11DeviceContext1", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext to ID3D11DeviceContext1"), result); goto done; } - result = ID3D11Device_QueryInterface(d3dDevice, &IID_IDXGIDevice1, &dxgiDevice); + result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_IDXGIDevice1, (void **)&dxgiDevice); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice1", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to IDXGIDevice1"), result); goto done; } @@ -1106,7 +651,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) */ result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIDevice1::SetMaximumFrameLatency"), result); goto done; } @@ -1135,68 +680,19 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) break; default: - SDL_SetError(__FUNCTION__ ", Unexpected feature level: %d", data->featureLevel); + SDL_SetError("%s, Unexpected feature level: %d", __FUNCTION__, data->featureLevel); result = E_FAIL; goto done; } - /* Load in SDL's one and only vertex shader: */ - result = ID3D11Device_CreateVertexShader(data->d3dDevice, - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - NULL, - &data->vertexShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateVertexShader", result); - goto done; - } - - /* Create an input layout for SDL's vertex shader: */ - result = ID3D11Device_CreateInputLayout(data->d3dDevice, - vertexDesc, - ARRAYSIZE(vertexDesc), - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - &data->inputLayout - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateInputLayout", result); + if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) { goto done; } - /* Load in SDL's pixel shaders */ - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Colors, - sizeof(D3D11_PixelShader_Colors), - NULL, - &data->colorPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['color' shader]", result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Textures, - sizeof(D3D11_PixelShader_Textures), - NULL, - &data->texturePixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['textures' shader]", result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_YUV, - sizeof(D3D11_PixelShader_YUV), - NULL, - &data->yuvPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['yuv' shader]", result); - goto done; + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) { + goto done; + } } /* Setup space to hold vertex shader constants: */ @@ -1210,7 +706,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) &data->vertexShaderConstants ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex shader constants]"), result); goto done; } @@ -1230,7 +726,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) &data->nearestPixelSampler ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [nearest-pixel filter]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [nearest-pixel filter]"), result); goto done; } @@ -1240,7 +736,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) &data->linearSampler ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [linear filter]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [linear filter]"), result); goto done; } @@ -1258,53 +754,21 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) rasterDesc.SlopeScaledDepthBias = 0.0f; result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->mainRasterizer); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [main rasterizer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [main rasterizer]"), result); goto done; } rasterDesc.ScissorEnable = TRUE; result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->clippedRasterizer); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [clipped rasterizer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [clipped rasterizer]"), result); goto done; } /* Create blending states: */ - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlend */ - D3D11_BLEND_ONE, /* srcBlendAlpha */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlendAlpha */ - &data->blendModeBlend); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_ONE, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeAdd); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_ZERO, /* srcBlend */ - D3D11_BLEND_SRC_COLOR, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeMod); - if (FAILED(result)) { + if (!D3D11_CreateBlendState(renderer, SDL_BLENDMODE_BLEND) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_ADD) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_MOD)) { /* D3D11_CreateBlendMode will set the SDL error, if it fails */ goto done; } @@ -1358,7 +822,6 @@ D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer * renderer) static int D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect, BOOL includeViewportOffset) { - D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer); switch (rotation) { case DXGI_MODE_ROTATION_IDENTITY: @@ -1444,7 +907,7 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h) &data->swapChain ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForCoreWindow", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForCoreWindow"), result); goto done; } } else if (usingXAML) { @@ -1454,18 +917,18 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h) NULL, &data->swapChain); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForComposition", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForComposition"), result); goto done; } #if WINAPI_FAMILY == WINAPI_FAMILY_APP result = ISwapChainBackgroundPanelNative_SetSwapChain(WINRT_GlobalSwapChainBackgroundPanelNative, (IDXGISwapChain *) data->swapChain); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ISwapChainBackgroundPanelNative::SetSwapChain", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ISwapChainBackgroundPanelNative::SetSwapChain"), result); goto done; } #else - SDL_SetError(__FUNCTION__ ", XAML support is not yet available for Windows Phone"); + SDL_SetError(SDL_COMPOSE_ERROR("XAML support is not yet available for Windows Phone")); result = E_FAIL; goto done; #endif @@ -1484,7 +947,7 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h) &data->swapChain ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForHwnd", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForHwnd"), result); goto done; } @@ -1545,7 +1008,7 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) */ goto done; } else if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::ResizeBuffers", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::ResizeBuffers"), result); goto done; } #endif @@ -1576,7 +1039,7 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) { result = IDXGISwapChain1_SetRotation(data->swapChain, data->rotation); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::SetRotation", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::SetRotation"), result); goto done; } } @@ -1584,11 +1047,11 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) result = IDXGISwapChain_GetBuffer(data->swapChain, 0, - &IID_ID3D11Texture2D, - &backBuffer + &SDL_IID_ID3D11Texture2D, + (void **)&backBuffer ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::GetBuffer [back-buffer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::GetBuffer [back-buffer]"), result); goto done; } @@ -1599,7 +1062,7 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) &data->mainRenderTargetView ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device::CreateRenderTargetView", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateRenderTargetView"), result); goto done; } @@ -1618,14 +1081,12 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) static HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer) { - D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; return D3D11_CreateWindowSizeDependentResources(renderer); } HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer) { - D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; HRESULT result = S_OK; D3D11_ReleaseAll(renderer); @@ -1661,7 +1122,7 @@ D3D11_Trim(SDL_Renderer * renderer) HRESULT result = S_OK; IDXGIDevice3 *dxgiDevice = NULL; - result = ID3D11Device_QueryInterface(data->d3dDevice, &IID_IDXGIDevice3, &dxgiDevice); + result = ID3D11Device_QueryInterface(data->d3dDevice, &SDL_IID_IDXGIDevice3, &dxgiDevice); if (FAILED(result)) { //WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice3", result); return; @@ -1681,15 +1142,23 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -static D3D11_FILTER -GetScaleQuality(void) +static SDL_bool +D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return D3D11_FILTER_MIN_MAG_MIP_POINT; - } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ { - return D3D11_FILTER_MIN_MAG_MIP_LINEAR; - } + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendEquation(colorOperation) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || + !GetBlendEquation(alphaOperation)) { + return SDL_FALSE; + } + return SDL_TRUE; } static int @@ -1702,7 +1171,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) D3D11_TEXTURE2D_DESC textureDesc; D3D11_SHADER_RESOURCE_VIEW_DESC resourceViewDesc; - if (textureFormat == SDL_PIXELFORMAT_UNKNOWN) { + if (textureFormat == DXGI_FORMAT_UNKNOWN) { return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified", __FUNCTION__, texture->format); } @@ -1712,7 +1181,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_OutOfMemory(); return -1; } - textureData->scaleMode = GetScaleQuality(); + textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR; texture->driverdata = textureData; @@ -1747,7 +1216,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return -1; } @@ -1755,8 +1224,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { textureData->yuv = SDL_TRUE; - textureDesc.Width /= 2; - textureDesc.Height /= 2; + textureDesc.Width = (textureDesc.Width + 1) / 2; + textureDesc.Height = (textureDesc.Height + 1) / 2; result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, &textureDesc, @@ -1765,7 +1234,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return -1; } @@ -1776,7 +1245,29 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; + } + } + + if (texture->format == SDL_PIXELFORMAT_NV12 || + texture->format == SDL_PIXELFORMAT_NV21) { + D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc; + + textureData->nv12 = SDL_TRUE; + + nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM; + nvTextureDesc.Width = (textureDesc.Width + 1) / 2; + nvTextureDesc.Height = (textureDesc.Height + 1) / 2; + + result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, + &nvTextureDesc, + NULL, + &textureData->mainTextureNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return -1; } } @@ -1792,7 +1283,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); return -1; } @@ -1804,7 +1295,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); return -1; } result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, @@ -1814,7 +1305,24 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; + } + } + + if (textureData->nv12) { + D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc; + + nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM; + + result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, + (ID3D11Resource *)textureData->mainTextureNV, + &nvResourceViewDesc, + &textureData->mainTextureResourceViewNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); return -1; } } @@ -1831,7 +1339,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) &textureData->mainTextureRenderTargetView); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); return -1; } } @@ -1863,7 +1371,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, } static int -D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch) { ID3D11Texture2D *stagingTexture; const Uint8 *src; @@ -1887,7 +1395,7 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex NULL, &stagingTexture); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); return -1; } @@ -1900,14 +1408,14 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex &textureMemory ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(stagingTexture); return -1; } src = (const Uint8 *)pixels; dst = textureMemory.pData; - length = w * SDL_BYTESPERPIXEL(format); + length = w * bpp; if (length == pitch && length == textureMemory.RowPitch) { SDL_memcpy(dst, src, length*h); } else { @@ -1958,7 +1466,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { return -1; } @@ -1966,13 +1474,22 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { + return -1; + } + + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2)); + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { return -1; } + } + if (textureData->nv12) { /* Skip to the correct offset into the next texture */ - srcPixels = (const void*)((const Uint8*)srcPixels + (rect->h * srcPitch) / 4); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); + + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) { return -1; } } @@ -1994,13 +1511,13 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -2021,7 +1538,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { /* It's more efficient to upload directly... */ if (!textureData->pixels) { textureData->pitch = texture->w; @@ -2062,7 +1579,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, NULL, &textureData->stagingTexture); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); return -1; } @@ -2075,7 +1592,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, &textureMemory ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(textureData->stagingTexture); return -1; } @@ -2104,7 +1621,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) return; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { const SDL_Rect *rect = &textureData->locked_rect; void *pixels = (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch + @@ -2359,7 +1876,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &mappedResource ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [vertex buffer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result); return -1; } SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes); @@ -2383,7 +1900,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &rendererData->vertexBuffer ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex buffer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result); return -1; } @@ -2430,19 +1947,21 @@ D3D11_RenderSetBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; ID3D11BlendState *blendState = NULL; - switch (blendMode) { - case SDL_BLENDMODE_BLEND: - blendState = rendererData->blendModeBlend; - break; - case SDL_BLENDMODE_ADD: - blendState = rendererData->blendModeAdd; - break; - case SDL_BLENDMODE_MOD: - blendState = rendererData->blendModeMod; - break; - case SDL_BLENDMODE_NONE: - blendState = NULL; - break; + if (blendMode != SDL_BLENDMODE_NONE) { + int i; + for (i = 0; i < rendererData->blendModesCount; ++i) { + if (blendMode == rendererData->blendModes[i].blendMode) { + blendState = rendererData->blendModes[i].blendState; + break; + } + } + if (!blendState) { + if (D3D11_CreateBlendState(renderer, blendMode)) { + /* Successfully created the blend state, try again */ + D3D11_RenderSetBlendMode(renderer, blendMode); + } + return; + } } if (blendState != rendererData->currentBlendState) { ID3D11DeviceContext_OMSetBlendState(rendererData->d3dContext, blendState, 0, 0xFFFFFFFF); @@ -2505,7 +2024,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2518,7 +2037,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2544,7 +2063,7 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2557,12 +2076,18 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, count); + + if (points[0].x != points[count - 1].x || points[0].y != points[count - 1].y) { + ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + ID3D11DeviceContext_Draw(rendererData->d3dContext, 1, count - 1); + } + SDL_stack_free(vertices); return 0; } @@ -2596,7 +2121,7 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2607,32 +2132,100 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, return 0; } -static ID3D11SamplerState * -D3D11_RenderGetSampler(SDL_Renderer * renderer, SDL_Texture * texture) +static int +D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture) { D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata; + ID3D11SamplerState *textureSampler; switch (textureData->scaleMode) { case D3D11_FILTER_MIN_MAG_MIP_POINT: - return rendererData->nearestPixelSampler; + textureSampler = rendererData->nearestPixelSampler; + break; case D3D11_FILTER_MIN_MAG_MIP_LINEAR: - return rendererData->linearSampler; + textureSampler = rendererData->linearSampler; + break; default: - return NULL; + return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); + } + + if (textureData->yuv) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewU, + textureData->mainTextureResourceViewV + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = SHADER_YUV_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = SHADER_YUV_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = SHADER_YUV_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else if (textureData->nv12) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewNV, + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else { + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[SHADER_RGB], + 1, + &textureData->mainTextureResourceView, + textureSampler); } + + return 0; } static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect) { - D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata; - D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata; float minu, maxu, minv, maxv; Float4 color; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2687,26 +2280,8 @@ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); @@ -2719,14 +2294,11 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) { - D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata; - D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata; float minu, maxu, minv, maxv; Float4 color; Float4X4 modelMatrix; float minx, maxx, miny, maxy; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2803,26 +2375,8 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); @@ -2842,18 +2396,18 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, HRESULT result; int status = -1; D3D11_TEXTURE2D_DESC stagingTextureDesc; - D3D11_RECT srcRect; + D3D11_RECT srcRect = {0, 0, 0, 0}; D3D11_BOX srcBox; D3D11_MAPPED_SUBRESOURCE textureMemory; /* Retrieve a pointer to the back buffer: */ result = IDXGISwapChain_GetBuffer(data->swapChain, 0, - &IID_ID3D11Texture2D, - &backBuffer + &SDL_IID_ID3D11Texture2D, + (void **)&backBuffer ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::GetBuffer [get back buffer]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::GetBuffer [get back buffer]"), result); goto done; } @@ -2870,7 +2424,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, NULL, &stagingTexture); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); goto done; } @@ -2902,7 +2456,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, 0, &textureMemory); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); goto done; } @@ -2921,7 +2475,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, * Get the error message, and attach some extra data to it. */ char errorMessage[1024]; - SDL_snprintf(errorMessage, sizeof(errorMessage), __FUNCTION__ ", Convert Pixels failed: %s", SDL_GetError()); + SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", __FUNCTION__, SDL_GetError()); SDL_SetError("%s", errorMessage); goto done; } @@ -2991,7 +2545,7 @@ D3D11_RenderPresent(SDL_Renderer * renderer) /* We probably went through a fullscreen <-> windowed transition */ D3D11_CreateWindowSizeDependentResources(renderer); } else { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::Present", result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::Present"), result); } } } diff --git a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.cpp b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.cpp similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.cpp rename to 3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.cpp index 99f2b4ea42..2f2c3e54b2 100644 --- a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.cpp +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.h b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.h rename to 3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.h index 734ebf41aa..7bb8fb78b2 100644 --- a/3rdparty/sdl2-2.0.4/src/render/direct3d11/SDL_render_winrt.h +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.c b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.c new file mode 100644 index 0000000000..f1277b9c03 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.c @@ -0,0 +1,1957 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED + +#include "SDL_stdinc.h" + +#define COBJMACROS +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d11.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + + +/* Direct3D 11.x shaders + + SDL's shaders are compiled into SDL itself, to simplify distribution. + + All Direct3D 11.x shaders were compiled with the following: + + fxc /E"main" /T "" /Fo"" "" + + Variables: + - : the type of shader. A table of utilized shader types is + listed below. + - : where to store compiled output + - : where to read shader source code from + + Shader types: + - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT + - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT + - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 + - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 + + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' + */ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 +#else +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 +#endif + +/* The color-only-rendering pixel shader: + + --- D3D11_PixelShader_Colors.hlsl --- + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'colors' pixel shader is not defined." +#endif + +/* The texture-rendering pixel shader: + + --- D3D11_PixelShader_Textures.hlsl --- + Texture2D theTexture : register(t0); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return theTexture.Sample(theSampler, input.tex) * input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'textures' pixel shader is not defined" +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, + 0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, + 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, + 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, + 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, + 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0x754ba6c4, 0xe321a747, 0x23680787, 0x6bb1bdcc, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0xb6219b20, 0xb71bbcf7, 0xf361cc45, 0xc4d5f5be, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The sole vertex shader: + + --- D3D11_VertexShader.hlsl --- + #pragma pack_matrix( row_major ) + + cbuffer VertexShaderConstants : register(b0) + { + matrix model; + matrix projectionAndView; + }; + + struct VertexShaderInput + { + float3 pos : POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + struct VertexShaderOutput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + VertexShaderOutput main(VertexShaderInput input) + { + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, projectionAndView); + output.pos = pos; + + // Pass through texture coordinates and color values without transformation + output.tex = input.tex; + output.color = input.color; + + return output; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#else +#error "An appropriate vertex shader is not defined." +#endif + +static struct +{ + const void *shader_data; + SIZE_T shader_size; +} D3D11_shaders[] = { + { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, + { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, + { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, + { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, + { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, + { D3D11_PixelShader_NV12_JPEG, sizeof(D3D11_PixelShader_NV12_JPEG) }, + { D3D11_PixelShader_NV12_BT601, sizeof(D3D11_PixelShader_NV12_BT601) }, + { D3D11_PixelShader_NV12_BT709, sizeof(D3D11_PixelShader_NV12_BT709) }, + { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, + { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, + { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, +}; + +int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) +{ + /* Declare how the input layout for SDL's vertex shader will be setup: */ + const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + HRESULT result; + + /* Load in SDL's one and only vertex shader: */ + result = ID3D11Device_CreateVertexShader(d3dDevice, + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + NULL, + vertexShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result); + } + + /* Create an input layout for SDL's vertex shader: */ + result = ID3D11Device_CreateInputLayout(d3dDevice, + vertexDesc, + ARRAYSIZE(vertexDesc), + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + inputLayout + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result); + } + return 0; +} + +int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader) +{ + HRESULT result; + + result = ID3D11Device_CreatePixelShader(d3dDevice, + D3D11_shaders[shader].shader_data, + D3D11_shaders[shader].shader_size, + NULL, + pixelShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader"), result); + } + return 0; +} + +#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.h b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.h new file mode 100644 index 0000000000..b28b5728f3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/direct3d11/SDL_shaders_d3d11.h @@ -0,0 +1,43 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D11 shader implementation */ + +typedef enum { + SHADER_SOLID, + SHADER_RGB, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, + NUM_SHADERS +} D3D11_Shader; + +extern int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout); +extern int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/render/metal/SDL_render_metal.m b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_render_metal.m new file mode 100644 index 0000000000..5b4d8ea27c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_render_metal.m @@ -0,0 +1,1455 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_assert.h" +#include "SDL_syswm.h" +#include "../SDL_sysrender.h" + +#ifdef __MACOSX__ +#include "../../video/cocoa/SDL_cocoametalview.h" +#else +#include "../../video/uikit/SDL_uikitmetalview.h" +#endif +#include +#import +#import + +/* Regenerate these with build-metal-shaders.sh */ +#ifdef __MACOSX__ +#include "SDL_shaders_metal_osx.h" +#else +#include "SDL_shaders_metal_ios.h" +#endif + +/* Apple Metal renderer implementation */ + +static SDL_Renderer *METAL_CreateRenderer(SDL_Window * window, Uint32 flags); +static void METAL_WindowEvent(SDL_Renderer * renderer, + const SDL_WindowEvent *event); +static int METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); +static int METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, + int pitch); +static int METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch); +static int METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch); +static void METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateViewport(SDL_Renderer * renderer); +static int METAL_UpdateClipRect(SDL_Renderer * renderer); +static int METAL_RenderClear(SDL_Renderer * renderer); +static int METAL_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderDrawLines(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderFillRects(SDL_Renderer * renderer, + const SDL_FRect * rects, int count); +static int METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect); +static int METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); +static int METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch); +static void METAL_RenderPresent(SDL_Renderer * renderer); +static void METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static void METAL_DestroyRenderer(SDL_Renderer * renderer); +static void *METAL_GetMetalLayer(SDL_Renderer * renderer); +static void *METAL_GetMetalCommandEncoder(SDL_Renderer * renderer); + +SDL_RenderDriver METAL_RenderDriver = { + METAL_CreateRenderer, + { + "metal", + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), + 6, + { + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 + }, + 0, 0, + } +}; + +/* macOS requires constants in a buffer to have a 256 byte alignment. */ +#ifdef __MACOSX__ +#define CONSTANT_ALIGN 256 +#else +#define CONSTANT_ALIGN 4 +#endif + +#define ALIGN_CONSTANTS(size) ((size + CONSTANT_ALIGN - 1) & (~(CONSTANT_ALIGN - 1))) + +static const size_t CONSTANTS_OFFSET_IDENTITY = 0; +static const size_t CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM = ALIGN_CONSTANTS(CONSTANTS_OFFSET_IDENTITY + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_JPEG = ALIGN_CONSTANTS(CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_BT601 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_JPEG + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_DECODE_BT709 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT601 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_CLEAR_VERTS = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT709 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_LENGTH = CONSTANTS_OFFSET_CLEAR_VERTS + sizeof(float) * 6; + +typedef enum SDL_MetalVertexFunction +{ + SDL_METAL_VERTEX_SOLID, + SDL_METAL_VERTEX_COPY, +} SDL_MetalVertexFunction; + +typedef enum SDL_MetalFragmentFunction +{ + SDL_METAL_FRAGMENT_SOLID = 0, + SDL_METAL_FRAGMENT_COPY, + SDL_METAL_FRAGMENT_YUV, + SDL_METAL_FRAGMENT_NV12, + SDL_METAL_FRAGMENT_NV21, + SDL_METAL_FRAGMENT_COUNT, +} SDL_MetalFragmentFunction; + +typedef struct METAL_PipelineState +{ + SDL_BlendMode blendMode; + void *pipe; +} METAL_PipelineState; + +typedef struct METAL_PipelineCache +{ + METAL_PipelineState *states; + int count; + SDL_MetalVertexFunction vertexFunction; + SDL_MetalFragmentFunction fragmentFunction; + MTLPixelFormat renderTargetFormat; + const char *label; +} METAL_PipelineCache; + +/* Each shader combination used by drawing functions has a separate pipeline + * cache, and we have a separate list of caches for each render target pixel + * format. This is more efficient than iterating over a global cache to find + * the pipeline based on the specified shader combination and RT pixel format, + * since we know what the RT pixel format is when we set the render target, and + * we know what the shader combination is inside each drawing function's code. */ +typedef struct METAL_ShaderPipelines +{ + MTLPixelFormat renderTargetFormat; + METAL_PipelineCache caches[SDL_METAL_FRAGMENT_COUNT]; +} METAL_ShaderPipelines; + +@interface METAL_RenderData : NSObject + @property (nonatomic, retain) id mtldevice; + @property (nonatomic, retain) id mtlcmdqueue; + @property (nonatomic, retain) id mtlcmdbuffer; + @property (nonatomic, retain) id mtlcmdencoder; + @property (nonatomic, retain) id mtllibrary; + @property (nonatomic, retain) id mtlbackbuffer; + @property (nonatomic, retain) id mtlsamplernearest; + @property (nonatomic, retain) id mtlsamplerlinear; + @property (nonatomic, retain) id mtlbufconstants; + @property (nonatomic, retain) CAMetalLayer *mtllayer; + @property (nonatomic, retain) MTLRenderPassDescriptor *mtlpassdesc; + @property (nonatomic, assign) METAL_ShaderPipelines *activepipelines; + @property (nonatomic, assign) METAL_ShaderPipelines *allpipelines; + @property (nonatomic, assign) int pipelinescount; +@end + +@implementation METAL_RenderData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtldevice release]; + [_mtlcmdqueue release]; + [_mtlcmdbuffer release]; + [_mtlcmdencoder release]; + [_mtllibrary release]; + [_mtlbackbuffer release]; + [_mtlsamplernearest release]; + [_mtlsamplerlinear release]; + [_mtlbufconstants release]; + [_mtllayer release]; + [_mtlpassdesc release]; + [super dealloc]; +} +#endif +@end + +@interface METAL_TextureData : NSObject + @property (nonatomic, retain) id mtltexture; + @property (nonatomic, retain) id mtltexture_uv; + @property (nonatomic, retain) id mtlsampler; + @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; + @property (nonatomic, assign) BOOL yuv; + @property (nonatomic, assign) BOOL nv12; + @property (nonatomic, assign) size_t conversionBufferOffset; +@end + +@implementation METAL_TextureData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtltexture release]; + [_mtltexture_uv release]; + [_mtlsampler release]; + [super dealloc]; +} +#endif +@end + +static int +IsMetalAvailable(const SDL_SysWMinfo *syswm) +{ + if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) { + return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment."); + } + + // this checks a weak symbol. +#if (defined(__MACOSX__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) + if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower. + return SDL_SetError("Metal framework not available on this system"); + } +#endif + + return 0; +} + +static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF; +static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF; + +static MTLBlendOperation +GetBlendOperation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: return MTLBlendOperationAdd; + case SDL_BLENDOPERATION_SUBTRACT: return MTLBlendOperationSubtract; + case SDL_BLENDOPERATION_REV_SUBTRACT: return MTLBlendOperationReverseSubtract; + case SDL_BLENDOPERATION_MINIMUM: return MTLBlendOperationMin; + case SDL_BLENDOPERATION_MAXIMUM: return MTLBlendOperationMax; + default: return invalidBlendOperation; + } +} + +static MTLBlendFactor +GetBlendFactor(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: return MTLBlendFactorZero; + case SDL_BLENDFACTOR_ONE: return MTLBlendFactorOne; + case SDL_BLENDFACTOR_SRC_COLOR: return MTLBlendFactorSourceColor; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return MTLBlendFactorOneMinusSourceColor; + case SDL_BLENDFACTOR_SRC_ALPHA: return MTLBlendFactorSourceAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: return MTLBlendFactorOneMinusSourceAlpha; + case SDL_BLENDFACTOR_DST_COLOR: return MTLBlendFactorDestinationColor; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: return MTLBlendFactorOneMinusDestinationColor; + case SDL_BLENDFACTOR_DST_ALPHA: return MTLBlendFactorDestinationAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return MTLBlendFactorOneMinusDestinationAlpha; + default: return invalidBlendFactor; + } +} + +static NSString * +GetVertexFunctionName(SDL_MetalVertexFunction function) +{ + switch (function) { + case SDL_METAL_VERTEX_SOLID: return @"SDL_Solid_vertex"; + case SDL_METAL_VERTEX_COPY: return @"SDL_Copy_vertex"; + default: return nil; + } +} + +static NSString * +GetFragmentFunctionName(SDL_MetalFragmentFunction function) +{ + switch (function) { + case SDL_METAL_FRAGMENT_SOLID: return @"SDL_Solid_fragment"; + case SDL_METAL_FRAGMENT_COPY: return @"SDL_Copy_fragment"; + case SDL_METAL_FRAGMENT_YUV: return @"SDL_YUV_fragment"; + case SDL_METAL_FRAGMENT_NV12: return @"SDL_NV12_fragment"; + case SDL_METAL_FRAGMENT_NV21: return @"SDL_NV21_fragment"; + default: return nil; + } +} + +static id +MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, + NSString *blendlabel, SDL_BlendMode blendmode) +{ + id mtlvertfn = [data.mtllibrary newFunctionWithName:GetVertexFunctionName(cache->vertexFunction)]; + id mtlfragfn = [data.mtllibrary newFunctionWithName:GetFragmentFunctionName(cache->fragmentFunction)]; + SDL_assert(mtlvertfn != nil); + SDL_assert(mtlfragfn != nil); + + MTLRenderPipelineDescriptor *mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init]; + mtlpipedesc.vertexFunction = mtlvertfn; + mtlpipedesc.fragmentFunction = mtlfragfn; + + MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0]; + + rtdesc.pixelFormat = cache->renderTargetFormat; + + if (blendmode != SDL_BLENDMODE_NONE) { + rtdesc.blendingEnabled = YES; + rtdesc.sourceRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcColorFactor(blendmode)); + rtdesc.destinationRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeDstColorFactor(blendmode)); + rtdesc.rgbBlendOperation = GetBlendOperation(SDL_GetBlendModeColorOperation(blendmode)); + rtdesc.sourceAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcAlphaFactor(blendmode)); + rtdesc.destinationAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeDstAlphaFactor(blendmode)); + rtdesc.alphaBlendOperation = GetBlendOperation(SDL_GetBlendModeAlphaOperation(blendmode)); + } else { + rtdesc.blendingEnabled = NO; + } + + mtlpipedesc.label = [@(cache->label) stringByAppendingString:blendlabel]; + + NSError *err = nil; + id state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err]; + SDL_assert(err == nil); + + METAL_PipelineState pipeline; + pipeline.blendMode = blendmode; + pipeline.pipe = (void *)CFBridgingRetain(state); + + METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); + +#if !__has_feature(objc_arc) + [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it? + [mtlvertfn release]; + [mtlfragfn release]; + [state release]; +#endif + + if (states) { + states[cache->count++] = pipeline; + cache->states = states; + return (__bridge id)pipeline.pipe; + } else { + CFBridgingRelease(pipeline.pipe); + SDL_OutOfMemory(); + return NULL; + } +} + +static void +MakePipelineCache(METAL_RenderData *data, METAL_PipelineCache *cache, const char *label, + MTLPixelFormat rtformat, SDL_MetalVertexFunction vertfn, SDL_MetalFragmentFunction fragfn) +{ + SDL_zerop(cache); + + cache->vertexFunction = vertfn; + cache->fragmentFunction = fragfn; + cache->renderTargetFormat = rtformat; + cache->label = label; + + /* Create pipeline states for the default blend modes. Custom blend modes + * will be added to the cache on-demand. */ + MakePipelineState(data, cache, @" (blend=none)", SDL_BLENDMODE_NONE); + MakePipelineState(data, cache, @" (blend=blend)", SDL_BLENDMODE_BLEND); + MakePipelineState(data, cache, @" (blend=add)", SDL_BLENDMODE_ADD); + MakePipelineState(data, cache, @" (blend=mod)", SDL_BLENDMODE_MOD); +} + +static void +DestroyPipelineCache(METAL_PipelineCache *cache) +{ + if (cache != NULL) { + for (int i = 0; i < cache->count; i++) { + CFBridgingRelease(cache->states[i].pipe); + } + + SDL_free(cache->states); + } +} + +void +MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat) +{ + SDL_zerop(pipelines); + + pipelines->renderTargetFormat = rtformat; + + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_SOLID], "SDL primitives pipeline", rtformat, SDL_METAL_VERTEX_SOLID, SDL_METAL_FRAGMENT_SOLID); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_COPY], "SDL copy pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_COPY); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_YUV], "SDL YUV pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_YUV); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV12], "SDL NV12 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV12); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV21], "SDL NV21 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV21); +} + +static METAL_ShaderPipelines * +ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat) +{ + METAL_ShaderPipelines *allpipelines = data.allpipelines; + int count = data.pipelinescount; + + for (int i = 0; i < count; i++) { + if (allpipelines[i].renderTargetFormat == rtformat) { + return &allpipelines[i]; + } + } + + allpipelines = SDL_realloc(allpipelines, (count + 1) * sizeof(METAL_ShaderPipelines)); + + if (allpipelines == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + MakeShaderPipelines(data, &allpipelines[count], rtformat); + + data.allpipelines = allpipelines; + data.pipelinescount = count + 1; + + return &data.allpipelines[count]; +} + +static void +DestroyAllPipelines(METAL_ShaderPipelines *allpipelines, int count) +{ + if (allpipelines != NULL) { + for (int i = 0; i < count; i++) { + for (int cache = 0; cache < SDL_METAL_FRAGMENT_COUNT; cache++) { + DestroyPipelineCache(&allpipelines[i].caches[cache]); + } + } + + SDL_free(allpipelines); + } +} + +static inline id +ChoosePipelineState(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode) +{ + METAL_PipelineCache *cache = &pipelines->caches[fragfn]; + + for (int i = 0; i < cache->count; i++) { + if (cache->states[i].blendMode == blendmode) { + return (__bridge id)cache->states[i].pipe; + } + } + + return MakePipelineState(data, cache, [NSString stringWithFormat:@" (blend=custom 0x%x)", blendmode], blendmode); +} + +static SDL_Renderer * +METAL_CreateRenderer(SDL_Window * window, Uint32 flags) +{ @autoreleasepool { + SDL_Renderer *renderer = NULL; + METAL_RenderData *data = NULL; + id mtldevice = nil; + SDL_SysWMinfo syswm; + + SDL_VERSION(&syswm.version); + if (!SDL_GetWindowWMInfo(window, &syswm)) { + return NULL; + } + + if (IsMetalAvailable(&syswm) == -1) { + return NULL; + } + + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + // !!! FIXME: MTLCopyAllDevices() can find other GPUs on macOS... + mtldevice = MTLCreateSystemDefaultDevice(); + + if (mtldevice == nil) { + SDL_free(renderer); + SDL_SetError("Failed to obtain Metal device"); + return NULL; + } + + // !!! FIXME: error checking on all of this. + data = [[METAL_RenderData alloc] init]; + + renderer->driverdata = (void*)CFBridgingRetain(data); + renderer->window = window; + +#ifdef __MACOSX__ + NSView *view = Cocoa_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; + + layer.device = mtldevice; + + //layer.colorspace = nil; + +#else + UIView *view = UIKit_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; +#endif + + // Necessary for RenderReadPixels. + layer.framebufferOnly = NO; + + data.mtldevice = layer.device; + data.mtllayer = layer; + id mtlcmdqueue = [data.mtldevice newCommandQueue]; + data.mtlcmdqueue = mtlcmdqueue; + data.mtlcmdqueue.label = @"SDL Metal Renderer"; + data.mtlpassdesc = [MTLRenderPassDescriptor renderPassDescriptor]; + + NSError *err = nil; + + // The compiled .metallib is embedded in a static array in a header file + // but the original shader source code is in SDL_shaders_metal.metal. + dispatch_data_t mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{}); + id mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; + data.mtllibrary = mtllibrary; + SDL_assert(err == nil); +#if !__has_feature(objc_arc) + dispatch_release(mtllibdata); +#endif + data.mtllibrary.label = @"SDL Metal renderer shader library"; + + /* Do some shader pipeline state loading up-front rather than on demand. */ + data.pipelinescount = 0; + data.allpipelines = NULL; + ChooseShaderPipelines(data, MTLPixelFormatBGRA8Unorm); + + MTLSamplerDescriptor *samplerdesc = [[MTLSamplerDescriptor alloc] init]; + + samplerdesc.minFilter = MTLSamplerMinMagFilterNearest; + samplerdesc.magFilter = MTLSamplerMinMagFilterNearest; + id mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplernearest = mtlsamplernearest; + + samplerdesc.minFilter = MTLSamplerMinMagFilterLinear; + samplerdesc.magFilter = MTLSamplerMinMagFilterLinear; + id mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplerlinear = mtlsamplerlinear; + + /* Note: matrices are column major. */ + float identitytransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + + float halfpixeltransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.5f, 0.5f, 0.0f, 1.0f, + }; + + /* Metal pads float3s to 16 bytes. */ + float decodetransformJPEG[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT601[4*4] = { + -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */ + 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */ + 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT709[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float clearverts[6] = {0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f}; + + id mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; + mtlbufconstantstaging.label = @"SDL constant staging data"; + + id mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate]; + data.mtlbufconstants = mtlbufconstants; + data.mtlbufconstants.label = @"SDL constant data"; + + char *constantdata = [mtlbufconstantstaging contents]; + SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, halfpixeltransform, sizeof(halfpixeltransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_JPEG, decodetransformJPEG, sizeof(decodetransformJPEG)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT601, decodetransformBT601, sizeof(decodetransformBT601)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT709, decodetransformBT709, sizeof(decodetransformBT709)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_CLEAR_VERTS, clearverts, sizeof(clearverts)); + + id cmdbuffer = [data.mtlcmdqueue commandBuffer]; + id blitcmd = [cmdbuffer blitCommandEncoder]; + + [blitcmd copyFromBuffer:mtlbufconstantstaging sourceOffset:0 toBuffer:data.mtlbufconstants destinationOffset:0 size:CONSTANTS_LENGTH]; + + [blitcmd endEncoding]; + [cmdbuffer commit]; + + // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed. + + renderer->WindowEvent = METAL_WindowEvent; + renderer->GetOutputSize = METAL_GetOutputSize; + renderer->SupportsBlendMode = METAL_SupportsBlendMode; + renderer->CreateTexture = METAL_CreateTexture; + renderer->UpdateTexture = METAL_UpdateTexture; + renderer->UpdateTextureYUV = METAL_UpdateTextureYUV; + renderer->LockTexture = METAL_LockTexture; + renderer->UnlockTexture = METAL_UnlockTexture; + renderer->SetRenderTarget = METAL_SetRenderTarget; + renderer->UpdateViewport = METAL_UpdateViewport; + renderer->UpdateClipRect = METAL_UpdateClipRect; + renderer->RenderClear = METAL_RenderClear; + renderer->RenderDrawPoints = METAL_RenderDrawPoints; + renderer->RenderDrawLines = METAL_RenderDrawLines; + renderer->RenderFillRects = METAL_RenderFillRects; + renderer->RenderCopy = METAL_RenderCopy; + renderer->RenderCopyEx = METAL_RenderCopyEx; + renderer->RenderReadPixels = METAL_RenderReadPixels; + renderer->RenderPresent = METAL_RenderPresent; + renderer->DestroyTexture = METAL_DestroyTexture; + renderer->DestroyRenderer = METAL_DestroyRenderer; + renderer->GetMetalLayer = METAL_GetMetalLayer; + renderer->GetMetalCommandEncoder = METAL_GetMetalCommandEncoder; + + renderer->info = METAL_RenderDriver.info; + renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); + +#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13) + if (@available(macOS 10.13, *)) { + data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0; + } else +#endif + { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } + + /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ + int maxtexsize = 4096; +#if defined(__MACOSX__) + maxtexsize = 16384; +#elif defined(__TVOS__) + maxtexsize = 8192; +#ifdef __TVOS_11_0 + if (@available(tvOS 11.0, *)) { + if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { + maxtexsize = 16384; + } + } +#endif +#else +#ifdef __IPHONE_11_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { + maxtexsize = 16384; + } else +#endif +#ifdef __IPHONE_10_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { + maxtexsize = 16384; + } else +#endif + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) { + maxtexsize = 8192; + } else { + maxtexsize = 4096; + } +#endif + + renderer->info.max_texture_width = maxtexsize; + renderer->info.max_texture_height = maxtexsize; + +#if !__has_feature(objc_arc) + [mtlcmdqueue release]; + [mtllibrary release]; + [samplerdesc release]; + [mtlsamplernearest release]; + [mtlsamplerlinear release]; + [mtlbufconstants release]; + [view release]; + [data release]; + [mtldevice release]; +#endif + + return renderer; +}} + +static void +METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load) +{ + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Our SetRenderTarget just signals that the next render operation should + * set up a new render pass. This is where that work happens. */ + if (data.mtlcmdencoder == nil) { + id mtltexture = nil; + + if (renderer->target != NULL) { + METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->driverdata; + mtltexture = texdata.mtltexture; + } else { + if (data.mtlbackbuffer == nil) { + /* The backbuffer's contents aren't guaranteed to persist after + * presenting, so we can leave it undefined when loading it. */ + data.mtlbackbuffer = [data.mtllayer nextDrawable]; + if (load == MTLLoadActionLoad) { + load = MTLLoadActionDontCare; + } + } + mtltexture = data.mtlbackbuffer.texture; + } + + SDL_assert(mtltexture); + + if (load == MTLLoadActionClear) { + MTLClearColor color = MTLClearColorMake(renderer->r/255.0, renderer->g/255.0, renderer->b/255.0, renderer->a/255.0); + data.mtlpassdesc.colorAttachments[0].clearColor = color; + } + + data.mtlpassdesc.colorAttachments[0].loadAction = load; + data.mtlpassdesc.colorAttachments[0].texture = mtltexture; + + data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; + data.mtlcmdencoder = [data.mtlcmdbuffer renderCommandEncoderWithDescriptor:data.mtlpassdesc]; + + if (data.mtlbackbuffer != nil && mtltexture == data.mtlbackbuffer.texture) { + data.mtlcmdencoder.label = @"SDL metal renderer backbuffer"; + } else { + data.mtlcmdencoder.label = @"SDL metal renderer render target"; + } + + data.activepipelines = ChooseShaderPipelines(data, mtltexture.pixelFormat); + + /* Make sure the viewport and clip rect are set on the new render pass. */ + METAL_UpdateViewport(renderer); + METAL_UpdateClipRect(renderer); + } +} + +static void +METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + if (event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { + // !!! FIXME: write me + } +} + +static int +METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (w) { + *w = (int)data.mtllayer.drawableSize.width; + } + if (h) { + *h = (int)data.mtllayer.drawableSize.height; + } + return 0; +}} + +static SDL_bool +METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFactor(srcColorFactor) == invalidBlendFactor || + GetBlendFactor(srcAlphaFactor) == invalidBlendFactor || + GetBlendOperation(colorOperation) == invalidBlendOperation || + GetBlendFactor(dstColorFactor) == invalidBlendFactor || + GetBlendFactor(dstAlphaFactor) == invalidBlendFactor || + GetBlendOperation(alphaOperation) == invalidBlendOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static int +METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + MTLPixelFormat pixfmt; + + switch (texture->format) { + case SDL_PIXELFORMAT_ABGR8888: + pixfmt = MTLPixelFormatRGBA8Unorm; + break; + case SDL_PIXELFORMAT_ARGB8888: + pixfmt = MTLPixelFormatBGRA8Unorm; + break; + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pixfmt = MTLPixelFormatR8Unorm; + break; + default: + return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format)); + } + + MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt + width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO]; + + /* Not available in iOS 8. */ + if ([mtltexdesc respondsToSelector:@selector(usage)]) { + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; + } else { + mtltexdesc.usage = MTLTextureUsageShaderRead; + } + } + + id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + if (mtltexture == nil) { + return SDL_SetError("Texture allocation failed"); + } + + id mtltexture_uv = nil; + + BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); + BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); + + if (yuv) { + mtltexdesc.pixelFormat = MTLPixelFormatR8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + mtltexdesc.textureType = MTLTextureType2DArray; + mtltexdesc.arrayLength = 2; + } else if (nv12) { + mtltexdesc.pixelFormat = MTLPixelFormatRG8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + } + + if (yuv || nv12) { + mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + if (mtltexture_uv == nil) { +#if !__has_feature(objc_arc) + [mtltexture release]; +#endif + return SDL_SetError("Texture allocation failed"); + } + } + + METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; + if (texture->scaleMode == SDL_ScaleModeNearest) { + texturedata.mtlsampler = data.mtlsamplernearest; + } else { + texturedata.mtlsampler = data.mtlsamplerlinear; + } + texturedata.mtltexture = mtltexture; + texturedata.mtltexture_uv = mtltexture_uv; + + texturedata.yuv = yuv; + texturedata.nv12 = nv12; + + if (yuv) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV; + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12; + } else if (texture->format == SDL_PIXELFORMAT_NV21) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; + } else { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; + } + + if (yuv || nv12) { + size_t offset = 0; + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); + switch (mode) { + case SDL_YUV_CONVERSION_JPEG: offset = CONSTANTS_OFFSET_DECODE_JPEG; break; + case SDL_YUV_CONVERSION_BT601: offset = CONSTANTS_OFFSET_DECODE_BT601; break; + case SDL_YUV_CONVERSION_BT709: offset = CONSTANTS_OFFSET_DECODE_BT709; break; + default: offset = 0; break; + } + texturedata.conversionBufferOffset = offset; + } + + texture->driverdata = (void*)CFBridgingRetain(texturedata); + +#if !__has_feature(objc_arc) + [texturedata release]; + [mtltexture release]; + [mtltexture_uv release]; +#endif + + return 0; +}} + +static int +METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, int pitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + + /* !!! FIXME: replaceRegion does not do any synchronization, so it might + * !!! FIXME: stomp on a previous frame's data that's currently being read + * !!! FIXME: by the GPU. */ + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:pixels + bytesPerRow:pitch]; + + if (texturedata.yuv) { + int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; + int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + } + + if (texturedata.nv12) { + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:0 + withBytes:pixels + bytesPerRow:2 * ((pitch + 1) / 2) + bytesPerImage:0]; + } + + return 0; +}} + +static int +METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const int Uslice = 0; + const int Vslice = 1; + + /* Bail out if we're supposed to update an empty rectangle */ + if (rect->w <= 0 || rect->h <= 0) { + return 0; + } + + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:Yplane + bytesPerRow:Ypitch]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:Uplane + bytesPerRow:Upitch + bytesPerImage:0]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:Vplane + bytesPerRow:Vpitch + bytesPerImage:0]; + + return 0; +}} + +static int +METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch) +{ + return SDL_Unsupported(); // !!! FIXME: write me +} + +static void +METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + // !!! FIXME: write me +} + +static int +METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder) { + /* End encoding for the previous render target so we can set up a new + * render pass for this one. */ + [data.mtlcmdencoder endEncoding]; + [data.mtlcmdbuffer commit]; + + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + } + + /* We don't begin a new render pass right away - we delay it until an actual + * draw or clear happens. That way we can use hardware clears when possible, + * which are only available when beginning a new render pass. */ + return 0; +}} + +static int +METAL_SetOrthographicProjection(SDL_Renderer *renderer, int w, int h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + float projection[4][4]; + + if (!w || !h) { + return 0; + } + + /* Prepare an orthographic projection */ + projection[0][0] = 2.0f / w; + projection[0][1] = 0.0f; + projection[0][2] = 0.0f; + projection[0][3] = 0.0f; + projection[1][0] = 0.0f; + projection[1][1] = -2.0f / h; + projection[1][2] = 0.0f; + projection[1][3] = 0.0f; + projection[2][0] = 0.0f; + projection[2][1] = 0.0f; + projection[2][2] = 0.0f; + projection[2][3] = 0.0f; + projection[3][0] = -1.0f; + projection[3][1] = 1.0f; + projection[3][2] = 0.0f; + projection[3][3] = 1.0f; + + // !!! FIXME: This should be in a buffer... + [data.mtlcmdencoder setVertexBytes:projection length:sizeof(float)*16 atIndex:2]; + return 0; +}} + +static int +METAL_UpdateViewport(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLViewport viewport; + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + return 0; +}} + +static int +METAL_UpdateClipRect(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLScissorRect mtlrect; + // !!! FIXME: should this care about the viewport? + if (renderer->clipping_enabled) { + const SDL_Rect *rect = &renderer->clip_rect; + mtlrect.x = renderer->viewport.x + rect->x; + mtlrect.y = renderer->viewport.x + rect->y; + mtlrect.width = rect->w; + mtlrect.height = rect->h; + } else { + mtlrect.x = renderer->viewport.x; + mtlrect.y = renderer->viewport.y; + mtlrect.width = renderer->viewport.w; + mtlrect.height = renderer->viewport.h; + } + if (mtlrect.width > 0 && mtlrect.height > 0) { + [data.mtlcmdencoder setScissorRect:mtlrect]; + } + } + return 0; +}} + +static int +METAL_RenderClear(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Since we set up the render command encoder lazily when a draw is + * requested, we can do the fast path hardware clear if no draws have + * happened since the last SetRenderTarget. */ + if (data.mtlcmdencoder == nil) { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear); + } else { + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + MTLViewport viewport; // RenderClear ignores the viewport state, though, so reset that. + viewport.originX = viewport.originY = 0.0; + viewport.width = data.mtlpassdesc.colorAttachments[0].texture.width; + viewport.height = data.mtlpassdesc.colorAttachments[0].texture.height; + viewport.znear = 0.0; + viewport.zfar = 1.0; + + // Slow path for clearing: draw a filled fullscreen triangle. + METAL_SetOrthographicProjection(renderer, 1, 1); + [data.mtlcmdencoder setViewport:viewport]; + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, SDL_BLENDMODE_NONE)]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_CLEAR_VERTS atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3]; + + // reset the viewport for the rest of our usual drawing work... + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + + return 0; +}} + +// normalize a value from 0.0f to len into 0.0f to 1.0f. +static inline float +normtex(const float _val, const float len) +{ + return _val / len; +} + +static int +DrawVerts(SDL_Renderer * renderer, const SDL_FPoint * points, int count, + const MTLPrimitiveType primtype) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + const size_t vertlen = (sizeof (float) * 2) * count; + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + + [data.mtlcmdencoder setVertexBytes:points length:vertlen atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM atIndex:3]; + [data.mtlcmdencoder drawPrimitives:primtype vertexStart:0 vertexCount:count]; + + return 0; +}} + +static int +METAL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypePoint); +} + +static int +METAL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypeLineStrip); +} + +static int +METAL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + + for (int i = 0; i < count; i++, rects++) { + if ((rects->w <= 0.0f) || (rects->h <= 0.0f)) continue; + + const float verts[] = { + rects->x, rects->y + rects->h, + rects->x, rects->y, + rects->x + rects->w, rects->y + rects->h, + rects->x + rects->w, rects->y + }; + + [data.mtlcmdencoder setVertexBytes:verts length:sizeof(verts) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + } + + return 0; +}} + +static void +METAL_SetupRenderCopy(METAL_RenderData *data, SDL_Texture *texture, METAL_TextureData *texturedata) +{ + float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + if (texture->modMode) { + color[0] = ((float)texture->r) / 255.0f; + color[1] = ((float)texture->g) / 255.0f; + color[2] = ((float)texture->b) / 255.0f; + color[3] = ((float)texture->a) / 255.0f; + } + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, texturedata.fragmentFunction, texture->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0]; + + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; + + if (texturedata.yuv || texturedata.nv12) { + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; + [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; + } +} + +static int +METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + + METAL_SetupRenderCopy(data, texture, texturedata); + + const float xy[] = { + dstrect->x, dstrect->y + dstrect->h, + dstrect->x, dstrect->y, + dstrect->x + dstrect->w, dstrect->y + dstrect->h, + dstrect->x + dstrect->w, dstrect->y + }; + + const float uv[] = { + normtex(srcrect->x, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x, texw), normtex(srcrect->y, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y, texh) + }; + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + float transform[16]; + float minu, maxu, minv, maxv; + + METAL_SetupRenderCopy(data, texture, texturedata); + + minu = normtex(srcrect->x, texw); + maxu = normtex(srcrect->x + srcrect->w, texw); + minv = normtex(srcrect->y, texh); + maxv = normtex(srcrect->y + srcrect->h, texh); + + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + + const float uv[] = { + minu, maxv, + minu, minv, + maxu, maxv, + maxu, minv + }; + + const float xy[] = { + -center->x, dstrect->h - center->y, + -center->x, -center->y, + dstrect->w - center->x, dstrect->h - center->y, + dstrect->w - center->x, -center->y + }; + + { + float rads = (float)(M_PI * (float) angle / 180.0f); + float c = cosf(rads), s = sinf(rads); + SDL_memset(transform, 0, sizeof(transform)); + + transform[10] = transform[15] = 1.0f; + + /* Rotation */ + transform[0] = c; + transform[1] = s; + transform[4] = -s; + transform[5] = c; + + /* Translation */ + transform[12] = dstrect->x + center->x; + transform[13] = dstrect->y + center->y; + } + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBytes:transform length:sizeof(transform) atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Make sure we have a valid MTLTexture to read from, and an active command + * buffer we can wait for. */ + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + /* Wait for the current command buffer to finish, so we don't read from the + * texture before the GPU finishes rendering to it. */ + if (data.mtlcmdencoder) { + [data.mtlcmdencoder endEncoding]; + [data.mtlcmdbuffer commit]; + [data.mtlcmdbuffer waitUntilCompleted]; + + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + } + + id mtltexture = data.mtlpassdesc.colorAttachments[0].texture; + MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h); + + // we only do BGRA8 or RGBA8 at the moment, so 4 will do. + const int temp_pitch = rect->w * 4; + void *temp_pixels = SDL_malloc(temp_pitch * rect->h); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + + [mtltexture getBytes:temp_pixels bytesPerRow:temp_pitch fromRegion:mtlregion mipmapLevel:0]; + + const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888; + const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch); + SDL_free(temp_pixels); + + /* Set up an active command buffer and encoder once we're done. It will use + * the same texture that was active before (even if it's part of the swap + * chain), since we didn't clear that when waiting for the command buffer to + * complete. */ + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + return status; +}} + +static void +METAL_RenderPresent(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + if (data.mtlbackbuffer != nil) { + [data.mtlcmdbuffer presentDrawable:data.mtlbackbuffer]; + } + if (data.mtlcmdbuffer != nil) { + [data.mtlcmdbuffer commit]; + } + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + data.mtlbackbuffer = nil; +}} + +static void +METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + CFBridgingRelease(texture->driverdata); + texture->driverdata = NULL; +}} + +static void +METAL_DestroyRenderer(SDL_Renderer * renderer) +{ @autoreleasepool { + if (renderer->driverdata) { + METAL_RenderData *data = CFBridgingRelease(renderer->driverdata); + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + + DestroyAllPipelines(data.allpipelines, data.pipelinescount); + } + + SDL_free(renderer); +}} + +static void * +METAL_GetMetalLayer(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtllayer; +}} + +static void * +METAL_GetMetalCommandEncoder(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtlcmdencoder; +}} + +#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal.metal b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal.metal new file mode 100644 index 0000000000..8df3b753ef --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal.metal @@ -0,0 +1,109 @@ +#include +#include + +using namespace metal; + +struct SolidVertexOutput +{ + float4 position [[position]]; + float pointSize [[point_size]]; +}; + +vertex SolidVertexOutput SDL_Solid_vertex(const device float2 *position [[buffer(0)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + SolidVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.pointSize = 1.0f; + return v; +} + +fragment float4 SDL_Solid_fragment(constant float4 &col [[buffer(0)]]) +{ + return col; +} + +struct CopyVertexOutput +{ + float4 position [[position]]; + float2 texcoord; +}; + +vertex CopyVertexOutput SDL_Copy_vertex(const device float2 *position [[buffer(0)]], + const device float2 *texcoords [[buffer(1)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + CopyVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.texcoord = texcoords[vid]; + return v; +} + +fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + texture2d tex [[texture(0)]], + sampler s [[sampler(0)]]) +{ + return tex.sample(s, vert.texcoord) * col; +} + +struct YUVDecode +{ + float3 offset; + float3 Rcoeff; + float3 Gcoeff; + float3 Bcoeff; +}; + +fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d_array texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.y = texUV.sample(s, vert.texcoord, 0).r; + yuv.z = texUV.sample(s, vert.texcoord, 1).r; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).rg; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).gr; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} diff --git a/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_ios.h b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_ios.h new file mode 100644 index 0000000000..1c9325238f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_ios.h @@ -0,0 +1,1899 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd8, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xa1, 0x91, 0x35, 0x76, 0xce, 0x36, 0x38, 0x71, 0xba, 0x1c, 0x81, 0x62, + 0xda, 0x7c, 0x6b, 0x94, 0xc7, 0x88, 0x39, 0xd4, 0x91, 0xc2, 0xe7, 0xf9, + 0x21, 0x8c, 0x74, 0x25, 0xa9, 0xb0, 0x81, 0x85, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0x71, + 0xbb, 0x07, 0x58, 0x1b, 0x7c, 0x44, 0xaa, 0x03, 0xc8, 0xab, 0x11, 0xe4, + 0x63, 0xdb, 0xe3, 0xe6, 0xce, 0x52, 0x97, 0x34, 0x82, 0xf0, 0x46, 0x70, + 0xaa, 0xa9, 0x31, 0x51, 0x3c, 0xe8, 0x39, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x4a, 0x07, 0x48, 0xd3, 0xb7, 0x7a, 0x3a, 0x01, 0x6c, 0xaa, 0x80, + 0xde, 0x84, 0x6e, 0x3c, 0x9a, 0xdd, 0x55, 0x90, 0x43, 0xa6, 0xdd, 0xbb, + 0xd6, 0xeb, 0xea, 0x81, 0x62, 0xf6, 0x50, 0x04, 0x95, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x16, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x4c, 0xaa, 0x05, 0x27, 0x1a, 0x40, 0x5c, 0xe3, 0xd5, 0x46, + 0x38, 0xad, 0x07, 0xe7, 0x70, 0xdf, 0xde, 0x83, 0x74, 0x96, 0x26, 0x6e, + 0x35, 0x7b, 0xc9, 0xc5, 0x46, 0x08, 0x51, 0xb4, 0x13, 0xa8, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0xc9, 0x73, 0x33, 0x9a, 0x36, 0x6d, 0x15, 0x10, 0xa2, 0x81, + 0xaa, 0xbf, 0x27, 0xb1, 0x22, 0xc6, 0x0a, 0x7b, 0x68, 0x66, 0xdb, 0xe9, + 0xab, 0x19, 0x22, 0x40, 0x87, 0x6b, 0x10, 0x93, 0xc5, 0xf5, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x59, 0x54, 0x77, 0x75, 0xe5, 0xb6, 0xd5, 0x2e, 0xf7, + 0xb1, 0x9d, 0xd1, 0x75, 0x39, 0x4c, 0x97, 0x0f, 0x40, 0x58, 0xaa, 0xc9, + 0x42, 0xe8, 0x03, 0x29, 0x1e, 0x93, 0x63, 0x0c, 0x91, 0x38, 0xc8, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0x77, 0x01, 0x3e, 0x26, 0x2e, 0xc2, 0xe2, 0x34, + 0x70, 0xcf, 0x0c, 0x9e, 0x0d, 0xed, 0x69, 0xa4, 0x2a, 0x9c, 0x80, 0x06, + 0x52, 0xd1, 0x4b, 0x77, 0x6d, 0xda, 0x29, 0x27, 0x51, 0x25, 0xf4, 0x92, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x30, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, + 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, + 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, + 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, + 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, + 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, + 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, + 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, + 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, + 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, + 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, + 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, + 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, + 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x30, 0x02, 0x50, 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, + 0xd4, 0x46, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, + 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, + 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, + 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, + 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, + 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x2c, 0xcc, 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, + 0xd1, 0x4d, 0xa5, 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, + 0x81, 0x96, 0x6a, 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, + 0x45, 0xac, 0xce, 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, + 0xdb, 0xdb, 0x58, 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, + 0x19, 0x1e, 0x91, 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, + 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, + 0x0c, 0xe1, 0x10, 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x21, 0x16, 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, + 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, + 0xa5, 0xe9, 0x95, 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, + 0xa1, 0x02, 0x27, 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, + 0x04, 0x0c, 0x90, 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, + 0x60, 0xd1, 0x96, 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, + 0x05, 0x5a, 0xc2, 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, + 0x5c, 0xdb, 0x10, 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, + 0xe4, 0x40, 0x82, 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, + 0x05, 0x0c, 0x16, 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, + 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, + 0x59, 0xcc, 0x60, 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, + 0x0b, 0x19, 0x2c, 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, + 0xcf, 0x5b, 0x9b, 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8, + 0x18, 0x5a, 0x98, 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90, + 0xa1, 0x95, 0x15, 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06, + 0x43, 0x8c, 0x65, 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6, 0xe2, 0x06, + 0x8b, 0x1b, 0x34, 0xc8, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, + 0x0d, 0xd2, 0x81, 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, + 0x58, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, + 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, + 0x1d, 0xe4, 0xc1, 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, + 0x1c, 0xce, 0xa1, 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, + 0x1d, 0xde, 0xc1, 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0x60, 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, + 0x1c, 0x7e, 0xe1, 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, + 0x1e, 0xa6, 0x10, 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79, + 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29, + 0x81, 0x1a, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x45, 0x44, 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x84, 0x60, 0x9a, 0x46, 0x00, + 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x98, 0x01, 0xa0, 0x31, + 0x03, 0x40, 0x62, 0x06, 0x80, 0xc2, 0x0c, 0x00, 0x81, 0x11, 0x80, 0x31, + 0x02, 0x10, 0x04, 0x41, 0xfc, 0x03, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0xd1, 0x94, 0x4d, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x50, 0x57, 0x17, 0x50, 0x50, 0x06, 0x19, 0x82, 0x65, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x90, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x51, 0x76, 0x45, 0x93, 0xf1, 0x88, + 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, 0xc8, 0xc7, 0x02, 0x04, + 0x3e, 0xa6, 0xb0, 0x01, 0x0c, 0x86, 0x1b, 0x02, 0x0e, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xce, 0xa0, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xde, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x07, 0x06, 0xb3, + 0x0c, 0x44, 0x10, 0x8c, 0x47, 0x64, 0x6a, 0x00, 0x07, 0x6a, 0x40, 0x41, + 0x19, 0x8f, 0xd8, 0xd8, 0x40, 0x0e, 0xc6, 0x80, 0x82, 0x32, 0x1e, 0xd1, + 0xb9, 0x01, 0x1d, 0x98, 0x01, 0x05, 0x65, 0x3c, 0xe2, 0x83, 0x03, 0x3b, + 0x48, 0x03, 0x0a, 0xca, 0x78, 0x04, 0x18, 0xc8, 0x01, 0x1e, 0xc8, 0xc1, + 0x60, 0x44, 0x80, 0x14, 0xc0, 0x78, 0x44, 0x18, 0xcc, 0x41, 0x1e, 0xa8, + 0xc1, 0x60, 0x44, 0x70, 0x14, 0xc0, 0x78, 0x84, 0x18, 0xd0, 0x81, 0x1e, + 0xb0, 0xc1, 0x60, 0x44, 0x60, 0x14, 0xc0, 0x78, 0xc4, 0x18, 0xd4, 0xc1, + 0x1e, 0xb8, 0xc1, 0x60, 0x44, 0x50, 0x14, 0xc0, 0xc9, 0x41, 0x8b, 0xf1, + 0x04, 0x3b, 0x08, 0x28, 0x20, 0x83, 0x0c, 0x41, 0x1b, 0xd0, 0xc1, 0x1c, + 0x43, 0xb0, 0x06, 0x7d, 0x30, 0xc7, 0x10, 0xac, 0x01, 0x1f, 0x0c, 0x32, + 0x04, 0x6e, 0x60, 0x07, 0x16, 0x48, 0xf2, 0x99, 0x25, 0x28, 0x06, 0x2a, + 0x10, 0x95, 0x20, 0xaa, 0x62, 0xa0, 0x22, 0x20, 0x88, 0xa8, 0x18, 0x43, + 0x28, 0x84, 0x39, 0x86, 0x39, 0x08, 0x4e, 0x61, 0x90, 0x21, 0xa0, 0x03, + 0x3e, 0xb8, 0xa2, 0xc9, 0x78, 0x84, 0x1c, 0x90, 0x82, 0x2a, 0x04, 0x14, + 0x14, 0x0b, 0x08, 0xf9, 0x58, 0x80, 0xc0, 0xc7, 0x94, 0x57, 0x80, 0xc1, + 0x70, 0x43, 0xf0, 0x07, 0x60, 0x30, 0xcb, 0x60, 0x14, 0xc1, 0x6c, 0x43, + 0x1f, 0x0c, 0xc0, 0x6c, 0x43, 0xb0, 0x07, 0x41, 0x06, 0x01, 0x31, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, + 0xbc, 0xc1, 0x96, 0x61, 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, + 0x65, 0x80, 0x83, 0xe0, 0x0d, 0xb6, 0x0c, 0x7e, 0x10, 0xbc, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x88, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xdf, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x50, 0x10, 0x23, 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, + 0x85, 0x40, 0x6d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0xd3, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, + 0x04, 0x64, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, + 0x24, 0x40, 0x02, 0x64, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, + 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, + 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, + 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, + 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, + 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, + 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, + 0x5a, 0x22, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, + 0xca, 0xe4, 0xc2, 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, + 0xde, 0xde, 0xe4, 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, + 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, + 0x93, 0x23, 0x1b, 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, + 0x62, 0x0d, 0x21, 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, + 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, + 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, + 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, + 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, + 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, + 0x5c, 0x9a, 0x5e, 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, + 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, + 0x81, 0x96, 0x88, 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, + 0xdc, 0x10, 0x0e, 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, + 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, + 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, + 0x5c, 0x9a, 0x5e, 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, + 0x1a, 0x2a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0xc0, 0x00, 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, + 0x58, 0x34, 0xe4, 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, + 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, + 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, + 0xd2, 0xdc, 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, + 0x83, 0xc5, 0x59, 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, + 0x02, 0x06, 0x0b, 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, + 0x16, 0x6c, 0x59, 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, + 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, + 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, + 0x86, 0x08, 0x8b, 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, + 0x86, 0x18, 0x0b, 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, + 0x87, 0x29, 0x41, 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, + 0x30, 0x82, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, + 0x87, 0x73, 0xa8, 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, + 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, + 0xa6, 0x70, 0x48, 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, + 0x87, 0x74, 0x60, 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, + 0x87, 0x77, 0x70, 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, + 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, + 0xca, 0x01, 0x1f, 0xa6, 0x04, 0x6c, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x86, + 0x80, 0xa2, 0x46, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x19, + 0x00, 0x1a, 0x33, 0x00, 0x24, 0x66, 0x00, 0x28, 0xcc, 0x00, 0x10, 0x18, + 0x23, 0x00, 0x41, 0x10, 0xc4, 0xbf, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, + 0xd0, 0x94, 0x4d, 0x14, 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, + 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x4c, 0x57, 0x17, 0x50, 0x50, + 0x06, 0x19, 0x82, 0x45, 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, + 0x81, 0x98, 0x42, 0x50, 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, + 0x42, 0x21, 0xcc, 0x31, 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x11, 0x76, + 0x45, 0x93, 0xf1, 0x08, 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, + 0xc8, 0xc7, 0x02, 0x04, 0x3e, 0xa6, 0xb4, 0x01, 0x0c, 0x86, 0x1b, 0x82, + 0x33, 0x00, 0x83, 0x59, 0x86, 0x41, 0x08, 0xc6, 0x23, 0xac, 0x33, 0x68, + 0x83, 0x68, 0x30, 0x22, 0x20, 0x0a, 0xc0, 0x26, 0x38, 0x80, 0xc1, 0x70, + 0x43, 0xa0, 0x06, 0x60, 0x30, 0xcb, 0x40, 0x04, 0xc1, 0x78, 0x44, 0xa6, + 0x06, 0x70, 0xa0, 0x06, 0x14, 0x94, 0xf1, 0x88, 0x8d, 0x0d, 0xe4, 0x40, + 0x0c, 0x28, 0x28, 0xe3, 0x11, 0x9d, 0x1b, 0xd0, 0x41, 0x19, 0x50, 0x50, + 0xc6, 0x23, 0x3e, 0x38, 0xb0, 0x03, 0x34, 0xa0, 0xa0, 0x8c, 0x47, 0x80, + 0x81, 0x1c, 0xe0, 0x81, 0x1c, 0x0c, 0x46, 0x04, 0x48, 0x01, 0x8c, 0x47, + 0x84, 0xc1, 0x1c, 0xe4, 0x41, 0x1a, 0x0c, 0x46, 0x04, 0x47, 0x01, 0x8c, + 0x47, 0x88, 0x01, 0x1d, 0xe8, 0xc1, 0x1a, 0x0c, 0x46, 0x04, 0x46, 0x01, + 0x8c, 0x47, 0x8c, 0x41, 0x1d, 0xec, 0x41, 0x1b, 0x0c, 0x46, 0x04, 0x45, + 0x01, 0x5c, 0x1c, 0xb4, 0x18, 0x4f, 0xb0, 0x83, 0x80, 0x02, 0x32, 0xc8, + 0x10, 0xb0, 0xc1, 0x1c, 0xcc, 0x31, 0x04, 0x6a, 0xe0, 0x07, 0x73, 0x0c, + 0x01, 0x1b, 0xf4, 0xc1, 0x20, 0x43, 0xe0, 0x06, 0x75, 0x60, 0x81, 0x24, + 0x9f, 0x59, 0x82, 0x62, 0xa0, 0x02, 0x61, 0x09, 0xa2, 0x2a, 0x06, 0x2a, + 0x02, 0x82, 0x88, 0x8a, 0x31, 0x84, 0x42, 0x98, 0x63, 0x98, 0x83, 0xe0, + 0x14, 0x06, 0x19, 0x02, 0x3a, 0xd8, 0x83, 0x2b, 0x9a, 0x8c, 0x47, 0xc8, + 0x01, 0x29, 0xa8, 0x42, 0x40, 0x41, 0xb1, 0x80, 0x90, 0x8f, 0x05, 0x08, + 0x7c, 0x4c, 0x81, 0x05, 0x18, 0x0c, 0x37, 0x04, 0xaa, 0x00, 0x06, 0xb3, + 0x0c, 0x46, 0x11, 0x8c, 0x27, 0xa0, 0x02, 0x45, 0x01, 0x99, 0x6d, 0x00, + 0x85, 0x02, 0x98, 0x6d, 0x08, 0x84, 0x20, 0x83, 0x80, 0x18, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, + 0xc4, 0xc1, 0x96, 0x61, 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, + 0x65, 0x80, 0x83, 0x20, 0x0e, 0xb6, 0x0c, 0x7e, 0x10, 0xc4, 0xc1, 0x96, + 0xa1, 0x14, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x08, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0x21, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, 0x2e, 0xc2, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, 0xbc, 0x83, 0x3c, 0xc8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, 0xb4, 0x81, 0x3c, 0xbc, + 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, 0xb4, 0x01, 0x39, 0xa4, + 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, 0xcc, 0x43, 0x3c, 0xc8, + 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, + 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x10, + 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, 0x0e, 0xe5, 0xd0, 0x06, + 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, 0x0e, 0xe1, 0xc0, 0x0e, + 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, + 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, 0xc0, 0x83, 0x3c, 0x94, + 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, + 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, 0x10, + 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10, 0x0e, 0xed, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40, 0x0f, 0xe5, 0x20, 0x0f, + 0x6d, 0x50, 0x0e, 0xec, 0x90, 0x0e, 0xed, 0x00, 0xd0, 0x83, 0x3c, 0xd4, + 0x43, 0x39, 0x00, 0x83, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, 0x84, + 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, 0xd0, + 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b, 0xb4, + 0x81, 0x3b, 0xbc, 0x83, 0x3b, 0xb4, 0x01, 0x3b, 0x94, 0x43, 0x38, 0x98, + 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0x41, 0x3a, 0xb8, 0x83, 0x39, 0xcc, + 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d, 0xa0, + 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, 0x10, 0xee, 0xf0, 0x0e, + 0x6d, 0xa0, 0x0e, 0xf5, 0xd0, 0x0e, 0xf0, 0xd0, 0x06, 0xf4, 0x10, 0x0e, + 0xe2, 0xc0, 0x0e, 0xe5, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, + 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xb8, 0x43, 0x38, 0xb8, + 0xc3, 0x3c, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, + 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0x00, 0xe1, 0x0e, + 0xef, 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xe7, 0xe0, 0x0e, 0xe5, 0x40, 0x0e, + 0x6d, 0xa0, 0x0f, 0xe5, 0x20, 0x0f, 0xef, 0x30, 0x0f, 0x6d, 0x60, 0x0e, + 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, + 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0xc4, 0x3c, 0xd0, 0x43, 0x38, 0x8c, + 0xc3, 0x3a, 0xb4, 0x01, 0x3c, 0xc8, 0xc3, 0x3b, 0xd0, 0x43, 0x39, 0x8c, + 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38, 0xd4, 0x83, 0x39, 0x98, + 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a, 0xe8, 0x43, 0x39, 0x00, + 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70, 0x0e, 0xe5, 0x40, 0x0f, + 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, + 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, 0xd8, 0x01, 0x40, 0xd4, + 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, 0xb4, 0x81, 0x39, 0xc0, + 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, + 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, 0x0e, 0x6d, 0x30, 0x0f, + 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, 0x94, 0x03, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x84, 0x40, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, + 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x88, 0x10, 0x08, 0x45, + 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, 0x39, 0x02, 0x50, 0x18, + 0x01, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, 0x86, + 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc, 0xac, + 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, + 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb6, + 0xb7, 0xb1, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xaf, 0x34, 0x37, 0xb2, 0x32, + 0x3c, 0x22, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x8c, 0xc2, + 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, + 0xe6, 0xd2, 0xf4, 0xca, 0x78, 0x85, 0xa5, 0xc9, 0xb9, 0x84, 0xc9, 0x9d, + 0x7d, 0xd1, 0xe5, 0xc1, 0x95, 0x7d, 0x85, 0xb1, 0xa5, 0x9d, 0xb9, 0x7d, + 0xcd, 0xa5, 0xe9, 0x95, 0x91, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, + 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0xe3, 0x30, 0xf6, 0xc6, 0x36, 0x04, 0x0c, + 0x8c, 0xa0, 0x90, 0x8a, 0xc9, 0x18, 0x0a, 0xca, 0x08, 0x0c, 0xa1, 0xa8, + 0x0a, 0xcb, 0x18, 0x8a, 0xcb, 0x18, 0x0a, 0xa7, 0x78, 0x0a, 0xac, 0xc8, + 0x86, 0x08, 0x85, 0x36, 0xc4, 0x20, 0x80, 0x22, 0x2a, 0x36, 0x3e, 0x6f, + 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, + 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56, + 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x85, 0x37, 0xc4, 0x28, + 0xba, 0xe2, 0x3b, 0x8a, 0x21, 0x46, 0x01, 0x06, 0x05, 0x18, 0x1c, 0xc5, + 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, 0x1c, + 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, 0x1d, + 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, + 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, 0x1c, + 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, 0x1d, + 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, 0x1c, + 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, 0x1d, + 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, 0x06, + 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, 0x90, + 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x01, + 0x07, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x60, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, 0xfe, 0xff, 0xff, 0xff, + 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, + 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, + 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, + 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, + 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, + 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, + 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, + 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, + 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, + 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, + 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, + 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, + 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, + 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, + 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, + 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, + 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, 0x03, 0x7a, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, + 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xdc, 0x21, 0x1c, 0xdc, + 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0x70, 0x87, + 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, 0x87, 0x72, 0x20, 0x87, + 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, 0x87, 0x36, 0x30, 0x07, + 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, 0xe8, 0x21, 0x1c, 0xc6, + 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, 0xe8, 0xa1, 0x1c, 0xc6, + 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, 0xea, 0xc1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xf4, 0xa1, 0x1c, 0x00, + 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, 0x87, 0x72, 0xa0, 0x87, + 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87, + 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, 0xec, 0x00, 0x20, 0xea, + 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, + 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, 0x87, 0x36, 0x98, 0x87, + 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, 0x07, + 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0xd8, 0x40, + 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, 0x36, 0x20, 0xc6, 0xff, + 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, 0x05, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x86, 0x40, 0x18, + 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x48, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x70, 0x94, + 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, 0x13, 0x15, 0x11, 0xbf, + 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, 0x04, 0x17, 0x49, 0x53, + 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, 0x44, 0xf4, 0x4f, 0x63, + 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, 0x31, 0xca, 0x21, 0x34, + 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, 0xb0, 0x14, 0x24, 0x94, + 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, 0x01, 0x28, 0x8c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x98, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x21, 0x8c, 0x03, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, + 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, 0x19, + 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xcb, 0xf0, 0x48, 0xcf, 0xf4, 0x50, 0x8f, 0xf3, 0x3c, 0x4f, + 0xf5, 0x58, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, + 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, + 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, + 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, + 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, + 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, + 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0xb4, 0x08, 0x0f, + 0xf6, 0x64, 0xcf, 0xf4, 0x68, 0x8f, 0xf3, 0x6c, 0x4f, 0xf5, 0x70, 0x54, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, + 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, + 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0xb0, 0x18, 0x8f, 0xf7, 0x7c, + 0x0b, 0xf1, 0x80, 0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18, 0x2c, + 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19, 0x70, + 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, 0xa3, + 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, 0x8c, + 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, 0xed, + 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, 0x87, + 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, 0x60, + 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, 0x34, + 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, + 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, + 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, 0x1e, + 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, 0x19, + 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, 0x03, + 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, + 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, + 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, 0x1c, + 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, 0x1d, + 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, 0x30, + 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, 0x87, + 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, 0x87, + 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, 0x87, + 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, + 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, 0x07, + 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, 0x87, + 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, 0x87, + 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, 0xe4, + 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, 0xdc, + 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x6c, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c, + 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, + 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b, + 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0, + 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0, + 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0, + 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0, + 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90, + 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0, + 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, + 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c, + 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60, + 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0, + 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, + 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39, + 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b, + 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d, + 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31, + 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0, + 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20, + 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90, + 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c, + 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d, + 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10, + 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50, + 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c, + 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39, + 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x4e, 0x93, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, 0x22, 0xe2, 0xb7, 0x87, + 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, 0x60, 0x10, 0x21, 0x09, + 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, + 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, 0x28, 0x48, 0x08, 0x62, + 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, 0xcd, 0x11, 0x80, 0xc1, + 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, 0x8a, 0x89, 0x28, 0xa7, + 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, 0x40, 0x76, 0x20, 0x60, + 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, 0x00, 0x14, 0x06, 0x11, + 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, + 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, + 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, + 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, + 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, + 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x07, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x21, 0x0c, 0x04, 0x04, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x10, 0xa6, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x08, 0x73, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0x05, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, 0x86, + 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, + 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, + 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, + 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, + 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, + 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, 0x81, + 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, 0xc2, + 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe, + 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85, + 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, + 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73, + 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, + 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec, + 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8, 0x84, + 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, + 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, + 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, + 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, + 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, + 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, + 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, + 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, + 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, 0x41, + 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, 0x91, + 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, + 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, + 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, + 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, + 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, + 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, 0xb0, + 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd2, + 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, 0x22, + 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, + 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, + 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, 0x74, + 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, + 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, + 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, + 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, + 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, 0x03, + 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, 0xc2, + 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, 0xd9, + 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, 0x1d, + 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, 0x32, + 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, + 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, 0x52, + 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, 0x79, + 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, 0xc0, + 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, 0x00, + 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, 0xae, + 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, 0x1b, + 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, 0xd0, + 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, 0xd0, + 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, 0xec, + 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, 0xf4, + 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xf6, + 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, 0x10, + 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, 0xee, + 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, 0xe5, + 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, 0xc4, + 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, 0xf0, + 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, 0xe9, + 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, 0x4c, + 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, 0x43, + 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x79, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, + 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, + 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, + 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, + 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, + 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, + 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, + 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, + 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, + 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, + 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, + 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, + 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, + 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a, + 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54, + 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, + 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, + 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, + 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, + 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, + 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, + 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x04, 0x11, 0x14, + 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, + 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, + 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xdd, + 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, 0x80, 0xe0, 0x0c, 0x00, + 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, 0x10, 0x99, 0x01, 0xa0, + 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, 0x10, 0xff, 0x46, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, 0x88, 0x01, 0xe4, 0x4c, + 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, 0x01, 0xf4, 0x50, 0xca, + 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, 0x08, 0x86, 0x33, 0xc8, + 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, 0x8d, 0xa5, 0xa0, 0xd8, + 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, 0xcf, 0x78, 0x03, 0x07, + 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, 0x43, 0x10, 0x4d, 0x23, + 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, 0x4c, 0x41, 0x1c, 0x8c, + 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, 0x4b, 0x30, 0xc7, 0x60, + 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, 0x07, 0x17, 0x8c, 0xa5, + 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, 0x10, 0x81, 0x1f, 0x44, + 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, 0xf0, 0xe1, 0x81, 0x05, + 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, + 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, + 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, + 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, + 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, + 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, + 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, + 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, + 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, + 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, + 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, + 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, + 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, + 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a, + 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54, + 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, + 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, + 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, + 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, + 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, + 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, + 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x04, 0x11, 0x14, + 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, + 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, + 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xde, + 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, 0xd0, 0xab, 0x81, 0x11, + 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, 0x12, 0x02, 0x80, 0xc8, + 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, + 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, 0x06, 0xca, 0x10, 0x94, + 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, 0x41, 0x81, 0x0c, 0x32, + 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, 0x83, 0x10, 0x4c, 0x83, + 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, 0x43, 0x00, 0x1f, 0xf2, + 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, 0x18, 0xb8, 0xc1, 0x05, + 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, 0x18, 0x14, 0x44, 0x50, + 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, 0xde, 0x50, 0x06, 0x69, + 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x18, 0x18, 0x8c, + 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x79, 0x30, + 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, 0x0a, 0x51, 0x30, 0xc7, + 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, 0x1e, 0x58, 0x50, 0xc9, + 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x25, 0x08, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22744; diff --git a/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_osx.h b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_osx.h new file mode 100644 index 0000000000..787c6fe217 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_osx.h @@ -0,0 +1,1903 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xcb, 0x86, 0x8e, 0x78, 0x90, 0x1d, 0xa9, 0xc3, 0xb9, 0xec, 0xcd, 0xec, + 0x69, 0xba, 0x3d, 0x7e, 0x97, 0xb5, 0xa9, 0x05, 0x01, 0xbe, 0x87, 0xd8, + 0x0c, 0xca, 0x1a, 0xb4, 0x91, 0x54, 0x7e, 0x29, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0xf5, + 0xc6, 0xe3, 0x26, 0x71, 0xe3, 0x1c, 0x45, 0x4d, 0xb1, 0xdb, 0x0e, 0x1a, + 0x29, 0x85, 0x9d, 0xa7, 0x04, 0x40, 0x91, 0x18, 0x99, 0x5c, 0x9f, 0xdb, + 0x7c, 0x30, 0xd1, 0x67, 0x59, 0xd8, 0xa4, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x31, 0xa8, 0x6b, 0xb7, 0x4d, 0x8a, 0x56, 0xc7, 0x91, 0xa4, 0x37, + 0xfd, 0xa6, 0xbf, 0x79, 0xd1, 0x55, 0x8c, 0xd5, 0x1b, 0x88, 0x69, 0x8e, + 0x6c, 0xf0, 0x53, 0x1b, 0xd3, 0x35, 0xfe, 0x3f, 0x01, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x52, 0xe7, 0xfc, 0x67, 0x4e, 0xed, 0x7a, 0xa8, 0x44, 0x82, + 0xb2, 0x41, 0x3c, 0xdb, 0x9e, 0xe8, 0x5b, 0xbb, 0x30, 0x60, 0xf8, 0xa1, + 0x94, 0xac, 0xb4, 0x80, 0xaa, 0x08, 0xa6, 0xa0, 0xe6, 0xfd, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x28, 0x59, 0x9d, 0x20, 0x32, 0xc7, 0x94, 0x63, 0xa8, 0xda, + 0x9c, 0xac, 0x28, 0xb8, 0x01, 0xc3, 0x5f, 0x48, 0xf6, 0x74, 0x09, 0x1a, + 0xd9, 0x84, 0x91, 0x19, 0xc6, 0xe7, 0x4e, 0x94, 0x47, 0xce, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x08, 0x35, 0xd4, 0x21, 0x2f, 0xca, 0x8d, 0x22, 0xb2, + 0xa3, 0x9a, 0xd8, 0xd9, 0x46, 0x6d, 0x01, 0x7d, 0x06, 0x95, 0x04, 0x7a, + 0x94, 0xdf, 0x2b, 0xd2, 0x21, 0xea, 0x99, 0x9f, 0x2b, 0xda, 0x65, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0xe0, 0x53, 0xda, 0x06, 0xef, 0x80, 0x49, 0x61, + 0xf6, 0x9e, 0xee, 0xfe, 0x49, 0xb6, 0xd2, 0xce, 0xb8, 0xea, 0x5f, 0x9a, + 0xf4, 0x77, 0x35, 0xe7, 0xd3, 0xfc, 0x0f, 0xf6, 0x01, 0xe5, 0x90, 0xd6, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x38, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, + 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, + 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, + 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, + 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, + 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, + 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, + 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, + 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, + 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, + 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, + 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, + 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, + 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x30, 0x02, 0x50, + 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, 0xd4, 0x46, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, + 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, + 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, + 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, + 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, + 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, + 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, + 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, 0x69, 0x72, 0x2e, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x2c, 0xcc, + 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, 0xd1, 0x4d, 0xa5, + 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, 0x81, 0x96, 0x6a, + 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, + 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, 0xdb, 0xdb, 0x58, + 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, 0x19, 0x1e, 0x91, + 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, 0xbe, 0xe6, 0xd2, + 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x0c, 0xe1, 0x10, + 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, 0x0d, 0x21, 0x16, + 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, 0x84, 0xa5, 0xc9, + 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, + 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, 0xa1, 0x02, 0x27, + 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x04, 0x0c, 0x90, + 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, 0x05, 0x5a, 0xc2, + 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, 0x5c, 0xdb, 0x10, + 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, 0xe4, 0x40, 0x82, + 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, 0x05, 0x0c, 0x16, + 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, + 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, 0x38, 0xd8, + 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, 0x59, 0xcc, 0x60, + 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, 0x0b, 0x19, 0x2c, + 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, 0xcf, 0x5b, 0x9b, + 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8, 0x18, 0x5a, 0x98, + 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90, 0xa1, 0x95, 0x15, + 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06, 0x43, 0x8c, 0x65, + 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6, 0xe2, 0x06, 0x8b, 0x1b, 0x34, + 0xc8, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, + 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, + 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, + 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, + 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, + 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, + 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, + 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, + 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, + 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29, 0x81, 0x1a, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, 0x0c, 0x7f, 0x45, 0x44, + 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x20, + 0x31, 0x03, 0x40, 0x61, 0x06, 0x80, 0xc0, 0x08, 0xc0, 0x18, 0x01, 0x08, + 0x82, 0x20, 0xfe, 0x01, 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, + 0x12, 0x14, 0xe3, 0x11, 0x0e, 0x64, 0x41, 0x14, 0x94, 0x59, 0x82, 0x60, + 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x44, + 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x25, 0xb2, 0xc0, 0x90, 0xcf, + 0x2c, 0x81, 0x30, 0x50, 0x81, 0xf8, 0x41, 0x50, 0x09, 0x03, 0x15, 0x01, + 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, 0x40, 0x41, 0x18, 0x0c, + 0x32, 0x04, 0xd1, 0x75, 0x45, 0x93, 0xf1, 0x08, 0xce, 0x23, 0x83, 0x80, + 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, 0x98, 0x92, 0x06, 0x30, + 0x18, 0x6e, 0x08, 0x34, 0x30, 0x98, 0x65, 0x18, 0x84, 0x60, 0x3c, 0xc2, + 0x22, 0x03, 0x35, 0x88, 0x06, 0x23, 0x02, 0xa2, 0x00, 0x6c, 0x62, 0x03, + 0x18, 0x0c, 0x37, 0x04, 0x1d, 0x18, 0xcc, 0x32, 0x10, 0x41, 0x30, 0x1e, + 0x91, 0x9d, 0x41, 0x1b, 0x9c, 0x01, 0x05, 0x65, 0x3c, 0x62, 0x4b, 0x83, + 0x37, 0x08, 0x03, 0x0a, 0xca, 0x78, 0x44, 0xb7, 0x06, 0x71, 0x40, 0x06, + 0x14, 0x94, 0xf1, 0x88, 0xaf, 0x0d, 0xe6, 0xe0, 0x0c, 0x28, 0x28, 0xe3, + 0x11, 0x60, 0xf0, 0x06, 0x75, 0xf0, 0x06, 0x83, 0x11, 0x01, 0x52, 0x00, + 0xe3, 0x11, 0x61, 0x00, 0x07, 0x76, 0x80, 0x06, 0x83, 0x11, 0xc1, 0x51, + 0x00, 0xe3, 0x11, 0x62, 0x10, 0x07, 0x77, 0xa0, 0x06, 0x83, 0x11, 0x81, + 0x51, 0x00, 0xe3, 0x11, 0x63, 0x20, 0x07, 0x78, 0xc0, 0x06, 0x83, 0x11, + 0x41, 0x51, 0x00, 0xf7, 0x06, 0x2d, 0xc6, 0x13, 0xe6, 0x20, 0xa0, 0x80, + 0x8c, 0x21, 0x04, 0x7c, 0x30, 0xc7, 0xc0, 0x06, 0x41, 0x1f, 0x8c, 0x21, + 0x0c, 0x7f, 0x30, 0xc7, 0x20, 0x04, 0xa0, 0x30, 0xc7, 0x10, 0xb8, 0x41, + 0x1f, 0xcc, 0x31, 0x04, 0x6e, 0xc0, 0x07, 0x83, 0x0c, 0x41, 0x1c, 0xdc, + 0x81, 0x05, 0x95, 0x7c, 0x66, 0x09, 0x8a, 0x81, 0x0a, 0x44, 0x25, 0x88, + 0xaa, 0x18, 0xa8, 0x08, 0x08, 0x22, 0x2a, 0xc6, 0x10, 0x0a, 0x61, 0x8e, + 0xc1, 0x0e, 0x82, 0x53, 0x18, 0x64, 0x08, 0xee, 0xa0, 0x0f, 0xae, 0x68, + 0x32, 0x1e, 0x51, 0x07, 0xa4, 0xa0, 0x0a, 0x01, 0x05, 0xc5, 0x02, 0x42, + 0x3e, 0x16, 0x20, 0xf0, 0x31, 0xe5, 0x15, 0x60, 0x30, 0xdc, 0x10, 0x80, + 0x02, 0x18, 0xcc, 0x32, 0x18, 0x45, 0x30, 0xdb, 0x00, 0x0a, 0x03, 0x30, + 0xdb, 0x10, 0xf8, 0x41, 0x90, 0x41, 0x40, 0x0c, 0x08, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, 0xbc, 0xc1, 0x96, 0x61, + 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, 0x65, 0x80, 0x83, 0xe0, + 0x0d, 0xb6, 0x0c, 0xa1, 0x10, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xe1, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x50, 0x10, 0x23, + 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, 0x85, 0x40, 0x6d, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x04, 0x64, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x64, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, + 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, + 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, + 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, 0xca, 0xe4, 0xc2, + 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, 0xde, 0xde, 0xe4, + 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, 0x93, 0x23, 0x1b, + 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, 0x62, 0x0d, 0x21, + 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, + 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, 0x09, 0x96, 0x6d, + 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x88, + 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, 0xdc, 0x10, 0x0e, + 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, + 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, 0x4f, 0x58, 0x9a, + 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, 0x1a, 0x2a, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0xc0, 0x00, + 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, 0x40, 0x82, 0x65, + 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, + 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xe4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, + 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, 0x83, 0xc5, 0x59, + 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, 0x02, 0x06, 0x0b, + 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, 0x16, 0x6c, 0x59, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8b, + 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, 0x86, 0x18, 0x0b, + 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, 0xca, 0x01, 0x1f, + 0xa6, 0x04, 0x6c, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, 0xf9, 0x73, 0xce, 0x83, + 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, + 0x00, 0x8d, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, 0x10, + 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0x0d, 0x64, 0x41, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x40, 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x05, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x80, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x41, 0x18, 0x0c, 0x32, 0x04, 0x91, 0x75, 0x45, 0x93, 0xf1, 0x88, + 0xcd, 0x23, 0x83, 0x80, 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, + 0x98, 0xa2, 0x06, 0x30, 0x18, 0x6e, 0x08, 0xc8, 0x00, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xc8, 0x40, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xda, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x19, 0x80, 0xc1, + 0x2c, 0x03, 0x11, 0x04, 0xe3, 0x11, 0xd9, 0x19, 0xb4, 0xc1, 0x19, 0x50, + 0x50, 0xc6, 0x23, 0xb6, 0x34, 0x78, 0x03, 0x30, 0xa0, 0xa0, 0x8c, 0x47, + 0x74, 0x6b, 0x10, 0x07, 0x63, 0x40, 0x41, 0x19, 0x8f, 0xf8, 0xda, 0x60, + 0x0e, 0xcc, 0x80, 0x82, 0x32, 0x1e, 0x01, 0x06, 0x6f, 0x50, 0x07, 0x6f, + 0x30, 0x18, 0x11, 0x20, 0x05, 0x30, 0x1e, 0x11, 0x06, 0x70, 0x60, 0x07, + 0x67, 0x30, 0x18, 0x11, 0x1c, 0x05, 0x30, 0x1e, 0x21, 0x06, 0x71, 0x70, + 0x07, 0x69, 0x30, 0x18, 0x11, 0x18, 0x05, 0x30, 0x1e, 0x31, 0x06, 0x72, + 0x80, 0x07, 0x6b, 0x30, 0x18, 0x11, 0x14, 0x05, 0x70, 0x6e, 0xd0, 0x62, + 0x3c, 0x61, 0x0e, 0x02, 0x0a, 0xc8, 0x18, 0x42, 0xc0, 0x07, 0x73, 0x0c, + 0x6c, 0x10, 0xf4, 0xc1, 0x18, 0xc2, 0x00, 0x0a, 0x73, 0x0c, 0x42, 0x10, + 0x0a, 0x73, 0x0c, 0x41, 0x1b, 0xf8, 0xc1, 0x1c, 0x43, 0xf0, 0x06, 0x7d, + 0x30, 0xc8, 0x10, 0xc4, 0x81, 0x1d, 0x58, 0x50, 0xc9, 0x67, 0x96, 0xa0, + 0x18, 0xa8, 0x40, 0x58, 0x82, 0xa8, 0x8a, 0x81, 0x8a, 0x80, 0x20, 0xa2, + 0x62, 0x0c, 0xa1, 0x10, 0xe6, 0x18, 0xec, 0x20, 0x38, 0x85, 0x41, 0x86, + 0xe0, 0x0e, 0xf8, 0xe0, 0x8a, 0x26, 0xe3, 0x11, 0x75, 0x40, 0x0a, 0xaa, + 0x10, 0x50, 0x50, 0x2c, 0x20, 0xe4, 0x63, 0x01, 0x02, 0x1f, 0x53, 0x60, + 0x01, 0x06, 0xc3, 0x0d, 0x81, 0x2a, 0x80, 0xc1, 0x2c, 0x83, 0x51, 0x04, + 0xe3, 0x09, 0xa8, 0x70, 0x51, 0x40, 0x66, 0x1b, 0x44, 0xa1, 0x00, 0x66, + 0x1b, 0x02, 0x21, 0xc8, 0x20, 0x20, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, 0xc4, 0xc1, 0x96, 0x61, + 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, 0x65, 0x80, 0x83, 0x20, + 0x0e, 0xb6, 0x0c, 0xa1, 0x10, 0xc4, 0xc1, 0x96, 0x01, 0x15, 0x82, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x98, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x81, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, + 0x2e, 0xc2, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, + 0xbc, 0x83, 0x3c, 0xc8, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, + 0xb4, 0x81, 0x3c, 0xbc, 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, + 0xb4, 0x01, 0x39, 0xa4, 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, + 0xcc, 0x43, 0x3c, 0xc8, 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, + 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x10, 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, + 0x0e, 0xe5, 0xd0, 0x06, 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, + 0x0e, 0xe1, 0xc0, 0x0e, 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, + 0xc0, 0x83, 0x3c, 0x94, 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, + 0x98, 0x03, 0x3c, 0xb4, 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50, + 0x0f, 0xe5, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10, + 0x0e, 0xed, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40, + 0x0f, 0xe5, 0x20, 0x0f, 0x6d, 0x50, 0x0e, 0xec, 0x90, 0x0e, 0xed, 0x00, + 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x83, 0x3b, 0xbc, 0x43, 0x1b, + 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, + 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, + 0xa4, 0x43, 0x3b, 0xb4, 0x81, 0x3b, 0xbc, 0x83, 0x3b, 0xb4, 0x01, 0x3b, + 0x94, 0x43, 0x38, 0x98, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0x41, 0x3a, + 0xb8, 0x83, 0x39, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, + 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, + 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0xa0, 0x0e, 0xf5, 0xd0, 0x0e, 0xf0, 0xd0, + 0x06, 0xf4, 0x10, 0x0e, 0xe2, 0xc0, 0x0e, 0xe5, 0x30, 0x0f, 0x80, 0x39, + 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, + 0xb8, 0x43, 0x38, 0xb8, 0xc3, 0x3c, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, + 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, + 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xe7, 0xe0, + 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0xa0, 0x0f, 0xe5, 0x20, 0x0f, 0xef, 0x30, + 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0xc4, 0x3c, + 0xd0, 0x43, 0x38, 0x8c, 0xc3, 0x3a, 0xb4, 0x01, 0x3c, 0xc8, 0xc3, 0x3b, + 0xd0, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38, + 0xd4, 0x83, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a, + 0xe8, 0x43, 0x39, 0x00, 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70, + 0x0e, 0xe5, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50, + 0x0f, 0xf2, 0x50, 0x0e, 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, + 0xd8, 0x01, 0x40, 0xd4, 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, + 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, + 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, + 0x0e, 0x6d, 0x30, 0x0f, 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, + 0x94, 0x03, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x13, 0x84, 0x40, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, + 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, + 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, + 0x88, 0x10, 0x08, 0x45, 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, + 0x39, 0x02, 0x50, 0x18, 0x01, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x21, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, + 0x02, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, + 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, + 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, + 0x86, 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc, + 0xac, 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, + 0x99, 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb6, 0xb7, 0xb1, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xaf, 0x34, 0x37, 0xb2, + 0x32, 0x3c, 0x22, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x78, 0x85, 0xa5, 0xc9, 0xb9, 0x84, 0xc9, + 0x9d, 0x7d, 0xd1, 0xe5, 0xc1, 0x95, 0x7d, 0x85, 0xb1, 0xa5, 0x9d, 0xb9, + 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x91, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, + 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0xe3, 0x30, 0xf6, 0xc6, 0x36, 0x04, + 0x0c, 0x8c, 0xa0, 0x90, 0x8a, 0xc9, 0x18, 0x0a, 0xca, 0x08, 0x0c, 0xa1, + 0xa8, 0x0a, 0xcb, 0x18, 0x8a, 0xcb, 0x18, 0x0a, 0xa7, 0x78, 0x0a, 0xac, + 0xc8, 0x86, 0x08, 0x85, 0x36, 0xc4, 0x20, 0x80, 0x22, 0x2a, 0x36, 0x3e, + 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, 0x63, + 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, 0x86, + 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x85, 0x37, 0xc4, + 0x28, 0xba, 0xe2, 0x3b, 0x8a, 0x21, 0x46, 0x01, 0x06, 0x05, 0x18, 0x1c, + 0xc5, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, + 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, + 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, + 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, + 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, + 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, + 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, + 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, + 0x06, 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, + 0x90, 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, + 0x01, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x68, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, + 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, + 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, + 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, + 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, + 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, + 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, + 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, + 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, + 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, + 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, + 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, + 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, + 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, + 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, + 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, + 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, + 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, + 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, + 0x08, 0x77, 0x78, 0x87, 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, + 0x03, 0x7a, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, + 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, + 0xdc, 0x21, 0x1c, 0xdc, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, + 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, + 0x87, 0x72, 0x20, 0x87, 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, + 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, + 0xe8, 0x21, 0x1c, 0xc6, 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, + 0xe8, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, + 0xea, 0xc1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, + 0xf4, 0xa1, 0x1c, 0x00, 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, + 0x87, 0x72, 0xa0, 0x87, 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, + 0x07, 0x79, 0x28, 0x87, 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, + 0xec, 0x00, 0x20, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, + 0x87, 0x36, 0x98, 0x87, 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, + 0x87, 0x77, 0x08, 0x07, 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, + 0xca, 0x01, 0xd8, 0x40, 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, + 0x36, 0x20, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, + 0x05, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x13, 0x86, 0x40, 0x18, 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x48, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x70, 0x94, 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, + 0x13, 0x15, 0x11, 0xbf, 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, + 0x04, 0x17, 0x49, 0x53, 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, + 0x44, 0xf4, 0x4f, 0x63, 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, + 0x31, 0xca, 0x21, 0x34, 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, + 0xb0, 0x14, 0x24, 0x94, 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, + 0x01, 0x28, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x49, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, + 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, + 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, + 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, + 0x19, 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce, + 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, + 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, + 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, + 0xdc, 0x86, 0x40, 0xcb, 0xf0, 0x48, 0xcf, 0xf4, 0x50, 0x8f, 0xf3, 0x3c, + 0x4f, 0xf5, 0x58, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, + 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, + 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, + 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, + 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, + 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, + 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0xb4, 0x08, + 0x0f, 0xf6, 0x64, 0xcf, 0xf4, 0x68, 0x8f, 0xf3, 0x6c, 0x4f, 0xf5, 0x70, + 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, + 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, + 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, + 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, + 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, + 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, + 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, + 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, + 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0xb0, 0x18, 0x8f, 0xf7, + 0x7c, 0x0b, 0xf1, 0x80, 0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18, + 0x2c, 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19, + 0x70, 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, + 0xa3, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, + 0x8c, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, + 0xed, 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, + 0x87, 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, + 0x60, 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, + 0x34, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, + 0x1e, 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, + 0x19, 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, + 0x1c, 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, + 0x1d, 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, + 0xdc, 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x74, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x9a, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, + 0x3b, 0xa4, 0x43, 0x3b, 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, + 0xe0, 0x0e, 0xef, 0xd0, 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, + 0xd0, 0x06, 0xf0, 0xf0, 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xe5, 0xc0, 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, + 0xe0, 0x0e, 0x6d, 0xc0, 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, + 0xf0, 0x0e, 0x6d, 0x90, 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, + 0x00, 0x0f, 0x6d, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, + 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, + 0x3d, 0xb4, 0x03, 0x3c, 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, + 0x39, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, + 0xe1, 0x0e, 0xef, 0xd0, 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, + 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, + 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, + 0x39, 0xc8, 0xc3, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x4e, 0x93, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, + 0x22, 0xe2, 0xb7, 0x87, 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, + 0x60, 0x10, 0x21, 0x09, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, + 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, + 0x28, 0x48, 0x08, 0x62, 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, + 0xcd, 0x11, 0x80, 0xc1, 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, + 0x8a, 0x89, 0x28, 0xa7, 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, + 0x40, 0x76, 0x20, 0x60, 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, + 0x00, 0x14, 0x06, 0x11, 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, + 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, + 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, + 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, + 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, + 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, + 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, + 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, + 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, + 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x71, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0xc2, 0x40, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x61, 0x2a, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x86, 0x30, 0x17, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, + 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, + 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, + 0x86, 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, + 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, + 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, + 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, + 0x81, 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, + 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, + 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, + 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, + 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, + 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, + 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, + 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8, + 0x84, 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4, + 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, + 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, + 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, + 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, + 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, + 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, + 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, + 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, + 0x37, 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, + 0x41, 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, + 0x91, 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, + 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, + 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, + 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, + 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, + 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, + 0xb0, 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, + 0xd2, 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, + 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, + 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, + 0xb2, 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, + 0x74, 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, + 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, + 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, + 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, + 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, + 0x03, 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, + 0xc2, 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, + 0xd9, 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, + 0x1d, 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, + 0x32, 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, + 0x8e, 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, + 0x52, 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, + 0x79, 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, + 0xc0, 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, + 0x00, 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, + 0xae, 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, + 0x1b, 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, + 0xd0, 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, + 0xd0, 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, + 0xec, 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, + 0xf4, 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, + 0xf6, 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, + 0x10, 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, + 0xee, 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, + 0xe5, 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, + 0xc4, 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, + 0xf0, 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, + 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, + 0x4c, 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, + 0x43, 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c, + 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, + 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b, + 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0, + 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0, + 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0, + 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0, + 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90, + 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0, + 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, + 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c, + 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60, + 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0, + 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, + 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39, + 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b, + 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d, + 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31, + 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0, + 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20, + 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90, + 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c, + 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d, + 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10, + 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50, + 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c, + 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39, + 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, + 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, + 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, + 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, + 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, + 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, + 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, + 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, + 0x51, 0x94, 0x43, 0x3d, 0x54, 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, + 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, + 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, + 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, + 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, + 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, + 0x6c, 0x88, 0x04, 0x11, 0x14, 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, + 0x6d, 0x54, 0x45, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, + 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, + 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, + 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, + 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, + 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, + 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, + 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, + 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xdd, 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, + 0x80, 0xe0, 0x0c, 0x00, 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, + 0x10, 0x99, 0x01, 0xa0, 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, + 0x10, 0xff, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x88, 0x01, 0xe4, 0x4c, 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, + 0x01, 0xf4, 0x50, 0xca, 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, + 0x08, 0x86, 0x33, 0xc8, 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, + 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, + 0xcf, 0x78, 0x03, 0x07, 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, + 0x43, 0x10, 0x4d, 0x23, 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, + 0x4c, 0x41, 0x1c, 0x8c, 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, + 0x29, 0x28, 0x83, 0x0c, 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, + 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, + 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, + 0x10, 0x81, 0x1f, 0x44, 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, + 0xf0, 0xe1, 0x81, 0x05, 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7d, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c, + 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, + 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa4, 0x43, 0x3b, + 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0xc0, 0xe0, 0x0e, 0xef, 0xd0, + 0x06, 0xe6, 0x20, 0x0f, 0xe1, 0xd0, 0x0e, 0xe5, 0xd0, 0x06, 0xf0, 0xf0, + 0x0e, 0xe9, 0xe0, 0x0e, 0xf4, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xe5, 0xc0, + 0x0e, 0xe9, 0xd0, 0x0e, 0x6d, 0xe0, 0x0e, 0xef, 0xe0, 0x0e, 0x6d, 0xc0, + 0x0e, 0xe5, 0x10, 0x0e, 0xe6, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x90, + 0x0e, 0xee, 0x60, 0x0e, 0xf3, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0x6d, 0xd0, + 0x0e, 0xe1, 0x40, 0x0f, 0xe8, 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, + 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0xa8, 0x43, 0x3d, 0xb4, 0x03, 0x3c, + 0xb4, 0x01, 0x3d, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xcc, 0x03, 0x60, + 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xe1, 0x0e, 0xef, 0xd0, + 0x06, 0xee, 0x10, 0x0e, 0xee, 0x30, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, + 0x94, 0x03, 0x40, 0xb8, 0xc3, 0x3b, 0xb4, 0xc1, 0x3c, 0xa4, 0xc3, 0x39, + 0xb8, 0x43, 0x39, 0x90, 0x43, 0x1b, 0xe8, 0x43, 0x39, 0xc8, 0xc3, 0x3b, + 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, 0x3b, 0x84, 0x03, 0x3d, + 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0x31, + 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, 0x00, 0x0f, 0xf2, 0xf0, + 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, 0x0f, 0x6d, 0x20, + 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xd0, 0x06, 0xf3, 0x90, + 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, 0x3d, 0x84, 0x83, 0x3c, + 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, 0x39, 0x84, 0x03, 0x3d, + 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10, + 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50, + 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c, + 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39, + 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, + 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, + 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, + 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, + 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, + 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, + 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, + 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, + 0x51, 0x94, 0x43, 0x3d, 0x54, 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, + 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, + 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, + 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, + 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, + 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, + 0x6c, 0x88, 0x04, 0x11, 0x14, 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, + 0x6d, 0x54, 0x45, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, + 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, + 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, + 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, + 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, + 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, + 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, + 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, + 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xde, 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, + 0xd0, 0xab, 0x81, 0x11, 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, + 0x12, 0x02, 0x80, 0xc8, 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, + 0x04, 0xc6, 0x08, 0x40, 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, + 0x06, 0xca, 0x10, 0x94, 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, + 0x41, 0x81, 0x0c, 0x32, 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, + 0x83, 0x10, 0x4c, 0x83, 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, + 0x43, 0x00, 0x1f, 0xf2, 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, + 0x18, 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, + 0x18, 0x14, 0x44, 0x50, 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, + 0xde, 0x50, 0x06, 0x69, 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x18, 0x18, 0x8c, 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, + 0x60, 0x04, 0x79, 0x30, 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, + 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, + 0x0a, 0x51, 0x30, 0xc7, 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, + 0x1e, 0x58, 0x50, 0xc9, 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x25, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22792; diff --git a/3rdparty/sdl2-2.0.9/src/render/metal/build-metal-shaders.sh b/3rdparty/sdl2-2.0.9/src/render/metal/build-metal-shaders.sh new file mode 100755 index 0000000000..8ebf63eaba --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/metal/build-metal-shaders.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -x +set -e +cd `dirname "$0"` + +generate_shaders() +{ + platform=$1 + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $? + xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h + rm -f sdl.air sdl.metalar sdl.metallib +} + +generate_shaders osx +generate_shaders ios diff --git a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_glfuncs.h b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_glfuncs.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/render/opengl/SDL_glfuncs.h rename to 3rdparty/sdl2-2.0.9/src/render/opengl/SDL_glfuncs.h index c8eba583cb..02be0e1578 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_glfuncs.h +++ b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC_UNUSED(void, glBitmap, (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) -SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glBlendEquation, (GLenum)) +SDL_PROC_UNUSED(void, glBlendFunc, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC_UNUSED(void, glCallList, (GLuint)) SDL_PROC_UNUSED(void, glCallLists, (GLsizei, GLenum, const GLvoid *)) diff --git a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_render_gl.c b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_render_gl.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/render/opengl/SDL_render_gl.c rename to 3rdparty/sdl2-2.0.9/src/render/opengl/SDL_render_gl.c index 6a4fa3ecf2..f3e8326ac6 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_render_gl.c +++ b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags); static void GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -126,7 +127,7 @@ typedef struct struct { GL_Shader shader; Uint32 color; - int blendMode; + SDL_BlendMode blendMode; } current; SDL_bool GL_EXT_framebuffer_object_supported; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif static int @@ -275,7 +274,7 @@ GL_LoadFunctions(GL_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -320,8 +319,8 @@ GL_ResetState(SDL_Renderer *renderer) } data->current.shader = SHADER_NONE; - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_CULL_FACE); @@ -390,7 +389,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) { SDL_Renderer *renderer; GL_RenderData *data; - const char *hint; GLint value; Uint32 window_flags; int profile_mask = 0, major = 0, minor = 0; @@ -429,6 +427,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GL_WindowEvent; renderer->GetOutputSize = GL_GetOutputSize; + renderer->SupportsBlendMode = GL_SupportsBlendMode; renderer->CreateTexture = GL_CreateTexture; renderer->UpdateTexture = GL_UpdateTexture; renderer->UpdateTextureYUV = GL_UpdateTextureYUV; @@ -450,7 +449,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->GL_BindTexture = GL_BindTexture; renderer->GL_UnbindTexture = GL_UnbindTexture; renderer->info = GL_RenderDriver.info; - renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); + renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->driverdata = data; renderer->window = window; @@ -494,7 +493,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); data->GL_ARB_debug_output_supported = SDL_TRUE; - data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)&data->next_error_callback); + data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback); data->glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM_ARB, &data->next_error_userparam); glDebugMessageCallbackARBFunc(GL_HandleDebugMessage, renderer); @@ -528,8 +527,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) } /* Check for shader support */ - hint = SDL_GetHint(SDL_HINT_RENDER_OPENGL_SHADERS); - if (!hint || *hint != '0') { + if (SDL_GetHintBoolean(SDL_HINT_RENDER_OPENGL_SHADERS, SDL_TRUE)) { data->shaders = GL_CreateShaderContext(); } SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s", @@ -594,10 +592,75 @@ static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) { SDL_GL_GetDrawableSize(renderer->window, w, h); - return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + SDL_FORCE_INLINE int power_of_2(int input) { @@ -640,18 +703,6 @@ convert_format(GL_RenderData *renderdata, Uint32 pixel_format, return SDL_TRUE; } -static GLenum -GetScaleQuality(void) -{ - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return GL_NEAREST; - } else { - return GL_LINEAR; - } -} - static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { @@ -664,6 +715,11 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_ActivateRenderer(renderer); + if (texture->access == SDL_TEXTUREACCESS_TARGET && + !renderdata->GL_EXT_framebuffer_object_supported) { + return SDL_SetError("Render targets not supported by OpenGL"); + } + if (!convert_format(renderdata, texture->format, &internalFormat, &format, &type)) { return SDL_SetError("Texture format %s not supported by OpenGL", @@ -682,12 +738,12 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (texture->format == SDL_PIXELFORMAT_NV12 || texture->format == SDL_PIXELFORMAT_NV21) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixels = SDL_calloc(1, size); if (!data->pixels) { @@ -735,7 +791,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) data->format = format; data->formattype = type; - scaleMode = GetScaleQuality(); + scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; renderdata->glEnable(data->type); renderdata->glBindTexture(data->type, data->texture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode); @@ -805,8 +861,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, @@ -817,8 +873,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glDisable(data->type); } @@ -839,8 +895,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, texture_w/2, - texture_h/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, (texture_w+1)/2, + (texture_h+1)/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); renderdata->glDisable(data->type); } @@ -867,7 +923,7 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->h, data->format, data->formattype, pixels); if (data->yuv) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); @@ -877,29 +933,29 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glBindTexture(data->type, data->utexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else { renderdata->glBindTexture(data->type, data->vtexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); } if (data->nv12) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pixels); } renderdata->glDisable(data->type); @@ -930,13 +986,13 @@ GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Upitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Uplane); renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Vpitch); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Vplane); renderdata->glDisable(data->type); @@ -980,6 +1036,10 @@ GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) GL_ActivateRenderer(renderer); + if (!data->GL_EXT_framebuffer_object_supported) { + return SDL_SetError("Render targets not supported by OpenGL"); + } + if (texture == NULL) { data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); return 0; @@ -1013,7 +1073,7 @@ GL_UpdateViewport(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h), renderer->viewport.w, renderer->viewport.h); } @@ -1035,6 +1095,8 @@ GL_UpdateViewport(SDL_Renderer * renderer) 0.0, 1.0); } } + data->glMatrixMode(GL_MODELVIEW); + return GL_CheckError("", renderer); } @@ -1051,7 +1113,7 @@ GL_UpdateClipRect(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { @@ -1084,29 +1146,18 @@ GL_SetColor(GL_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GL_SetBlendMode(GL_RenderData * data, int blendMode) +GL_SetBlendMode(GL_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1141,8 +1192,16 @@ GL_RenderClear(SDL_Renderer * renderer) (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); + if (renderer->clipping_enabled) { + data->glDisable(GL_SCISSOR_TEST); + } + data->glClear(GL_COLOR_BUFFER_BIT); + if (renderer->clipping_enabled) { + data->glEnable(GL_SCISSOR_TEST); + } + return 0; } @@ -1276,13 +1335,37 @@ GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture) GL_SetBlendMode(data, texture->blendMode); - if (texturedata->yuv) { - GL_SetShader(data, SHADER_YUV); - } else if (texturedata->nv12) { - if (texture->format == SDL_PIXELFORMAT_NV12) { - GL_SetShader(data, SHADER_NV12); - } else { - GL_SetShader(data, SHADER_NV21); + if (texturedata->yuv || texturedata->nv12) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_JPEG); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_JPEG); + } else { + GL_SetShader(data, SHADER_NV21_JPEG); + } + break; + case SDL_YUV_CONVERSION_BT601: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT601); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT601); + } else { + GL_SetShader(data, SHADER_NV21_BT601); + } + break; + case SDL_YUV_CONVERSION_BT709: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT709); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT709); + } else { + GL_SetShader(data, SHADER_NV21_BT709); + } + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); } } else { GL_SetShader(data, SHADER_RGB); @@ -1409,7 +1492,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - Uint32 temp_format = SDL_PIXELFORMAT_ARGB8888; + Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888; void *temp_pixels; int temp_pitch; GLint internalFormat; @@ -1420,42 +1503,51 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, GL_ActivateRenderer(renderer); + if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { + return SDL_SetError("Texture format %s not supported by OpenGL", + SDL_GetPixelFormatName(temp_format)); + } + + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { return SDL_OutOfMemory(); } - convert_format(data, temp_format, &internalFormat, &format, &type); - SDL_GetRendererOutputSize(renderer, &w, &h); data->glPixelStorei(GL_PACK_ALIGNMENT, 1); data->glPixelStorei(GL_PACK_ROW_LENGTH, (temp_pitch / SDL_BYTESPERPIXEL(temp_format))); - data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, - format, type, temp_pixels); + data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h, + rect->w, rect->h, format, type, temp_pixels); if (GL_CheckError("glReadPixels()", renderer) < 0) { SDL_free(temp_pixels); return -1; } - /* Flip the rows to be top-down */ - length = rect->w * SDL_BYTESPERPIXEL(temp_format); - src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; - dst = (Uint8*)temp_pixels; - tmp = SDL_stack_alloc(Uint8, length); - rows = rect->h / 2; - while (rows--) { - SDL_memcpy(tmp, dst, length); - SDL_memcpy(dst, src, length); - SDL_memcpy(src, tmp, length); - dst += temp_pitch; - src -= temp_pitch; + /* Flip the rows to be top-down if necessary */ + if (!renderer->target) { + length = rect->w * SDL_BYTESPERPIXEL(temp_format); + src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; + dst = (Uint8*)temp_pixels; + tmp = SDL_stack_alloc(Uint8, length); + rows = rect->h / 2; + while (rows--) { + SDL_memcpy(tmp, dst, length); + SDL_memcpy(dst, src, length); + SDL_memcpy(src, tmp, length); + dst += temp_pitch; + src -= temp_pitch; + } + SDL_stack_free(tmp); } - SDL_stack_free(tmp); status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, @@ -1502,6 +1594,11 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (data) { + if (data->context != NULL) { + /* make sure we delete the right resources! */ + GL_ActivateRenderer(renderer); + } + GL_ClearErrors(renderer); if (data->GL_ARB_debug_output_supported) { PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); diff --git a/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.c b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.c new file mode 100644 index 0000000000..251b54d130 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.c @@ -0,0 +1,524 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED + +#include "SDL_stdinc.h" +#include "SDL_log.h" +#include "SDL_opengl.h" +#include "SDL_video.h" +#include "SDL_shaders_gl.h" + +/* OpenGL shader implementation */ + +/* #define DEBUG_SHADERS */ + +typedef struct +{ + GLhandleARB program; + GLhandleARB vert_shader; + GLhandleARB frag_shader; +} GL_ShaderData; + +struct GL_ShaderContext +{ + GLenum (*glGetError)(void); + + PFNGLATTACHOBJECTARBPROC glAttachObjectARB; + PFNGLCOMPILESHADERARBPROC glCompileShaderARB; + PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; + PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; + PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; + PFNGLGETINFOLOGARBPROC glGetInfoLogARB; + PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; + PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; + PFNGLLINKPROGRAMARBPROC glLinkProgramARB; + PFNGLSHADERSOURCEARBPROC glShaderSourceARB; + PFNGLUNIFORM1IARBPROC glUniform1iARB; + PFNGLUNIFORM1FARBPROC glUniform1fARB; + PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; + + SDL_bool GL_ARB_texture_rectangle_supported; + + GL_ShaderData shaders[NUM_SHADERS]; +}; + +#define COLOR_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +"}" \ + +#define TEXTURE_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +" v_texCoord = vec2(gl_MultiTexCoord0);\n" \ +"}" \ + +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1, 0.000, 1.402);\n" \ +"const vec3 Gcoeff = vec3(1, -0.3441, -0.7141);\n" \ +"const vec3 Bcoeff = vec3(1, 1.772, 0.000);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.596);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.3918, -0.813);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.0172, 0.000);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);\n" \ + +#define YUV_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U \n" \ +"uniform sampler2D tex2; // V \n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.y = texture2D(tex1, tcoord).r;\n" \ +" yuv.z = texture2D(tex2, tcoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV12_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV21_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +/* + * NOTE: Always use sampler2D, etc here. We'll #define them to the + * texture_rectangle versions if we choose to use that extension. + */ +static const char *shader_source[NUM_SHADERS][2] = +{ + /* SHADER_NONE */ + { NULL, NULL }, + + /* SHADER_SOLID */ + { + /* vertex shader */ + COLOR_VERTEX_SHADER, + /* fragment shader */ +"varying vec4 v_color;\n" +"\n" +"void main()\n" +"{\n" +" gl_FragColor = v_color;\n" +"}" + }, + + /* SHADER_RGB */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ +"varying vec4 v_color;\n" +"varying vec2 v_texCoord;\n" +"uniform sampler2D tex0;\n" +"\n" +"void main()\n" +"{\n" +" gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" +"}" + }, + + /* SHADER_YUV_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + YUV_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + YUV_SHADER_BODY + }, + /* SHADER_YUV_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + YUV_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + YUV_SHADER_BODY + }, + /* SHADER_YUV_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + YUV_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + YUV_SHADER_BODY + }, + /* SHADER_NV12_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV21_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV21_SHADER_BODY + }, +}; + +static SDL_bool +CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char *defines, const char *source) +{ + GLint status; + const char *sources[2]; + + sources[0] = defines; + sources[1] = source; + + ctx->glShaderSourceARB(shader, SDL_arraysize(sources), sources, NULL); + ctx->glCompileShaderARB(shader); + ctx->glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); + if (status == 0) { + GLint length; + char *info; + + ctx->glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + info = SDL_stack_alloc(char, length+1); + ctx->glGetInfoLogARB(shader, length, NULL, info); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, + "Failed to compile shader:\n%s%s\n%s", defines, source, info); +#ifdef DEBUG_SHADERS + fprintf(stderr, + "Failed to compile shader:\n%s%s\n%s", defines, source, info); +#endif + SDL_stack_free(info); + + return SDL_FALSE; + } else { + return SDL_TRUE; + } +} + +static SDL_bool +CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data) +{ + const int num_tmus_bound = 4; + const char *vert_defines = ""; + const char *frag_defines = ""; + int i; + GLint location; + + if (index == SHADER_NONE) { + return SDL_TRUE; + } + + ctx->glGetError(); + + /* Make sure we use the correct sampler type for our texture type */ + if (ctx->GL_ARB_texture_rectangle_supported) { + frag_defines = +"#define sampler2D sampler2DRect\n" +"#define texture2D texture2DRect\n" +"#define UVCoordScale 0.5\n"; + } else { + frag_defines = +"#define UVCoordScale 1.0\n"; + } + + /* Create one program object to rule them all */ + data->program = ctx->glCreateProgramObjectARB(); + + /* Create the vertex shader */ + data->vert_shader = ctx->glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + if (!CompileShader(ctx, data->vert_shader, vert_defines, shader_source[index][0])) { + return SDL_FALSE; + } + + /* Create the fragment shader */ + data->frag_shader = ctx->glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + if (!CompileShader(ctx, data->frag_shader, frag_defines, shader_source[index][1])) { + return SDL_FALSE; + } + + /* ... and in the darkness bind them */ + ctx->glAttachObjectARB(data->program, data->vert_shader); + ctx->glAttachObjectARB(data->program, data->frag_shader); + ctx->glLinkProgramARB(data->program); + + /* Set up some uniform variables */ + ctx->glUseProgramObjectARB(data->program); + for (i = 0; i < num_tmus_bound; ++i) { + char tex_name[10]; + SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i); + location = ctx->glGetUniformLocationARB(data->program, tex_name); + if (location >= 0) { + ctx->glUniform1iARB(location, i); + } + } + ctx->glUseProgramObjectARB(0); + + return (ctx->glGetError() == GL_NO_ERROR); +} + +static void +DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data) +{ + ctx->glDeleteObjectARB(data->vert_shader); + ctx->glDeleteObjectARB(data->frag_shader); + ctx->glDeleteObjectARB(data->program); +} + +GL_ShaderContext * +GL_CreateShaderContext(void) +{ + GL_ShaderContext *ctx; + SDL_bool shaders_supported; + int i; + + ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + return NULL; + } + + if (!SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two") && + (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") || + SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle"))) { + ctx->GL_ARB_texture_rectangle_supported = SDL_TRUE; + } + + /* Check for shader support */ + shaders_supported = SDL_FALSE; + if (SDL_GL_ExtensionSupported("GL_ARB_shader_objects") && + SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") && + SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") && + SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) { + ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError"); + ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB"); + ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB"); + ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB"); + ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB"); + ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB"); + ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB"); + ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB"); + ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB"); + ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB"); + ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB"); + ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB"); + ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB"); + ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB"); + if (ctx->glGetError && + ctx->glAttachObjectARB && + ctx->glCompileShaderARB && + ctx->glCreateProgramObjectARB && + ctx->glCreateShaderObjectARB && + ctx->glDeleteObjectARB && + ctx->glGetInfoLogARB && + ctx->glGetObjectParameterivARB && + ctx->glGetUniformLocationARB && + ctx->glLinkProgramARB && + ctx->glShaderSourceARB && + ctx->glUniform1iARB && + ctx->glUniform1fARB && + ctx->glUseProgramObjectARB) { + shaders_supported = SDL_TRUE; + } + } + + if (!shaders_supported) { + SDL_free(ctx); + return NULL; + } + + /* Compile all the shaders */ + for (i = 0; i < NUM_SHADERS; ++i) { + if (!CompileShaderProgram(ctx, i, &ctx->shaders[i])) { + GL_DestroyShaderContext(ctx); + return NULL; + } + } + + /* We're done! */ + return ctx; +} + +void +GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader) +{ + ctx->glUseProgramObjectARB(ctx->shaders[shader].program); +} + +void +GL_DestroyShaderContext(GL_ShaderContext *ctx) +{ + int i; + + for (i = 0; i < NUM_SHADERS; ++i) { + DestroyShaderProgram(ctx, &ctx->shaders[i]); + } + SDL_free(ctx); +} + +#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.h b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.h rename to 3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.h index 261627cc79..36975214d9 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.h +++ b/3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_shaders_gl_h_ +#define SDL_shaders_gl_h_ + #include "../../SDL_internal.h" /* OpenGL shader implementation */ @@ -26,16 +30,24 @@ typedef enum { SHADER_NONE, SHADER_SOLID, SHADER_RGB, - SHADER_YUV, - SHADER_NV12, - SHADER_NV21, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, NUM_SHADERS } GL_Shader; typedef struct GL_ShaderContext GL_ShaderContext; -extern GL_ShaderContext * GL_CreateShaderContext(); +extern GL_ShaderContext * GL_CreateShaderContext(void); extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader); extern void GL_DestroyShaderContext(GL_ShaderContext *ctx); +#endif /* SDL_shaders_gl_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles/SDL_glesfuncs.h b/3rdparty/sdl2-2.0.9/src/render/opengles/SDL_glesfuncs.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/render/opengles/SDL_glesfuncs.h rename to 3rdparty/sdl2-2.0.9/src/render/opengles/SDL_glesfuncs.h index a15d76d496..e00982b155 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengles/SDL_glesfuncs.h +++ b/3rdparty/sdl2-2.0.9/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC_OES(void, glBlendEquationOES, (GLenum)) +SDL_PROC_OES(void, glBlendEquationSeparateOES, (GLenum, GLenum)) SDL_PROC_OES(void, glBlendFuncSeparateOES, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles/SDL_render_gles.c b/3rdparty/sdl2-2.0.9/src/render/opengles/SDL_render_gles.c similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/render/opengles/SDL_render_gles.c rename to 3rdparty/sdl2-2.0.9/src/render/opengles/SDL_render_gles.c index 0d59da3605..4007dff585 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengles/SDL_render_gles.c +++ b/3rdparty/sdl2-2.0.9/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,6 +56,7 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); static void GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -116,7 +117,7 @@ typedef struct SDL_GLContext context; struct { Uint32 color; - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -129,9 +130,9 @@ typedef struct GLES_FBOList *framebuffers; GLuint window_framebuffer; - SDL_bool useDrawTexture; - SDL_bool GL_OES_draw_texture_supported; SDL_bool GL_OES_blend_func_separate_supported; + SDL_bool GL_OES_blend_equation_separate_supported; + SDL_bool GL_OES_blend_subtract_supported; } GLES_RenderData; typedef struct @@ -199,7 +200,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #define SDL_PROC_OES(ret,func,params) \ @@ -216,7 +217,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) static SDL_GLContext SDL_CurrentContext = NULL; -GLES_FBOList * +static GLES_FBOList * GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) { GLES_FBOList *result = data->framebuffers; @@ -263,8 +264,8 @@ GLES_ResetState(SDL_Renderer *renderer) GLES_ActivateRenderer(renderer); } - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glDisable(GL_DEPTH_TEST); @@ -321,6 +322,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GLES_WindowEvent; renderer->GetOutputSize = GLES_GetOutputSize; + renderer->SupportsBlendMode = GLES_SupportsBlendMode; renderer->CreateTexture = GLES_CreateTexture; renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; @@ -369,19 +371,6 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } -#if SDL_VIDEO_DRIVER_PANDORA - data->GL_OES_draw_texture_supported = SDL_FALSE; - data->useDrawTexture = SDL_FALSE; -#else - if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) { - data->GL_OES_draw_texture_supported = SDL_TRUE; - data->useDrawTexture = SDL_TRUE; - } else { - data->GL_OES_draw_texture_supported = SDL_FALSE; - data->useDrawTexture = SDL_FALSE; - } -#endif - value = 0; data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); renderer->info.max_texture_width = value; @@ -403,6 +392,12 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) if (SDL_GL_ExtensionSupported("GL_OES_blend_func_separate")) { data->GL_OES_blend_func_separate_supported = SDL_TRUE; } + if (SDL_GL_ExtensionSupported("GL_OES_blend_equation_separate")) { + data->GL_OES_blend_equation_separate_supported = SDL_TRUE; + } + if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) { + data->GL_OES_blend_subtract_supported = SDL_TRUE; + } /* Set up parameters for rendering */ GLES_ResetState(renderer); @@ -445,6 +440,79 @@ GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD_OES; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT_OES; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT_OES; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->GL_OES_blend_func_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation && !data->GL_OES_blend_equation_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static SDL_INLINE int power_of_2(int input) { @@ -456,18 +524,6 @@ power_of_2(int input) return value; } -static GLenum -GetScaleQuality(void) -{ - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return GL_NEAREST; - } else { - return GL_LINEAR; - } -} - static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { @@ -535,7 +591,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) data->format = format; data->formattype = type; - scaleMode = GetScaleQuality(); + scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; renderdata->glBindTexture(data->type, data->texture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, scaleMode); renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, scaleMode); @@ -605,6 +661,7 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, data->format, data->formattype, src); + renderdata->glDisable(data->type); SDL_free(blob); if (renderdata->glGetError() != GL_NO_ERROR) { @@ -647,8 +704,6 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) GLES_TextureData *texturedata = NULL; GLenum status; - GLES_ActivateRenderer(renderer); - if (!data->GL_OES_framebuffer_object_supported) { return SDL_SetError("Can't enable render target support in this renderer"); } @@ -686,19 +741,30 @@ GLES_UpdateViewport(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h), renderer->viewport.w, renderer->viewport.h); } + data->glMatrixMode(GL_PROJECTION); + data->glLoadIdentity(); if (renderer->viewport.w && renderer->viewport.h) { - data->glMatrixMode(GL_PROJECTION); - data->glLoadIdentity(); - data->glOrthof((GLfloat) 0, - (GLfloat) renderer->viewport.w, - (GLfloat) renderer->viewport.h, - (GLfloat) 0, 0.0, 1.0); + if (renderer->target) { + data->glOrthof((GLfloat) 0, + (GLfloat) renderer->viewport.w, + (GLfloat) 0, + (GLfloat) renderer->viewport.h, + 0.0, 1.0); + } else { + data->glOrthof((GLfloat) 0, + (GLfloat) renderer->viewport.w, + (GLfloat) renderer->viewport.h, + (GLfloat) 0, + 0.0, 1.0); + } } + data->glMatrixMode(GL_MODELVIEW); + return 0; } @@ -720,7 +786,7 @@ GLES_UpdateClipRect(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { @@ -744,41 +810,28 @@ GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GLES_SetBlendMode(GLES_RenderData * data, int blendMode) +GLES_SetBlendMode(GLES_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - break; - case SDL_BLENDMODE_ADD: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } else { data->glEnable(GL_BLEND); if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); + data->glBlendFuncSeparateOES(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE); + data->glBlendFunc(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); } - break; - case SDL_BLENDMODE_MOD: - data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - } else { - data->glBlendFunc(GL_ZERO, GL_SRC_COLOR); + if (data->GL_OES_blend_equation_separate_supported) { + data->glBlendEquationSeparateOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); + } else if (data->GL_OES_blend_subtract_supported) { + data->glBlendEquationOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } - break; } data->current.blendMode = blendMode; } @@ -825,9 +878,17 @@ GLES_RenderClear(SDL_Renderer * renderer) (GLfloat) renderer->g * inv255f, (GLfloat) renderer->b * inv255f, (GLfloat) renderer->a * inv255f); + + if (renderer->clipping_enabled) { + data->glDisable(GL_SCISSOR_TEST); + } data->glClear(GL_COLOR_BUFFER_BIT); + if (renderer->clipping_enabled) { + data->glEnable(GL_SCISSOR_TEST); + } + return 0; } @@ -952,71 +1013,42 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, GLES_SetTexCoords(data, SDL_TRUE); - if (data->GL_OES_draw_texture_supported && data->useDrawTexture) { - /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */ - GLint cropRect[4]; - int w, h; - SDL_Window *window = renderer->window; + minx = dstrect->x; + miny = dstrect->y; + maxx = dstrect->x + dstrect->w; + maxy = dstrect->y + dstrect->h; - SDL_GetWindowSize(window, &w, &h); - if (renderer->target) { - cropRect[0] = srcrect->x; - cropRect[1] = srcrect->y; - cropRect[2] = srcrect->w; - cropRect[3] = srcrect->h; - data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, - cropRect); - data->glDrawTexfOES(renderer->viewport.x + dstrect->x, renderer->viewport.y + dstrect->y, 0, - dstrect->w, dstrect->h); - } else { - cropRect[0] = srcrect->x; - cropRect[1] = srcrect->y + srcrect->h; - cropRect[2] = srcrect->w; - cropRect[3] = -srcrect->h; - data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, - cropRect); - data->glDrawTexfOES(renderer->viewport.x + dstrect->x, - h - (renderer->viewport.y + dstrect->y) - dstrect->h, 0, - dstrect->w, dstrect->h); - } - } else { - - minx = dstrect->x; - miny = dstrect->y; - maxx = dstrect->x + dstrect->w; - maxy = dstrect->y + dstrect->h; + minu = (GLfloat) srcrect->x / texture->w; + minu *= texturedata->texw; + maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w; + maxu *= texturedata->texw; + minv = (GLfloat) srcrect->y / texture->h; + minv *= texturedata->texh; + maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h; + maxv *= texturedata->texh; - minu = (GLfloat) srcrect->x / texture->w; - minu *= texturedata->texw; - maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w; - maxu *= texturedata->texw; - minv = (GLfloat) srcrect->y / texture->h; - minv *= texturedata->texh; - maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h; - maxv *= texturedata->texh; + vertices[0] = minx; + vertices[1] = miny; + vertices[2] = maxx; + vertices[3] = miny; + vertices[4] = minx; + vertices[5] = maxy; + vertices[6] = maxx; + vertices[7] = maxy; - vertices[0] = minx; - vertices[1] = miny; - vertices[2] = maxx; - vertices[3] = miny; - vertices[4] = minx; - vertices[5] = maxy; - vertices[6] = maxx; - vertices[7] = maxy; + texCoords[0] = minu; + texCoords[1] = minv; + texCoords[2] = maxu; + texCoords[3] = minv; + texCoords[4] = minu; + texCoords[5] = maxv; + texCoords[6] = maxu; + texCoords[7] = maxv; - texCoords[0] = minu; - texCoords[1] = minv; - texCoords[2] = maxu; - texCoords[3] = minv; - texCoords[4] = minu; - texCoords[5] = maxv; - texCoords[6] = maxu; - texCoords[7] = maxv; + data->glVertexPointer(2, GL_FLOAT, 0, vertices); + data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords); + data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - data->glVertexPointer(2, GL_FLOAT, 0, vertices); - data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords); - data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - } data->glDisable(GL_TEXTURE_2D); return 0; @@ -1117,7 +1149,7 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; - Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888; + Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888; void *temp_pixels; int temp_pitch; Uint8 *src, *dst, *tmp; @@ -1136,23 +1168,25 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, data->glPixelStorei(GL_PACK_ALIGNMENT, 1); - data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, - GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); - - /* Flip the rows to be top-down */ - length = rect->w * SDL_BYTESPERPIXEL(temp_format); - src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; - dst = (Uint8*)temp_pixels; - tmp = SDL_stack_alloc(Uint8, length); - rows = rect->h / 2; - while (rows--) { - SDL_memcpy(tmp, dst, length); - SDL_memcpy(dst, src, length); - SDL_memcpy(src, tmp, length); - dst += temp_pitch; - src -= temp_pitch; + data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h, + rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); + + /* Flip the rows to be top-down if necessary */ + if (!renderer->target) { + length = rect->w * SDL_BYTESPERPIXEL(temp_format); + src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; + dst = (Uint8*)temp_pixels; + tmp = SDL_stack_alloc(Uint8, length); + rows = rect->h / 2; + while (rows--) { + SDL_memcpy(tmp, dst, length); + SDL_memcpy(dst, src, length); + SDL_memcpy(src, tmp, length); + dst += temp_pitch; + src -= temp_pitch; + } + SDL_stack_free(tmp); } - SDL_stack_free(tmp); status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_gles2funcs.h b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_gles2funcs.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_gles2funcs.h rename to 3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_gles2funcs.h index 0ecfa7f94e..b6a1436186 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_gles2funcs.h +++ b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ SDL_PROC(void, glActiveTexture, (GLenum)) SDL_PROC(void, glAttachShader, (GLuint, GLuint)) SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *)) SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendEquationSeparate, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) @@ -53,7 +54,11 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) +#if __NACL__ || __ANDROID__ +SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) +#else SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *)) +#endif SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_render_gles2.c b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_render_gles2.c similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_render_gles2.c rename to 3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_render_gles2.c index e41ab62316..fe51b9aaf6 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_render_gles2.c +++ b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_opengles2.h" #include "../SDL_sysrender.h" @@ -122,7 +123,6 @@ typedef struct GLES2_ShaderCache typedef struct GLES2_ProgramCacheEntry { GLuint id; - SDL_BlendMode blend_mode; GLES2_ShaderCacheEntry *vertex_shader; GLES2_ShaderCacheEntry *fragment_shader; GLuint uniform_locations[16]; @@ -167,7 +167,8 @@ typedef enum GLES2_IMAGESOURCE_TEXTURE_BGR, GLES2_IMAGESOURCE_TEXTURE_YUV, GLES2_IMAGESOURCE_TEXTURE_NV12, - GLES2_IMAGESOURCE_TEXTURE_NV21 + GLES2_IMAGESOURCE_TEXTURE_NV21, + GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES } GLES2_ImageSource; typedef struct GLES2_DriverContext @@ -177,7 +178,7 @@ typedef struct GLES2_DriverContext SDL_bool debug_enabled; struct { - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif @@ -297,7 +296,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -307,7 +306,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) return 0; } -GLES2_FBOList * +static GLES2_FBOList * GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h) { GLES2_FBOList *result = data->framebuffers; @@ -372,6 +371,69 @@ GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES2_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static int GLES2_UpdateViewport(SDL_Renderer * renderer) { @@ -388,7 +450,7 @@ GLES2_UpdateViewport(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h), renderer->viewport.w, renderer->viewport.h); } @@ -417,7 +479,7 @@ GLES2_UpdateClipRect(SDL_Renderer * renderer) } else { int w, h; - SDL_GetRendererOutputSize(renderer, &w, &h); + SDL_GL_GetDrawableSize(renderer->window, &w, &h); data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h); } } else { @@ -491,18 +553,6 @@ static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture); static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture); -static GLenum -GetScaleQuality(void) -{ - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return GL_NEAREST; - } else { - return GL_LINEAR; - } -} - static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) { @@ -531,24 +581,39 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_LUMINANCE; type = GL_UNSIGNED_BYTE; break; +#ifdef GL_TEXTURE_EXTERNAL_OES + case SDL_PIXELFORMAT_EXTERNAL_OES: + format = GL_NONE; + type = GL_NONE; + break; +#endif default: return SDL_SetError("Texture format not supported"); } + if (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES && + texture->access != SDL_TEXTUREACCESS_STATIC) { + return SDL_SetError("Unsupported texture access for SDL_PIXELFORMAT_EXTERNAL_OES"); + } + /* Allocate a texture struct */ data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData)); if (!data) { return SDL_OutOfMemory(); } data->texture = 0; +#ifdef GL_TEXTURE_EXTERNAL_OES + data->texture_type = (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES) ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; +#else data->texture_type = GL_TEXTURE_2D; +#endif data->pixel_format = format; data->pixel_type = type; data->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12)); data->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21)); data->texture_u = 0; data->texture_v = 0; - scaleMode = GetScaleQuality(); + scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR; /* Allocate a blob for image renderdata */ if (texture->access == SDL_TEXTUREACCESS_STREAMING) { @@ -557,11 +622,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) size = texture->h * data->pitch; if (data->yuv) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (data->nv12) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixel_data = SDL_calloc(1, size); if (!data->pixel_data) { @@ -584,7 +649,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); renderdata->glGenTextures(1, &data->texture_u); if (GL_CheckError("glGenTexures()", renderer) < 0) { @@ -596,7 +661,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -613,7 +678,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, texture->w / 2, texture->h / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -630,9 +695,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); - if (GL_CheckError("glTexImage2D()", renderer) < 0) { - return -1; + if (texture->format != SDL_PIXELFORMAT_EXTERNAL_OES) { + renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); + if (GL_CheckError("glTexImage2D()", renderer) < 0) { + return -1; + } } if (texture->access == SDL_TEXTUREACCESS_TARGET) { @@ -652,6 +719,10 @@ GLES2_TexSubImage2D(GLES2_DriverContext *data, GLenum target, GLint xoffset, GLi int src_pitch; int y; + if ((width == 0) || (height == 0) || (bpp == 0)) { + return 0; /* nothing to do */ + } + /* Reformat the texture data into a tightly packed array */ src_pitch = width * bpp; src = (Uint8 *)pixels; @@ -713,14 +784,15 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); + /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); if (texture->format == SDL_PIXELFORMAT_YV12) { data->glBindTexture(tdata->texture_type, tdata->texture_u); } else { @@ -729,11 +801,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); } if (tdata->nv12) { @@ -743,11 +815,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, - pixels, pitch, 2); + pixels, 2 * ((pitch + 1) / 2), 2); } return GL_CheckError("glTexSubImage2D()", renderer); @@ -774,8 +846,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Vplane, Vpitch, 1); @@ -784,8 +856,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Uplane, Upitch, 1); @@ -882,19 +954,16 @@ GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) * Shader management functions * *************************************************************************************************/ -static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, - SDL_BlendMode blendMode); +static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type); static void GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry); static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, - SDL_BlendMode blendMode); -static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, - SDL_BlendMode blendMode); + GLES2_ShaderCacheEntry *fragment); +static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h); static GLES2_ProgramCacheEntry * GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, SDL_BlendMode blendMode) + GLES2_ShaderCacheEntry *fragment) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ProgramCacheEntry *entry; @@ -933,7 +1002,6 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } entry->vertex_shader = vertex; entry->fragment_shader = fragment; - entry->blend_mode = blendMode; /* Create the program and link it */ entry->id = data->glCreateProgram(); @@ -1011,7 +1079,7 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } static GLES2_ShaderCacheEntry * -GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode blendMode) +GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; const GLES2_Shader *shader; @@ -1021,7 +1089,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b int i, j; /* Find the corresponding shader */ - shader = GLES2_GetShader(type, blendMode); + shader = GLES2_GetShader(type); if (!shader) { SDL_SetError("No shader matching the requested characteristics was found"); return NULL; @@ -1068,7 +1136,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b /* Compile or load the selected shader instance */ entry->id = data->glCreateShader(instance->type); if (instance->format == (GLenum)-1) { - data->glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); + data->glShaderSource(entry->id, 1, (const char **)(char *)&instance->data, NULL); data->glCompileShader(entry->id); data->glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); } else { @@ -1130,7 +1198,7 @@ GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry) } static int -GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendMode blendMode) +GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ShaderCacheEntry *vertex = NULL; @@ -1157,24 +1225,66 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC; break; case GLES2_IMAGESOURCE_TEXTURE_YUV: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV12: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV21: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } + break; + case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC; break; default: goto fault; } /* Load the requested shaders */ - vertex = GLES2_CacheShader(renderer, vtype, blendMode); + vertex = GLES2_CacheShader(renderer, vtype); if (!vertex) { goto fault; } - fragment = GLES2_CacheShader(renderer, ftype, blendMode); + fragment = GLES2_CacheShader(renderer, ftype); if (!fragment) { goto fault; } @@ -1187,7 +1297,7 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM } /* Generate a matching program */ - program = GLES2_CacheProgram(renderer, vertex, fragment, blendMode); + program = GLES2_CacheProgram(renderer, vertex, fragment); if (!program) { goto fault; } @@ -1327,32 +1437,33 @@ GLES2_RenderClear(SDL_Renderer * renderer) data->clear_a = renderer->a; } + if (renderer->clipping_enabled) { + data->glDisable(GL_SCISSOR_TEST); + } + data->glClear(GL_COLOR_BUFFER_BIT); + if (renderer->clipping_enabled) { + data->glEnable(GL_SCISSOR_TEST); + } + return 0; } static void -GLES2_SetBlendMode(GLES2_DriverContext *data, int blendMode) +GLES2_SetBlendMode(GLES2_DriverContext *data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - default: - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquationSeparate(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1375,18 +1486,17 @@ static int GLES2_SetDrawingState(SDL_Renderer * renderer) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; - const int blendMode = renderer->blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; GLES2_ActivateRenderer(renderer); - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, renderer->blendMode); GLES2_SetTexCoords(data, SDL_FALSE); /* Activate an appropriate shader and set the projection matrix */ - if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, 0, 0) < 0) { return -1; } @@ -1424,7 +1534,7 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr, GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; #if !SDL_GLES2_USE_VBOS - data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, vertexData); + data->glVertexAttribPointer(attr, 2, GL_FLOAT, GL_FALSE, 0, vertexData); #else if (!data->vertex_buffers[attr]) { data->glGenBuffers(1, &data->vertex_buffers[attr]); @@ -1439,7 +1549,7 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr, data->glBufferSubData(GL_ARRAY_BUFFER, 0, dataSizeInBytes, vertexData); } - data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, 0); + data->glVertexAttribPointer(attr, 2, GL_FLOAT, GL_FALSE, 0, 0); #endif return 0; @@ -1547,12 +1657,10 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata; GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; - SDL_BlendMode blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; /* Activate an appropriate shader and set the projection matrix */ - blendMode = texture->blendMode; if (renderer->target) { /* Check if we need to do color mapping between the source and render target textures */ if (renderer->target->format != texture->format) { @@ -1615,6 +1723,9 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } @@ -1645,12 +1756,15 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } } - if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, sourceType, texture->w, texture->h) < 0) { return -1; } @@ -1697,7 +1811,7 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) } /* Configure texture blending */ - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, texture->blendMode); GLES2_SetTexCoords(data, SDL_TRUE); return 0; @@ -1751,8 +1865,9 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLfloat vertices[8]; GLfloat texCoords[8]; GLfloat translate[8]; - GLfloat fAngle[4]; + GLfloat fAngle[8]; GLfloat tmp; + float radian_angle; GLES2_ActivateRenderer(renderer); @@ -1762,7 +1877,11 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER); data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE); - fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle); + + radian_angle = (float)(M_PI * (360.0 - angle) / 180.0); + fAngle[0] = fAngle[2] = fAngle[4] = fAngle[6] = (GLfloat)SDL_sin(radian_angle); + /* render expects cos value - 1 (see GLES2_VertexSrc_Default_) */ + fAngle[1] = fAngle[3] = fAngle[5] = fAngle[7] = (GLfloat)SDL_cos(radian_angle) - 1.0f; /* Calculate the center of rotation */ translate[0] = translate[2] = translate[4] = translate[6] = (center->x + dstrect->x); translate[1] = translate[3] = translate[5] = translate[7] = (center->y + dstrect->y); @@ -1791,7 +1910,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, translate); data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);*/ - GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_ANGLE, fAngle, 4 * sizeof(GLfloat)); + GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_ANGLE, fAngle, 8 * sizeof(GLfloat)); GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_CENTER, translate, 8 * sizeof(GLfloat)); GLES2_UpdateVertexBuffer(renderer, GLES2_ATTRIBUTE_POSITION, vertices, 8 * sizeof(GLfloat)); @@ -1817,7 +1936,8 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; - Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888; + Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888; + size_t buflen; void *temp_pixels; int temp_pitch; Uint8 *src, *dst, *tmp; @@ -1827,33 +1947,40 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, GLES2_ActivateRenderer(renderer); temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); - temp_pixels = SDL_malloc(rect->h * temp_pitch); + buflen = (size_t) (rect->h * temp_pitch); + if (buflen == 0) { + return 0; /* nothing to do. */ + } + + temp_pixels = SDL_malloc(buflen); if (!temp_pixels) { return SDL_OutOfMemory(); } SDL_GetRendererOutputSize(renderer, &w, &h); - data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, - GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); + data->glReadPixels(rect->x, renderer->target ? rect->y : (h-rect->y)-rect->h, + rect->w, rect->h, GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels); if (GL_CheckError("glReadPixels()", renderer) < 0) { return -1; } - /* Flip the rows to be top-down */ - length = rect->w * SDL_BYTESPERPIXEL(temp_format); - src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; - dst = (Uint8*)temp_pixels; - tmp = SDL_stack_alloc(Uint8, length); - rows = rect->h / 2; - while (rows--) { - SDL_memcpy(tmp, dst, length); - SDL_memcpy(dst, src, length); - SDL_memcpy(src, tmp, length); - dst += temp_pitch; - src -= temp_pitch; + /* Flip the rows to be top-down if necessary */ + if (!renderer->target) { + length = rect->w * SDL_BYTESPERPIXEL(temp_format); + src = (Uint8*)temp_pixels + (rect->h-1)*temp_pitch; + dst = (Uint8*)temp_pixels; + tmp = SDL_stack_alloc(Uint8, length); + rows = rect->h / 2; + while (rows--) { + SDL_memcpy(tmp, dst, length); + SDL_memcpy(dst, src, length); + SDL_memcpy(src, tmp, length); + dst += temp_pitch; + src -= temp_pitch; + } + SDL_stack_free(tmp); } - SDL_stack_free(tmp); status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, @@ -1913,7 +2040,9 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) * Renderer instantiation * *************************************************************************************************/ +#ifdef ZUNE_HD #define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B +#endif static void GLES2_ResetState(SDL_Renderer *renderer) @@ -1926,7 +2055,7 @@ GLES2_ResetState(SDL_Renderer *renderer) GLES2_ActivateRenderer(renderer); } - data->current.blendMode = -1; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glActiveTexture(GL_TEXTURE0); @@ -1953,19 +2082,26 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) #ifndef ZUNE_HD GLboolean hasCompiler; #endif - Uint32 window_flags; + Uint32 window_flags = 0; /* -Wconditional-uninitialized */ GLint window_framebuffer; GLint value; int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; - SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); - SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); - SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); + if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask) < 0) { + goto error; + } + if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major) < 0) { + goto error; + } + if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor) < 0) { + goto error; + } window_flags = SDL_GetWindowFlags(window); + /* OpenGL ES 3.0 is a superset of OpenGL ES 2.0 */ if (!(window_flags & SDL_WINDOW_OPENGL) || - profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { + profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major < RENDERER_CONTEXT_MAJOR) { changed_window = SDL_TRUE; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); @@ -2073,33 +2209,37 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) data->window_framebuffer = (GLuint)window_framebuffer; /* Populate the function pointers for the module */ - renderer->WindowEvent = &GLES2_WindowEvent; - renderer->GetOutputSize = &GLES2_GetOutputSize; - renderer->CreateTexture = &GLES2_CreateTexture; - renderer->UpdateTexture = &GLES2_UpdateTexture; - renderer->UpdateTextureYUV = &GLES2_UpdateTextureYUV; - renderer->LockTexture = &GLES2_LockTexture; - renderer->UnlockTexture = &GLES2_UnlockTexture; - renderer->SetRenderTarget = &GLES2_SetRenderTarget; - renderer->UpdateViewport = &GLES2_UpdateViewport; - renderer->UpdateClipRect = &GLES2_UpdateClipRect; - renderer->RenderClear = &GLES2_RenderClear; - renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; - renderer->RenderDrawLines = &GLES2_RenderDrawLines; - renderer->RenderFillRects = &GLES2_RenderFillRects; - renderer->RenderCopy = &GLES2_RenderCopy; - renderer->RenderCopyEx = &GLES2_RenderCopyEx; - renderer->RenderReadPixels = &GLES2_RenderReadPixels; - renderer->RenderPresent = &GLES2_RenderPresent; - renderer->DestroyTexture = &GLES2_DestroyTexture; - renderer->DestroyRenderer = &GLES2_DestroyRenderer; - renderer->GL_BindTexture = &GLES2_BindTexture; - renderer->GL_UnbindTexture = &GLES2_UnbindTexture; + renderer->WindowEvent = GLES2_WindowEvent; + renderer->GetOutputSize = GLES2_GetOutputSize; + renderer->SupportsBlendMode = GLES2_SupportsBlendMode; + renderer->CreateTexture = GLES2_CreateTexture; + renderer->UpdateTexture = GLES2_UpdateTexture; + renderer->UpdateTextureYUV = GLES2_UpdateTextureYUV; + renderer->LockTexture = GLES2_LockTexture; + renderer->UnlockTexture = GLES2_UnlockTexture; + renderer->SetRenderTarget = GLES2_SetRenderTarget; + renderer->UpdateViewport = GLES2_UpdateViewport; + renderer->UpdateClipRect = GLES2_UpdateClipRect; + renderer->RenderClear = GLES2_RenderClear; + renderer->RenderDrawPoints = GLES2_RenderDrawPoints; + renderer->RenderDrawLines = GLES2_RenderDrawLines; + renderer->RenderFillRects = GLES2_RenderFillRects; + renderer->RenderCopy = GLES2_RenderCopy; + renderer->RenderCopyEx = GLES2_RenderCopyEx; + renderer->RenderReadPixels = GLES2_RenderReadPixels; + renderer->RenderPresent = GLES2_RenderPresent; + renderer->DestroyTexture = GLES2_DestroyTexture; + renderer->DestroyRenderer = GLES2_DestroyRenderer; + renderer->GL_BindTexture = GLES2_BindTexture; + renderer->GL_UnbindTexture = GLES2_UnbindTexture; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; +#ifdef GL_TEXTURE_EXTERNAL_OES + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; +#endif GLES2_ResetState(renderer); diff --git a/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.c b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.c new file mode 100644 index 0000000000..f428a49456 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.c @@ -0,0 +1,573 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED + +#include "SDL_video.h" +#include "SDL_opengles2.h" +#include "SDL_shaders_gles2.h" +#include "SDL_stdinc.h" + +/************************************************************************************************* + * Vertex/fragment shader source * + *************************************************************************************************/ +/* Notes on a_angle: + * It is a vector containing sin and cos for rotation matrix + * To get correct rotation for most cases when a_angle is disabled cos + value is decremented by 1.0 to get proper output with 0.0 which is + default value +*/ +static const Uint8 GLES2_VertexSrc_Default_[] = " \ + uniform mat4 u_projection; \ + attribute vec2 a_position; \ + attribute vec2 a_texCoord; \ + attribute vec2 a_angle; \ + attribute vec2 a_center; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + float s = a_angle[0]; \ + float c = a_angle[1] + 1.0; \ + mat2 rotationMatrix = mat2(c, -s, s, c); \ + vec2 position = rotationMatrix * (a_position - a_center) + a_center; \ + v_texCoord = a_texCoord; \ + gl_Position = u_projection * vec4(position, 0.0, 1.0);\ + gl_PointSize = 1.0; \ + } \ +"; + +static const Uint8 GLES2_FragmentSrc_SolidSrc_[] = " \ + precision mediump float; \ + uniform vec4 u_color; \ + \ + void main() \ + { \ + gl_FragColor = u_color; \ + } \ +"; + +static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + gl_FragColor = texture2D(u_texture, v_texCoord); \ + gl_FragColor *= u_modulation; \ + } \ +"; + +/* ARGB to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.r = abgr.b; \ + gl_FragColor.b = abgr.r; \ + gl_FragColor *= u_modulation; \ + } \ +"; + +/* RGB to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.r = abgr.b; \ + gl_FragColor.b = abgr.r; \ + gl_FragColor.a = 1.0; \ + gl_FragColor *= u_modulation; \ + } \ +"; + +/* BGR to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \ + precision mediump float; \ + uniform sampler2D u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + vec4 abgr = texture2D(u_texture, v_texCoord); \ + gl_FragColor = abgr; \ + gl_FragColor.a = 1.0; \ + gl_FragColor *= u_modulation; \ + } \ +"; + +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1, 1, 1,\n" \ +" 0, -0.3441, 1.772,\n" \ +" 1.402, -0.7141, 0);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.3918, 2.0172,\n" \ +" 1.596, -0.813, 0);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.2132, 2.1124,\n" \ +" 1.7927, -0.5329, 0);\n" \ + + +#define YUV_SHADER_PROLOGUE \ +"precision mediump float;\n" \ +"uniform sampler2D u_texture;\n" \ +"uniform sampler2D u_texture_u;\n" \ +"uniform sampler2D u_texture_v;\n" \ +"uniform vec4 u_modulation;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.y = texture2D(u_texture_u, v_texCoord).r;\n" \ +" yuv.z = texture2D(u_texture_v, v_texCoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +/* YUV to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; + +/* NV12 to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; + +/* NV21 to ABGR conversion */ +static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; + +/* Custom Android video format texture */ +static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \ + #extension GL_OES_EGL_image_external : require\n\ + precision mediump float; \ + uniform samplerExternalOES u_texture; \ + uniform vec4 u_modulation; \ + varying vec2 v_texCoord; \ + \ + void main() \ + { \ + gl_FragColor = texture2D(u_texture, v_texCoord); \ + gl_FragColor *= u_modulation; \ + } \ +"; + +static const GLES2_ShaderInstance GLES2_VertexSrc_Default = { + GL_VERTEX_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_VertexSrc_Default_), + GLES2_VertexSrc_Default_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_SolidSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_SolidSrc_), + GLES2_FragmentSrc_SolidSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureABGRSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureABGRSrc_), + GLES2_FragmentSrc_TextureABGRSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureARGBSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureARGBSrc_), + GLES2_FragmentSrc_TextureARGBSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureRGBSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureRGBSrc_), + GLES2_FragmentSrc_TextureRGBSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureBGRSrc_), + GLES2_FragmentSrc_TextureBGRSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_), + GLES2_FragmentSrc_TextureYUVJPEGSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_), + GLES2_FragmentSrc_TextureYUVBT601Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_), + GLES2_FragmentSrc_TextureYUVBT709Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_), + GLES2_FragmentSrc_TextureNV12JPEGSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_), + GLES2_FragmentSrc_TextureNV12BT601Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_), + GLES2_FragmentSrc_TextureNV21BT709Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_), + GLES2_FragmentSrc_TextureNV21JPEGSrc_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_), + GLES2_FragmentSrc_TextureNV21BT601Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_), + GLES2_FragmentSrc_TextureNV12BT709Src_ +}; + +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = { + GL_FRAGMENT_SHADER, + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureExternalOESSrc_), + GLES2_FragmentSrc_TextureExternalOESSrc_ +}; + + +/************************************************************************************************* + * Vertex/fragment shader definitions * + *************************************************************************************************/ + +static GLES2_Shader GLES2_VertexShader_Default = { + 1, + { + &GLES2_VertexSrc_Default + } +}; + +static GLES2_Shader GLES2_FragmentShader_SolidSrc = { + 1, + { + &GLES2_FragmentSrc_SolidSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureABGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureABGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureARGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureARGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureRGBSrc = { + 1, + { + &GLES2_FragmentSrc_TextureRGBSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = { + 1, + { + &GLES2_FragmentSrc_TextureBGRSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = { + 1, + { + &GLES2_FragmentSrc_TextureYUVJPEGSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = { + 1, + { + &GLES2_FragmentSrc_TextureYUVBT601Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = { + 1, + { + &GLES2_FragmentSrc_TextureYUVBT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = { + 1, + { + &GLES2_FragmentSrc_TextureNV12JPEGSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV12BT601Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV12BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = { + 1, + { + &GLES2_FragmentSrc_TextureNV21JPEGSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT601Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = { + 1, + { + &GLES2_FragmentSrc_TextureExternalOESSrc + } +}; + + +/************************************************************************************************* + * Shader selector * + *************************************************************************************************/ + +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type) +{ + switch (type) { + case GLES2_SHADER_VERTEX_DEFAULT: + return &GLES2_VertexShader_Default; + case GLES2_SHADER_FRAGMENT_SOLID_SRC: + return &GLES2_FragmentShader_SolidSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC: + return &GLES2_FragmentShader_TextureABGRSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC: + return &GLES2_FragmentShader_TextureARGBSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC: + return &GLES2_FragmentShader_TextureRGBSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC: + return &GLES2_FragmentShader_TextureBGRSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC: + return &GLES2_FragmentShader_TextureYUVJPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC: + return &GLES2_FragmentShader_TextureYUVBT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC: + return &GLES2_FragmentShader_TextureYUVBT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV12JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC: + return &GLES2_FragmentShader_TextureNV12BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC: + return &GLES2_FragmentShader_TextureNV12BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV21JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC: + return &GLES2_FragmentShader_TextureNV21BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC: + return &GLES2_FragmentShader_TextureNV21BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC: + return &GLES2_FragmentShader_TextureExternalOESSrc; + default: + return NULL; + } +} + +#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.h b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.h similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.h rename to 3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.h index 3958ae00d1..c16ce127e9 100644 --- a/3rdparty/sdl2-2.0.4/src/render/opengles2/SDL_shaders_gles2.h +++ b/3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 +#ifndef SDL_shaders_gles2_h_ +#define SDL_shaders_gles2_h_ -#ifndef SDL_shaderdata_h_ -#define SDL_shaderdata_h_ +#if SDL_VIDEO_RENDER_OGL_ES2 typedef struct GLES2_ShaderInstance { @@ -47,17 +47,24 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC } GLES2_ShaderType; #define GLES2_SOURCE_SHADER (GLenum)-1 -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode); - -#endif /* SDL_shaderdata_h_ */ +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type); #endif /* SDL_VIDEO_RENDER_OGL_ES2 */ +#endif /* SDL_shaders_gles2_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/psp/SDL_render_psp.c b/3rdparty/sdl2-2.0.9/src/render/psp/SDL_render_psp.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/render/psp/SDL_render_psp.c rename to 3rdparty/sdl2-2.0.9/src/render/psp/SDL_render_psp.c index 8e8c873535..babc2526a0 100644 --- a/3rdparty/sdl2-2.0.4/src/render/psp/SDL_render_psp.c +++ b/3rdparty/sdl2-2.0.9/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,8 @@ static SDL_Renderer *PSP_CreateRenderer(SDL_Window * window, Uint32 flags); static void PSP_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int PSP_SetTextureColorMod(SDL_Renderer * renderer, + SDL_Texture * texture); static int PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -184,18 +186,6 @@ TextureNextPow2(unsigned int w) } -static int -GetScaleQuality(void) -{ - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return GU_NEAREST; /* GU_NEAREST good for tile-map */ - } else { - return GU_LINEAR; /* GU_LINEAR good for scaling */ - } -} - static int PixelFormatToPSPFMT(Uint32 format) { @@ -359,6 +349,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = PSP_WindowEvent; renderer->CreateTexture = PSP_CreateTexture; + renderer->SetTextureColorMod = PSP_SetTextureColorMod; renderer->UpdateTexture = PSP_UpdateTexture; renderer->LockTexture = PSP_LockTexture; renderer->UnlockTexture = PSP_UnlockTexture; @@ -501,12 +492,17 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return 0; } +static int +PSP_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) +{ + return SDL_Unsupported(); +} void TextureActivate(SDL_Texture * texture) { PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata; - int scaleMode = GetScaleQuality(); + int scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GU_NEAREST : GU_LINEAR; /* Swizzling is useless with small textures. */ if (texture->w >= 16 || texture->h >= 16) @@ -853,7 +849,7 @@ PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 pixel_format, void * pixels, int pitch) { - return 0; + return SDL_Unsupported(); } @@ -941,11 +937,11 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, vertices[3].y = y + sw - ch; vertices[3].z = 0; - if (flip & SDL_FLIP_HORIZONTAL) { + if (flip & SDL_FLIP_VERTICAL) { Swap(&vertices[0].v, &vertices[2].v); Swap(&vertices[1].v, &vertices[3].v); } - if (flip & SDL_FLIP_VERTICAL) { + if (flip & SDL_FLIP_HORIZONTAL) { Swap(&vertices[0].u, &vertices[2].u); Swap(&vertices[1].u, &vertices[3].u); } diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.c index 7cfb274aef..8a3f7500e9 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -245,7 +245,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, } else { return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.h index 88bb2e2c46..3cac834549 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_blendfillrect_h_ +#define SDL_blendfillrect_h_ + #include "../../SDL_internal.h" extern int SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); extern int SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#endif /* SDL_blendfillrect_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.c index ef0d585316..0ed0ccd203 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -685,7 +685,7 @@ SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt) } else { return SDL_BlendLine_RGB2; } - break; + /* break; -Wunreachable-code-break */ case 4: if (fmt->Rmask == 0x00FF0000) { if (fmt->Amask) { diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.h index c0b545f345..a48a4984ea 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_blendline_h_ +#define SDL_blendline_h_ + #include "../../SDL_internal.h" extern int SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); extern int SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#endif /* SDL_blendline_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.c index fc42dfe767..37fb49862a 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -235,13 +235,11 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r switch (dst->format->Rmask) { case 0x00FF0000: if (!dst->format->Amask) { - return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a); } else { - return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.h index 58ddec7ee4..188557cea5 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_blendpoint_h_ +#define SDL_blendpoint_h_ + #include "../../SDL_internal.h" extern int SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); extern int SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#endif /* SDL_blendpoint_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_draw.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_draw.h similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_draw.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_draw.h index 3a5e7cf113..945f2bcd04 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_draw.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -562,10 +562,10 @@ do { \ while (height--) { \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { op; pixel++; \ - case 3: op; pixel++; \ - case 2: op; pixel++; \ - case 1: op; pixel++; \ + case 0: do { op; pixel++; /* fallthrough */ \ + case 3: op; pixel++; /* fallthrough */ \ + case 2: op; pixel++; /* fallthrough */ \ + case 1: op; pixel++; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } \ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.c index fd50ea748b..eeb54ed3a9 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.h index 40721c3fce..4e8e2bd459 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_drawline_h_ +#define SDL_drawline_h_ + #include "../../SDL_internal.h" extern int SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color); extern int SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color); +#endif /* SDL_drawline_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.c index 98f0d83c00..64a4e52a91 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.h index e77857ac91..454774d068 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_drawpoint_h_ +#define SDL_drawpoint_h_ + #include "../../SDL_internal.h" extern int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color); extern int SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color); +#endif /* SDL_drawpoint_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw.c similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw.c index dadd2442f9..709dfe8e48 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,7 +239,10 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a); SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode); - if (texture->access == SDL_TEXTUREACCESS_STATIC) { + /* Only RLE encode textures without an alpha channel since the RLE coder + * discards the color values of pixels with an alpha value of zero. + */ + if (texture->access == SDL_TEXTUREACCESS_STATIC && !Amask) { SDL_SetSurfaceRLE(texture->driverdata, 1); } @@ -368,9 +371,14 @@ SW_UpdateClipRect(SDL_Renderer * renderer) SDL_Surface *surface = data->surface; if (surface) { if (renderer->clipping_enabled) { - SDL_SetClipRect(surface, &renderer->clip_rect); + SDL_Rect clip_rect; + clip_rect = renderer->clip_rect; + clip_rect.x += renderer->viewport.x; + clip_rect.y += renderer->viewport.y; + SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect); + SDL_SetClipRect(surface, &clip_rect); } else { - SDL_SetClipRect(surface, NULL); + SDL_SetClipRect(surface, &renderer->viewport); } } return 0; @@ -579,18 +587,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, } } -static int -GetScaleQuality(void) -{ - const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - - if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { - return 0; - } else { - return 1; - } -} - static int SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, @@ -599,9 +595,15 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Surface *surface = SW_ActivateRenderer(renderer); SDL_Surface *src = (SDL_Surface *) texture->driverdata; SDL_Rect final_rect, tmp_rect; - SDL_Surface *surface_rotated, *surface_scaled; - int retval, dstwidth, dstheight, abscenterx, abscentery; + SDL_Surface *src_clone, *src_rotated, *src_scaled; + SDL_Surface *mask = NULL, *mask_rotated = NULL; + int retval = 0, dstwidth, dstheight, abscenterx, abscentery; double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y; + SDL_BlendMode blendmode; + Uint8 alphaMod, rMod, gMod, bMod; + int applyModulation = SDL_FALSE; + int blitRequired = SDL_FALSE; + int isOpaque = SDL_FALSE; if (!surface) { return -1; @@ -617,69 +619,109 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, final_rect.w = (int)dstrect->w; final_rect.h = (int)dstrect->h; - /* SDLgfx_rotateSurface doesn't accept a source rectangle, so crop and scale if we need to */ tmp_rect = final_rect; tmp_rect.x = 0; tmp_rect.y = 0; - if (srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0) { - surface_scaled = src; /* but if we don't need to, just use the original */ - retval = 0; - } else { - SDL_Surface *blit_src = src; - Uint32 colorkey; - SDL_BlendMode blendMode; - Uint8 alphaMod, r, g, b; - SDL_bool cloneSource = SDL_FALSE; - - surface_scaled = SDL_CreateRGBSurface(SDL_SWSURFACE, final_rect.w, final_rect.h, src->format->BitsPerPixel, - src->format->Rmask, src->format->Gmask, - src->format->Bmask, src->format->Amask ); - if (!surface_scaled) { - return -1; - } - /* copy the color key, alpha mod, blend mode, and color mod so the scaled surface behaves like the source */ - if (SDL_GetColorKey(src, &colorkey) == 0) { - SDL_SetColorKey(surface_scaled, SDL_TRUE, colorkey); - cloneSource = SDL_TRUE; + /* It is possible to encounter an RLE encoded surface here and locking it is + * necessary because this code is going to access the pixel buffer directly. + */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); + } + + /* Clone the source surface but use its pixel buffer directly. + * The original source surface must be treated as read-only. + */ + src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); + if (src_clone == NULL) { + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } - SDL_GetSurfaceAlphaMod(src, &alphaMod); /* these will be copied to surface_scaled below if necessary */ - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &r, &g, &b); - - /* now we need to blit the src into surface_scaled. since we want to copy the colors from the source to - * surface_scaled rather than blend them, etc. we'll need to disable the blend mode, alpha mod, etc. - * but we don't want to modify src (in case it's being used on other threads), so we'll need to clone it - * before changing the blend options - */ - cloneSource |= blendMode != SDL_BLENDMODE_NONE || (alphaMod & r & g & b) != 255; - if (cloneSource) { - blit_src = SDL_ConvertSurface(src, src->format, src->flags); /* clone src */ - if (!blit_src) { - SDL_FreeSurface(surface_scaled); - return -1; - } - SDL_SetSurfaceAlphaMod(blit_src, 255); /* disable all blending options in blit_src */ - SDL_SetSurfaceBlendMode(blit_src, SDL_BLENDMODE_NONE); - SDL_SetColorKey(blit_src, 0, 0); - SDL_SetSurfaceColorMod(blit_src, 255, 255, 255); - SDL_SetSurfaceRLE(blit_src, 0); /* don't RLE encode a surface we'll only use once */ - - SDL_SetSurfaceAlphaMod(surface_scaled, alphaMod); /* copy blending options to surface_scaled */ - SDL_SetSurfaceBlendMode(surface_scaled, blendMode); - SDL_SetSurfaceColorMod(surface_scaled, r, g, b); + return -1; + } + + SDL_GetSurfaceBlendMode(src, &blendmode); + SDL_GetSurfaceAlphaMod(src, &alphaMod); + SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod); + + /* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */ + if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) { + blitRequired = SDL_TRUE; + } + + /* If scaling and cropping is necessary, it has to be taken care of before the rotation. */ + if (!(srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0)) { + blitRequired = SDL_TRUE; + } + + /* srcrect is not selecting the whole src surface, so cropping is needed */ + if (!(srcrect->w == src->w && srcrect->h == src->h && srcrect->x == 0 && srcrect->y == 0)) { + blitRequired = SDL_TRUE; + } + + /* The color and alpha modulation has to be applied before the rotation when using the NONE and MOD blend modes. */ + if ((blendmode == SDL_BLENDMODE_NONE || blendmode == SDL_BLENDMODE_MOD) && (alphaMod & rMod & gMod & bMod) != 255) { + applyModulation = SDL_TRUE; + SDL_SetSurfaceAlphaMod(src_clone, alphaMod); + SDL_SetSurfaceColorMod(src_clone, rMod, gMod, bMod); + } + + /* Opaque surfaces are much easier to handle with the NONE blend mode. */ + if (blendmode == SDL_BLENDMODE_NONE && !src->format->Amask && alphaMod == 255) { + isOpaque = SDL_TRUE; + } + + /* The NONE blend mode requires a mask for non-opaque surfaces. This mask will be used + * to clear the pixels in the destination surface. The other steps are explained below. + */ + if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) { + mask = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (mask == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD); } + } - retval = SDL_BlitScaled(blit_src, srcrect, surface_scaled, &tmp_rect); - if (blit_src != src) { - SDL_FreeSurface(blit_src); + /* Create a new surface should there be a format mismatch or if scaling, cropping, + * or modulation is required. It's possible to use the source surface directly otherwise. + */ + if (!retval && (blitRequired || applyModulation)) { + SDL_Rect scale_rect = tmp_rect; + src_scaled = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (src_scaled == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE); + retval = SDL_BlitScaled(src_clone, srcrect, src_scaled, &scale_rect); + SDL_FreeSurface(src_clone); + src_clone = src_scaled; + src_scaled = NULL; } } + /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */ + SDL_SetSurfaceBlendMode(src_clone, blendmode); + if (!retval) { - SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, -angle, &dstwidth, &dstheight, &cangle, &sangle); - surface_rotated = SDLgfx_rotateSurface(surface_scaled, -angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); - if(surface_rotated) { + SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle); + src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); + if (src_rotated == NULL) { + retval = -1; + } + if (!retval && mask != NULL) { + /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ + mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle); + if (mask_rotated == NULL) { + retval = -1; + } + } + if (!retval) { /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ abscenterx = final_rect.x + (int)center->x; abscentery = final_rect.y + (int)center->y; @@ -715,13 +757,69 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, tmp_rect.w = dstwidth; tmp_rect.h = dstheight; - retval = SDL_BlitSurface(surface_rotated, NULL, surface, &tmp_rect); - SDL_FreeSurface(surface_rotated); + /* The NONE blend mode needs some special care with non-opaque surfaces. + * Other blend modes or opaque surfaces can be blitted directly. + */ + if (blendmode != SDL_BLENDMODE_NONE || isOpaque) { + if (applyModulation == SDL_FALSE) { + /* If the modulation wasn't already applied, make it happen now. */ + SDL_SetSurfaceAlphaMod(src_rotated, alphaMod); + SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod); + } + retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect); + } else { + /* The NONE blend mode requires three steps to get the pixels onto the destination surface. + * First, the area where the rotated pixels will be blitted to get set to zero. + * This is accomplished by simply blitting a mask with the NONE blend mode. + * The colorkey set by the rotate function will discard the correct pixels. + */ + SDL_Rect mask_rect = tmp_rect; + SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE); + retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The next step copies the alpha value. This is done with the BLEND blend mode and + * by modulating the source colors with 0. Since the destination is all zeros, this + * will effectively set the destination alpha to the source alpha. + */ + SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0); + mask_rect = tmp_rect; + retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The last step gets the color values in place. The ADD blend mode simply adds them to + * the destination (where the color values are all zero). However, because the ADD blend + * mode modulates the colors with the alpha channel, a surface without an alpha mask needs + * to be created. This makes all source pixels opaque and the colors get copied correctly. + */ + SDL_Surface *src_rotated_rgb; + src_rotated_rgb = SDL_CreateRGBSurfaceFrom(src_rotated->pixels, src_rotated->w, src_rotated->h, + src_rotated->format->BitsPerPixel, src_rotated->pitch, + src_rotated->format->Rmask, src_rotated->format->Gmask, + src_rotated->format->Bmask, 0); + if (src_rotated_rgb == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); + retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect); + SDL_FreeSurface(src_rotated_rgb); + } + } + } + SDL_FreeSurface(mask_rotated); + } + if (src_rotated != NULL) { + SDL_FreeSurface(src_rotated); + } } } - if (surface_scaled != src) { - SDL_FreeSurface(surface_scaled); + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); + } + if (mask != NULL) { + SDL_FreeSurface(mask); + } + if (src_clone != NULL) { + SDL_FreeSurface(src_clone); } return retval; } @@ -733,19 +831,14 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Surface *surface = SW_ActivateRenderer(renderer); Uint32 src_format; void *src_pixels; - SDL_Rect final_rect; if (!surface) { return -1; } - if (renderer->viewport.x || renderer->viewport.y) { - final_rect.x = renderer->viewport.x + rect->x; - final_rect.y = renderer->viewport.y + rect->y; - final_rect.w = rect->w; - final_rect.h = rect->h; - rect = &final_rect; - } + /* NOTE: The rect is already adjusted according to the viewport by + * SDL_RenderReadPixels. + */ if (rect->x < 0 || rect->x+rect->w > surface->w || rect->y < 0 || rect->y+rect->h > surface->h) { diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw_c.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw_c.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw_c.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw_c.h index 89b4e8acc4..f228517c5b 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw_c.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,11 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_render_sw_c_h_ +#define SDL_render_sw_c_h_ + extern SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface * surface); +#endif /* SDL_render_sw_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.c b/3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.c similarity index 52% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.c rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.c index 8d92758f87..09e099c391 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.c +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.c @@ -76,11 +76,6 @@ to a situation where the program can segfault. */ #define GUARD_ROWS (2) -/* ! -\brief Lower limit of absolute zoom factor or rotation degrees. -*/ -#define VALUE_LIMIT 0.001 - /* ! \brief Returns colorkey info for a surface */ @@ -88,7 +83,9 @@ static Uint32 _colorkey(SDL_Surface *src) { Uint32 key = 0; - SDL_GetColorKey(src, &key); + if (SDL_HasColorKey(src)) { + SDL_GetColorKey(src, &key); + } return key; } @@ -110,31 +107,105 @@ SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle) { - double x, y, cx, cy, sx, sy; - double radangle; - int dstwidthhalf, dstheighthalf; + /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */ + int angle90 = (int)(angle/90); + if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */ + angle90 %= 4; + if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ + if(angle90 & 1) { + *dstwidth = height; + *dstheight = width; + *cangle = 0; + *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */ + } else { + *dstwidth = width; + *dstheight = height; + *cangle = angle90 == 0 ? 1 : -1; + *sangle = 0; + } + } else { + double x, y, cx, cy, sx, sy; + double radangle; + int dstwidthhalf, dstheighthalf; + /* + * Determine destination width and height by rotating a centered source box + */ + radangle = angle * (M_PI / -180.0); /* reverse the angle because our rotations are clockwise */ + *sangle = SDL_sin(radangle); + *cangle = SDL_cos(radangle); + x = (double)(width / 2); + y = (double)(height / 2); + cx = *cangle * x; + cy = *cangle * y; + sx = *sangle * x; + sy = *sangle * y; + + dstwidthhalf = MAX((int) + SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); + dstheighthalf = MAX((int) + SDL_ceil(MAX(MAX(MAX(SDL_fabs(sx + cy), SDL_fabs(sx - cy)), SDL_fabs(-sx + cy)), SDL_fabs(-sx - cy))), 1); + *dstwidth = 2 * dstwidthhalf; + *dstheight = 2 * dstheighthalf; + } +} - /* - * Determine destination width and height by rotating a centered source box - */ - radangle = angle * (M_PI / 180.0); - *sangle = SDL_sin(radangle); - *cangle = SDL_cos(radangle); - x = (double)(width / 2); - y = (double)(height / 2); - cx = *cangle * x; - cy = *cangle * y; - sx = *sangle * x; - sy = *sangle * y; - - dstwidthhalf = MAX((int) - SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); - dstheighthalf = MAX((int) - SDL_ceil(MAX(MAX(MAX(SDL_fabs(sx + cy), SDL_fabs(sx - cy)), SDL_fabs(-sx + cy)), SDL_fabs(-sx - cy))), 1); - *dstwidth = 2 * dstwidthhalf; - *dstheight = 2 * dstheighthalf; +/* Computes source pointer X/Y increments for a rotation that's a multiple of 90 degrees. */ +static void +computeSourceIncrements90(SDL_Surface * src, int bpp, int angle, int flipx, int flipy, + int *sincx, int *sincy, int *signx, int *signy) +{ + int pitch = flipy ? -src->pitch : src->pitch; + if (flipx) { + bpp = -bpp; + } + switch (angle) { /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ + case 0: *sincx = bpp; *sincy = pitch - src->w * *sincx; *signx = *signy = 1; break; + case 1: *sincx = -pitch; *sincy = bpp - *sincx * src->h; *signx = 1; *signy = -1; break; + case 2: *sincx = -bpp; *sincy = -src->w * *sincx - pitch; *signx = *signy = -1; break; + case 3: default: *sincx = pitch; *sincy = -*sincx * src->h - bpp; *signx = -1; *signy = 1; break; + } + if (flipx) { + *signx = -*signx; + } + if (flipy) { + *signy = -*signy; + } } +/* Performs a relatively fast rotation/flip when the angle is a multiple of 90 degrees. */ +#define TRANSFORM_SURFACE_90(pixelType) \ + int dy, dincy = dst->pitch - dst->w*sizeof(pixelType), sincx, sincy, signx, signy; \ + Uint8 *sp = (Uint8*)src->pixels, *dp = (Uint8*)dst->pixels, *de; \ + \ + computeSourceIncrements90(src, sizeof(pixelType), angle, flipx, flipy, &sincx, &sincy, &signx, &signy); \ + if (signx < 0) sp += (src->w-1)*sizeof(pixelType); \ + if (signy < 0) sp += (src->h-1)*src->pitch; \ + \ + for (dy = 0; dy < dst->h; sp += sincy, dp += dincy, dy++) { \ + if (sincx == sizeof(pixelType)) { /* if advancing src and dest equally, use memcpy */ \ + SDL_memcpy(dp, sp, dst->w*sizeof(pixelType)); \ + sp += dst->w*sizeof(pixelType); \ + dp += dst->w*sizeof(pixelType); \ + } else { \ + for (de = dp + dst->w*sizeof(pixelType); dp != de; sp += sincx, dp += sizeof(pixelType)) { \ + *(pixelType*)dp = *(pixelType*)sp; \ + } \ + } \ + } + +static void +transformSurfaceRGBA90(SDL_Surface * src, SDL_Surface * dst, int angle, int flipx, int flipy) +{ + TRANSFORM_SURFACE_90(tColorRGBA); +} + +static void +transformSurfaceY90(SDL_Surface * src, SDL_Surface * dst, int angle, int flipx, int flipy) +{ + TRANSFORM_SURFACE_90(tColorY); +} + +#undef TRANSFORM_SURFACE_90 /* ! \brief Internal 32 bit rotozoomer with optional anti-aliasing. @@ -188,7 +259,7 @@ _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int dy = (sdy >> 16); if (flipx) dx = sw - dx; if (flipy) dy = sh - dy; - if ((unsigned)dx < (unsigned)sw && (unsigned)dy < (unsigned)sh) { + if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx; c00 = *sp; sp += 1; @@ -316,10 +387,14 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin /* ! \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. -Rotates a 32bit or 8bit 'src' surface to newly created 'dst' surface. +Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set -then the destination 32bit surface is anti-aliased. If the surface is not 8bit -or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. +then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit +surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes). +The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE +mode will set the BLEND mode on the 'dst' surface. The MOD mode either generates a white 'dst' +surface and sets the colorkey or fills the it with the colorkey before copying the pixels. +When using the NONE and MOD modes, color and alpha modulation must be applied before using this function. \param src The surface to rotozoom. \param angle The angle to rotate in degrees. @@ -339,75 +414,49 @@ or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. SDL_Surface * SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) { - SDL_Surface *rz_src; SDL_Surface *rz_dst; - int is32bit; + int is8bit, angle90; int i; - Uint8 r,g,b; + SDL_BlendMode blendmode; Uint32 colorkey = 0; - int colorKeyAvailable = 0; + int colorKeyAvailable = SDL_FALSE; double sangleinv, cangleinv; - /* - * Sanity check - */ + /* Sanity check */ if (src == NULL) - return (NULL); + return NULL; - if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */) - { - colorkey = _colorkey(src); - SDL_GetRGB(colorkey, src->format, &r, &g, &b); - colorKeyAvailable = 1; - } - /* - * Determine if source surface is 32bit or 8bit - */ - is32bit = (src->format->BitsPerPixel == 32); - if ((is32bit) || (src->format->BitsPerPixel == 8)) { - /* - * Use source surface 'as is' - */ - rz_src = src; - } else { - Uint32 format = SDL_MasksToPixelFormatEnum(32, -#if SDL_BYTEORDER == SDL_LIL_ENDIAN - 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 -#else - 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff -#endif - ); - rz_src = SDL_ConvertSurfaceFormat(src, format, src->flags); - is32bit = 1; + if (SDL_HasColorKey(src)) { + if (SDL_GetColorKey(src, &colorkey) == 0) { + colorKeyAvailable = SDL_TRUE; + } } + /* This function requires a 32-bit surface or 8-bit surface with a colorkey */ + is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable; + if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) + return NULL; - /* Determine target size */ - /* _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, &dstwidth, &dstheight, &cangle, &sangle); */ - - /* - * Calculate target factors from sin/cos and zoom - */ + /* Calculate target factors from sin/cos and zoom */ sangleinv = sangle*65536.0; cangleinv = cangle*65536.0; - /* - * Alloc space to completely contain the rotated surface - */ + /* Alloc space to completely contain the rotated surface */ rz_dst = NULL; - if (is32bit) { - /* - * Target surface is 32bit with source RGBA/ABGR ordering - */ - rz_dst = - SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32, - rz_src->format->Rmask, rz_src->format->Gmask, - rz_src->format->Bmask, rz_src->format->Amask); + if (is8bit) { + /* Target surface is 8 bit */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + if (rz_dst != NULL) { + for (i = 0; i < src->format->palette->ncolors; i++) { + rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; + } + rz_dst->format->palette->ncolors = src->format->palette->ncolors; + } } else { - /* - * Target surface is 8bit - */ - rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + /* Target surface is 32 bit with source RGBA ordering */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); } /* Check target */ @@ -417,80 +466,69 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, /* Adjust for guard rows */ rz_dst->h = dstheight; - if (colorKeyAvailable == 1){ - colorkey = SDL_MapRGB(rz_dst->format, r, g, b); - - SDL_FillRect(rz_dst, NULL, colorkey ); + SDL_GetSurfaceBlendMode(src, &blendmode); + + if (colorKeyAvailable == SDL_TRUE) { + /* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); + SDL_FillRect(rz_dst, NULL, colorkey); + } else if (blendmode == SDL_BLENDMODE_NONE) { + blendmode = SDL_BLENDMODE_BLEND; + } else if (blendmode == SDL_BLENDMODE_MOD) { + /* Without a colorkey, the target texture has to be white for the MOD blend mode so + * that the pixels outside the rotated area don't affect the destination surface. + */ + colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0); + SDL_FillRect(rz_dst, NULL, colorkey); + /* Setting a white colorkey for the destination surface makes the final blit discard + * all pixels outside of the rotated area. This doesn't interfere with anything because + * white pixels are already a no-op and the MOD blend mode does not interact with alpha. + */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); } - /* - * Lock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_LockSurface(rz_src); - } + SDL_SetSurfaceBlendMode(rz_dst, blendmode); - /* - * Check which kind of surface we have - */ - if (is32bit) { - /* - * Call the 32bit transformation routine to do the rotation (using alpha) - */ - _transformSurfaceRGBA(rz_src, rz_dst, centerx, centery, - (int) (sangleinv), (int) (cangleinv), - flipx, flipy, - smooth); - /* - * Turn on source-alpha support - */ - /* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */ - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); - } else { - /* - * Copy palette and colorkey info - */ - for (i = 0; i < rz_src->format->palette->ncolors; i++) { - rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; - } - rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; - /* - * Call the 8bit transformation routine to do the rotation - */ - transformSurfaceY(rz_src, rz_dst, centerx, centery, - (int) (sangleinv), (int) (cangleinv), - flipx, flipy); - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); + /* Lock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); } - /* copy alpha mod, color mod, and blend mode */ - { - SDL_BlendMode blendMode; - Uint8 alphaMod, cr, cg, cb; - SDL_GetSurfaceAlphaMod(src, &alphaMod); - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &cr, &cg, &cb); - SDL_SetSurfaceAlphaMod(rz_dst, alphaMod); - SDL_SetSurfaceBlendMode(rz_dst, blendMode); - SDL_SetSurfaceColorMod(rz_dst, cr, cg, cb); + /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce + * the off-by-one problem in _transformSurfaceRGBA that expresses itself when the rotation is near + * multiples of 90 degrees. + */ + angle90 = (int)(angle/90); + if (angle90 == angle/90) { + angle90 %= 4; + if (angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ + } else { + angle90 = -1; } - /* - * Unlock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_UnlockSurface(rz_src); + if (is8bit) { + /* Call the 8-bit transformation routine to do the rotation */ + if(angle90 >= 0) { + transformSurfaceY90(src, rz_dst, angle90, flipx, flipy); + } else { + transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy); + } + } else { + /* Call the 32-bit transformation routine to do the rotation */ + if (angle90 >= 0) { + transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy); + } else { + _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy, smooth); + } } - /* - * Cleanup temp surface - */ - if (rz_src != src) { - SDL_FreeSurface(rz_src); + /* Unlock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } - /* - * Return destination surface - */ - return (rz_dst); + /* Return rotated surface */ + return rz_dst; } diff --git a/3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.h b/3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.h rename to 3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.h index 338109fc05..54c0927a1a 100644 --- a/3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.h +++ b/3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_rotate_h_ +#define SDL_rotate_h_ + #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif @@ -26,3 +29,4 @@ extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle); extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle); +#endif /* SDL_rotate_h_ */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor.c b/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor.c new file mode 100644 index 0000000000..5c7a990193 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor.c @@ -0,0 +1,546 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* This is the sensor API for Simple DirectMedia Layer */ + +#include "SDL.h" +#include "SDL_atomic.h" +#include "SDL_events.h" +#include "SDL_syssensor.h" +#include "SDL_assert.h" + +#if !SDL_EVENTS_DISABLED +#include "../events/SDL_events_c.h" +#endif + +static SDL_SensorDriver *SDL_sensor_drivers[] = { +#ifdef SDL_SENSOR_ANDROID + &SDL_ANDROID_SensorDriver, +#endif +#ifdef SDL_SENSOR_COREMOTION + &SDL_COREMOTION_SensorDriver, +#endif +#if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED) + &SDL_DUMMY_SensorDriver +#endif +}; +static SDL_Sensor *SDL_sensors = NULL; +static SDL_bool SDL_updating_sensor = SDL_FALSE; +static SDL_mutex *SDL_sensor_lock = NULL; /* This needs to support recursive locks */ +static SDL_atomic_t SDL_next_sensor_instance_id; + +static void +SDL_LockSensors(void) +{ + if (SDL_sensor_lock) { + SDL_LockMutex(SDL_sensor_lock); + } +} + +static void +SDL_UnlockSensors(void) +{ + if (SDL_sensor_lock) { + SDL_UnlockMutex(SDL_sensor_lock); + } +} + + +int +SDL_SensorInit(void) +{ + int i, status; + + /* Create the sensor list lock */ + if (!SDL_sensor_lock) { + SDL_sensor_lock = SDL_CreateMutex(); + } + +#if !SDL_EVENTS_DISABLED + if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { + return -1; + } +#endif /* !SDL_EVENTS_DISABLED */ + + status = -1; + for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) { + if (SDL_sensor_drivers[i]->Init() >= 0) { + status = 0; + } + } + return status; +} + +/* + * Count the number of sensors attached to the system + */ +int +SDL_NumSensors(void) +{ + int i, total_sensors = 0; + SDL_LockSensors(); + for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) { + total_sensors += SDL_sensor_drivers[i]->GetCount(); + } + SDL_UnlockSensors(); + return total_sensors; +} + +/* + * Return the next available sensor instance ID + * This may be called by drivers from multiple threads, unprotected by any locks + */ +SDL_SensorID SDL_GetNextSensorInstanceID() +{ + return SDL_AtomicIncRef(&SDL_next_sensor_instance_id); +} + +/* + * Get the driver and device index for an API device index + * This should be called while the sensor lock is held, to prevent another thread from updating the list + */ +static SDL_bool +SDL_GetDriverAndSensorIndex(int device_index, SDL_SensorDriver **driver, int *driver_index) +{ + int i, num_sensors, total_sensors = 0; + + if (device_index >= 0) { + for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) { + num_sensors = SDL_sensor_drivers[i]->GetCount(); + if (device_index < num_sensors) { + *driver = SDL_sensor_drivers[i]; + *driver_index = device_index; + return SDL_TRUE; + } + device_index -= num_sensors; + total_sensors += num_sensors; + } + } + + SDL_SetError("There are %d sensors available", total_sensors); + return SDL_FALSE; +} + +/* + * Get the implementation dependent name of a sensor + */ +const char * +SDL_SensorGetDeviceName(int device_index) +{ + SDL_SensorDriver *driver; + const char *name = NULL; + + SDL_LockSensors(); + if (SDL_GetDriverAndSensorIndex(device_index, &driver, &device_index)) { + name = driver->GetDeviceName(device_index); + } + SDL_UnlockSensors(); + + /* FIXME: Really we should reference count this name so it doesn't go away after unlock */ + return name; +} + +SDL_SensorType +SDL_SensorGetDeviceType(int device_index) +{ + SDL_SensorDriver *driver; + SDL_SensorType type = SDL_SENSOR_INVALID; + + SDL_LockSensors(); + if (SDL_GetDriverAndSensorIndex(device_index, &driver, &device_index)) { + type = driver->GetDeviceType(device_index); + } + SDL_UnlockSensors(); + + return type; +} + +SDL_SensorType +SDL_SensorGetDeviceNonPortableType(int device_index) +{ + SDL_SensorDriver *driver; + int type = -1; + + SDL_LockSensors(); + if (SDL_GetDriverAndSensorIndex(device_index, &driver, &device_index)) { + type = driver->GetDeviceNonPortableType(device_index); + } + SDL_UnlockSensors(); + + return type; +} + +SDL_SensorID +SDL_SensorGetDeviceInstanceID(int device_index) +{ + SDL_SensorDriver *driver; + SDL_SensorID instance_id = -1; + + SDL_LockSensors(); + if (SDL_GetDriverAndSensorIndex(device_index, &driver, &device_index)) { + instance_id = driver->GetDeviceInstanceID(device_index); + } + SDL_UnlockSensors(); + + return instance_id; +} + +/* + * Open a sensor for use - the index passed as an argument refers to + * the N'th sensor on the system. This index is the value which will + * identify this sensor in future sensor events. + * + * This function returns a sensor identifier, or NULL if an error occurred. + */ +SDL_Sensor * +SDL_SensorOpen(int device_index) +{ + SDL_SensorDriver *driver; + SDL_SensorID instance_id; + SDL_Sensor *sensor; + SDL_Sensor *sensorlist; + const char *sensorname = NULL; + + SDL_LockSensors(); + + if (!SDL_GetDriverAndSensorIndex(device_index, &driver, &device_index)) { + SDL_UnlockSensors(); + return NULL; + } + + sensorlist = SDL_sensors; + /* If the sensor is already open, return it + * it is important that we have a single sensor * for each instance id + */ + instance_id = driver->GetDeviceInstanceID(device_index); + while (sensorlist) { + if (instance_id == sensorlist->instance_id) { + sensor = sensorlist; + ++sensor->ref_count; + SDL_UnlockSensors(); + return sensor; + } + sensorlist = sensorlist->next; + } + + /* Create and initialize the sensor */ + sensor = (SDL_Sensor *) SDL_calloc(sizeof(*sensor), 1); + if (sensor == NULL) { + SDL_OutOfMemory(); + SDL_UnlockSensors(); + return NULL; + } + sensor->driver = driver; + sensor->instance_id = instance_id; + sensor->type = driver->GetDeviceType(device_index); + sensor->non_portable_type = driver->GetDeviceNonPortableType(device_index); + + if (driver->Open(sensor, device_index) < 0) { + SDL_free(sensor); + SDL_UnlockSensors(); + return NULL; + } + + sensorname = driver->GetDeviceName(device_index); + if (sensorname) { + sensor->name = SDL_strdup(sensorname); + } else { + sensor->name = NULL; + } + + /* Add sensor to list */ + ++sensor->ref_count; + /* Link the sensor in the list */ + sensor->next = SDL_sensors; + SDL_sensors = sensor; + + SDL_UnlockSensors(); + + driver->Update(sensor); + + return sensor; +} + +/* + * Find the SDL_Sensor that owns this instance id + */ +SDL_Sensor * +SDL_SensorFromInstanceID(SDL_SensorID instance_id) +{ + SDL_Sensor *sensor; + + SDL_LockSensors(); + for (sensor = SDL_sensors; sensor; sensor = sensor->next) { + if (sensor->instance_id == instance_id) { + break; + } + } + SDL_UnlockSensors(); + return sensor; +} + +/* + * Checks to make sure the sensor is valid. + */ +static int +SDL_PrivateSensorValid(SDL_Sensor * sensor) +{ + int valid; + + if (sensor == NULL) { + SDL_SetError("Sensor hasn't been opened yet"); + valid = 0; + } else { + valid = 1; + } + + return valid; +} + +/* + * Get the friendly name of this sensor + */ +const char * +SDL_SensorGetName(SDL_Sensor * sensor) +{ + if (!SDL_PrivateSensorValid(sensor)) { + return NULL; + } + + return sensor->name; +} + +/* + * Get the type of this sensor + */ +SDL_SensorType +SDL_SensorGetType(SDL_Sensor * sensor) +{ + if (!SDL_PrivateSensorValid(sensor)) { + return SDL_SENSOR_INVALID; + } + + return sensor->type; +} + +/* + * Get the platform dependent type of this sensor + */ +int +SDL_SensorGetNonPortableType(SDL_Sensor * sensor) +{ + if (!SDL_PrivateSensorValid(sensor)) { + return -1; + } + + return sensor->non_portable_type; +} + +/* + * Get the instance id for this opened sensor + */ +SDL_SensorID +SDL_SensorGetInstanceID(SDL_Sensor * sensor) +{ + if (!SDL_PrivateSensorValid(sensor)) { + return -1; + } + + return sensor->instance_id; +} + +/* + * Get the current state of this sensor + */ +int +SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values) +{ + if (!SDL_PrivateSensorValid(sensor)) { + return -1; + } + + num_values = SDL_min(num_values, SDL_arraysize(sensor->data)); + SDL_memcpy(data, sensor->data, num_values*sizeof(*data)); + return 0; +} + +/* + * Close a sensor previously opened with SDL_SensorOpen() + */ +void +SDL_SensorClose(SDL_Sensor * sensor) +{ + SDL_Sensor *sensorlist; + SDL_Sensor *sensorlistprev; + + if (!SDL_PrivateSensorValid(sensor)) { + return; + } + + SDL_LockSensors(); + + /* First decrement ref count */ + if (--sensor->ref_count > 0) { + SDL_UnlockSensors(); + return; + } + + if (SDL_updating_sensor) { + SDL_UnlockSensors(); + return; + } + + sensor->driver->Close(sensor); + sensor->hwdata = NULL; + + sensorlist = SDL_sensors; + sensorlistprev = NULL; + while (sensorlist) { + if (sensor == sensorlist) { + if (sensorlistprev) { + /* unlink this entry */ + sensorlistprev->next = sensorlist->next; + } else { + SDL_sensors = sensor->next; + } + break; + } + sensorlistprev = sensorlist; + sensorlist = sensorlist->next; + } + + SDL_free(sensor->name); + + /* Free the data associated with this sensor */ + SDL_free(sensor); + + SDL_UnlockSensors(); +} + +void +SDL_SensorQuit(void) +{ + int i; + + /* Make sure we're not getting called in the middle of updating sensors */ + SDL_assert(!SDL_updating_sensor); + + SDL_LockSensors(); + + /* Stop the event polling */ + while (SDL_sensors) { + SDL_sensors->ref_count = 1; + SDL_SensorClose(SDL_sensors); + } + + /* Quit the sensor setup */ + for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) { + SDL_sensor_drivers[i]->Quit(); + } + + SDL_UnlockSensors(); + +#if !SDL_EVENTS_DISABLED + SDL_QuitSubSystem(SDL_INIT_EVENTS); +#endif + + if (SDL_sensor_lock) { + SDL_DestroyMutex(SDL_sensor_lock); + SDL_sensor_lock = NULL; + } +} + + +/* These are global for SDL_syssensor.c and SDL_events.c */ + +int +SDL_PrivateSensorUpdate(SDL_Sensor *sensor, float *data, int num_values) +{ + int posted; + + /* Allow duplicate events, for things like steps and heartbeats */ + + /* Update internal sensor state */ + num_values = SDL_min(num_values, SDL_arraysize(sensor->data)); + SDL_memcpy(sensor->data, data, num_values*sizeof(*data)); + + /* Post the event, if desired */ + posted = 0; +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_SENSORUPDATE; + event.sensor.which = sensor->instance_id; + num_values = SDL_min(num_values, SDL_arraysize(event.sensor.data)); + SDL_memset(event.sensor.data, 0, sizeof(event.sensor.data)); + SDL_memcpy(event.sensor.data, data, num_values*sizeof(*data)); + posted = SDL_PushEvent(&event) == 1; + } +#endif /* !SDL_EVENTS_DISABLED */ + return posted; +} + +void +SDL_SensorUpdate(void) +{ + int i; + SDL_Sensor *sensor; + + SDL_LockSensors(); + + if (SDL_updating_sensor) { + /* The sensors are already being updated */ + SDL_UnlockSensors(); + return; + } + + SDL_updating_sensor = SDL_TRUE; + + /* Make sure the list is unlocked while dispatching events to prevent application deadlocks */ + SDL_UnlockSensors(); + + for (sensor = SDL_sensors; sensor; sensor = sensor->next) { + sensor->driver->Update(sensor); + } + + SDL_LockSensors(); + + SDL_updating_sensor = SDL_FALSE; + + /* If any sensors were closed while updating, free them here */ + for (sensor = SDL_sensors; sensor; sensor = sensor->next) { + if (sensor->ref_count <= 0) { + SDL_SensorClose(sensor); + } + } + + /* this needs to happen AFTER walking the sensor list above, so that any + dangling hardware data from removed devices can be free'd + */ + for (i = 0; i < SDL_arraysize(SDL_sensor_drivers); ++i) { + SDL_sensor_drivers[i]->Detect(); + } + + SDL_UnlockSensors(); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor_c.h b/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor_c.h new file mode 100644 index 0000000000..70974af596 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor_c.h @@ -0,0 +1,44 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_sensor_c_h_ +#define SDL_sensor_c_h_ + +#include "SDL_config.h" + +struct _SDL_SensorDriver; + +/* Useful functions and variables from SDL_sensor.c */ +#include "SDL_sensor.h" + +/* Function to get the next available sensor instance ID */ +extern SDL_SensorID SDL_GetNextSensorInstanceID(void); + +/* Initialization and shutdown functions */ +extern int SDL_SensorInit(void); +extern void SDL_SensorQuit(void); + +/* Internal event queueing functions */ +extern int SDL_PrivateSensorUpdate(SDL_Sensor *sensor, float *data, int num_values); + +#endif /* SDL_sensor_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/SDL_syssensor.h b/3rdparty/sdl2-2.0.9/src/sensor/SDL_syssensor.h new file mode 100644 index 0000000000..210577a9d3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/SDL_syssensor.h @@ -0,0 +1,105 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_syssensor_c_h_ +#define SDL_syssensor_c_h_ + +#include "SDL_config.h" + +/* This is the system specific header for the SDL sensor API */ + +#include "SDL_sensor.h" +#include "SDL_sensor_c.h" + +/* The SDL sensor structure */ +struct _SDL_Sensor +{ + SDL_SensorID instance_id; /* Device instance, monotonically increasing from 0 */ + char *name; /* Sensor name - system dependent */ + SDL_SensorType type; /* Type of the sensor */ + int non_portable_type; /* Platform dependent type of the sensor */ + + float data[16]; /* The current state of the sensor */ + + struct _SDL_SensorDriver *driver; + + struct sensor_hwdata *hwdata; /* Driver dependent information */ + + int ref_count; /* Reference count for multiple opens */ + + struct _SDL_Sensor *next; /* pointer to next sensor we have allocated */ +}; + +typedef struct _SDL_SensorDriver +{ + /* Function to scan the system for sensors. + * sensor 0 should be the system default sensor. + * This function should return 0, or -1 on an unrecoverable fatal error. + */ + int (*Init)(void); + + /* Function to return the number of sensors available right now */ + int (*GetCount)(void); + + /* Function to check to see if the available sensors have changed */ + void (*Detect)(void); + + /* Function to get the device-dependent name of a sensor */ + const char *(*GetDeviceName)(int device_index); + + /* Function to get the type of a sensor */ + SDL_SensorType (*GetDeviceType)(int device_index); + + /* Function to get the platform dependent type of a sensor */ + int (*GetDeviceNonPortableType)(int device_index); + + /* Function to get the current instance id of the sensor located at device_index */ + SDL_SensorID (*GetDeviceInstanceID)(int device_index); + + /* Function to open a sensor for use. + The sensor to open is specified by the device index. + It returns 0, or -1 if there is an error. + */ + int (*Open)(SDL_Sensor * sensor, int device_index); + + /* Function to update the state of a sensor - called as a device poll. + * This function shouldn't update the sensor structure directly, + * but instead should call SDL_PrivateSensorUpdate() to deliver events + * and update sensor device state. + */ + void (*Update)(SDL_Sensor * sensor); + + /* Function to close a sensor after use */ + void (*Close)(SDL_Sensor * sensor); + + /* Function to perform any system-specific sensor related cleanup */ + void (*Quit)(void); + +} SDL_SensorDriver; + +/* The available sensor drivers */ +extern SDL_SensorDriver SDL_ANDROID_SensorDriver; +extern SDL_SensorDriver SDL_COREMOTION_SensorDriver; +extern SDL_SensorDriver SDL_DUMMY_SensorDriver; + +#endif /* SDL_syssensor_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.c b/3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.c new file mode 100644 index 0000000000..117c18dff2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.c @@ -0,0 +1,211 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_config.h" + +#ifdef SDL_SENSOR_ANDROID + +/* This is the system specific header for the SDL sensor API */ +#include + +#include "SDL_error.h" +#include "SDL_sensor.h" +#include "SDL_androidsensor.h" +#include "../SDL_syssensor.h" +#include "../SDL_sensor_c.h" +//#include "../../core/android/SDL_android.h" + +#ifndef LOOPER_ID_USER +#define LOOPER_ID_USER 3 +#endif + +typedef struct +{ + ASensorRef asensor; + SDL_SensorID instance_id; +} SDL_AndroidSensor; + +static ASensorManager* SDL_sensor_manager; +static ALooper* SDL_sensor_looper; +static SDL_AndroidSensor *SDL_sensors; +static int SDL_sensors_count; + +static int +SDL_ANDROID_SensorInit(void) +{ + int i, sensors_count; + ASensorList sensors; + + SDL_sensor_manager = ASensorManager_getInstance(); + if (!SDL_sensor_manager) { + return SDL_SetError("Couldn't create sensor manager"); + } + + SDL_sensor_looper = ALooper_forThread(); + if (!SDL_sensor_looper) { + SDL_sensor_looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); + if (!SDL_sensor_looper) { + return SDL_SetError("Couldn't create sensor event loop"); + } + } + + /* FIXME: Is the sensor list dynamic? */ + sensors_count = ASensorManager_getSensorList(SDL_sensor_manager, &sensors); + if (sensors_count > 0) { + SDL_sensors = (SDL_AndroidSensor *)SDL_calloc(sensors_count, sizeof(*SDL_sensors)); + if (!SDL_sensors) { + return SDL_OutOfMemory(); + } + + for (i = 0; i < sensors_count; ++i) { + SDL_sensors[i].asensor = sensors[i]; + SDL_sensors[i].instance_id = SDL_GetNextSensorInstanceID(); + } + SDL_sensors_count = sensors_count; + } + return 0; +} + +static int +SDL_ANDROID_SensorGetCount(void) +{ + return SDL_sensors_count; +} + +static void +SDL_ANDROID_SensorDetect(void) +{ +} + +static const char * +SDL_ANDROID_SensorGetDeviceName(int device_index) +{ + return ASensor_getName(SDL_sensors[device_index].asensor); +} + +static SDL_SensorType +SDL_ANDROID_SensorGetDeviceType(int device_index) +{ + switch (ASensor_getType(SDL_sensors[device_index].asensor)) { + case 0x00000001: + return SDL_SENSOR_ACCEL; + case 0x00000004: + return SDL_SENSOR_GYRO; + default: + return SDL_SENSOR_UNKNOWN; + } +} + +static int +SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index) +{ + return ASensor_getType(SDL_sensors[device_index].asensor); +} + +static SDL_SensorID +SDL_ANDROID_SensorGetDeviceInstanceID(int device_index) +{ + return SDL_sensors[device_index].instance_id; +} + +static int +SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index) +{ + struct sensor_hwdata *hwdata; + + hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata)); + if (hwdata == NULL) { + return SDL_OutOfMemory(); + } + + hwdata->asensor = SDL_sensors[device_index].asensor; + hwdata->eventqueue = ASensorManager_createEventQueue(SDL_sensor_manager, SDL_sensor_looper, LOOPER_ID_USER, NULL, NULL); + if (!hwdata->eventqueue) { + SDL_free(hwdata); + return SDL_SetError("Couldn't create sensor event queue"); + } + + if (ASensorEventQueue_enableSensor(hwdata->eventqueue, hwdata->asensor) < 0) { + ASensorManager_destroyEventQueue(SDL_sensor_manager, hwdata->eventqueue); + SDL_free(hwdata); + return SDL_SetError("Couldn't enable sensor"); + } + + /* FIXME: What rate should we set for this sensor? 60 FPS? Let's try the default rate for now... */ + + sensor->hwdata = hwdata; + return 0; +} + +static void +SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor) +{ + int events; + ASensorEvent event; + struct android_poll_source* source; + + if (ALooper_pollAll(0, NULL, &events, (void**)&source) == LOOPER_ID_USER) { + SDL_zero(event); + while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) { + SDL_PrivateSensorUpdate(sensor, event.data, SDL_arraysize(event.data)); + } + } +} + +static void +SDL_ANDROID_SensorClose(SDL_Sensor *sensor) +{ + if (sensor->hwdata) { + ASensorEventQueue_disableSensor(sensor->hwdata->eventqueue, sensor->hwdata->asensor); + ASensorManager_destroyEventQueue(SDL_sensor_manager, sensor->hwdata->eventqueue); + SDL_free(sensor->hwdata); + sensor->hwdata = NULL; + } +} + +static void +SDL_ANDROID_SensorQuit(void) +{ + if (SDL_sensors) { + SDL_free(SDL_sensors); + SDL_sensors = NULL; + SDL_sensors_count = 0; + } +} + +SDL_SensorDriver SDL_ANDROID_SensorDriver = +{ + SDL_ANDROID_SensorInit, + SDL_ANDROID_SensorGetCount, + SDL_ANDROID_SensorDetect, + SDL_ANDROID_SensorGetDeviceName, + SDL_ANDROID_SensorGetDeviceType, + SDL_ANDROID_SensorGetDeviceNonPortableType, + SDL_ANDROID_SensorGetDeviceInstanceID, + SDL_ANDROID_SensorOpen, + SDL_ANDROID_SensorUpdate, + SDL_ANDROID_SensorClose, + SDL_ANDROID_SensorQuit, +}; + +#endif /* SDL_SENSOR_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/events/SDL_dropevents_c.h b/3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.h similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/events/SDL_dropevents_c.h rename to 3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.h index a60e089f35..c65002edfa 100644 --- a/3rdparty/sdl2-2.0.4/src/events/SDL_dropevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/sensor/android/SDL_androidsensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,13 +18,14 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "../SDL_internal.h" +#include "SDL_config.h" -#ifndef _SDL_dropevents_c_h -#define _SDL_dropevents_c_h +/* The private structure used to keep track of a sensor */ +struct sensor_hwdata +{ + ASensorRef asensor; + ASensorEventQueue *eventqueue; +}; -extern int SDL_SendDropFile(const char *file); - -#endif /* _SDL_dropevents_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.h b/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.h new file mode 100644 index 0000000000..2312e84f68 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +/* The private structure used to keep track of a sensor */ +struct sensor_hwdata +{ + float data[3]; +}; + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.m b/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.m new file mode 100644 index 0000000000..526cce8748 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/coremotion/SDL_coremotionsensor.m @@ -0,0 +1,234 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_config.h" + +#ifdef SDL_SENSOR_COREMOTION + +/* This is the system specific header for the SDL sensor API */ +#include + +#include "SDL_error.h" +#include "SDL_sensor.h" +#include "SDL_coremotionsensor.h" +#include "../SDL_syssensor.h" +#include "../SDL_sensor_c.h" + +typedef struct +{ + SDL_SensorType type; + SDL_SensorID instance_id; +} SDL_CoreMotionSensor; + +static CMMotionManager *SDL_motion_manager; +static SDL_CoreMotionSensor *SDL_sensors; +static int SDL_sensors_count; + +static int +SDL_COREMOTION_SensorInit(void) +{ + int i, sensors_count = 0; + + if (!SDL_motion_manager) { + SDL_motion_manager = [[CMMotionManager alloc] init]; + } + + if (SDL_motion_manager.accelerometerAvailable) { + ++sensors_count; + } + if (SDL_motion_manager.gyroAvailable) { + ++sensors_count; + } + + if (sensors_count > 0) { + SDL_sensors = (SDL_CoreMotionSensor *)SDL_calloc(sensors_count, sizeof(*SDL_sensors)); + if (!SDL_sensors) { + return SDL_OutOfMemory(); + } + + i = 0; + if (SDL_motion_manager.accelerometerAvailable) { + SDL_sensors[i].type = SDL_SENSOR_ACCEL; + SDL_sensors[i].instance_id = SDL_GetNextSensorInstanceID(); + ++i; + } + if (SDL_motion_manager.gyroAvailable) { + SDL_sensors[i].type = SDL_SENSOR_GYRO; + SDL_sensors[i].instance_id = SDL_GetNextSensorInstanceID(); + ++i; + } + SDL_sensors_count = sensors_count; + } + return 0; +} + +static int +SDL_COREMOTION_SensorGetCount(void) +{ + return SDL_sensors_count; +} + +static void +SDL_COREMOTION_SensorDetect(void) +{ +} + +static const char * +SDL_COREMOTION_SensorGetDeviceName(int device_index) +{ + switch (SDL_sensors[device_index].type) { + case SDL_SENSOR_ACCEL: + return "Accelerometer"; + case SDL_SENSOR_GYRO: + return "Gyro"; + default: + return "Unknown"; + } +} + +static SDL_SensorType +SDL_COREMOTION_SensorGetDeviceType(int device_index) +{ + return SDL_sensors[device_index].type; +} + +static int +SDL_COREMOTION_SensorGetDeviceNonPortableType(int device_index) +{ + return SDL_sensors[device_index].type; +} + +static SDL_SensorID +SDL_COREMOTION_SensorGetDeviceInstanceID(int device_index) +{ + return SDL_sensors[device_index].instance_id; +} + +static int +SDL_COREMOTION_SensorOpen(SDL_Sensor *sensor, int device_index) +{ + struct sensor_hwdata *hwdata; + + hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata)); + if (hwdata == NULL) { + return SDL_OutOfMemory(); + } + sensor->hwdata = hwdata; + + switch (sensor->type) + { + case SDL_SENSOR_ACCEL: + [SDL_motion_manager startAccelerometerUpdates]; + break; + case SDL_SENSOR_GYRO: + [SDL_motion_manager startGyroUpdates]; + break; + default: + break; + } + return 0; +} + +static void +SDL_COREMOTION_SensorUpdate(SDL_Sensor *sensor) +{ + switch (sensor->type) + { + case SDL_SENSOR_ACCEL: + { + CMAccelerometerData *accelerometerData = SDL_motion_manager.accelerometerData; + if (accelerometerData) { + CMAcceleration acceleration = accelerometerData.acceleration; + float data[3]; + data[0] = acceleration.x * SDL_STANDARD_GRAVITY; + data[1] = acceleration.y * SDL_STANDARD_GRAVITY; + data[2] = acceleration.z * SDL_STANDARD_GRAVITY; + if (SDL_memcmp(data, sensor->hwdata->data, sizeof(data)) != 0) { + SDL_PrivateSensorUpdate(sensor, data, SDL_arraysize(data)); + SDL_memcpy(sensor->hwdata->data, data, sizeof(data)); + } + } + } + break; + case SDL_SENSOR_GYRO: + { + CMGyroData *gyroData = SDL_motion_manager.gyroData; + if (gyroData) { + CMRotationRate rotationRate = gyroData.rotationRate; + float data[3]; + data[0] = rotationRate.x; + data[1] = rotationRate.y; + data[2] = rotationRate.z; + if (SDL_memcmp(data, sensor->hwdata->data, sizeof(data)) != 0) { + SDL_PrivateSensorUpdate(sensor, data, SDL_arraysize(data)); + SDL_memcpy(sensor->hwdata->data, data, sizeof(data)); + } + } + } + break; + default: + break; + } +} + +static void +SDL_COREMOTION_SensorClose(SDL_Sensor *sensor) +{ + if (sensor->hwdata) { + switch (sensor->type) + { + case SDL_SENSOR_ACCEL: + [SDL_motion_manager stopAccelerometerUpdates]; + break; + case SDL_SENSOR_GYRO: + [SDL_motion_manager stopGyroUpdates]; + break; + default: + break; + } + SDL_free(sensor->hwdata); + sensor->hwdata = NULL; + } +} + +static void +SDL_COREMOTION_SensorQuit(void) +{ +} + +SDL_SensorDriver SDL_COREMOTION_SensorDriver = +{ + SDL_COREMOTION_SensorInit, + SDL_COREMOTION_SensorGetCount, + SDL_COREMOTION_SensorDetect, + SDL_COREMOTION_SensorGetDeviceName, + SDL_COREMOTION_SensorGetDeviceType, + SDL_COREMOTION_SensorGetDeviceNonPortableType, + SDL_COREMOTION_SensorGetDeviceInstanceID, + SDL_COREMOTION_SensorOpen, + SDL_COREMOTION_SensorUpdate, + SDL_COREMOTION_SensorClose, + SDL_COREMOTION_SensorQuit, +}; + +#endif /* SDL_SENSOR_COREMOTION */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.c b/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.c new file mode 100644 index 0000000000..cf040450de --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.c @@ -0,0 +1,110 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_config.h" + +#if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED) + +#include "SDL_error.h" +#include "SDL_sensor.h" +#include "SDL_dummysensor.h" +#include "../SDL_syssensor.h" + +static int +SDL_DUMMY_SensorInit(void) +{ + return 0; +} + +static int +SDL_DUMMY_SensorGetCount(void) +{ + return 0; +} + +static void +SDL_DUMMY_SensorDetect(void) +{ +} + +static const char * +SDL_DUMMY_SensorGetDeviceName(int device_index) +{ + return NULL; +} + +static SDL_SensorType +SDL_DUMMY_SensorGetDeviceType(int device_index) +{ + return SDL_SENSOR_INVALID; +} + +static int +SDL_DUMMY_SensorGetDeviceNonPortableType(int device_index) +{ + return -1; +} + +static SDL_SensorID +SDL_DUMMY_SensorGetDeviceInstanceID(int device_index) +{ + return -1; +} + +static int +SDL_DUMMY_SensorOpen(SDL_Sensor *sensor, int device_index) +{ + return SDL_Unsupported(); +} + +static void +SDL_DUMMY_SensorUpdate(SDL_Sensor *sensor) +{ +} + +static void +SDL_DUMMY_SensorClose(SDL_Sensor *sensor) +{ +} + +static void +SDL_DUMMY_SensorQuit(void) +{ +} + +SDL_SensorDriver SDL_DUMMY_SensorDriver = +{ + SDL_DUMMY_SensorInit, + SDL_DUMMY_SensorGetCount, + SDL_DUMMY_SensorDetect, + SDL_DUMMY_SensorGetDeviceName, + SDL_DUMMY_SensorGetDeviceType, + SDL_DUMMY_SensorGetDeviceNonPortableType, + SDL_DUMMY_SensorGetDeviceInstanceID, + SDL_DUMMY_SensorOpen, + SDL_DUMMY_SensorUpdate, + SDL_DUMMY_SensorClose, + SDL_DUMMY_SensorQuit, +}; + +#endif /* SDL_SENSOR_DUMMY || SDL_SENSOR_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.h b/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.h new file mode 100644 index 0000000000..507ee93b97 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.h @@ -0,0 +1,23 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_getenv.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_getenv.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/stdlib/SDL_getenv.c rename to 3rdparty/sdl2-2.0.9/src/stdlib/SDL_getenv.c index 3fc4119fd2..591a314f6d 100644 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_getenv.c +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,10 @@ #include "../core/windows/SDL_windows.h" #endif +#if defined(__ANDROID__) +#include "../core/android/SDL_android.h" +#endif + #include "SDL_stdinc.h" #if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) @@ -60,9 +64,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) } if (!overwrite) { - char ch = 0; - const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch)); - if (len > 0) { + if (GetEnvironmentVariableA(name, NULL, 0) > 0) { return 0; /* asked not to overwrite existing value. */ } } @@ -173,8 +175,13 @@ SDL_setenv(const char *name, const char *value, int overwrite) char * SDL_getenv(const char *name) { +#if defined(__ANDROID__) + /* Make sure variables from the application manifest are available */ + Android_JNI_GetManifestEnvironmentVariables(); +#endif + /* Input validation */ - if (!name || SDL_strlen(name)==0) { + if (!name || !*name) { return NULL; } diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_iconv.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_iconv.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/stdlib/SDL_iconv.c rename to 3rdparty/sdl2-2.0.9/src/stdlib/SDL_iconv.c index 8f04037340..e2e3a3f866 100644 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_iconv.c +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,13 +30,15 @@ #include "SDL_stdinc.h" #include "SDL_endian.h" -#ifdef HAVE_ICONV +#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) +#include /* Depending on which standard the iconv() was implemented with, iconv() may or may not use const char ** for the inbuf param. If we get this wrong, it's just a warning, so no big deal. */ #if defined(_XGP6) || defined(__APPLE__) || \ + defined(__EMSCRIPTEN__) || \ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ (defined(_NEWLIB_VERSION))) #define ICONV_INBUF_NONCONST @@ -87,13 +89,13 @@ SDL_iconv(SDL_iconv_t cd, #else /* Lots of useful information on Unicode at: - http://www.cl.cam.ac.uk/~mgk25/unicode.html + http://www.cl.cam.ac.uk/~mgk25/unicode.html */ -#define UNICODE_BOM 0xFEFF +#define UNICODE_BOM 0xFEFF -#define UNKNOWN_ASCII '?' -#define UNKNOWN_UNICODE 0xFFFD +#define UNKNOWN_ASCII '?' +#define UNKNOWN_UNICODE 0xFFFD enum { @@ -113,13 +115,13 @@ enum ENCODING_UCS4LE, }; #if SDL_BYTEORDER == SDL_BIG_ENDIAN -#define ENCODING_UTF16NATIVE ENCODING_UTF16BE -#define ENCODING_UTF32NATIVE ENCODING_UTF32BE +#define ENCODING_UTF16NATIVE ENCODING_UTF16BE +#define ENCODING_UTF32NATIVE ENCODING_UTF32BE #define ENCODING_UCS2NATIVE ENCODING_UCS2BE #define ENCODING_UCS4NATIVE ENCODING_UCS4BE #else -#define ENCODING_UTF16NATIVE ENCODING_UTF16LE -#define ENCODING_UTF32NATIVE ENCODING_UTF32LE +#define ENCODING_UTF16NATIVE ENCODING_UTF16LE +#define ENCODING_UTF32NATIVE ENCODING_UTF32LE #define ENCODING_UCS2NATIVE ENCODING_UCS2LE #define ENCODING_UCS4NATIVE ENCODING_UCS4LE #endif @@ -796,6 +798,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4BE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; @@ -817,6 +820,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4LE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_malloc.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_malloc.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/stdlib/SDL_malloc.c rename to 3rdparty/sdl2-2.0.9/src/stdlib/SDL_malloc.c index d640c8fade..ace76bf70c 100644 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_malloc.c +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,33 +26,11 @@ #include "../SDL_internal.h" /* This file contains portable memory management functions for SDL */ - #include "SDL_stdinc.h" +#include "SDL_atomic.h" +#include "SDL_error.h" -#if defined(HAVE_MALLOC) - -void *SDL_malloc(size_t size) -{ - return malloc(size); -} - -void *SDL_calloc(size_t nmemb, size_t size) -{ - return calloc(nmemb, size); -} - -void *SDL_realloc(void *ptr, size_t size) -{ - return realloc(ptr, size); -} - -void SDL_free(void *ptr) -{ - free(ptr); -} - -#else /* the rest of this is a LOT of tapdancing to implement malloc. :) */ - +#ifndef HAVE_MALLOC #define LACKS_SYS_TYPES_H #define LACKS_STDIO_H #define LACKS_STRINGS_H @@ -60,6 +38,7 @@ void SDL_free(void *ptr) #define LACKS_STDLIB_H #define ABORT #define USE_LOCKS 1 +#define USE_DL_PREFIX /* This is a version (aka dlmalloc) of malloc/free/realloc written by @@ -636,12 +615,12 @@ DEFAULT_MMAP_THRESHOLD default: 256K #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ +#ifndef memset #define memset SDL_memset +#endif +#ifndef memcpy #define memcpy SDL_memcpy -#define malloc SDL_malloc -#define calloc SDL_calloc -#define realloc SDL_realloc -#define free SDL_free +#endif /* mallopt tuning options. SVID/XPG defines four standard parameter @@ -2946,13 +2925,17 @@ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { +#ifndef LACKS_STDIO_H size_t maxfp = 0; +#endif size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; +#ifndef LACKS_STDIO_H maxfp = m->max_footprint; +#endif fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); @@ -5261,4 +5244,133 @@ mspace_mallopt(int param_number, int value) #endif /* !HAVE_MALLOC */ +#ifdef HAVE_MALLOC +#define real_malloc malloc +#define real_calloc calloc +#define real_realloc realloc +#define real_free free +#else +#define real_malloc dlmalloc +#define real_calloc dlcalloc +#define real_realloc dlrealloc +#define real_free dlfree +#endif + +/* Memory functions used by SDL that can be replaced by the application */ +static struct +{ + SDL_malloc_func malloc_func; + SDL_calloc_func calloc_func; + SDL_realloc_func realloc_func; + SDL_free_func free_func; + SDL_atomic_t num_allocations; +} s_mem = { + real_malloc, real_calloc, real_realloc, real_free, { 0 } +}; + +void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func) +{ + if (malloc_func) { + *malloc_func = s_mem.malloc_func; + } + if (calloc_func) { + *calloc_func = s_mem.calloc_func; + } + if (realloc_func) { + *realloc_func = s_mem.realloc_func; + } + if (free_func) { + *free_func = s_mem.free_func; + } +} + +int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func) +{ + if (!malloc_func) { + return SDL_InvalidParamError("malloc_func"); + } + if (!calloc_func) { + return SDL_InvalidParamError("calloc_func"); + } + if (!realloc_func) { + return SDL_InvalidParamError("realloc_func"); + } + if (!free_func) { + return SDL_InvalidParamError("free_func"); + } + + s_mem.malloc_func = malloc_func; + s_mem.calloc_func = calloc_func; + s_mem.realloc_func = realloc_func; + s_mem.free_func = free_func; + return 0; +} + +int SDL_GetNumAllocations(void) +{ + return SDL_AtomicGet(&s_mem.num_allocations); +} + +void *SDL_malloc(size_t size) +{ + void *mem; + + if (!size) { + size = 1; + } + + mem = s_mem.malloc_func(size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_calloc(size_t nmemb, size_t size) +{ + void *mem; + + if (!nmemb || !size) { + nmemb = 1; + size = 1; + } + + mem = s_mem.calloc_func(nmemb, size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_realloc(void *ptr, size_t size) +{ + void *mem; + + if (!ptr && !size) { + size = 1; + } + + mem = s_mem.realloc_func(ptr, size); + if (mem && !ptr) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void SDL_free(void *ptr) +{ + if (!ptr) { + return; + } + + s_mem.free_func(ptr); + (void)SDL_AtomicDecRef(&s_mem.num_allocations); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/stdlib/SDL_qsort.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_qsort.c new file mode 100644 index 0000000000..700b9da91c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_qsort.c @@ -0,0 +1,534 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) +#define SDL_DISABLE_ANALYZE_MACROS 1 +#endif + +#include "../SDL_internal.h" + +#include "SDL_stdinc.h" +#include "SDL_assert.h" + +#if defined(HAVE_QSORT) +void +SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) +{ + qsort(base, nmemb, size, compare); +} + +#else + +#ifdef assert +#undef assert +#endif +#define assert SDL_assert +#ifdef malloc +#undef malloc +#endif +#define malloc SDL_malloc +#ifdef free +#undef free +#endif +#define free SDL_free +#ifdef memcpy +#undef memcpy +#endif +#define memcpy SDL_memcpy +#ifdef memmove +#undef memmove +#endif +#define memmove SDL_memmove +#ifdef qsortG +#undef qsortG +#endif +#define qsortG SDL_qsort + +/* +This code came from Gareth McCaughan, under the zlib license. +Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.14 + +Everything below this comment until the HAVE_QSORT #endif was from Gareth +(any minor changes will be noted inline). + +Thank you to Gareth for relicensing this code under the zlib license for our +benefit! + +--ryan. +*/ + +/* This is a drop-in replacement for the C library's |qsort()| routine. + * + * It is intended for use where you know or suspect that your + * platform's qsort is bad. If that isn't the case, then you + * should probably use the qsort your system gives you in preference + * to mine -- it will likely have been tested and tuned better. + * + * Features: + * - Median-of-three pivoting (and more) + * - Truncation and final polishing by a single insertion sort + * - Early truncation when no swaps needed in pivoting step + * - Explicit recursion, guaranteed not to overflow + * - A few little wrinkles stolen from the GNU |qsort()|. + * (For the avoidance of doubt, no code was stolen, only + * broad ideas.) + * - separate code for non-aligned / aligned / word-size objects + * + * Earlier releases of this code used an idiosyncratic licence + * I wrote myself, because I'm an idiot. The code is now released + * under the "zlib/libpng licence"; you will find the actual + * terms in the next comment. I request (but do not require) + * that if you make any changes beyond the name of the exported + * routine and reasonable tweaks to the TRUNC_* and + * PIVOT_THRESHOLD values, you modify the _ID string so as + * to make it clear that you have changed the code. + * + * If you find problems with this code, or find ways of + * making it significantly faster, please let me know! + * My e-mail address, valid as of early 2016 and for the + * foreseeable future, is + * gareth.mccaughan@pobox.com + * Thanks! + * + * Gareth McCaughan + */ + +/* Copyright (c) 1998-2016 Gareth McCaughan + * + * 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. + */ + +/* Revision history since release: + * 1998-03-19 v1.12 First release I have any records of. + * 2007-09-02 v1.13 Fix bug kindly reported by Dan Bodoh + * (premature termination of recursion). + * Add a few clarifying comments. + * Minor improvements to debug output. + * 2016-02-21 v1.14 Replace licence with 2-clause BSD, + * and clarify a couple of things in + * comments. No code changes. + */ + +/* BEGIN SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ +#if 0 +#include +#include +#include + +#define DEBUG_QSORT + +static char _ID[]=""; +#endif +/* END SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ + +/* How many bytes are there per word? (Must be a power of 2, + * and must in fact equal sizeof(int).) + */ +#define WORD_BYTES sizeof(int) + +/* How big does our stack need to be? Answer: one entry per + * bit in a |size_t|. + */ +#define STACK_SIZE (8*sizeof(size_t)) + +/* Different situations have slightly different requirements, + * and we make life epsilon easier by using different truncation + * points for the three different cases. + * So far, I have tuned TRUNC_words and guessed that the same + * value might work well for the other two cases. Of course + * what works well on my machine might work badly on yours. + */ +#define TRUNC_nonaligned 12 +#define TRUNC_aligned 12 +#define TRUNC_words 12*WORD_BYTES /* nb different meaning */ + +/* We use a simple pivoting algorithm for shortish sub-arrays + * and a more complicated one for larger ones. The threshold + * is PIVOT_THRESHOLD. + */ +#define PIVOT_THRESHOLD 40 + +typedef struct { char * first; char * last; } stack_entry; +#define pushLeft {stack[stacktop].first=ffirst;stack[stacktop++].last=last;} +#define pushRight {stack[stacktop].first=first;stack[stacktop++].last=llast;} +#define doLeft {first=ffirst;llast=last;continue;} +#define doRight {ffirst=first;last=llast;continue;} +#define pop {if (--stacktop<0) break;\ + first=ffirst=stack[stacktop].first;\ + last=llast=stack[stacktop].last;\ + continue;} + +/* Some comments on the implementation. + * 1. When we finish partitioning the array into "low" + * and "high", we forget entirely about short subarrays, + * because they'll be done later by insertion sort. + * Doing lots of little insertion sorts might be a win + * on large datasets for locality-of-reference reasons, + * but it makes the code much nastier and increases + * bookkeeping overhead. + * 2. We always save the shorter and get to work on the + * longer. This guarantees that every time we push + * an item onto the stack its size is <= 1/2 of that + * of its parent; so the stack can't need more than + * log_2(max-array-size) entries. + * 3. We choose a pivot by looking at the first, last + * and middle elements. We arrange them into order + * because it's easy to do that in conjunction with + * choosing the pivot, and it makes things a little + * easier in the partitioning step. Anyway, the pivot + * is the middle of these three. It's still possible + * to construct datasets where the algorithm takes + * time of order n^2, but it simply never happens in + * practice. + * 3' Newsflash: On further investigation I find that + * it's easy to construct datasets where median-of-3 + * simply isn't good enough. So on large-ish subarrays + * we do a more sophisticated pivoting: we take three + * sets of 3 elements, find their medians, and then + * take the median of those. + * 4. We copy the pivot element to a separate place + * because that way we can always do our comparisons + * directly against a pointer to that separate place, + * and don't have to wonder "did we move the pivot + * element?". This makes the inner loop better. + * 5. It's possible to make the pivoting even more + * reliable by looking at more candidates when n + * is larger. (Taking this to its logical conclusion + * results in a variant of quicksort that doesn't + * have that n^2 worst case.) However, the overhead + * from the extra bookkeeping means that it's just + * not worth while. + * 6. This is pretty clean and portable code. Here are + * all the potential portability pitfalls and problems + * I know of: + * - In one place (the insertion sort) I construct + * a pointer that points just past the end of the + * supplied array, and assume that (a) it won't + * compare equal to any pointer within the array, + * and (b) it will compare equal to a pointer + * obtained by stepping off the end of the array. + * These might fail on some segmented architectures. + * - I assume that there are 8 bits in a |char| when + * computing the size of stack needed. This would + * fail on machines with 9-bit or 16-bit bytes. + * - I assume that if |((int)base&(sizeof(int)-1))==0| + * and |(size&(sizeof(int)-1))==0| then it's safe to + * get at array elements via |int*|s, and that if + * actually |size==sizeof(int)| as well then it's + * safe to treat the elements as |int|s. This might + * fail on systems that convert pointers to integers + * in non-standard ways. + * - I assume that |8*sizeof(size_t)<=INT_MAX|. This + * would be false on a machine with 8-bit |char|s, + * 16-bit |int|s and 4096-bit |size_t|s. :-) + */ + +/* The recursion logic is the same in each case. + * We keep chopping up until we reach subarrays of size + * strictly less than Trunc; we leave these unsorted. */ +#define Recurse(Trunc) \ + { size_t l=last-ffirst,r=llast-first; \ + if (l=Trunc) doRight \ + else pop \ + } \ + else if (l<=r) { pushLeft; doRight } \ + else if (r>=Trunc) { pushRight; doLeft }\ + else doLeft \ + } + +/* and so is the pivoting logic (note: last is inclusive): */ +#define Pivot(swapper,sz) \ + if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ + else { \ + if (compare(first,mid)<0) { \ + if (compare(mid,last)>0) { \ + swapper(mid,last); \ + if (compare(first,mid)>0) swapper(first,mid);\ + } \ + } \ + else { \ + if (compare(mid,last)>0) swapper(first,last)\ + else { \ + swapper(first,mid); \ + if (compare(mid,last)>0) swapper(mid,last);\ + } \ + } \ + first+=sz; last-=sz; \ + } + +#ifdef DEBUG_QSORT +#include +#endif + +/* and so is the partitioning logic: */ +#define Partition(swapper,sz) { \ + do { \ + while (compare(first,pivot)<0) first+=sz; \ + while (compare(pivot,last)<0) last-=sz; \ + if (firstlimit ? limit : nmemb)-1)*sz;\ + while (last!=base) { \ + if (compare(first,last)>0) first=last; \ + last-=sz; } \ + if (first!=base) swapper(first,(char*)base); + +/* and so is the insertion sort, in the first two cases: */ +#define Insertion(swapper) \ + last=((char*)base)+nmemb*size; \ + for (first=((char*)base)+size;first!=last;first+=size) { \ + char *test; \ + /* Find the right place for |first|. \ + * My apologies for var reuse. */ \ + for (test=first-size;compare(test,first)>0;test-=size) ; \ + test+=size; \ + if (test!=first) { \ + /* Shift everything in [test,first) \ + * up by one, and place |first| \ + * where |test| is. */ \ + memcpy(pivot,first,size); \ + memmove(test+size,test,first-test); \ + memcpy(test,pivot,size); \ + } \ + } + +#define SWAP_nonaligned(a,b) { \ + register char *aa=(a),*bb=(b); \ + register size_t sz=size; \ + do { register char t=*aa; *aa++=*bb; *bb++=t; } while (--sz); } + +#define SWAP_aligned(a,b) { \ + register int *aa=(int*)(a),*bb=(int*)(b); \ + register size_t sz=size; \ + do { register int t=*aa;*aa++=*bb; *bb++=t; } while (sz-=WORD_BYTES); } + +#define SWAP_words(a,b) { \ + register int t=*((int*)a); *((int*)a)=*((int*)b); *((int*)b)=t; } + +/* ---------------------------------------------------------------------- */ + +static char * pivot_big(char *first, char *mid, char *last, size_t size, + int compare(const void *, const void *)) { + size_t d=(((last-first)/size)>>3)*size; +#ifdef DEBUG_QSORT +fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); +#endif + char *m1,*m2,*m3; + { char *a=first, *b=first+d, *c=first+2*d; +#ifdef DEBUG_QSORT +fprintf(stderr,"< %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); +#endif + m1 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } + { char *a=mid-d, *b=mid, *c=mid+d; +#ifdef DEBUG_QSORT +fprintf(stderr,". %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); +#endif + m2 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } + { char *a=last-2*d, *b=last-d, *c=last; +#ifdef DEBUG_QSORT +fprintf(stderr,"> %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); +#endif + m3 = compare(a,b)<0 ? + (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) + : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); + } +#ifdef DEBUG_QSORT +fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m3); +#endif + return compare(m1,m2)<0 ? + (compare(m2,m3)<0 ? m2 : (compare(m1,m3)<0 ? m3 : m1)) + : (compare(m1,m3)<0 ? m1 : (compare(m2,m3)<0 ? m3 : m2)); +} + +/* ---------------------------------------------------------------------- */ + +static void qsort_nonaligned(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { + + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(size); + size_t trunc=TRUNC_nonaligned*size; + assert(pivot!=0); + + first=(char*)base; last=first+(nmemb-1)*size; + + if ((size_t)(last-first)>=trunc) { + char *ffirst=first, *llast=last; + while (1) { + /* Select pivot */ + { char * mid=first+size*((last-first)/size >> 1); + Pivot(SWAP_nonaligned,size); + memcpy(pivot,mid,size); + } + /* Partition. */ + Partition(SWAP_nonaligned,size); + /* Prepare to recurse/iterate. */ + Recurse(trunc) + } + } + PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size); + Insertion(SWAP_nonaligned); + free(pivot); +} + +static void qsort_aligned(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { + + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(size); + size_t trunc=TRUNC_aligned*size; + assert(pivot!=0); + + first=(char*)base; last=first+(nmemb-1)*size; + + if ((size_t)(last-first)>=trunc) { + char *ffirst=first,*llast=last; + while (1) { + /* Select pivot */ + { char * mid=first+size*((last-first)/size >> 1); + Pivot(SWAP_aligned,size); + memcpy(pivot,mid,size); + } + /* Partition. */ + Partition(SWAP_aligned,size); + /* Prepare to recurse/iterate. */ + Recurse(trunc) + } + } + PreInsertion(SWAP_aligned,TRUNC_aligned,size); + Insertion(SWAP_aligned); + free(pivot); +} + +static void qsort_words(void *base, size_t nmemb, + int (*compare)(const void *, const void *)) { + + stack_entry stack[STACK_SIZE]; + int stacktop=0; + char *first,*last; + char *pivot=malloc(WORD_BYTES); + assert(pivot!=0); + + first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; + + if (last-first>=TRUNC_words) { + char *ffirst=first, *llast=last; + while (1) { +#ifdef DEBUG_QSORT +fprintf(stderr,"Doing %d:%d: ", + (first-(char*)base)/WORD_BYTES, + (last-(char*)base)/WORD_BYTES); +#endif + /* Select pivot */ + { char * mid=first+WORD_BYTES*((last-first) / (2*WORD_BYTES)); + Pivot(SWAP_words,WORD_BYTES); + *(int*)pivot=*(int*)mid; +#ifdef DEBUG_QSORT +fprintf(stderr,"pivot = %p = #%lu = %d\n", mid, (unsigned long)(((int*)mid)-((int*)base)), *(int*)mid); +#endif + } + /* Partition. */ + Partition(SWAP_words,WORD_BYTES); +#ifdef DEBUG_QSORT +fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base)/4lu, (last-(char*)base)/4lu); +#endif + /* Prepare to recurse/iterate. */ + Recurse(TRUNC_words) + } + } + PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES),WORD_BYTES); + /* Now do insertion sort. */ + last=((char*)base)+nmemb*WORD_BYTES; + for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) { + /* Find the right place for |first|. My apologies for var reuse */ + int *pl=(int*)(first-WORD_BYTES),*pr=(int*)first; + *(int*)pivot=*(int*)first; + for (;compare(pl,pivot)>0;pr=pl,--pl) { + *pr=*pl; } + if (pr!=(int*)first) *pr=*(int*)pivot; + } + free(pivot); +} + +/* ---------------------------------------------------------------------- */ + +extern void qsortG(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)) { + + if (nmemb<=1) return; + if (((size_t)base|size)&(WORD_BYTES-1)) + qsort_nonaligned(base,nmemb,size,compare); + else if (size!=WORD_BYTES) + qsort_aligned(base,nmemb,size,compare); + else + qsort_words(base,nmemb,compare); +} + + +#endif /* HAVE_QSORT */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_stdlib.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_stdlib.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/stdlib/SDL_stdlib.c rename to 3rdparty/sdl2-2.0.9/src/stdlib/SDL_stdlib.c index 6723d4e2c8..d500bf400d 100644 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_stdlib.c +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,11 +34,21 @@ double SDL_atan(double x) { -#ifdef HAVE_ATAN +#if defined(HAVE_ATAN) return atan(x); #else return SDL_uclibc_atan(x); -#endif /* HAVE_ATAN */ +#endif +} + +float +SDL_atanf(float x) +{ +#if defined(HAVE_ATANF) + return atanf(x); +#else + return (float)SDL_atan((double)x); +#endif } double @@ -48,7 +58,17 @@ SDL_atan2(double x, double y) return atan2(x, y); #else return SDL_uclibc_atan2(x, y); -#endif /* HAVE_ATAN2 */ +#endif +} + +float +SDL_atan2f(float x, float y) +{ +#if defined(HAVE_ATAN2F) + return atan2f(x, y); +#else + return (float)SDL_atan2((double)x, (double)y); +#endif } double @@ -71,6 +91,16 @@ SDL_acos(double val) #endif } +float +SDL_acosf(float val) +{ +#if defined(HAVE_ACOSF) + return acosf(val); +#else + return (float)SDL_acos((double)val); +#endif +} + double SDL_asin(double val) { @@ -87,10 +117,20 @@ SDL_asin(double val) #endif } +float +SDL_asinf(float val) +{ +#if defined(HAVE_ASINF) + return asinf(val); +#else + return (float)SDL_asin((double)val); +#endif +} + double SDL_ceil(double x) { -#ifdef HAVE_CEIL +#if defined(HAVE_CEIL) return ceil(x); #else double integer = SDL_floor(x); @@ -102,6 +142,16 @@ SDL_ceil(double x) #endif /* HAVE_CEIL */ } +float +SDL_ceilf(float x) +{ +#if defined(HAVE_CEILF) + return ceilf(x); +#else + return (float)SDL_ceil((float)x); +#endif +} + double SDL_copysign(double x, double y) { @@ -109,11 +159,27 @@ SDL_copysign(double x, double y) return copysign(x, y); #elif defined(HAVE__COPYSIGN) return _copysign(x, y); +#elif defined(__WATCOMC__) && defined(__386__) + /* this is nasty as hell, but it works.. */ + unsigned int *xi = (unsigned int *) &x, + *yi = (unsigned int *) &y; + xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff); + return x; #else return SDL_uclibc_copysign(x, y); #endif /* HAVE_COPYSIGN */ } +float +SDL_copysignf(float x, float y) +{ +#if defined(HAVE_COPYSIGNF) + return copysignf(x, y); +#else + return (float)SDL_copysign((double)x, (double)y); +#endif +} + double SDL_cos(double x) { @@ -121,27 +187,57 @@ SDL_cos(double x) return cos(x); #else return SDL_uclibc_cos(x); -#endif /* HAVE_COS */ +#endif } float SDL_cosf(float x) { -#ifdef HAVE_COSF +#if defined(HAVE_COSF) return cosf(x); #else return (float)SDL_cos((double)x); #endif } +double +SDL_exp(double x) +{ +#if defined(HAVE_EXP) + return exp(x); +#else + return SDL_uclibc_exp(x); +#endif +} + +float +SDL_expf(float x) +{ +#if defined(HAVE_EXPF) + return expf(x); +#else + return (float)SDL_exp((double)x); +#endif +} + double SDL_fabs(double x) { #if defined(HAVE_FABS) - return fabs(x); + return fabs(x); #else return SDL_uclibc_fabs(x); -#endif /* HAVE_FABS */ +#endif +} + +float +SDL_fabsf(float x) +{ +#if defined(HAVE_FABSF) + return fabsf(x); +#else + return (float)SDL_fabs((double)x); +#endif } double @@ -151,7 +247,37 @@ SDL_floor(double x) return floor(x); #else return SDL_uclibc_floor(x); -#endif /* HAVE_FLOOR */ +#endif +} + +float +SDL_floorf(float x) +{ +#if defined(HAVE_FLOORF) + return floorf(x); +#else + return (float)SDL_floor((double)x); +#endif +} + +double +SDL_fmod(double x, double y) +{ +#if defined(HAVE_FMOD) + return fmod(x, y); +#else + return SDL_uclibc_fmod(x, y); +#endif +} + +float +SDL_fmodf(float x, float y) +{ +#if defined(HAVE_FMODF) + return fmodf(x, y); +#else + return (float)SDL_fmod((double)x, (double)y); +#endif } double @@ -161,7 +287,37 @@ SDL_log(double x) return log(x); #else return SDL_uclibc_log(x); -#endif /* HAVE_LOG */ +#endif +} + +float +SDL_logf(float x) +{ +#if defined(HAVE_LOGF) + return logf(x); +#else + return (float)SDL_log((double)x); +#endif +} + +double +SDL_log10(double x) +{ +#if defined(HAVE_LOG10) + return log10(x); +#else + return SDL_uclibc_log10(x); +#endif +} + +float +SDL_log10f(float x) +{ +#if defined(HAVE_LOG10F) + return log10f(x); +#else + return (float)SDL_log10((double)x); +#endif } double @@ -171,7 +327,17 @@ SDL_pow(double x, double y) return pow(x, y); #else return SDL_uclibc_pow(x, y); -#endif /* HAVE_POW */ +#endif +} + +float +SDL_powf(float x, float y) +{ +#if defined(HAVE_POWF) + return powf(x, y); +#else + return (float)SDL_pow((double)x, (double)y); +#endif } double @@ -181,9 +347,23 @@ SDL_scalbn(double x, int n) return scalbn(x, n); #elif defined(HAVE__SCALB) return _scalb(x, n); +#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2) +/* from scalbn(3): If FLT_RADIX equals 2 (which is + * usual), then scalbn() is equivalent to ldexp(3). */ + return ldexp(x, n); #else return SDL_uclibc_scalbn(x, n); -#endif /* HAVE_SCALBN */ +#endif +} + +float +SDL_scalbnf(float x, int n) +{ +#if defined(HAVE_SCALBNF) + return scalbnf(x, n); +#else + return (float)SDL_scalbn((double)x, n); +#endif } double @@ -193,17 +373,17 @@ SDL_sin(double x) return sin(x); #else return SDL_uclibc_sin(x); -#endif /* HAVE_SIN */ +#endif } float SDL_sinf(float x) { -#ifdef HAVE_SINF +#if defined(HAVE_SINF) return sinf(x); #else return (float)SDL_sin((double)x); -#endif /* HAVE_SINF */ +#endif } double @@ -248,14 +428,14 @@ SDL_tanf(float x) int SDL_abs(int x) { -#ifdef HAVE_ABS +#if defined(HAVE_ABS) return abs(x); #else return ((x) < 0 ? -(x) : (x)); #endif } -#ifdef HAVE_CTYPE_H +#if defined(HAVE_CTYPE_H) int SDL_isdigit(int x) { return isdigit(x); } int SDL_isspace(int x) { return isspace(x); } int SDL_toupper(int x) { return toupper(x); } @@ -279,7 +459,7 @@ __declspec(selectany) int _fltused = 1; #endif /* The optimizer on Visual Studio 2005 and later generates memcpy() calls */ -#if (_MSC_VER >= 1400) && defined(_WIN64) && !defined(_DEBUG) +#if (_MSC_VER >= 1400) && defined(_WIN64) && !defined(_DEBUG) && !(_MSC_VER >= 1900 && defined(_MT)) #include #pragma function(memcpy) @@ -914,8 +1094,8 @@ _allshr() { /* *INDENT-OFF* */ __asm { - cmp cl,40h - jae RETZERO + cmp cl,3Fh + jae RETSIGN cmp cl,20h jae MORE32 shrd eax,edx,cl @@ -923,13 +1103,13 @@ _allshr() ret MORE32: mov eax,edx - xor edx,edx + sar edx,1Fh and cl,1Fh sar eax,cl ret -RETZERO: - xor eax,eax - xor edx,edx +RETSIGN: + sar edx,1Fh + mov eax,edx ret } /* *INDENT-ON* */ diff --git a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_string.c b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_string.c similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/stdlib/SDL_string.c rename to 3rdparty/sdl2-2.0.9/src/stdlib/SDL_string.c index 5debb22850..a563adfcc2 100644 --- a/3rdparty/sdl2-2.0.4/src/stdlib/SDL_string.c +++ b/3rdparty/sdl2-2.0.9/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,24 +18,20 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) +#if defined(__clang_analyzer__) #define SDL_DISABLE_ANALYZE_MACROS 1 #endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - #include "../SDL_internal.h" /* This file contains portable string manipulation functions for SDL */ #include "SDL_stdinc.h" - +#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) #define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) +#endif #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4) #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) @@ -82,7 +78,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -118,7 +114,7 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -150,7 +146,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -187,7 +183,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -223,7 +219,7 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -255,7 +251,7 @@ SDL_ScanFloat(const char *text, double *valuep) ++text; } } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -275,12 +271,16 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) size_t left; Uint32 *dstp4; Uint8 *dstp1 = (Uint8 *) dst; - Uint32 value4 = (c | (c << 8) | (c << 16) | (c << 24)); - Uint8 value1 = (Uint8) c; + Uint8 value1; + Uint32 value4; + + /* The value used in memset() is a byte, passed as an int */ + c &= 0xff; /* The destination pointer needs to be aligned on a 4-byte boundary to * execute a 32-bit set. Set first bytes manually if needed until it is * aligned. */ + value1 = (Uint8)c; while ((intptr_t)dstp1 & 0x3) { if (len--) { *dstp1++ = value1; @@ -289,6 +289,7 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) } } + value4 = (c | (c << 8) | (c << 16) | (c << 24)); dstp4 = (Uint32 *) dstp1; left = (len % 4); len /= 4; @@ -420,6 +421,17 @@ SDL_strlen(const char *string) #endif /* HAVE_STRLEN */ } +wchar_t * +SDL_wcsdup(const wchar_t *string) +{ + size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t)); + wchar_t *newstr = (wchar_t *)SDL_malloc(len); + if (newstr) { + SDL_memcpy(newstr, string, len); + } + return newstr; +} + size_t SDL_wcslen(const wchar_t * string) { @@ -465,6 +477,22 @@ SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t max #endif /* HAVE_WCSLCAT */ } +int +SDL_wcscmp(const wchar_t *str1, const wchar_t *str2) +{ +#if defined(HAVE_WCSCMP) + return wcscmp(str1, str2); +#else + while (*str1 && *str2) { + if (*str1 != *str2) + break; + ++str1; + ++str2; + } + return (int)(*str1 - *str2); +#endif /* HAVE_WCSCMP */ +} + size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -481,7 +509,8 @@ SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) #endif /* HAVE_STRLCPY */ } -size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) +size_t +SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) { size_t src_bytes = SDL_strlen(src); size_t bytes = SDL_min(src_bytes, dst_bytes - 1); @@ -513,6 +542,23 @@ size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size return bytes; } +size_t +SDL_utf8strlen(const char *str) +{ + size_t retval = 0; + const char *p = str; + char ch; + + while ((ch = *(p++))) { + /* if top two bits are 1 and 0, it's a continuation byte. */ + if ((ch & 0xc0) != 0x80) { + retval++; + } + } + + return retval; +} + size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -531,16 +577,12 @@ SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) char * SDL_strdup(const char *string) { -#if defined(HAVE_STRDUP) - return strdup(string); -#else size_t len = SDL_strlen(string) + 1; - char *newstr = SDL_malloc(len); + char *newstr = (char *)SDL_malloc(len); if (newstr) { - SDL_strlcpy(newstr, string, len); + SDL_memcpy(newstr, string, len); } return newstr; -#endif /* HAVE_STRDUP */ } char * @@ -789,7 +831,7 @@ SDL_strtol(const char *string, char **endp, int base) return strtol(string, endp, base); #else size_t len; - long value; + long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -814,7 +856,7 @@ SDL_strtoul(const char *string, char **endp, int base) return strtoul(string, endp, base); #else size_t len; - unsigned long value; + unsigned long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -839,7 +881,7 @@ SDL_strtoll(const char *string, char **endp, int base) return strtoll(string, endp, base); #else size_t len; - Sint64 value; + Sint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -864,7 +906,7 @@ SDL_strtoull(const char *string, char **endp, int base) return strtoull(string, endp, base); #else size_t len; - Uint64 value; + Uint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -889,7 +931,7 @@ SDL_strtod(const char *string, char **endp) return strtod(string, endp); #else size_t len; - double value; + double value = 0.0; len = SDL_ScanFloat(string, &value); if (endp) { @@ -911,7 +953,7 @@ SDL_strcmp(const char *str1, const char *str2) ++str1; ++str2; } - return (int) ((unsigned char) *str1 - (unsigned char) *str2); + return (int)((unsigned char) *str1 - (unsigned char) *str2); #endif /* HAVE_STRCMP */ } @@ -1011,6 +1053,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) { int retval = 0; + if (!text || !*text) { + return -1; + } + while (*fmt) { if (*fmt == ' ') { while (SDL_isspace((unsigned char) *text)) { @@ -1030,6 +1076,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) DO_LONG, DO_LONGLONG } inttype = DO_INT; + size_t advance; SDL_bool suppress = SDL_FALSE; ++fmt; @@ -1109,16 +1156,18 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'd': if (inttype == DO_LONGLONG) { Sint64 value; - text += SDL_ScanLongLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Sint64 *valuep = va_arg(ap, Sint64 *); *valuep = value; ++retval; } } else { long value; - text += SDL_ScanLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1160,17 +1209,19 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) /* Fall through to unsigned handling */ case 'u': if (inttype == DO_LONGLONG) { - Uint64 value; - text += SDL_ScanUnsignedLongLong(text, radix, &value); - if (!suppress) { + Uint64 value = 0; + advance = SDL_ScanUnsignedLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Uint64 *valuep = va_arg(ap, Uint64 *); *valuep = value; ++retval; } } else { - unsigned long value; - text += SDL_ScanUnsignedLong(text, radix, &value); - if (!suppress) { + unsigned long value = 0; + advance = SDL_ScanUnsignedLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1201,9 +1252,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) break; case 'p': { - uintptr_t value; - text += SDL_ScanUintPtrT(text, 16, &value); - if (!suppress) { + uintptr_t value = 0; + advance = SDL_ScanUintPtrT(text, 16, &value); + text += advance; + if (advance && !suppress) { void **valuep = va_arg(ap, void **); *valuep = (void *) value; ++retval; @@ -1214,8 +1266,9 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'f': { double value; - text += SDL_ScanFloat(text, &value); - if (!suppress) { + advance = SDL_ScanFloat(text, &value); + text += advance; + if (advance && !suppress) { float *valuep = va_arg(ap, float *); *valuep = (float) value; ++retval; @@ -1282,7 +1335,18 @@ SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_ return retval; } -#ifdef HAVE_VSNPRINTF +#if defined(HAVE_LIBC) && defined(__WATCOMC__) +/* _vsnprintf() doesn't ensure nul termination */ +int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap) +{ + int retval; + if (!fmt) fmt = ""; + retval = _vsnprintf(text, maxlen, fmt, ap); + if (maxlen > 0) text[maxlen-1] = '\0'; + if (retval < 0) retval = (int) maxlen; + return retval; +} +#elif defined(HAVE_VSNPRINTF) int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap) { if (!fmt) { @@ -1301,9 +1365,9 @@ typedef enum typedef struct { - SDL_bool left_justify; + SDL_bool left_justify; /* for now: ignored. */ SDL_bool force_sign; - SDL_bool force_type; + SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */ SDL_bool pad_zeroes; SDL_letter_case force_case; int width; @@ -1315,10 +1379,18 @@ static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string) { size_t length = 0; + size_t slen, sz; - if (info && info->width && (size_t)info->width > SDL_strlen(string)) { + if (string == NULL) { + string = "(null)"; + } + + sz = SDL_strlen(string); + if (info && info->width > 0 && (size_t)info->width > sz) { char fill = info->pad_zeroes ? '0' : ' '; - size_t width = info->width - SDL_strlen(string); + size_t width = info->width - sz; + if (info->precision >= 0 && (size_t)info->precision < sz) + width += sz - (size_t)info->precision; while (width-- > 0 && maxlen > 0) { *text++ = fill; ++length; @@ -1326,9 +1398,17 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str } } - length += SDL_strlcpy(text, string, maxlen); + slen = SDL_strlcpy(text, string, maxlen); + length += SDL_min(slen, maxlen); if (info) { + if (info->precision >= 0 && (size_t)info->precision < sz) { + slen = (size_t)info->precision; + if (slen < maxlen) { + text[slen] = 0; + length -= (sz - slen); + } + } if (info->force_case == SDL_CASE_LOWER) { SDL_strlwr(text); } else if (info->force_case == SDL_CASE_UPPER) { @@ -1338,12 +1418,54 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str return length; } +static void +SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info) +{/* left-pad num with zeroes. */ + size_t sz, pad, have_sign; + + if (!info) + return; + + have_sign = 0; + if (*num == '-' || *num == '+') { + have_sign = 1; + ++num; + --maxlen; + } + sz = SDL_strlen(num); + if (info->precision > 0 && sz < (size_t)info->precision) { + pad = (size_t)info->precision - sz; + if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */ + SDL_memmove(num + pad, num, sz + 1); + SDL_memset(num, '0', pad); + } + } + info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */ + + if (info->pad_zeroes && info->width > 0 && (size_t)info->width > sz + have_sign) { + /* handle here: spaces are added before the sign + but zeroes must be placed _after_ the sign. */ + /* sz hasn't changed: we ignore pad_zeroes if a precision is given. */ + pad = (size_t)info->width - sz - have_sign; + if (pad + sz + 1 <= maxlen) { + SDL_memmove(num + pad, num, sz + 1); + SDL_memset(num, '0', pad); + } + info->width = 0; /* so that SDL_PrintString() doesn't make a mess. */ + } +} + static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value) { - char num[130]; + char num[130], *p = num; - SDL_ltoa(value, num, info ? info->radix : 10); + if (info->force_sign && value >= 0L) { + *p++ = '+'; + } + + SDL_ltoa(value, p, info ? info->radix : 10); + SDL_IntPrecisionAdjust(num, maxlen, info); return SDL_PrintString(text, maxlen, info, num); } @@ -1353,15 +1475,21 @@ SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned char num[130]; SDL_ultoa(value, num, info ? info->radix : 10); + SDL_IntPrecisionAdjust(num, maxlen, info); return SDL_PrintString(text, maxlen, info, num); } static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value) { - char num[130]; + char num[130], *p = num; - SDL_lltoa(value, num, info ? info->radix : 10); + if (info->force_sign && value >= (Sint64)0) { + *p++ = '+'; + } + + SDL_lltoa(value, p, info ? info->radix : 10); + SDL_IntPrecisionAdjust(num, maxlen, info); return SDL_PrintString(text, maxlen, info, num); } @@ -1371,6 +1499,7 @@ SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint6 char num[130]; SDL_ulltoa(value, num, info ? info->radix : 10); + SDL_IntPrecisionAdjust(num, maxlen, info); return SDL_PrintString(text, maxlen, info, num); } @@ -1402,10 +1531,11 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg) } value = (unsigned long) arg; len = SDL_PrintUnsignedLong(text, left, NULL, value); - text += len; if (len >= left) { + text += (left > 1) ? left - 1 : 0; left = SDL_min(left, 1); } else { + text += len; left -= len; } arg -= value; @@ -1422,10 +1552,11 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg) while (info->precision-- > 0) { value = (unsigned long) (arg * mult); len = SDL_PrintUnsignedLong(text, left, NULL, value); - text += len; if (len >= left) { + text += (left > 1) ? left - 1 : 0; left = SDL_min(left, 1); } else { + text += len; left -= len; } arg -= (double) value / mult; @@ -1458,10 +1589,11 @@ SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg) } } len = (size_t)width; - text += len; if (len >= left) { + text += (left > 1) ? left - 1 : 0; left = SDL_min(left, 1); } else { + text += len; left -= len; } while (len--) { @@ -1483,7 +1615,7 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, if (!fmt) { fmt = ""; } - while (*fmt) { + while (*fmt && left > 1) { if (*fmt == '%') { SDL_bool done = SDL_FALSE; size_t len = 0; @@ -1525,14 +1657,24 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, if (*fmt >= '0' && *fmt <= '9') { info.width = SDL_strtol(fmt, (char **)&fmt, 0); } + else if (*fmt == '*') { + ++fmt; + info.width = va_arg(ap, int); + } if (*fmt == '.') { ++fmt; if (*fmt >= '0' && *fmt <= '9') { info.precision = SDL_strtol(fmt, (char **)&fmt, 0); + } else if (*fmt == '*') { + ++fmt; + info.precision = va_arg(ap, int); } else { info.precision = 0; } + if (info.precision < 0) { + info.precision = 0; + } } while (!done) { @@ -1568,6 +1710,9 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, break; case 'i': case 'd': + if (info.precision >= 0) { + info.pad_zeroes = SDL_FALSE; + } switch (inttype) { case DO_INT: len = SDL_PrintLong(text, left, &info, @@ -1605,7 +1750,10 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, } /* Fall through to unsigned handling */ case 'u': - info.pad_zeroes = SDL_TRUE; + info.force_sign = SDL_FALSE; + if (info.precision >= 0) { + info.pad_zeroes = SDL_FALSE; + } switch (inttype) { case DO_INT: len = SDL_PrintUnsignedLong(text, left, &info, @@ -1627,7 +1775,19 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, len = SDL_PrintFloat(text, left, &info, va_arg(ap, double)); done = SDL_TRUE; break; + case 'S': + { + /* In practice this is used on Windows for WCHAR strings */ + wchar_t *wide_arg = va_arg(ap, wchar_t *); + char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg)); + info.pad_zeroes = SDL_FALSE; + len = SDL_PrintString(text, left, &info, arg); + SDL_free(arg); + done = SDL_TRUE; + } + break; case 's': + info.pad_zeroes = SDL_FALSE; len = SDL_PrintString(text, left, &info, va_arg(ap, char *)); done = SDL_TRUE; break; @@ -1637,19 +1797,16 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, } ++fmt; } - text += len; if (len >= left) { + text += (left > 1) ? left - 1 : 0; left = SDL_min(left, 1); } else { + text += len; left -= len; } } else { - if (left > 1) { - *text = *fmt; - --left; - } - ++fmt; - ++text; + *text++ = *fmt++; + --left; } } if (left > 0) { diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_assert.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_assert.c similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_assert.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_assert.c index 98a84d386d..4b57285606 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_assert.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,10 +30,10 @@ #include "SDL_test.h" /* Assert check message format */ -const char *SDLTest_AssertCheckFormat = "Assert '%s': %s"; +#define SDLTEST_ASSERT_CHECK_FORMAT "Assert '%s': %s" /* Assert summary message format */ -const char *SDLTest_AssertSummaryFormat = "Assert Summary: Total=%d Passed=%d Failed=%d"; +#define SDLTEST_ASSERT_SUMMARY_FORMAT "Assert Summary: Total=%d Passed=%d Failed=%d" /* ! \brief counts the failed asserts */ static Uint32 SDLTest_AssertsFailed = 0; @@ -77,12 +77,12 @@ int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char if (assertCondition == ASSERT_FAIL) { SDLTest_AssertsFailed++; - SDLTest_LogError(SDLTest_AssertCheckFormat, logMessage, "Failed"); + SDLTest_LogError(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Failed"); } else { SDLTest_AssertsPassed++; - SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Passed"); + SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Passed"); } return assertCondition; @@ -104,7 +104,7 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /* Log pass message */ SDLTest_AssertsPassed++; - SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Pass"); + SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, "Pass"); } /* @@ -125,11 +125,11 @@ void SDLTest_LogAssertSummary() Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed; if (SDLTest_AssertsFailed == 0) { - SDLTest_Log(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed); + SDLTest_Log(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed); } else { - SDLTest_LogError(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed); + SDLTest_LogError(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed); } } @@ -148,3 +148,5 @@ int SDLTest_AssertSummaryToTestResult() } } } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_common.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_common.c similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_common.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_common.c index fee249cb9b..81dd39eb14 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_common.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,10 +32,33 @@ #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" +static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) +{ + size_t length = SDL_strlen(text); + va_list ap; + + va_start(ap, fmt); + text += length; + maxlen -= length; + SDL_vsnprintf(text, maxlen, fmt, ap); + va_end(ap); +} + SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags) { - SDLTest_CommonState *state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); + int i; + SDLTest_CommonState *state; + + /* Do this first so we catch all allocations */ + for (i = 1; argv[i]; ++i) { + if (SDL_strcasecmp(argv[i], "--trackmem") == 0) { + SDLTest_TrackAllocations(); + break; + } + } + + state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); if (!state) { SDL_OutOfMemory(); return NULL; @@ -435,6 +458,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->audiospec.samples = (Uint16) SDL_atoi(argv[index]); return 2; } + if (SDL_strcasecmp(argv[index], "--trackmem") == 0) { + /* Already handled in SDLTest_CommonCreateState() */ + return 1; + } if ((SDL_strcasecmp(argv[index], "-h") == 0) || (SDL_strcasecmp(argv[index], "--help") == 0)) { /* Print the usage message */ @@ -452,134 +479,140 @@ SDLTest_CommonUsage(SDLTest_CommonState * state) { switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { case SDL_INIT_VIDEO: - return VIDEO_USAGE; + return "[--trackmem] " VIDEO_USAGE; case SDL_INIT_AUDIO: - return AUDIO_USAGE; + return "[--trackmem] " AUDIO_USAGE; case (SDL_INIT_VIDEO | SDL_INIT_AUDIO): - return VIDEO_USAGE " " AUDIO_USAGE; + return "[--trackmem] " VIDEO_USAGE " " AUDIO_USAGE; default: - return ""; + return "[--trackmem]"; } } static void -SDLTest_PrintRendererFlag(Uint32 flag) +SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag) { switch (flag) { - case SDL_RENDERER_PRESENTVSYNC: - fprintf(stderr, "PresentVSync"); + case SDL_RENDERER_SOFTWARE: + SDL_snprintfcat(text, maxlen, "Software"); break; case SDL_RENDERER_ACCELERATED: - fprintf(stderr, "Accelerated"); + SDL_snprintfcat(text, maxlen, "Accelerated"); + break; + case SDL_RENDERER_PRESENTVSYNC: + SDL_snprintfcat(text, maxlen, "PresentVSync"); + break; + case SDL_RENDERER_TARGETTEXTURE: + SDL_snprintfcat(text, maxlen, "TargetTexturesSupported"); break; default: - fprintf(stderr, "0x%8.8x", flag); + SDL_snprintfcat(text, maxlen, "0x%8.8x", flag); break; } } static void -SDLTest_PrintPixelFormat(Uint32 format) +SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format) { switch (format) { case SDL_PIXELFORMAT_UNKNOWN: - fprintf(stderr, "Unknwon"); + SDL_snprintfcat(text, maxlen, "Unknown"); break; case SDL_PIXELFORMAT_INDEX1LSB: - fprintf(stderr, "Index1LSB"); + SDL_snprintfcat(text, maxlen, "Index1LSB"); break; case SDL_PIXELFORMAT_INDEX1MSB: - fprintf(stderr, "Index1MSB"); + SDL_snprintfcat(text, maxlen, "Index1MSB"); break; case SDL_PIXELFORMAT_INDEX4LSB: - fprintf(stderr, "Index4LSB"); + SDL_snprintfcat(text, maxlen, "Index4LSB"); break; case SDL_PIXELFORMAT_INDEX4MSB: - fprintf(stderr, "Index4MSB"); + SDL_snprintfcat(text, maxlen, "Index4MSB"); break; case SDL_PIXELFORMAT_INDEX8: - fprintf(stderr, "Index8"); + SDL_snprintfcat(text, maxlen, "Index8"); break; case SDL_PIXELFORMAT_RGB332: - fprintf(stderr, "RGB332"); + SDL_snprintfcat(text, maxlen, "RGB332"); break; case SDL_PIXELFORMAT_RGB444: - fprintf(stderr, "RGB444"); + SDL_snprintfcat(text, maxlen, "RGB444"); break; case SDL_PIXELFORMAT_RGB555: - fprintf(stderr, "RGB555"); + SDL_snprintfcat(text, maxlen, "RGB555"); break; case SDL_PIXELFORMAT_BGR555: - fprintf(stderr, "BGR555"); + SDL_snprintfcat(text, maxlen, "BGR555"); break; case SDL_PIXELFORMAT_ARGB4444: - fprintf(stderr, "ARGB4444"); + SDL_snprintfcat(text, maxlen, "ARGB4444"); break; case SDL_PIXELFORMAT_ABGR4444: - fprintf(stderr, "ABGR4444"); + SDL_snprintfcat(text, maxlen, "ABGR4444"); break; case SDL_PIXELFORMAT_ARGB1555: - fprintf(stderr, "ARGB1555"); + SDL_snprintfcat(text, maxlen, "ARGB1555"); break; case SDL_PIXELFORMAT_ABGR1555: - fprintf(stderr, "ABGR1555"); + SDL_snprintfcat(text, maxlen, "ABGR1555"); break; case SDL_PIXELFORMAT_RGB565: - fprintf(stderr, "RGB565"); + SDL_snprintfcat(text, maxlen, "RGB565"); break; case SDL_PIXELFORMAT_BGR565: - fprintf(stderr, "BGR565"); + SDL_snprintfcat(text, maxlen, "BGR565"); break; case SDL_PIXELFORMAT_RGB24: - fprintf(stderr, "RGB24"); + SDL_snprintfcat(text, maxlen, "RGB24"); break; case SDL_PIXELFORMAT_BGR24: - fprintf(stderr, "BGR24"); + SDL_snprintfcat(text, maxlen, "BGR24"); break; case SDL_PIXELFORMAT_RGB888: - fprintf(stderr, "RGB888"); + SDL_snprintfcat(text, maxlen, "RGB888"); break; case SDL_PIXELFORMAT_BGR888: - fprintf(stderr, "BGR888"); + SDL_snprintfcat(text, maxlen, "BGR888"); break; case SDL_PIXELFORMAT_ARGB8888: - fprintf(stderr, "ARGB8888"); + SDL_snprintfcat(text, maxlen, "ARGB8888"); break; case SDL_PIXELFORMAT_RGBA8888: - fprintf(stderr, "RGBA8888"); + SDL_snprintfcat(text, maxlen, "RGBA8888"); break; case SDL_PIXELFORMAT_ABGR8888: - fprintf(stderr, "ABGR8888"); + SDL_snprintfcat(text, maxlen, "ABGR8888"); break; case SDL_PIXELFORMAT_BGRA8888: - fprintf(stderr, "BGRA8888"); + SDL_snprintfcat(text, maxlen, "BGRA8888"); break; case SDL_PIXELFORMAT_ARGB2101010: - fprintf(stderr, "ARGB2101010"); + SDL_snprintfcat(text, maxlen, "ARGB2101010"); break; case SDL_PIXELFORMAT_YV12: - fprintf(stderr, "YV12"); + SDL_snprintfcat(text, maxlen, "YV12"); break; case SDL_PIXELFORMAT_IYUV: - fprintf(stderr, "IYUV"); + SDL_snprintfcat(text, maxlen, "IYUV"); break; case SDL_PIXELFORMAT_YUY2: - fprintf(stderr, "YUY2"); + SDL_snprintfcat(text, maxlen, "YUY2"); break; case SDL_PIXELFORMAT_UYVY: - fprintf(stderr, "UYVY"); + SDL_snprintfcat(text, maxlen, "UYVY"); break; case SDL_PIXELFORMAT_YVYU: - fprintf(stderr, "YVYU"); + SDL_snprintfcat(text, maxlen, "YVYU"); break; case SDL_PIXELFORMAT_NV12: - fprintf(stderr, "NV12"); + SDL_snprintfcat(text, maxlen, "NV12"); break; case SDL_PIXELFORMAT_NV21: - fprintf(stderr, "NV21"); + SDL_snprintfcat(text, maxlen, "NV21"); break; default: - fprintf(stderr, "0x%8.8x", format); + SDL_snprintfcat(text, maxlen, "0x%8.8x", format); break; } } @@ -588,35 +621,37 @@ static void SDLTest_PrintRenderer(SDL_RendererInfo * info) { int i, count; + char text[1024]; - fprintf(stderr, " Renderer %s:\n", info->name); + SDL_Log(" Renderer %s:\n", info->name); - fprintf(stderr, " Flags: 0x%8.8X", info->flags); - fprintf(stderr, " ("); + SDL_snprintf(text, sizeof(text), " Flags: 0x%8.8X", info->flags); + SDL_snprintfcat(text, sizeof(text), " ("); count = 0; for (i = 0; i < sizeof(info->flags) * 8; ++i) { Uint32 flag = (1 << i); if (info->flags & flag) { if (count > 0) { - fprintf(stderr, " | "); + SDL_snprintfcat(text, sizeof(text), " | "); } - SDLTest_PrintRendererFlag(flag); + SDLTest_PrintRendererFlag(text, sizeof(text), flag); ++count; } } - fprintf(stderr, ")\n"); + SDL_snprintfcat(text, sizeof(text), ")"); + SDL_Log("%s\n", text); - fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats); + SDL_snprintf(text, sizeof(text), " Texture formats (%d): ", info->num_texture_formats); for (i = 0; i < (int) info->num_texture_formats; ++i) { if (i > 0) { - fprintf(stderr, ", "); + SDL_snprintfcat(text, sizeof(text), ", "); } - SDLTest_PrintPixelFormat(info->texture_formats[i]); + SDLTest_PrintPixelFormat(text, sizeof(text), info->texture_formats[i]); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); if (info->max_texture_width || info->max_texture_height) { - fprintf(stderr, " Max Texture Size: %dx%d\n", + SDL_Log(" Max Texture Size: %dx%d\n", info->max_texture_width, info->max_texture_height); } } @@ -629,7 +664,7 @@ SDLTest_LoadIcon(const char *file) /* Load the icon surface */ icon = SDL_LoadBMP(file); if (icon == NULL) { - fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError()); + SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); return (NULL); } @@ -641,35 +676,82 @@ SDLTest_LoadIcon(const char *file) return (icon); } +static SDL_HitTestResult SDLCALL +SDLTest_ExampleHitTestCallback(SDL_Window *win, const SDL_Point *area, void *data) +{ + int w, h; + const int RESIZE_BORDER = 8; + const int DRAGGABLE_TITLE = 32; + + /*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/ + + SDL_GetWindowSize(win, &w, &h); + + if (area->x < RESIZE_BORDER) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n"); + return SDL_HITTEST_RESIZE_TOPLEFT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n"); + return SDL_HITTEST_RESIZE_BOTTOMLEFT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_LEFT\n"); + return SDL_HITTEST_RESIZE_LEFT; + } + } else if (area->x >= (w-RESIZE_BORDER)) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n"); + return SDL_HITTEST_RESIZE_TOPRIGHT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n"); + return SDL_HITTEST_RESIZE_BOTTOMRIGHT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n"); + return SDL_HITTEST_RESIZE_RIGHT; + } + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n"); + return SDL_HITTEST_RESIZE_BOTTOM; + } else if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOP\n"); + return SDL_HITTEST_RESIZE_TOP; + } else if (area->y < DRAGGABLE_TITLE) { + SDL_Log("SDL_HITTEST_DRAGGABLE\n"); + return SDL_HITTEST_DRAGGABLE; + } + return SDL_HITTEST_NORMAL; +} + SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state) { int i, j, m, n, w, h; SDL_DisplayMode fullscreen_mode; + char text[1024]; if (state->flags & SDL_INIT_VIDEO) { if (state->verbose & VERBOSE_VIDEO) { n = SDL_GetNumVideoDrivers(); if (n == 0) { - fprintf(stderr, "No built-in video drivers\n"); + SDL_Log("No built-in video drivers\n"); } else { - fprintf(stderr, "Built-in video drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetVideoDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_VideoInit(state->videodriver) < 0) { - fprintf(stderr, "Couldn't initialize video driver: %s\n", + SDL_Log("Couldn't initialize video driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Video driver: %s\n", + SDL_Log("Video driver: %s\n", SDL_GetCurrentVideoDriver()); } @@ -706,75 +788,82 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } if (state->verbose & VERBOSE_MODES) { - SDL_Rect bounds; + SDL_Rect bounds, usablebounds; + float hdpi = 0; + float vdpi = 0; SDL_DisplayMode mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; #if SDL_VIDEO_DRIVER_WINDOWS - int adapterIndex = 0; - int outputIndex = 0; + int adapterIndex = 0; + int outputIndex = 0; #endif n = SDL_GetNumVideoDisplays(); - fprintf(stderr, "Number of displays: %d\n", n); + SDL_Log("Number of displays: %d\n", n); for (i = 0; i < n; ++i) { - fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i)); + SDL_Log("Display %d: %s\n", i, SDL_GetDisplayName(i)); SDL_zero(bounds); SDL_GetDisplayBounds(i, &bounds); - fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + + SDL_zero(usablebounds); + SDL_GetDisplayUsableBounds(i, &usablebounds); + + SDL_GetDisplayDPI(i, NULL, &hdpi, &vdpi); + + SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); + SDL_Log("DPI: %fx%f\n", hdpi, vdpi); SDL_GetDesktopDisplayMode(i, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", Bmask); + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, " Alpha Mask = 0x%.8x\n", Amask); + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } /* Print available fullscreen video modes */ m = SDL_GetNumDisplayModes(i); if (m == 0) { - fprintf(stderr, "No available fullscreen video modes\n"); + SDL_Log("No available fullscreen video modes\n"); } else { - fprintf(stderr, " Fullscreen video modes:\n"); + SDL_Log(" Fullscreen video modes:\n"); for (j = 0; j < m; ++j) { SDL_GetDisplayMode(i, j, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", j, mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, - " Alpha Mask = 0x%.8x\n", + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } } } #if SDL_VIDEO_DRIVER_WINDOWS - /* Print the D3D9 adapter index */ - adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); - fprintf( stderr, "D3D9 Adapter Index: %d", adapterIndex ); + /* Print the D3D9 adapter index */ + adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); + SDL_Log("D3D9 Adapter Index: %d", adapterIndex); - /* Print the DXGI adapter and output indices */ - SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); - fprintf( stderr, "DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex ); + /* Print the DXGI adapter and output indices */ + SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); + SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex); #endif } } @@ -784,9 +873,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) n = SDL_GetNumRenderDrivers(); if (n == 0) { - fprintf(stderr, "No built-in render drivers\n"); + SDL_Log("No built-in render drivers\n"); } else { - fprintf(stderr, "Built-in render drivers:\n"); + SDL_Log("Built-in render drivers:\n"); for (i = 0; i < n; ++i) { SDL_GetRenderDriverInfo(i, &info); SDLTest_PrintRenderer(&info); @@ -815,16 +904,16 @@ SDLTest_CommonInit(SDLTest_CommonState * state) fullscreen_mode.refresh_rate = state->refresh_rate; state->windows = - (SDL_Window **) SDL_malloc(state->num_windows * + (SDL_Window **) SDL_calloc(state->num_windows, sizeof(*state->windows)); state->renderers = - (SDL_Renderer **) SDL_malloc(state->num_windows * + (SDL_Renderer **) SDL_calloc(state->num_windows, sizeof(*state->renderers)); state->targets = - (SDL_Texture **) SDL_malloc(state->num_windows * + (SDL_Texture **) SDL_calloc(state->num_windows, sizeof(*state->targets)); if (!state->windows || !state->renderers) { - fprintf(stderr, "Out of memory!\n"); + SDL_Log("Out of memory!\n"); return SDL_FALSE; } for (i = 0; i < state->num_windows; ++i) { @@ -841,7 +930,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_w, state->window_h, state->window_flags); if (!state->windows[i]) { - fprintf(stderr, "Couldn't create window: %s\n", + SDL_Log("Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -859,11 +948,17 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_h = h; } if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) { - fprintf(stderr, "Can't set up fullscreen display mode: %s\n", + SDL_Log("Can't set up fullscreen display mode: %s\n", SDL_GetError()); return SDL_FALSE; } + /* Add resize/drag areas for windows that are borderless and resizable */ + if ((state->window_flags & (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) == + (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) { + SDL_SetWindowHitTest(state->windows[i], SDLTest_ExampleHitTestCallback, NULL); + } + if (state->window_icon) { SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon); if (icon) { @@ -874,12 +969,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_ShowWindow(state->windows[i]); - state->renderers[i] = NULL; - state->targets[i] = NULL; - if (!state->skip_renderer && (state->renderdriver - || !(state->window_flags & SDL_WINDOW_OPENGL))) { + || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) { m = -1; if (state->renderdriver) { SDL_RendererInfo info; @@ -893,8 +985,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } } if (m == -1) { - fprintf(stderr, - "Couldn't find render driver named %s", + SDL_Log("Couldn't find render driver named %s", state->renderdriver); return SDL_FALSE; } @@ -902,7 +993,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->renderers[i] = SDL_CreateRenderer(state->windows[i], m, state->render_flags); if (!state->renderers[i]) { - fprintf(stderr, "Couldn't create renderer: %s\n", + SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -914,7 +1005,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_RENDER) { SDL_RendererInfo info; - fprintf(stderr, "Current renderer:\n"); + SDL_Log("Current renderer:\n"); SDL_GetRendererInfo(state->renderers[i], &info); SDLTest_PrintRenderer(&info); } @@ -926,30 +1017,30 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_AUDIO) { n = SDL_GetNumAudioDrivers(); if (n == 0) { - fprintf(stderr, "No built-in audio drivers\n"); + SDL_Log("No built-in audio drivers\n"); } else { - fprintf(stderr, "Built-in audio drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in audio drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetAudioDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_AudioInit(state->audiodriver) < 0) { - fprintf(stderr, "Couldn't initialize audio driver: %s\n", + SDL_Log("Couldn't initialize audio driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Audio driver: %s\n", + SDL_Log("Audio driver: %s\n", SDL_GetCurrentAudioDriver()); } if (SDL_OpenAudio(&state->audiospec, NULL) < 0) { - fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_Log("Couldn't open audio: %s\n", SDL_GetError()); return SDL_FALSE; } } @@ -957,6 +1048,22 @@ SDLTest_CommonInit(SDLTest_CommonState * state) return SDL_TRUE; } +static const char * +DisplayOrientationName(int orientation) +{ + switch (orientation) + { +#define CASE(X) case SDL_ORIENTATION_##X: return #X + CASE(UNKNOWN); + CASE(LANDSCAPE); + CASE(LANDSCAPE_FLIPPED); + CASE(PORTRAIT); + CASE(PORTRAIT_FLIPPED); +#undef CASE +default: return "???"; + } +} + static const char * ControllerAxisName(const SDL_GameControllerAxis axis) { @@ -1011,6 +1118,17 @@ SDLTest_PrintEvent(SDL_Event * event) } switch (event->type) { + case SDL_DISPLAYEVENT: + switch (event->display.event) { + case SDL_DISPLAYEVENT_ORIENTATION: + SDL_Log("SDL EVENT: Display %d changed orientation to %s", event->display.display, DisplayOrientationName(event->display.data1)); + break; + default: + SDL_Log("SDL EVENT: Display %d got unknown event 0x%4.4x", + event->display.display, event->display.event); + break; + } + break; case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_SHOWN: @@ -1064,8 +1182,14 @@ SDLTest_PrintEvent(SDL_Event * event) case SDL_WINDOWEVENT_CLOSE: SDL_Log("SDL EVENT: Window %d closed", event->window.windowID); break; + case SDL_WINDOWEVENT_TAKE_FOCUS: + SDL_Log("SDL EVENT: Window %d take focus", event->window.windowID); + break; + case SDL_WINDOWEVENT_HIT_TEST: + SDL_Log("SDL EVENT: Window %d hit test", event->window.windowID); + break; default: - SDL_Log("SDL EVENT: Window %d got unknown event %d", + SDL_Log("SDL EVENT: Window %d got unknown event 0x%4.4x", event->window.windowID, event->window.event); break; } @@ -1084,10 +1208,17 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_GetScancodeName(event->key.keysym.scancode), event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); break; + case SDL_TEXTEDITING: + SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %d", + event->edit.text, event->edit.windowID); + break; case SDL_TEXTINPUT: SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %d", event->text.text, event->text.windowID); break; + case SDL_KEYMAPCHANGED: + SDL_Log("SDL EVENT: Keymap changed"); + break; case SDL_MOUSEMOTION: SDL_Log("SDL EVENT: Mouse: moved to %d,%d (%d,%d) in window %d", event->motion.x, event->motion.y, @@ -1194,6 +1325,13 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: Clipboard updated"); break; + case SDL_FINGERMOTION: + SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", + (long) event->tfinger.touchId, + (long) event->tfinger.fingerId, + event->tfinger.x, event->tfinger.y, + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); + break; case SDL_FINGERDOWN: case SDL_FINGERUP: SDL_Log("SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", @@ -1204,10 +1342,10 @@ SDLTest_PrintEvent(SDL_Event * event) event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); break; case SDL_DOLLARGESTURE: - SDL_Log("SDL_EVENT: Dollar gesture detect: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture detect: %ld", (long) event->dgesture.gestureId); break; case SDL_DOLLARRECORD: - SDL_Log("SDL_EVENT: Dollar gesture record: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture record: %ld", (long) event->dgesture.gestureId); break; case SDL_MULTIGESTURE: SDL_Log("SDL_EVENT: Multi gesture fingers: %d", event->mgesture.numFingers); @@ -1220,6 +1358,36 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: render targets reset"); break; + case SDL_APP_TERMINATING: + SDL_Log("SDL EVENT: App terminating"); + break; + case SDL_APP_LOWMEMORY: + SDL_Log("SDL EVENT: App running low on memory"); + break; + case SDL_APP_WILLENTERBACKGROUND: + SDL_Log("SDL EVENT: App will enter the background"); + break; + case SDL_APP_DIDENTERBACKGROUND: + SDL_Log("SDL EVENT: App entered the background"); + break; + case SDL_APP_WILLENTERFOREGROUND: + SDL_Log("SDL EVENT: App will enter the foreground"); + break; + case SDL_APP_DIDENTERFOREGROUND: + SDL_Log("SDL EVENT: App entered the foreground"); + break; + case SDL_DROPBEGIN: + SDL_Log("SDL EVENT: Drag and drop beginning"); + break; + case SDL_DROPFILE: + SDL_Log("SDL EVENT: Drag and drop file: '%s'", event->drop.file); + break; + case SDL_DROPTEXT: + SDL_Log("SDL EVENT: Drag and drop text: '%s'", event->drop.file); + break; + case SDL_DROPCOMPLETE: + SDL_Log("SDL EVENT: Drag and drop ending"); + break; case SDL_QUIT: SDL_Log("SDL EVENT: Quit requested"); break; @@ -1227,7 +1395,7 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: User event %d", event->user.code); break; default: - SDL_Log("Unknown event %04x", event->type); + SDL_Log("Unknown event 0x%4.4x", event->type); break; } } @@ -1251,19 +1419,19 @@ SDLTest_ScreenShot(SDL_Renderer *renderer) #endif 0x00000000); if (!surface) { - fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError()); + SDL_Log("Couldn't create surface: %s\n", SDL_GetError()); return; } if (SDL_RenderReadPixels(renderer, NULL, surface->format->format, surface->pixels, surface->pitch) < 0) { - fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError()); + SDL_Log("Couldn't read screen: %s\n", SDL_GetError()); SDL_free(surface); return; } if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) { - fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError()); + SDL_Log("Couldn't save screenshot.bmp: %s\n", SDL_GetError()); SDL_free(surface); return; } @@ -1368,6 +1536,67 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) } } break; + case SDLK_UP: + case SDLK_DOWN: + case SDLK_LEFT: + case SDLK_RIGHT: + if (withAlt) { + /* Alt-Up/Down/Left/Right switches between displays */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + int currentIndex = SDL_GetWindowDisplayIndex(window); + int numDisplays = SDL_GetNumVideoDisplays(); + + if (currentIndex >= 0 && numDisplays >= 1) { + int dest; + if (event->key.keysym.sym == SDLK_UP || event->key.keysym.sym == SDLK_LEFT) { + dest = (currentIndex + numDisplays - 1) % numDisplays; + } else { + dest = (currentIndex + numDisplays + 1) % numDisplays; + } + SDL_Log("Centering on display %d\n", dest); + SDL_SetWindowPosition(window, + SDL_WINDOWPOS_CENTERED_DISPLAY(dest), + SDL_WINDOWPOS_CENTERED_DISPLAY(dest)); + } + } + } + if (withShift) { + /* Shift-Up/Down/Left/Right shift the window by 100px */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + const int delta = 100; + int x, y; + SDL_GetWindowPosition(window, &x, &y); + + if (event->key.keysym.sym == SDLK_UP) y -= delta; + if (event->key.keysym.sym == SDLK_DOWN) y += delta; + if (event->key.keysym.sym == SDLK_LEFT) x -= delta; + if (event->key.keysym.sym == SDLK_RIGHT) x += delta; + + SDL_Log("Setting position to (%d, %d)\n", x, y); + SDL_SetWindowPosition(window, x, y); + } + } + break; + case SDLK_o: + if (withControl) { + /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + float opacity; + if (SDL_GetWindowOpacity(window, &opacity) == 0) { + if (withShift) { + opacity += 0.20f; + } else { + opacity -= 0.20f; + } + SDL_SetWindowOpacity(window, opacity); + } + } + } + break; + case SDLK_c: if (withControl) { /* Ctrl-C copy awesome text! */ @@ -1553,6 +1782,11 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) case SDL_MOUSEMOTION: lastEvent = event->motion; break; + + case SDL_DROPFILE: + case SDL_DROPTEXT: + SDL_free(event->drop.file); + break; } } @@ -1586,6 +1820,7 @@ SDLTest_CommonQuit(SDLTest_CommonState * state) } SDL_free(state); SDL_Quit(); + SDLTest_LogAllocations(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_compare.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_compare.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_compare.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_compare.c index 45eb3c6898..d4e3e71f0d 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_compare.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int bpp, bpp_reference; Uint8 *p, *p_reference; int dist; - int sampleErrorX, sampleErrorY, sampleDist; + int sampleErrorX = 0, sampleErrorY = 0, sampleDist = 0; Uint8 R, G, B, A; Uint8 Rd, Gd, Bd, Ad; char imageFilename[128]; @@ -113,3 +113,5 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, return ret; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_crc32.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_crc32.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_crc32.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_crc32.c index 6e1220881d..ea6b0a85bb 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_crc32.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,6 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext) } /* Complete CRC32 calculation on a memory block */ - int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32) { if (SDLTest_Crc32CalcStart(crcContext,crc32)) { @@ -163,3 +162,5 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext) return 0; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_font.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_font.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_font.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_font.c index afd35c6c2a..7825cc66fb 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_font.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -3116,9 +3116,9 @@ static SDL_Texture *SDLTest_CharTextureCache[256]; int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; - const Uint32 charHeight = FONT_CHARACTER_SIZE; - const Uint32 charSize = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charHeight = FONT_CHARACTER_SIZE; + const Uint32 charSize = FONT_CHARACTER_SIZE; SDL_Rect srect; SDL_Rect drect; int result; @@ -3133,16 +3133,16 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) Uint8 r, g, b, a; /* - * Setup source rectangle - */ + * Setup source rectangle + */ srect.x = 0; srect.y = 0; srect.w = charWidth; srect.h = charHeight; /* - * Setup destination rectangle - */ + * Setup destination rectangle + */ drect.x = x; drect.y = y; drect.w = charWidth; @@ -3152,12 +3152,12 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) ci = (unsigned char)c; /* - * Create new charWidth x charHeight bitmap surface if not already present. - */ + * Create new charWidth x charHeight bitmap surface if not already present. + */ if (SDLTest_CharTextureCache[ci] == NULL) { /* - * Redraw character into surface - */ + * Redraw character into surface + */ character = SDL_CreateRGBSurface(SDL_SWSURFACE, charWidth, charHeight, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -3170,8 +3170,8 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) pitch = character->pitch; /* - * Drawing loop - */ + * Drawing loop + */ patt = 0; for (iy = 0; iy < charWidth; iy++) { mask = 0x00; @@ -3196,24 +3196,24 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) SDL_FreeSurface(character); /* - * Check pointer - */ + * Check pointer + */ if (SDLTest_CharTextureCache[ci] == NULL) { return (-1); } } /* - * Set color - */ + * Set color + */ result = 0; result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a); result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b); result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a); /* - * Draw texture onto destination - */ + * Draw texture onto destination + */ result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect); return (result); @@ -3221,7 +3221,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; int result = 0; int curx = x; int cury = y; @@ -3236,3 +3236,15 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) return (result); } +void SDLTest_CleanupTextDrawing(void) +{ + unsigned int i; + for (i = 0; i < SDL_arraysize(SDLTest_CharTextureCache); ++i) { + if (SDLTest_CharTextureCache[i]) { + SDL_DestroyTexture(SDLTest_CharTextureCache[i]); + SDLTest_CharTextureCache[i] = NULL; + } + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_fuzzer.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_fuzzer.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_fuzzer.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_fuzzer.c index 1bd8dfa188..eee56a9feb 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_fuzzer.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,19 +27,20 @@ #include "SDL_config.h" +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else -#define _GNU_SOURCE #include #endif #include #include -#include #include #include "SDL_test.h" @@ -125,29 +126,35 @@ SDLTest_RandomUint32() Uint64 SDLTest_RandomUint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return value.v64; } Sint64 SDLTest_RandomSint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return (Sint64)value.v64; } @@ -197,7 +204,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax) * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Uint64 +static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { Uint64 b1, b2; @@ -298,7 +305,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { /* max value for Uint64 */ - const Uint64 maxValue = ULLONG_MAX; + const Uint64 maxValue = UINT64_MAX; return SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain); @@ -329,7 +336,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Sint64 +static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { Sint64 b1, b2; @@ -434,8 +441,8 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { /* min & max values for Sint64 */ - const Sint64 maxValue = LLONG_MAX; - const Sint64 minValue = LLONG_MIN; + const Sint64 maxValue = INT64_MAX; + const Sint64 minValue = INT64_MIN; return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, boundary1, boundary2, validDomain); @@ -444,7 +451,7 @@ SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool v float SDLTest_RandomUnitFloat() { - return (float) SDLTest_RandomUint32() / UINT_MAX; + return SDLTest_RandomUint32() / (float) UINT_MAX; } float @@ -523,3 +530,5 @@ SDLTest_RandomAsciiStringOfSize(int size) return string; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_harness.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_harness.c similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_harness.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_harness.c index fec34164c9..80b07940de 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_harness.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,13 +29,13 @@ #include /* Invalid test name/description message format */ -const char *SDLTest_InvalidNameFormat = "(Invalid)"; +#define SDLTEST_INVALID_NAME_FORMAT "(Invalid)" /* Log summary message format */ -const char *SDLTest_LogSummaryFormat = "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d"; +#define SDLTEST_LOG_SUMMARY_FORMAT "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d" /* Final result message format */ -const char *SDLTest_FinalResultFormat = ">>> %s '%s': %s\n"; +#define SDLTEST_FINAL_RESULT_FORMAT ">>> %s '%s': %s\n" /* ! \brief Timeout for single test case execution */ static Uint32 SDLTest_TestCaseTimeout = 3600; @@ -97,17 +97,17 @@ SDLTest_GenerateRunSeed(const int length) * \returns The generated execution key to initialize the fuzzer with. * */ -Uint64 -SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration) +static Uint64 +SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration) { SDLTest_Md5Context md5Context; Uint64 *keys; char iterationString[16]; - Uint32 runSeedLength; - Uint32 suiteNameLength; - Uint32 testNameLength; - Uint32 iterationStringLength; - Uint32 entireStringLength; + size_t runSeedLength; + size_t suiteNameLength; + size_t testNameLength; + size_t iterationStringLength; + size_t entireStringLength; char *buffer; if (runSeed == NULL || runSeed[0] == '\0') { @@ -150,7 +150,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter /* Hash string and use half of the digest as 64bit exec key */ SDLTest_Md5Init(&md5Context); - SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, entireStringLength); + SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, (unsigned int) entireStringLength); SDLTest_Md5Final(&md5Context); SDL_free(buffer); keys = (Uint64 *)md5Context.digest; @@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter * * \return Timer id or -1 on failure. */ -SDL_TimerID +static SDL_TimerID SDLTest_SetTestTimeout(int timeout, void (*callback)()) { Uint32 timeoutInMilliseconds; @@ -206,8 +206,11 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)()) /** * \brief Timeout handler. Aborts test run and exits harness process. */ -void - SDLTest_BailOut() +#if defined(__WATCOMC__) +#pragma aux SDLTest_BailOut aborts; +#endif +static SDL_NORETURN void +SDLTest_BailOut() { SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); exit(TEST_ABORTED); /* bail out from the test */ @@ -223,8 +226,8 @@ void * * \returns Test case result. */ -int -SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) +static int +SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) { SDL_TimerID timer = 0; int testCaseResult = 0; @@ -239,7 +242,7 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference if (!testCase->enabled && forceTestRun == SDL_FALSE) { - SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)"); + SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Disabled)"); return TEST_RESULT_SKIPPED; } @@ -256,7 +259,7 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference if (testSuite->testSetUp) { testSuite->testSetUp(0x0); if (SDLTest_AssertSummaryToTestResult() == TEST_RESULT_FAILED) { - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite Setup", testSuite->name, "Failed"); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite Setup", testSuite->name, "Failed"); return TEST_RESULT_SETUP_FAILURE; } } @@ -298,13 +301,13 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference /* Final log based on test execution result */ if (testCaseResult == TEST_SKIPPED) { /* Test was programatically skipped */ - SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Programmatically)"); + SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Programmatically)"); } else if (testCaseResult == TEST_STARTED) { /* Test did not return a TEST_COMPLETED value; assume it failed */ - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (test started, but did not return TEST_COMPLETED)"); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Failed (test started, but did not return TEST_COMPLETED)"); } else if (testCaseResult == TEST_ABORTED) { /* Test was aborted early; assume it failed */ - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (Aborted)"); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Failed (Aborted)"); } else { SDLTest_LogAssertSummary(); } @@ -313,7 +316,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference } /* Prints summary of all suites/tests contained in the given reference */ -void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) +#if 0 +static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) { int suiteCounter; int testCounter; @@ -326,7 +330,7 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) testSuite=&testSuites[suiteCounter]; suiteCounter++; SDLTest_Log("Test Suite %i - %s\n", suiteCounter, - (testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat); + (testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); /* Loop over all test cases */ testCounter = 0; @@ -335,17 +339,18 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; testCounter++; SDLTest_Log(" Test Case %i - %s: %s", testCounter, - (testCase->name) ? testCase->name : SDLTest_InvalidNameFormat, - (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat); + (testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT, + (testCase->description) ? testCase->description : SDLTEST_INVALID_NAME_FORMAT); } } } +#endif /* Gets a timer value in seconds */ -float GetClock() +static float GetClock() { - float currentClock = (float)clock(); - return currentClock / (float)CLOCKS_PER_SEC; + float currentClock = clock() / (float) CLOCKS_PER_SEC; + return currentClock; } /** @@ -370,7 +375,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user int testCounter; int iterationCounter; SDLTest_TestSuiteReference *testSuite; - SDLTest_TestCaseReference *testCase; + const SDLTest_TestCaseReference *testCase; const char *runSeed = NULL; char *currentSuiteName; char *currentTestName; @@ -396,8 +401,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user Uint32 testPassedCount = 0; Uint32 testSkippedCount = 0; Uint32 countSum = 0; - char *logFormat = (char *)SDLTest_LogSummaryFormat; - SDLTest_TestCaseReference **failedTests; + const SDLTest_TestCaseReference **failedTests; /* Sanitize test iterations */ if (testIterations < 1) { @@ -441,7 +445,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ - failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); + failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); if (failedTests == NULL) { SDLTest_LogError("Unable to allocate cache for failed tests"); SDL_Error(SDL_ENOMEM); @@ -467,7 +471,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while (testSuite->testCases[testCounter] && testFilter == 0) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; + testCase = testSuite->testCases[testCounter]; testCounter++; if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) { /* Matched a test name */ @@ -484,7 +488,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (suiteFilter == 0 && testFilter == 0) { SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter); SDLTest_Log("Exit code: 2"); - SDL_free(failedTests); + SDL_free((void *) failedTests); return 2; } } @@ -493,7 +497,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user suiteCounter = 0; while(testSuites[suiteCounter]) { testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter]; - currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat); + currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT); suiteCounter++; /* Filter suite if flag set and we have a name */ @@ -522,8 +526,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while(testSuite->testCases[testCounter]) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; - currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat); + testCase = testSuite->testCases[testCounter]; + currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); testCounter++; /* Filter tests if flag set and we have a name */ @@ -551,7 +555,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user currentTestName); if (testCase->description != NULL && testCase->description[0] != '\0') { SDLTest_Log("Test Description: '%s'", - (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat); + (testCase->description) ? testCase->description : SDLTEST_INVALID_NAME_FORMAT); } /* Loop over all iterations */ @@ -563,7 +567,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (userExecKey != 0) { execKey = userExecKey; } else { - execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); + execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter); } SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey); @@ -598,13 +602,13 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user /* Log final test result */ switch (testResult) { case TEST_RESULT_PASSED: - SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed"); + SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", currentTestName, "Passed"); break; case TEST_RESULT_FAILED: - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed"); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Test", currentTestName, "Failed"); break; case TEST_RESULT_NO_ASSERT: - SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts"); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT,"Test", currentTestName, "No Asserts"); break; } @@ -628,13 +632,13 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user countSum = testPassedCount + testFailedCount + testSkippedCount; if (testFailedCount == 0) { - SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount); - SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed"); + SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount); + SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Passed"); } else { - SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount); - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed"); + SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Suite", currentSuiteName, "Failed"); } } @@ -653,14 +657,14 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (totalTestFailedCount == 0) { runResult = 0; - SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount); - SDLTest_Log((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Passed"); + SDLTest_Log(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount); + SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Passed"); } else { runResult = 1; - SDLTest_LogError(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount); - SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Failed"); + SDLTest_LogError(SDLTEST_LOG_SUMMARY_FORMAT, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount); + SDLTest_LogError(SDLTEST_FINAL_RESULT_FORMAT, "Run /w seed", runSeed, "Failed"); } /* Print repro steps for failed tests */ @@ -670,8 +674,10 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDLTest_Log(" --seed %s --filter %s", runSeed, failedTests[testCounter]->name); } } - SDL_free(failedTests); + SDL_free((void *) failedTests); SDLTest_Log("Exit code: %d", runResult); return runResult; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlit.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlit.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlit.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlit.c index 5896ca0991..f5c251a97c 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlit.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (blit.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlit = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlit = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1555,3 +1555,5 @@ SDL_Surface *SDLTest_ImageBlitAlpha() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlitBlend.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlitBlend.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlitBlend.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlitBlend.c index 6e8c2f1b41..cf2d4afc15 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageBlitBlend.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { 80, 60, 3, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" @@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -2841,3 +2841,5 @@ SDL_Surface *SDLTest_ImageBlitBlendAll() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageFace.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageFace.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_imageFace.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_imageFace.c index 84f5037f4f..9b436378d3 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imageFace.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGBA C-Source image dump (face.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageFace = { +static const SDLTest_SurfaceImage_t SDLTest_imageFace = { 32, 32, 4, "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" @@ -244,3 +244,4 @@ SDL_Surface *SDLTest_ImageFace() return surface; } +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitives.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitives.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitives.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitives.c index 4ab48d2de3..17597c6141 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitives.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (primitives.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { 80, 60, 3, "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -510,3 +510,5 @@ SDL_Surface *SDLTest_ImagePrimitives() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitivesBlend.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitivesBlend.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitivesBlend.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitivesBlend.c index 5e538628e2..aa50662613 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_imagePrimitivesBlend.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { 80, 60, 3, "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321" ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377" @@ -692,3 +692,5 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_log.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_log.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_log.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_log.c index 097372e7a6..5d6ff24256 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_log.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,9 @@ */ /* quiet windows compiler warnings */ -#define _CRT_SECURE_NO_WARNINGS +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif #include "SDL_config.h" @@ -39,6 +41,19 @@ #include "SDL_test.h" +/* work around compiler warning on older GCCs. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) +static size_t +strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm) +{ + return strftime(s, max, fmt, tm); +} +#ifdef strftime +#undef strftime +#endif +#define strftime strftime_gcc2_workaround +#endif + /* ! * Converts unix timestamp to its ascii representation in localtime * @@ -50,17 +65,16 @@ * * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02' */ -char *SDLTest_TimestampToString(const time_t timestamp) +static char *SDLTest_TimestampToString(const time_t timestamp) { time_t copy; static char buffer[64]; struct tm *local; - const char *fmt = "%x %X"; SDL_memset(buffer, 0, sizeof(buffer)); copy = timestamp; local = localtime(©); - strftime(buffer, sizeof(buffer), fmt, local); + strftime(buffer, sizeof(buffer), "%x %X", local); return buffer; } @@ -100,3 +114,5 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) /* Log with timestamp and newline */ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_md5.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_md5.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_md5.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_md5.c index 7cc3567579..c0d05a4929 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_md5.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -334,3 +334,5 @@ static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in) buf[2] += c; buf[3] += d; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/test/SDL_test_memory.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_memory.c new file mode 100644 index 0000000000..6ce72f64d3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_memory.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" +#include "SDL_assert.h" +#include "SDL_stdinc.h" +#include "SDL_log.h" +#include "SDL_test_crc32.h" +#include "SDL_test_memory.h" + +#ifdef HAVE_LIBUNWIND_H +#include +#endif + +/* This is a simple tracking allocator to demonstrate the use of SDL's + memory allocation replacement functionality. + + It gets slow with large numbers of allocations and shouldn't be used + for production code. +*/ + +typedef struct SDL_tracked_allocation +{ + void *mem; + size_t size; + Uint64 stack[10]; + char stack_names[10][256]; + struct SDL_tracked_allocation *next; +} SDL_tracked_allocation; + +static SDLTest_Crc32Context s_crc32_context; +static SDL_malloc_func SDL_malloc_orig = NULL; +static SDL_calloc_func SDL_calloc_orig = NULL; +static SDL_realloc_func SDL_realloc_orig = NULL; +static SDL_free_func SDL_free_orig = NULL; +static int s_previous_allocations = 0; +static SDL_tracked_allocation *s_tracked_allocations[256]; + +static unsigned int get_allocation_bucket(void *mem) +{ + CrcUint32 crc_value; + unsigned int index; + SDLTest_Crc32Calc(&s_crc32_context, (CrcUint8 *)&mem, sizeof(mem), &crc_value); + index = (crc_value & (SDL_arraysize(s_tracked_allocations) - 1)); + return index; +} + +static SDL_bool SDL_IsAllocationTracked(void *mem) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void SDL_TrackAllocation(void *mem, size_t size) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + + if (SDL_IsAllocationTracked(mem)) { + return; + } + entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry)); + if (!entry) { + return; + } + entry->mem = mem; + entry->size = size; + + /* Generate the stack trace for the allocation */ + SDL_zero(entry->stack); +#ifdef HAVE_LIBUNWIND_H + { + int stack_index; + unw_cursor_t cursor; + unw_context_t context; + + unw_getcontext(&context); + unw_init_local(&cursor, &context); + + stack_index = 0; + while (unw_step(&cursor) > 0) { + unw_word_t offset, pc; + char sym[256]; + + unw_get_reg(&cursor, UNW_REG_IP, &pc); + entry->stack[stack_index] = pc; + + if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) { + snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, offset); + } + ++stack_index; + + if (stack_index == SDL_arraysize(entry->stack)) { + break; + } + } + } +#endif /* HAVE_LIBUNWIND_H */ + + entry->next = s_tracked_allocations[index]; + s_tracked_allocations[index] = entry; +} + +static void SDL_UntrackAllocation(void *mem) +{ + SDL_tracked_allocation *entry, *prev; + int index = get_allocation_bucket(mem); + + prev = NULL; + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + if (prev) { + prev->next = entry->next; + } else { + s_tracked_allocations[index] = entry->next; + } + SDL_free_orig(entry); + return; + } + prev = entry; + } +} + +static void * SDLCALL SDLTest_TrackedMalloc(size_t size) +{ + void *mem; + + mem = SDL_malloc_orig(size); + if (mem) { + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) +{ + void *mem; + + mem = SDL_calloc_orig(nmemb, size); + if (mem) { + SDL_TrackAllocation(mem, nmemb * size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) +{ + void *mem; + + SDL_assert(!ptr || SDL_IsAllocationTracked(ptr)); + mem = SDL_realloc_orig(ptr, size); + if (mem && mem != ptr) { + if (ptr) { + SDL_UntrackAllocation(ptr); + } + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void SDLCALL SDLTest_TrackedFree(void *ptr) +{ + if (!ptr) { + return; + } + + if (!s_previous_allocations) { + SDL_assert(SDL_IsAllocationTracked(ptr)); + } + SDL_UntrackAllocation(ptr); + SDL_free_orig(ptr); +} + +int SDLTest_TrackAllocations() +{ + if (SDL_malloc_orig) { + return 0; + } + + SDLTest_Crc32Init(&s_crc32_context); + + s_previous_allocations = SDL_GetNumAllocations(); + if (s_previous_allocations != 0) { + SDL_Log("SDLTest_TrackAllocations(): There are %d previous allocations, disabling free() validation", s_previous_allocations); + } + + SDL_GetMemoryFunctions(&SDL_malloc_orig, + &SDL_calloc_orig, + &SDL_realloc_orig, + &SDL_free_orig); + + SDL_SetMemoryFunctions(SDLTest_TrackedMalloc, + SDLTest_TrackedCalloc, + SDLTest_TrackedRealloc, + SDLTest_TrackedFree); + return 0; +} + +void SDLTest_LogAllocations() +{ + char *message = NULL; + size_t message_size = 0; + char line[128], *tmp; + SDL_tracked_allocation *entry; + int index, count, stack_index; + Uint64 total_allocated; + + if (!SDL_malloc_orig) { + return; + } + +#define ADD_LINE() \ + message_size += (SDL_strlen(line) + 1); \ + tmp = (char *)SDL_realloc_orig(message, message_size); \ + if (!tmp) { \ + return; \ + } \ + message = tmp; \ + SDL_strlcat(message, line, message_size) + + SDL_strlcpy(line, "Memory allocations:\n", sizeof(line)); + ADD_LINE(); + SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof(line)); + ADD_LINE(); + + count = 0; + total_allocated = 0; + for (index = 0; index < SDL_arraysize(s_tracked_allocations); ++index) { + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + SDL_snprintf(line, sizeof(line), "Allocation %d: %d bytes\n", count, (int)entry->size); + ADD_LINE(); + /* Start at stack index 1 to skip our tracking functions */ + for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) { + if (!entry->stack[stack_index]) { + break; + } + SDL_snprintf(line, sizeof(line), "\t0x%"SDL_PRIx64": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]); + ADD_LINE(); + } + total_allocated += entry->size; + ++count; + } + } + SDL_snprintf(line, sizeof(line), "Total: %.2f Kb in %d allocations\n", (float)total_allocated / 1024, count); + ADD_LINE(); +#undef ADD_LINE + + SDL_Log("%s", message); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/test/SDL_test_random.c b/3rdparty/sdl2-2.0.9/src/test/SDL_test_random.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/test/SDL_test_random.c rename to 3rdparty/sdl2-2.0.9/src/test/SDL_test_random.c index c5baaa640f..9e0f1df574 100644 --- a/3rdparty/sdl2-2.0.4/src/test/SDL_test_random.c +++ b/3rdparty/sdl2-2.0.9/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext) srand((unsigned int)time(NULL)); a=rand(); - srand(clock()); + srand((unsigned int)clock()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } @@ -92,3 +92,5 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext) rndContext->c++; return (rndContext->x); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/SDL_systhread.h b/3rdparty/sdl2-2.0.9/src/thread/SDL_systhread.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/thread/SDL_systhread.h rename to 3rdparty/sdl2-2.0.9/src/thread/SDL_systhread.h index f13f3e2039..1862b239b3 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/SDL_systhread.h +++ b/3rdparty/sdl2-2.0.9/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,8 +22,8 @@ /* These are functions that need to be implemented by a port of SDL */ -#ifndef _SDL_systhread_h -#define _SDL_systhread_h +#ifndef SDL_systhread_h_ +#define SDL_systhread_h_ #include "SDL_thread.h" #include "SDL_thread_c.h" @@ -55,11 +55,16 @@ extern void SDL_SYS_WaitThread(SDL_Thread * thread); extern void SDL_SYS_DetachThread(SDL_Thread * thread); /* Get the thread local storage for this thread */ -extern SDL_TLSData *SDL_SYS_GetTLSData(); +extern SDL_TLSData *SDL_SYS_GetTLSData(void); /* Set the thread local storage for this thread */ extern int SDL_SYS_SetTLSData(SDL_TLSData *data); -#endif /* _SDL_systhread_h */ +/* This is for internal SDL use, so we don't need #ifdefs everywhere. */ +extern SDL_Thread * +SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, + const size_t stacksize, void *data); + +#endif /* SDL_systhread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/SDL_thread.c b/3rdparty/sdl2-2.0.9/src/thread/SDL_thread.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/thread/SDL_thread.c rename to 3rdparty/sdl2-2.0.9/src/thread/SDL_thread.c index e66c5819cd..5570adbffa 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/SDL_thread.c +++ b/3rdparty/sdl2-2.0.9/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_thread.h" #include "SDL_thread_c.h" #include "SDL_systhread.h" +#include "SDL_hints.h" #include "../SDL_error_c.h" @@ -49,7 +50,7 @@ SDL_TLSGet(SDL_TLSID id) } int -SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void *)) +SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) { SDL_TLSData *storage; @@ -120,7 +121,7 @@ static SDL_TLSEntry *SDL_generic_TLS; SDL_TLSData * -SDL_Generic_GetTLSData() +SDL_Generic_GetTLSData(void) { SDL_threadID thread = SDL_ThreadID(); SDL_TLSEntry *entry; @@ -298,21 +299,23 @@ SDL_RunThread(void *data) #ifdef SDL_CreateThread #undef SDL_CreateThread +#undef SDL_CreateThreadWithStackSize #endif #if SDL_DYNAMIC_API #define SDL_CreateThread SDL_CreateThread_REAL +#define SDL_CreateThreadWithStackSize SDL_CreateThreadWithStackSize_REAL #endif #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD -DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(int (SDLCALL * fn) (void *), - const char *name, void *data, +SDL_Thread * +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread) #else -DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(int (SDLCALL * fn) (void *), - const char *name, void *data) +SDL_Thread * +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data) #endif { SDL_Thread *thread; @@ -362,6 +365,8 @@ SDL_CreateThread(int (SDLCALL * fn) (void *), return (NULL); } + thread->stacksize = stacksize; + /* Create the thread and go! */ #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread); @@ -386,6 +391,50 @@ SDL_CreateThread(int (SDLCALL * fn) (void *), return (thread); } +#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD +DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(int (SDLCALL * fn) (void *), + const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread) +#else +DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(int (SDLCALL * fn) (void *), + const char *name, void *data) +#endif +{ + /* !!! FIXME: in 2.1, just make stackhint part of the usual API. */ + const char *stackhint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE); + size_t stacksize = 0; + + /* If the SDL_HINT_THREAD_STACK_SIZE exists, use it */ + if (stackhint != NULL) { + char *endp = NULL; + const Sint64 hintval = SDL_strtoll(stackhint, &endp, 10); + if ((*stackhint != '\0') && (*endp == '\0')) { /* a valid number? */ + if (hintval > 0) { /* reject bogus values. */ + stacksize = (size_t) hintval; + } + } + } + +#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD + return SDL_CreateThreadWithStackSize(fn, name, stacksize, data, pfnBeginThread, pfnEndThread); +#else + return SDL_CreateThreadWithStackSize(fn, name, stacksize, data); +#endif +} + +SDL_Thread * +SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, + const size_t stacksize, void *data) { +#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD + return SDL_CreateThreadWithStackSize(fn, name, stacksize, data, NULL, NULL); +#else + return SDL_CreateThreadWithStackSize(fn, name, stacksize, data); +#endif +} + SDL_threadID SDL_GetThreadID(SDL_Thread * thread) { diff --git a/3rdparty/sdl2-2.0.4/src/thread/SDL_thread_c.h b/3rdparty/sdl2-2.0.9/src/thread/SDL_thread_c.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/thread/SDL_thread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/SDL_thread_c.h index a283a0e2ca..b68f90e91d 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/SDL_thread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_thread_c_h -#define _SDL_thread_c_h +#ifndef SDL_thread_c_h_ +#define SDL_thread_c_h_ #include "SDL_thread.h" @@ -59,6 +59,7 @@ struct SDL_Thread SDL_atomic_t state; /* SDL_THREAD_STATE_* */ SDL_error errbuf; char *name; + size_t stacksize; /* 0 for default, >0 for user-specified stack size. */ void *data; }; @@ -70,7 +71,7 @@ typedef struct { unsigned int limit; struct { void *data; - void (*destructor)(void*); + void (SDLCALL *destructor)(void*); } array[1]; } SDL_TLSData; @@ -81,7 +82,7 @@ typedef struct { This is only intended as a fallback if getting real thread-local storage fails or isn't supported on this platform. */ -extern SDL_TLSData *SDL_Generic_GetTLSData(); +extern SDL_TLSData *SDL_Generic_GetTLSData(void); /* Set cross-platform, slow, thread local storage for this thread. This is only intended as a fallback if getting real thread-local @@ -89,6 +90,6 @@ extern SDL_TLSData *SDL_Generic_GetTLSData(); */ extern int SDL_Generic_SetTLSData(SDL_TLSData *data); -#endif /* _SDL_thread_c_h */ +#endif /* SDL_thread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syscond.c b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syscond.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syscond.c rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syscond.c index e2ccd88ef1..34b9893b3d 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syscond.c +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex.c b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex.c rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex.c index f2f6689700..df78ca9ed6 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex.c +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex_c.h b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex_c.h index 9dba5e16c5..2979437b59 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syssem.c b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syssem.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syssem.c rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syssem.c index 92afcb0c07..30ff824413 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_syssem.c +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread.c b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread.c rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread.c index 7a81a6201f..7a19b781c0 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread.c +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread_c.h b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread_c.h index ea9b714603..13db579d00 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systhread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systls.c b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systls.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systls.c rename to 3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systls.c index e29c198182..241862e830 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_systls.c +++ b/3rdparty/sdl2-2.0.9/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syscond.c b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syscond.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syscond.c rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syscond.c index a84b206c8a..4ed73e0ecd 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syscond.c +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex.c b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex.c rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex.c index 78129fa69a..e2db5eb111 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_sysmutex.c +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex_c.h b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex_c.h index 9dba5e16c5..2979437b59 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/generic/SDL_sysmutex_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syssem.c b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syssem.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syssem.c rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syssem.c index 643406c46e..0c36434092 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_syssem.c +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +108,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) case SCE_KERNEL_ERROR_WAIT_TIMEOUT: return SDL_MUTEX_TIMEDOUT; default: - return SDL_SetError("WaitForSingleObject() failed"); + return SDL_SetError("sceKernelWaitSema() failed"); } } diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread.c b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread.c rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread.c index ab8aff3766..284f182a6a 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread.c +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,8 +52,8 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) priority = status.currentPriority; } - thread->handle = sceKernelCreateThread("SDL thread", ThreadEntry, - priority, 0x8000, + thread->handle = sceKernelCreateThread(thread->name, ThreadEntry, + priority, thread->stacksize ? ((int) thread->stacksize) : 0x8000, PSP_THREAD_ATTR_VFPU, NULL); if (thread->handle < 0) { return SDL_SetError("sceKernelCreateThread() failed"); @@ -97,6 +97,8 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) if (priority == SDL_THREAD_PRIORITY_LOW) { value = 19; } else if (priority == SDL_THREAD_PRIORITY_HIGH) { + value = -10; + } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { value = -20; } else { value = 0; diff --git a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread_c.h b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread_c.h index 4f74df06aa..ea26f81d2b 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/psp/SDL_systhread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syscond.c b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syscond.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syscond.c rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syscond.c index 998ac55b3f..d23578038d 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syscond.c +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ SDL_CreateCond(void) cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); if (cond) { - if (pthread_cond_init(&cond->cond, NULL) < 0) { + if (pthread_cond_init(&cond->cond, NULL) != 0) { SDL_SetError("pthread_cond_init() failed"); SDL_free(cond); cond = NULL; @@ -129,7 +129,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) switch (retval) { case EINTR: goto tryagain; - break; + /* break; -Wunreachable-code-break */ case ETIMEDOUT: retval = SDL_MUTEX_TIMEDOUT; break; diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex.c b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex.c rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex.c index f24cfdab01..e514778a5e 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex.c +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include @@ -108,7 +105,7 @@ SDL_LockMutex(SDL_mutex * mutex) } } #else - if (pthread_mutex_lock(&mutex->id) < 0) { + if (pthread_mutex_lock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_lock() failed"); } #endif @@ -119,6 +116,7 @@ int SDL_TryLockMutex(SDL_mutex * mutex) { int retval; + int result; #if FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif @@ -137,18 +135,20 @@ SDL_TryLockMutex(SDL_mutex * mutex) We set the locking thread id after we obtain the lock so unlocks from other threads will fail. */ - if (pthread_mutex_lock(&mutex->id) == 0) { + result = pthread_mutex_trylock(&mutex->id); + if (result == 0) { mutex->owner = this_thread; mutex->recursive = 0; - } else if (errno == EBUSY) { + } else if (result == EBUSY) { retval = SDL_MUTEX_TIMEDOUT; } else { retval = SDL_SetError("pthread_mutex_trylock() failed"); } } #else - if (pthread_mutex_trylock(&mutex->id) != 0) { - if (errno == EBUSY) { + result = pthread_mutex_trylock(&mutex->id); + if (result != 0) { + if (result == EBUSY) { retval = SDL_MUTEX_TIMEDOUT; } else { retval = SDL_SetError("pthread_mutex_trylock() failed"); @@ -184,7 +184,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) } #else - if (pthread_mutex_unlock(&mutex->id) < 0) { + if (pthread_mutex_unlock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_unlock() failed"); } #endif /* FAKE_RECURSIVE_MUTEX */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex_c.h b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex_c.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex_c.h index ee60ca0411..27ac1da615 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_mutex_c_h -#define _SDL_mutex_c_h +#ifndef SDL_mutex_c_h_ +#define SDL_mutex_c_h_ struct SDL_mutex { pthread_mutex_t id; }; -#endif /* _SDL_mutex_c_h */ +#endif /* SDL_mutex_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syssem.c b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syssem.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syssem.c rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syssem.c index b7547e699c..bdebf1311a 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syssem.c +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include #include @@ -94,7 +91,10 @@ SDL_SemWait(SDL_sem * sem) return SDL_SetError("Passed a NULL semaphore"); } - retval = sem_wait(&sem->sem); + do { + retval = sem_wait(&sem->sem); + } while (retval < 0 && errno == EINTR); + if (retval < 0) { retval = SDL_SetError("sem_wait() failed"); } diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread.c b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread.c similarity index 66% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread.c rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread.c index 22f7bd57b4..ec329379e6 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread.c +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,9 @@ #include #include #include +#include + +#include "../../core/linux/SDL_dbus.h" #endif /* __LINUX__ */ #if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__) @@ -43,9 +46,9 @@ #endif #endif +#include "SDL_log.h" #include "SDL_platform.h" #include "SDL_thread.h" -#include "SDL_hints.h" #include "../SDL_thread_c.h" #include "../SDL_systhread.h" #ifdef __ANDROID__ @@ -53,7 +56,7 @@ #endif #ifdef __HAIKU__ -#include +#include #endif #include "SDL_assert.h" @@ -87,7 +90,6 @@ int SDL_SYS_CreateThread(SDL_Thread * thread, void *args) { pthread_attr_t type; - const char *hint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE); /* do this here before any threads exist, so there's no race condition. */ #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__) @@ -108,12 +110,9 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) } pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE); - /* If the SDL_HINT_THREAD_STACK_SIZE exists and it seems to be a positive number, use it */ - if (hint && hint[0] >= '0' && hint[0] <= '9') { - const size_t stacksize = (size_t) SDL_atoi(hint); - if (stacksize > 0) { - pthread_attr_setstacksize(&type, stacksize); - } + /* Set caller-requested stack size. Otherwise: use the system default. */ + if (thread->stacksize) { + pthread_attr_setstacksize(&type, (size_t) thread->stacksize); } /* Create the thread and go! */ @@ -127,10 +126,10 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) void SDL_SYS_SetupThread(const char *name) { -#if !defined(__ANDROID__) && !defined(__NACL__) +#if !defined(__NACL__) int i; sigset_t mask; -#endif /* !__ANDROID__ && !__NACL__ */ +#endif /* !__NACL__ */ if (name != NULL) { #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__) @@ -160,14 +159,14 @@ SDL_SYS_SetupThread(const char *name) } /* NativeClient does not yet support signals.*/ -#if !defined(__ANDROID__) && !defined(__NACL__) +#if !defined(__NACL__) /* Mask asynchronous signals for this thread */ sigemptyset(&mask); for (i = 0; sig_list[i]; ++i) { sigaddset(&mask, sig_list[i]); } pthread_sigmask(SIG_BLOCK, &mask, 0); -#endif /* !__ANDROID__ && !__NACL__ */ +#endif /* !__NACL__ */ #ifdef PTHREAD_CANCEL_ASYNCHRONOUS @@ -185,6 +184,84 @@ SDL_ThreadID(void) return ((SDL_threadID) pthread_self()); } +#if __LINUX__ +/* d-bus queries to org.freedesktop.RealtimeKit1. */ +#if SDL_USE_LIBDBUS + +#define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" +#define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1" +#define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1" + +static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT; +static Sint32 rtkit_min_nice_level = -20; + +static void +rtkit_initialize() +{ + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + + /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */ + if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel", + DBUS_TYPE_INT32, &rtkit_min_nice_level)) { + rtkit_min_nice_level = -20; + } +} + +static SDL_bool +rtkit_setpriority(pid_t thread, int nice_level) +{ + Uint64 ui64 = (Uint64)thread; + Sint32 si32 = (Sint32)nice_level; + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + + pthread_once(&rtkit_initialize_once, rtkit_initialize); + + if (si32 < rtkit_min_nice_level) + si32 = rtkit_min_nice_level; + + if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, + RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadHighPriority", + DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID, + DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +#else + +static SDL_bool +rtkit_setpriority(pid_t thread, int nice_level) +{ + return SDL_FALSE; +} + +#endif /* !SDL_USE_LIBDBUS */ + +int +SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) +{ + if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) < 0) { + /* Note that this fails if you're trying to set high priority + and you don't have root permission. BUT DON'T RUN AS ROOT! + + You can grant the ability to increase thread priority by + running the following command on your application binary: + sudo setcap 'cap_sys_nice=eip' + + Let's try setting priority with RealtimeKit... + + README and sample code at: + http://git.0pointer.net/rtkit.git + */ + if (rtkit_setpriority((pid_t)threadID, priority) == SDL_FALSE) { + return SDL_SetError("setpriority() failed"); + } + } + return 0; +} +#endif /* __LINUX__ */ + int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { @@ -193,39 +270,39 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) return 0; #elif __LINUX__ int value; + pid_t thread = syscall(SYS_gettid); if (priority == SDL_THREAD_PRIORITY_LOW) { value = 19; } else if (priority == SDL_THREAD_PRIORITY_HIGH) { + value = -10; + } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { value = -20; } else { value = 0; } - if (setpriority(PRIO_PROCESS, syscall(SYS_gettid), value) < 0) { - /* Note that this fails if you're trying to set high priority - and you don't have root permission. BUT DON'T RUN AS ROOT! - */ - return SDL_SetError("setpriority() failed"); - } - return 0; + return SDL_LinuxSetThreadPriority(thread, value); #else struct sched_param sched; int policy; pthread_t thread = pthread_self(); - if (pthread_getschedparam(thread, &policy, &sched) < 0) { + if (pthread_getschedparam(thread, &policy, &sched) != 0) { return SDL_SetError("pthread_getschedparam() failed"); } if (priority == SDL_THREAD_PRIORITY_LOW) { sched.sched_priority = sched_get_priority_min(policy); - } else if (priority == SDL_THREAD_PRIORITY_HIGH) { + } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { sched.sched_priority = sched_get_priority_max(policy); } else { int min_priority = sched_get_priority_min(policy); int max_priority = sched_get_priority_max(policy); sched.sched_priority = (min_priority + (max_priority - min_priority) / 2); + if (priority == SDL_THREAD_PRIORITY_HIGH) { + sched.sched_priority += ((max_priority - min_priority) / 4); + } } - if (pthread_setschedparam(thread, policy, &sched) < 0) { + if (pthread_setschedparam(thread, policy, &sched) != 0) { return SDL_SetError("pthread_setschedparam() failed"); } return 0; diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread_c.h b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread_c.h index 4ad1884437..898c219fd8 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systls.c b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systls.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systls.c rename to 3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systls.c index 622ad02975..c580595bd5 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systls.c +++ b/3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../../SDL_internal.h" #include "SDL_thread.h" +#include "../SDL_systhread.h" #include "../SDL_thread_c.h" #include @@ -31,7 +32,7 @@ static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_syscond.cpp b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_syscond.cpp similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_syscond.cpp rename to 3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_syscond.cpp index 976bff4879..32c7c4bc3e 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_syscond.cpp +++ b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex.cpp b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex.cpp similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex.cpp rename to 3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex.cpp index 04028627d0..667d36b48f 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex_c.h b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex_c.h index ab0f2dd839..000288f295 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread.cpp b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread.cpp similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread.cpp rename to 3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread.cpp index 219c67e931..3020f1c1b5 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread.cpp +++ b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,6 +48,7 @@ int SDL_SYS_CreateThread(SDL_Thread * thread, void *args) { try { + // !!! FIXME: no way to set a thread stack size here. std::thread cpp_thread(RunThread, args); thread->handle = (void *) new std::thread(std::move(cpp_thread)); return 0; @@ -152,7 +153,7 @@ SDL_SYS_DetachThread(SDL_Thread * thread) extern "C" SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread_c.h b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread_c.h index c3cc507c3a..ee4764de66 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/stdcpp/SDL_systhread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_sysmutex.c b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_sysmutex.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/thread/windows/SDL_sysmutex.c rename to 3rdparty/sdl2-2.0.9/src/thread/windows/SDL_sysmutex.c index 413cb67037..119e62b67d 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_sysmutex.c +++ b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_syssem.c b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_syssem.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/windows/SDL_syssem.c rename to 3rdparty/sdl2-2.0.9/src/thread/windows/SDL_syssem.c index 86b58882de..dcb36fa0f0 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_syssem.c +++ b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,11 +90,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) } else { dwMilliseconds = (DWORD) timeout; } -#if __WINRT__ switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) { -#else - switch (WaitForSingleObject(sem->id, dwMilliseconds)) { -#endif case WAIT_OBJECT_0: InterlockedDecrement(&sem->count); retval = 0; diff --git a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread.c b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread.c similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread.c rename to 3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread.c index 308145e30b..251510d480 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread.c +++ b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ /* Win32 thread management routines for SDL */ +#include "SDL_hints.h" #include "SDL_thread.h" #include "../SDL_thread_c.h" #include "../SDL_systhread.h" @@ -33,6 +34,10 @@ /* We'll use the C library from this DLL */ #include +#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION +#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000 +#endif + /* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */ #if (defined(__MINGW32__) && (__GNUC__ < 4)) typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, @@ -121,6 +126,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) #endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */ pThreadStartParms pThreadParms = (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms)); + const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0; if (!pThreadParms) { return SDL_OutOfMemory(); } @@ -129,15 +135,18 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) /* Also save the real parameters we have to pass to thread function */ pThreadParms->args = args; + /* thread->stacksize == 0 means "system default", same as win32 expects */ if (pfnBeginThread) { unsigned threadid = 0; thread->handle = (SYS_ThreadHandle) - ((size_t) pfnBeginThread(NULL, 0, RunThreadViaBeginThreadEx, - pThreadParms, 0, &threadid)); + ((size_t) pfnBeginThread(NULL, (unsigned int) thread->stacksize, + RunThreadViaBeginThreadEx, + pThreadParms, flags, &threadid)); } else { DWORD threadid = 0; - thread->handle = CreateThread(NULL, 0, RunThreadViaCreateThread, - pThreadParms, 0, &threadid); + thread->handle = CreateThread(NULL, thread->stacksize, + RunThreadViaCreateThread, + pThreadParms, flags, &threadid); } if (thread->handle == NULL) { return SDL_SetError("Not enough resources to create thread"); @@ -145,9 +154,6 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) return 0; } -#if 0 /* !!! FIXME: revisit this later. See https://bugzilla.libsdl.org/show_bug.cgi?id=2089 */ -#ifdef _MSC_VER -#pragma warning(disable : 4733) #pragma pack(push,8) typedef struct tagTHREADNAME_INFO { @@ -158,48 +164,55 @@ typedef struct tagTHREADNAME_INFO } THREADNAME_INFO; #pragma pack(pop) -static EXCEPTION_DISPOSITION -ignore_exception(void *a, void *b, void *c, void *d) -{ - return ExceptionContinueExecution; -} -#endif -#endif + +typedef HRESULT (WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR); void SDL_SYS_SetupThread(const char *name) { if (name != NULL) { - #if 0 /* !!! FIXME: revisit this later. See https://bugzilla.libsdl.org/show_bug.cgi?id=2089 */ - #if (defined(_MSC_VER) && defined(_M_IX86)) - /* This magic tells the debugger to name a thread if it's listening. - The inline asm sets up SEH (__try/__except) without C runtime - support. See Microsoft Systems Journal, January 1997: - http://www.microsoft.com/msj/0197/exception/exception.aspx */ - INT_PTR handler = (INT_PTR) ignore_exception; - THREADNAME_INFO inf; - - inf.dwType = 0x1000; - inf.szName = name; - inf.dwThreadID = (DWORD) -1; - inf.dwFlags = 0; - - __asm { /* set up SEH */ - push handler - push fs:[0] - mov fs:[0],esp - } + #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ + static pfnSetThreadDescription pSetThreadDescription = NULL; + static HMODULE kernel32 = 0; - /* The program itself should ignore this bogus exception. */ - RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf); + if (!kernel32) { + kernel32 = LoadLibraryW(L"kernel32.dll"); + if (kernel32) { + pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription"); + } + } - __asm { /* tear down SEH. */ - mov eax,[esp] - mov fs:[0], eax - add esp, 8 + if (pSetThreadDescription != NULL) { + WCHAR *strw = WIN_UTF8ToString(name); + if (strw) { + pSetThreadDescription(GetCurrentThread(), strw); + SDL_free(strw); + } } #endif - #endif + + /* Presumably some version of Visual Studio will understand SetThreadDescription(), + but we still need to deal with older OSes and debuggers. Set it with the arcane + exception magic, too. */ + + if (IsDebuggerPresent()) { + THREADNAME_INFO inf; + + /* C# and friends will try to catch this Exception, let's avoid it. */ + if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_TRUE)) { + return; + } + + /* This magic tells the debugger to name a thread if it's listening. */ + SDL_zero(inf); + inf.dwType = 0x1000; + inf.szName = name; + inf.dwThreadID = (DWORD) -1; + inf.dwFlags = 0; + + /* The debugger catches this, renames the thread, continues on. */ + RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); + } } } @@ -218,6 +231,8 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) value = THREAD_PRIORITY_LOWEST; } else if (priority == SDL_THREAD_PRIORITY_HIGH) { value = THREAD_PRIORITY_HIGHEST; + } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { + value = THREAD_PRIORITY_TIME_CRITICAL; } else { value = THREAD_PRIORITY_NORMAL; } @@ -230,11 +245,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) void SDL_SYS_WaitThread(SDL_Thread * thread) { -#if __WINRT__ WaitForSingleObjectEx(thread->handle, INFINITE, FALSE); -#else - WaitForSingleObject(thread->handle, INFINITE); -#endif CloseHandle(thread->handle); } diff --git a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread_c.h b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread_c.h rename to 3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread_c.h index 90866a7bbd..65d5a1b8c6 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systhread_c.h +++ b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_systhread_c_h -#define _SDL_systhread_c_h +#ifndef SDL_systhread_c_h_ +#define SDL_systhread_c_h_ #include "../../core/windows/SDL_windows.h" typedef HANDLE SYS_ThreadHandle; -#endif /* _SDL_systhread_c_h */ +#endif /* SDL_systhread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systls.c b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systls.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systls.c rename to 3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systls.c index 7ec630e8fd..888fd747a6 100644 --- a/3rdparty/sdl2-2.0.4/src/thread/windows/SDL_systls.c +++ b/3rdparty/sdl2-2.0.9/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/3rdparty/sdl2-2.0.4/src/timer/SDL_timer.c b/3rdparty/sdl2-2.0.9/src/timer/SDL_timer.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/timer/SDL_timer.c rename to 3rdparty/sdl2-2.0.9/src/timer/SDL_timer.c index 6189ab8b50..f4a13f4bdd 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/SDL_timer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ #include "SDL_timer_c.h" #include "SDL_atomic.h" #include "SDL_cpuinfo.h" -#include "SDL_thread.h" +#include "../thread/SDL_systhread.h" /* #define DEBUG_TIMERS */ @@ -35,7 +35,7 @@ typedef struct _SDL_Timer void *param; Uint32 interval; Uint32 scheduled; - volatile SDL_bool canceled; + SDL_atomic_t canceled; struct _SDL_Timer *next; } SDL_Timer; @@ -60,9 +60,9 @@ typedef struct { /* Data used to communicate with the timer thread */ SDL_SpinLock lock; SDL_sem *sem; - SDL_Timer * volatile pending; - SDL_Timer * volatile freelist; - volatile SDL_bool active; + SDL_Timer *pending; + SDL_Timer *freelist; + SDL_atomic_t active; /* List of timers - this is only touched by the timer thread */ SDL_Timer *timers; @@ -97,7 +97,7 @@ SDL_AddTimerInternal(SDL_TimerData *data, SDL_Timer *timer) timer->next = curr; } -static int +static int SDLCALL SDL_TimerThread(void *_data) { SDL_TimerData *data = (SDL_TimerData *)_data; @@ -138,7 +138,7 @@ SDL_TimerThread(void *_data) freelist_tail = NULL; /* Check to see if we're still running, after maintenance */ - if (!data->active) { + if (!SDL_AtomicGet(&data->active)) { break; } @@ -160,7 +160,7 @@ SDL_TimerThread(void *_data) /* We're going to do something with this timer */ data->timers = current->next; - if (current->canceled) { + if (SDL_AtomicGet(¤t->canceled)) { interval = 0; } else { interval = current->callback(current->interval, current->param); @@ -168,6 +168,7 @@ SDL_TimerThread(void *_data) if (interval > 0) { /* Reschedule this timer */ + current->interval = interval; current->scheduled = tick + interval; SDL_AddTimerInternal(data, current); } else { @@ -179,7 +180,7 @@ SDL_TimerThread(void *_data) } freelist_tail = current; - current->canceled = SDL_TRUE; + SDL_AtomicSet(¤t->canceled, 1); } } @@ -207,7 +208,7 @@ SDL_TimerInit(void) { SDL_TimerData *data = &SDL_timer_data; - if (!data->active) { + if (!SDL_AtomicGet(&data->active)) { const char *name = "SDLTimer"; data->timermap_lock = SDL_CreateMutex(); if (!data->timermap_lock) { @@ -220,18 +221,10 @@ SDL_TimerInit(void) return -1; } - data->active = SDL_TRUE; - /* !!! FIXME: this is nasty. */ -#if defined(__WIN32__) && !defined(HAVE_LIBC) -#undef SDL_CreateThread -#if SDL_DYNAMIC_API - data->thread = SDL_CreateThread_REAL(SDL_TimerThread, name, data, NULL, NULL); -#else - data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL); -#endif -#else - data->thread = SDL_CreateThread(SDL_TimerThread, name, data); -#endif + SDL_AtomicSet(&data->active, 1); + + /* Timer threads use a callback into the app, so we can't set a limited stack size here. */ + data->thread = SDL_CreateThreadInternal(SDL_TimerThread, name, 0, data); if (!data->thread) { SDL_TimerQuit(); return -1; @@ -249,9 +242,7 @@ SDL_TimerQuit(void) SDL_Timer *timer; SDL_TimerMap *entry; - if (data->active) { - data->active = SDL_FALSE; - + if (SDL_AtomicCAS(&data->active, 1, 0)) { /* active? Move to inactive. */ /* Shutdown the timer thread */ if (data->thread) { SDL_SemPost(data->sem); @@ -291,21 +282,14 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) SDL_Timer *timer; SDL_TimerMap *entry; - if (!data->active) { - int status = 0; - - SDL_AtomicLock(&data->lock); - if (!data->active) { - status = SDL_TimerInit(); - } - SDL_AtomicUnlock(&data->lock); - - if (status < 0) { + SDL_AtomicLock(&data->lock); + if (!SDL_AtomicGet(&data->active)) { + if (SDL_TimerInit() < 0) { + SDL_AtomicUnlock(&data->lock); return 0; } } - SDL_AtomicLock(&data->lock); timer = data->freelist; if (timer) { data->freelist = timer->next; @@ -326,7 +310,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) timer->param = param; timer->interval = interval; timer->scheduled = SDL_GetTicks() + interval; - timer->canceled = SDL_FALSE; + SDL_AtomicSet(&timer->canceled, 0); entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry)); if (!entry) { @@ -377,8 +361,8 @@ SDL_RemoveTimer(SDL_TimerID id) SDL_UnlockMutex(data->timermap_lock); if (entry) { - if (!entry->timer->canceled) { - entry->timer->canceled = SDL_TRUE; + if (!SDL_AtomicGet(&entry->timer->canceled)) { + SDL_AtomicSet(&entry->timer->canceled, 1); canceled = SDL_TRUE; } SDL_free(entry); diff --git a/3rdparty/sdl2-2.0.4/src/timer/SDL_timer_c.h b/3rdparty/sdl2-2.0.9/src/timer/SDL_timer_c.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/timer/SDL_timer_c.h rename to 3rdparty/sdl2-2.0.9/src/timer/SDL_timer_c.h index 6ae8170585..3ea350ffbd 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/SDL_timer_c.h +++ b/3rdparty/sdl2-2.0.9/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_timer_c_h_ +#define SDL_timer_c_h_ + #include "../SDL_internal.h" /* Useful functions and variables from SDL_timer.c */ @@ -31,4 +35,6 @@ extern void SDL_TicksQuit(void); extern int SDL_TimerInit(void); extern void SDL_TimerQuit(void); +#endif /* SDL_timer_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/timer/dummy/SDL_systimer.c b/3rdparty/sdl2-2.0.9/src/timer/dummy/SDL_systimer.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/timer/dummy/SDL_systimer.c rename to 3rdparty/sdl2-2.0.9/src/timer/dummy/SDL_systimer.c index 1174d22417..aff145b29b 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/dummy/SDL_systimer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/timer/haiku/SDL_systimer.c b/3rdparty/sdl2-2.0.9/src/timer/haiku/SDL_systimer.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/timer/haiku/SDL_systimer.c rename to 3rdparty/sdl2-2.0.9/src/timer/haiku/SDL_systimer.c index f45aa64d7c..16f49c05c1 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/haiku/SDL_systimer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifdef SDL_TIMER_HAIKU -#include +#include #include "SDL_timer.h" diff --git a/3rdparty/sdl2-2.0.4/src/timer/psp/SDL_systimer.c b/3rdparty/sdl2-2.0.9/src/timer/psp/SDL_systimer.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/timer/psp/SDL_systimer.c rename to 3rdparty/sdl2-2.0.9/src/timer/psp/SDL_systimer.c index 1e8802cf19..e39d8007fc 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/psp/SDL_systimer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/timer/unix/SDL_systimer.c b/3rdparty/sdl2-2.0.9/src/timer/unix/SDL_systimer.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/timer/unix/SDL_systimer.c rename to 3rdparty/sdl2-2.0.9/src/timer/unix/SDL_systimer.c index 217fe327fa..5045996f36 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/unix/SDL_systimer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_timer.h" #include "SDL_assert.h" +#include "../SDL_timer_c.h" /* The clock_gettime provides monotonous time, so we should use it if it's available. The clock_gettime function is behind ifdef diff --git a/3rdparty/sdl2-2.0.4/src/timer/windows/SDL_systimer.c b/3rdparty/sdl2-2.0.9/src/timer/windows/SDL_systimer.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/timer/windows/SDL_systimer.c rename to 3rdparty/sdl2-2.0.9/src/timer/windows/SDL_systimer.c index abfbcb99ac..3f5413b269 100644 --- a/3rdparty/sdl2-2.0.4/src/timer/windows/SDL_systimer.c +++ b/3rdparty/sdl2-2.0.9/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,7 +60,7 @@ SDL_SetSystemTimerResolution(const UINT uPeriod) #endif } -static void +static void SDLCALL SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { UINT uPeriod; @@ -107,10 +107,8 @@ SDL_TicksInit(void) void SDL_TicksQuit(void) { - if (!hires_timer_available) { - SDL_DelHintCallback(SDL_HINT_TIMER_RESOLUTION, - SDL_TimerResolutionChanged, NULL); - } + SDL_DelHintCallback(SDL_HINT_TIMER_RESOLUTION, + SDL_TimerResolutionChanged, NULL); SDL_SetSystemTimerResolution(0); /* always release our timer resolution request. */ @@ -189,6 +187,10 @@ SDL_Delay(Uint32 ms) } WaitForSingleObjectEx(mutex, ms, FALSE); #else + if (!ticks_started) { + SDL_TicksInit(); + } + Sleep(ms); #endif } diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel.c b/3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel.c index 67baaf664e..661cb1f534 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,9 +90,6 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif @@ -448,7 +445,7 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, /* blit a colorkeyed RLE surface */ -int +int SDLCALL SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -726,7 +723,7 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, } /* blit a pixel-alpha RLE surface */ -int +int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -1280,7 +1277,7 @@ RLEColorkeySurface(SDL_Surface * surface) int y; Uint8 *srcbuf, *lastline; int maxsize = 0; - int bpp = surface->format->BytesPerPixel; + const int bpp = surface->format->BytesPerPixel; getpix_func getpix; Uint32 ckey, rgbmask; int w, h; @@ -1303,6 +1300,9 @@ RLEColorkeySurface(SDL_Surface * surface) maxsize = surface->h * (4 * (surface->w / 65535 + 1) + surface->w * 4) + 4; break; + + default: + return -1; } rlebuf = (Uint8 *) SDL_malloc(maxsize); @@ -1396,7 +1396,7 @@ RLEColorkeySurface(SDL_Surface * surface) surface->map->data = p; } - return (0); + return 0; } int diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel_c.h b/3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel_c.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel_c.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel_c.h index c04fc1527f..b6fa6a11eb 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,14 +18,21 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_RLEaccel_c_h_ +#define SDL_RLEaccel_c_h_ + #include "../SDL_internal.h" /* Useful functions and variables from SDL_RLEaccel.c */ extern int SDL_RLESurface(SDL_Surface * surface); -extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); -extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); extern void SDL_UnRLESurface(SDL_Surface * surface, int recode); + +#endif /* SDL_RLEaccel_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit.c index 90aa878984..0d4e2fdb93 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "SDL_pixels_c.h" /* The general purpose software blit routine */ -static int +static int SDLCALL SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) { @@ -219,6 +219,12 @@ SDL_CalculateBlit(SDL_Surface * surface) SDL_BlitMap *map = surface->map; SDL_Surface *dst = map->dst; + /* We don't currently support blitting to < 8 bpp surfaces */ + if (dst->format->BitsPerPixel < 8) { + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); + } + /* Clean everything out to start */ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { SDL_UnRLESurface(surface, 1); @@ -239,6 +245,10 @@ SDL_CalculateBlit(SDL_Surface * surface) /* Choose a standard blit function */ if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; + } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) { + /* Greater than 8 bits per channel not supported yet */ + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); } else if (surface->format->BitsPerPixel < 8 && SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { blit = SDL_CalculateBlit0(surface); diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit.h b/3rdparty/sdl2-2.0.9/src/video/SDL_blit.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit.h index e30f8afecb..6c95aafd05 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_blit_h -#define _SDL_blit_h +#ifndef SDL_blit_h_ +#define SDL_blit_h_ #include "SDL_cpuinfo.h" #include "SDL_endian.h" @@ -70,7 +70,8 @@ typedef struct Uint8 r, g, b, a; } SDL_BlitInfo; -typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info); +typedef void (*SDL_BlitFunc) (SDL_BlitInfo *info); + typedef struct { @@ -125,7 +126,7 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface); b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \ } #define RGB_FROM_RGB565(Pixel, r, g, b) \ - { \ +{ \ r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \ g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \ b = SDL_expand_byte[3][(Pixel&0x001F)]; \ @@ -261,18 +262,18 @@ do { \ { \ switch (bpp) { \ case 1: { \ - Uint8 Pixel; \ + Uint8 _Pixel; \ \ - PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \ - *((Uint8 *)(buf)) = Pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint8 *)(buf)) = _Pixel; \ } \ break; \ \ case 2: { \ - Uint16 Pixel; \ + Uint16 _Pixel; \ \ - PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \ - *((Uint16 *)(buf)) = Pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint16 *)(buf)) = _Pixel; \ } \ break; \ \ @@ -290,10 +291,10 @@ do { \ break; \ \ case 4: { \ - Uint32 Pixel; \ + Uint32 _Pixel; \ \ - PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \ - *((Uint32 *)(buf)) = Pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint32 *)(buf)) = _Pixel; \ } \ break; \ } \ @@ -443,19 +444,19 @@ do { \ /* Blend the RGB values of two pixels with an alpha value */ #define ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)A)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)A)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)A)/255)+dB); \ + dR = (Uint8)((((int)(sR-dR)*(int)A)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)A)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)A)/255)+dB); \ } while(0) /* Blend the RGBA values of two pixels */ #define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)sA)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)sA)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)sA)/255)+dB); \ - dA = ((unsigned)sA+(unsigned)dA-((unsigned)sA*dA)/255); \ + dR = (Uint8)((((int)(sR-dR)*(int)sA)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)sA)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)sA)/255)+dB); \ + dA = (Uint8)((int)sA+dA-((int)sA*dA)/255); \ } while(0) @@ -471,14 +472,14 @@ do { \ #define DUFFS_LOOP8(pixel_copy_increment, width) \ { int n = (width+7)/8; \ switch (width & 7) { \ - case 0: do { pixel_copy_increment; \ - case 7: pixel_copy_increment; \ - case 6: pixel_copy_increment; \ - case 5: pixel_copy_increment; \ - case 4: pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 7: pixel_copy_increment; /* fallthrough */ \ + case 6: pixel_copy_increment; /* fallthrough */ \ + case 5: pixel_copy_increment; /* fallthrough */ \ + case 4: pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } @@ -487,10 +488,10 @@ do { \ #define DUFFS_LOOP4(pixel_copy_increment, width) \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while (--n > 0); \ } \ } @@ -547,6 +548,6 @@ do { \ #pragma warning(disable: 4550) #endif -#endif /* _SDL_blit_h */ +#endif /* SDL_blit_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_0.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_0.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_0.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_0.c index fe7330d78d..b5c8efb3cc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_0.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_1.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_1.c similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_1.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_1.c index 69c15d08df..56ccf15fc9 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_1.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,13 +49,13 @@ Blit1to1(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP /* *INDENT-OFF* */ - DUFFS_LOOP( - { - *dst = map[*src]; - } - dst++; - src++; - , width); + DUFFS_LOOP( + { + *dst = map[*src]; + } + dst++; + src++; + , width); /* *INDENT-ON* */ #else for (c = width; c; --c) { @@ -70,12 +70,14 @@ Blit1to1(SDL_BlitInfo * info) } /* This is now endian dependent */ -#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) -#define HI 1 -#define LO 0 -#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ -#define HI 0 -#define LO 1 +#ifndef USE_DUFFS_LOOP +# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) +# define HI 1 +# define LO 0 +# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ +# define HI 0 +# define LO 1 +# endif #endif static void Blit1to2(SDL_BlitInfo * info) @@ -99,14 +101,14 @@ Blit1to2(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - *(Uint16 *)dst = map[*src++]; - dst += 2; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + *(Uint16 *)dst = map[*src++]; + dst += 2; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -206,18 +208,18 @@ Blit1to3(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - o = *src * 4; - dst[0] = map[o++]; - dst[1] = map[o++]; - dst[2] = map[o++]; - } - src++; - dst += 3; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + o = *src * 4; + dst[0] = map[o++]; + dst[1] = map[o++]; + dst[2] = map[o++]; + } + src++; + dst += 3; + , width); + /* *INDENT-ON* */ #else for (c = width; c; --c) { o = *src * 4; @@ -255,11 +257,11 @@ Blit1to4(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - *dst++ = map[*src++]; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + *dst++ = map[*src++]; + , width); + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { *dst++ = map[*src++]; @@ -295,33 +297,33 @@ Blit1to1Key(SDL_BlitInfo * info) if (palmap) { while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - *dst = palmap[*src]; - } - dst++; - src++; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + *dst = palmap[*src]; + } + dst++; + src++; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - *dst = *src; - } - dst++; - src++; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + *dst = *src; + } + dst++; + src++; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -344,17 +346,17 @@ Blit1to2Key(SDL_BlitInfo * info) dstskip /= 2; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - *dstp=palmap[*src]; - } - src++; - dstp++; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + *dstp=palmap[*src]; + } + src++; + dstp++; + }, + width); + /* *INDENT-ON* */ src += srcskip; dstp += dstskip; } @@ -374,20 +376,20 @@ Blit1to3Key(SDL_BlitInfo * info) int o; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - o = *src * 4; - dst[0] = palmap[o++]; - dst[1] = palmap[o++]; - dst[2] = palmap[o++]; - } - src++; - dst += 3; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + o = *src * 4; + dst[0] = palmap[o++]; + dst[1] = palmap[o++]; + dst[2] = palmap[o++]; + } + src++; + dst += 3; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -409,17 +411,17 @@ Blit1to4Key(SDL_BlitInfo * info) dstskip /= 4; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - *dstp = palmap[*src]; - } - src++; - dstp++; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + *dstp = palmap[*src]; + } + src++; + dstp++; + }, + width); + /* *INDENT-ON* */ src += srcskip; dstp += dstskip; } @@ -487,22 +489,22 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( *src != ckey ) { - sR = srcpal[*src].r; - sG = srcpal[*src].g; - sB = srcpal[*src].b; - DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA); - ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); - } - src++; - dst += dstbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( *src != ckey ) { + sR = srcpal[*src].r; + sG = srcpal[*src].g; + sB = srcpal[*src].b; + DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA); + ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); + } + src++; + dst += dstbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_A.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_A.c similarity index 56% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_A.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_A.c index 0190ffddda..3507932941 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_A.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,28 +45,28 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info) const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4( - { - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); - dR = dstfmt->palette->colors[*dst].r; - dG = dstfmt->palette->colors[*dst].g; - dB = dstfmt->palette->colors[*dst].b; - ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB); - dR &= 0xff; - dG &= 0xff; - dB &= 0xff; - /* Pack RGB into 8bit pixel */ - if ( palmap == NULL ) { - *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)); - } else { - *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))]; - } - dst++; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4( + { + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); + dR = dstfmt->palette->colors[*dst].r; + dG = dstfmt->palette->colors[*dst].g; + dB = dstfmt->palette->colors[*dst].b; + ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB); + dR &= 0xff; + dG &= 0xff; + dB &= 0xff; + /* Pack RGB into 8bit pixel */ + if ( palmap == NULL ) { + *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)); + } else { + *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))]; + } + dst++; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -91,28 +91,28 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info) unsigned dR, dG, dB; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4( - { - DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA); - dR = dstfmt->palette->colors[*dst].r; - dG = dstfmt->palette->colors[*dst].g; - dB = dstfmt->palette->colors[*dst].b; - ALPHA_BLEND_RGB(sR, sG, sB, sA, dR, dG, dB); - dR &= 0xff; - dG &= 0xff; - dB &= 0xff; - /* Pack RGB into 8bit pixel */ - if ( palmap == NULL ) { - *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)); - } else { - *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))]; - } - dst++; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4( + { + DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA); + dR = dstfmt->palette->colors[*dst].r; + dG = dstfmt->palette->colors[*dst].g; + dB = dstfmt->palette->colors[*dst].b; + ALPHA_BLEND_RGB(sR, sG, sB, sA, dR, dG, dB); + dR &= 0xff; + dG &= 0xff; + dB &= 0xff; + /* Pack RGB into 8bit pixel */ + if ( palmap == NULL ) { + *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)); + } else { + *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))]; + } + dst++; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -139,30 +139,30 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info) const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); - if ( Pixel != ckey ) { - dR = dstfmt->palette->colors[*dst].r; - dG = dstfmt->palette->colors[*dst].g; - dB = dstfmt->palette->colors[*dst].b; - ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB); - dR &= 0xff; - dG &= 0xff; - dB &= 0xff; - /* Pack RGB into 8bit pixel */ - if ( palmap == NULL ) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); + if ( Pixel != ckey ) { + dR = dstfmt->palette->colors[*dst].r; + dG = dstfmt->palette->colors[*dst].g; + dB = dstfmt->palette->colors[*dst].b; + ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB); + dR &= 0xff; + dG &= 0xff; + dB &= 0xff; + /* Pack RGB into 8bit pixel */ + if ( palmap == NULL ) { *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0)); - } else { + } else { *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))]; - } - } - dst++; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + } + } + dst++; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -342,45 +342,45 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) mm_zero = _mm_setzero_si64(); /* 0 -> mm_zero */ multmask = 0x00FF; - multmask <<= (ashift * 2); - multmask2 = 0x00FF00FF00FF00FFULL; + multmask <<= (ashift * 2); + multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 alpha = *srcp & amask; - if (alpha == 0) { - /* do nothing */ - } else if (alpha == amask) { - *dstp = *srcp; - } else { - src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */ - src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */ - - dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */ - dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */ - - mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */ - mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */ - mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */ - mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */ - mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */ - mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */ - - /* blend */ - src1 = _mm_mullo_pi16(src1, mm_alpha); - src1 = _mm_srli_pi16(src1, 8); - dst1 = _mm_mullo_pi16(dst1, mm_alpha2); - dst1 = _mm_srli_pi16(dst1, 8); - dst1 = _mm_add_pi16(src1, dst1); - dst1 = _mm_packs_pu16(dst1, mm_zero); - - *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */ - } - ++srcp; - ++dstp; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 alpha = *srcp & amask; + if (alpha == 0) { + /* do nothing */ + } else if (alpha == amask) { + *dstp = *srcp; + } else { + src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */ + src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */ + + dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */ + dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */ + + mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */ + mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */ + mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */ + mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */ + mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */ + mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */ + + /* blend */ + src1 = _mm_mullo_pi16(src1, mm_alpha); + src1 = _mm_srli_pi16(src1, 8); + dst1 = _mm_mullo_pi16(dst1, mm_alpha2); + dst1 = _mm_srli_pi16(dst1, 8); + dst1 = _mm_add_pi16(src1, dst1); + dst1 = _mm_packs_pu16(dst1, mm_zero); + + *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */ + } + ++srcp; + ++dstp; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -401,14 +401,14 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 s = *srcp++; - Uint32 d = *dstp; - *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) - + (s & d & 0x00010101)) | 0xff000000; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 s = *srcp++; + Uint32 d = *dstp; + *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) + + (s & d & 0x00010101)) | 0xff000000; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -434,22 +434,22 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) Uint32 d1; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - s = *srcp; - d = *dstp; - s1 = s & 0xff00ff; - d1 = d & 0xff00ff; - d1 = (d1 + ((s1 - d1) * alpha >> 8)) - & 0xff00ff; - s &= 0xff00; - d &= 0xff00; - d = (d + ((s - d) * alpha >> 8)) & 0xff00; - *dstp = d1 | d | 0xff000000; - ++srcp; - ++dstp; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + s = *srcp; + d = *dstp; + s1 = s & 0xff00ff; + d1 = d & 0xff00ff; + d1 = (d1 + ((s1 - d1) * alpha >> 8)) + & 0xff00ff; + s &= 0xff00; + d &= 0xff00; + d = (d + ((s - d) * alpha >> 8)) & 0xff00; + *dstp = d1 | d | 0xff000000; + ++srcp; + ++dstp; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -468,42 +468,42 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 dalpha; - Uint32 d; - Uint32 s1; - Uint32 d1; - Uint32 s = *srcp; - Uint32 alpha = s >> 24; - /* FIXME: Here we special-case opaque alpha since the - compositioning used (>>8 instead of /255) doesn't handle - it correctly. Also special-case alpha=0 for speed? - Benchmark this! */ - if (alpha) { - if (alpha == SDL_ALPHA_OPAQUE) { - *dstp = *srcp; - } else { - /* - * take out the middle component (green), and process - * the other two in parallel. One multiply less. - */ - d = *dstp; - dalpha = d >> 24; - s1 = s & 0xff00ff; - d1 = d & 0xff00ff; - d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; - s &= 0xff00; - d &= 0xff00; - d = (d + ((s - d) * alpha >> 8)) & 0xff00; - dalpha = alpha + (dalpha * (alpha ^ 0xFF) >> 8); - *dstp = d1 | d | (dalpha << 24); - } - } - ++srcp; - ++dstp; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 dalpha; + Uint32 d; + Uint32 s1; + Uint32 d1; + Uint32 s = *srcp; + Uint32 alpha = s >> 24; + /* FIXME: Here we special-case opaque alpha since the + compositioning used (>>8 instead of /255) doesn't handle + it correctly. Also special-case alpha=0 for speed? + Benchmark this! */ + if (alpha) { + if (alpha == SDL_ALPHA_OPAQUE) { + *dstp = *srcp; + } else { + /* + * take out the middle component (green), and process + * the other two in parallel. One multiply less. + */ + d = *dstp; + dalpha = d >> 24; + s1 = s & 0xff00ff; + d1 = d & 0xff00ff; + d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; + s &= 0xff00; + d &= 0xff00; + d = (d + ((s - d) * alpha >> 8)) & 0xff00; + dalpha = alpha + (dalpha * (alpha ^ 0xFF) >> 8); + *dstp = d1 | d | (dalpha << 24); + } + } + ++srcp; + ++dstp; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -533,47 +533,47 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 alpha; - - _m_prefetch(srcp + 16); - _m_prefetch(dstp + 16); - - alpha = *srcp & amask; - if (alpha == 0) { - /* do nothing */ - } else if (alpha == amask) { - *dstp = *srcp; - } else { - src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */ - src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */ - - dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */ - dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */ - - mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */ - mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */ - mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */ - mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */ - mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */ - mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */ - - - /* blend */ - src1 = _mm_mullo_pi16(src1, mm_alpha); - src1 = _mm_srli_pi16(src1, 8); - dst1 = _mm_mullo_pi16(dst1, mm_alpha2); - dst1 = _mm_srli_pi16(dst1, 8); - dst1 = _mm_add_pi16(src1, dst1); - dst1 = _mm_packs_pu16(dst1, mm_zero); - - *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */ - } - ++srcp; - ++dstp; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 alpha; + + _m_prefetch(srcp + 16); + _m_prefetch(dstp + 16); + + alpha = *srcp & amask; + if (alpha == 0) { + /* do nothing */ + } else if (alpha == amask) { + *dstp = *srcp; + } else { + src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */ + src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */ + + dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */ + dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */ + + mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */ + mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */ + mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */ + mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */ + mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask); /* 0F0A0A0A -> mm_alpha */ + mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2); /* 255 - mm_alpha -> mm_alpha */ + + + /* blend */ + src1 = _mm_mullo_pi16(src1, mm_alpha); + src1 = _mm_srli_pi16(src1, 8); + dst1 = _mm_mullo_pi16(dst1, mm_alpha2); + dst1 = _mm_srli_pi16(dst1, 8); + dst1 = _mm_add_pi16(src1, dst1); + dst1 = _mm_packs_pu16(dst1, mm_zero); + + *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */ + } + ++srcp; + ++dstp; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -585,13 +585,13 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) /* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */ /* blend a single 16 bit pixel at 50% */ -#define BLEND16_50(d, s, mask) \ - ((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff))) +#define BLEND16_50(d, s, mask) \ + ((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff))) /* blend two 16 bit pixels at 50% */ -#define BLEND2x16_50(d, s, mask) \ - (((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \ - + (s & d & (~(mask | mask << 16)))) +#define BLEND2x16_50(d, s, mask) \ + (((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \ + + (s & d & (~(mask | mask << 16)))) static void Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask) @@ -727,103 +727,103 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP_124( - { - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x07e0f81f; - d = (d | d << 16) & 0x07e0f81f; - d += (s - d) * alpha >> 5; - d &= 0x07e0f81f; - *dstp++ = (Uint16)(d | d >> 16); - },{ - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x07e0f81f; - d = (d | d << 16) & 0x07e0f81f; - d += (s - d) * alpha >> 5; - d &= 0x07e0f81f; - *dstp++ = (Uint16)(d | d >> 16); - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x07e0f81f; - d = (d | d << 16) & 0x07e0f81f; - d += (s - d) * alpha >> 5; - d &= 0x07e0f81f; - *dstp++ = (Uint16)(d | d >> 16); - },{ - src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */ - dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */ - - /* red */ - src2 = src1; - src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 [000r 000r 000r 000r] */ - - dst2 = dst1; - dst2 = _mm_srli_pi16(dst2, 11); /* dst2 >> 11 -> dst2 [000r 000r 000r 000r] */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - dst2 = _mm_slli_pi16(dst2, 11); /* dst2 << 11 -> dst2 */ - - mm_res = dst2; /* RED -> mm_res */ - - /* green -- process the bits in place */ - src2 = src1; - src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */ - - dst2 = dst1; - dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - - mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */ - - /* blue */ - src2 = src1; - src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */ - - dst2 = dst1; - dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */ - - mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */ - - *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */ - - srcp += 4; - dstp += 4; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP_124( + { + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x07e0f81f; + d = (d | d << 16) & 0x07e0f81f; + d += (s - d) * alpha >> 5; + d &= 0x07e0f81f; + *dstp++ = (Uint16)(d | d >> 16); + },{ + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x07e0f81f; + d = (d | d << 16) & 0x07e0f81f; + d += (s - d) * alpha >> 5; + d &= 0x07e0f81f; + *dstp++ = (Uint16)(d | d >> 16); + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x07e0f81f; + d = (d | d << 16) & 0x07e0f81f; + d += (s - d) * alpha >> 5; + d &= 0x07e0f81f; + *dstp++ = (Uint16)(d | d >> 16); + },{ + src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */ + dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */ + + /* red */ + src2 = src1; + src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 [000r 000r 000r 000r] */ + + dst2 = dst1; + dst2 = _mm_srli_pi16(dst2, 11); /* dst2 >> 11 -> dst2 [000r 000r 000r 000r] */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + dst2 = _mm_slli_pi16(dst2, 11); /* dst2 << 11 -> dst2 */ + + mm_res = dst2; /* RED -> mm_res */ + + /* green -- process the bits in place */ + src2 = src1; + src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */ + + dst2 = dst1; + dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + + mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */ + + /* blue */ + src2 = src1; + src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */ + + dst2 = dst1; + dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */ + + mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */ + + *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */ + + srcp += 4; + dstp += 4; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -865,103 +865,103 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP_124( - { - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x03e07c1f; - d = (d | d << 16) & 0x03e07c1f; - d += (s - d) * alpha >> 5; - d &= 0x03e07c1f; - *dstp++ = (Uint16)(d | d >> 16); - },{ - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x03e07c1f; - d = (d | d << 16) & 0x03e07c1f; - d += (s - d) * alpha >> 5; - d &= 0x03e07c1f; - *dstp++ = (Uint16)(d | d >> 16); - s = *srcp++; - d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x03e07c1f; - d = (d | d << 16) & 0x03e07c1f; - d += (s - d) * alpha >> 5; - d &= 0x03e07c1f; - *dstp++ = (Uint16)(d | d >> 16); - },{ - src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */ - dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */ - - /* red -- process the bits in place */ - src2 = src1; - src2 = _mm_and_si64(src2, rmask); /* src & MASKRED -> src2 */ - - dst2 = dst1; - dst2 = _mm_and_si64(dst2, rmask); /* dst & MASKRED -> dst2 */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - dst2 = _mm_and_si64(dst2, rmask); /* dst2 & MASKRED -> dst2 */ - - mm_res = dst2; /* RED -> mm_res */ - - /* green -- process the bits in place */ - src2 = src1; - src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */ - - dst2 = dst1; - dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - - mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */ - - /* blue */ - src2 = src1; /* src -> src2 */ - src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */ - - dst2 = dst1; /* dst -> dst2 */ - dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */ - - /* blend */ - src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ - src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ - src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ - dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ - dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */ - - mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */ - - *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */ - - srcp += 4; - dstp += 4; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP_124( + { + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x03e07c1f; + d = (d | d << 16) & 0x03e07c1f; + d += (s - d) * alpha >> 5; + d &= 0x03e07c1f; + *dstp++ = (Uint16)(d | d >> 16); + },{ + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x03e07c1f; + d = (d | d << 16) & 0x03e07c1f; + d += (s - d) * alpha >> 5; + d &= 0x03e07c1f; + *dstp++ = (Uint16)(d | d >> 16); + s = *srcp++; + d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x03e07c1f; + d = (d | d << 16) & 0x03e07c1f; + d += (s - d) * alpha >> 5; + d &= 0x03e07c1f; + *dstp++ = (Uint16)(d | d >> 16); + },{ + src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */ + dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */ + + /* red -- process the bits in place */ + src2 = src1; + src2 = _mm_and_si64(src2, rmask); /* src & MASKRED -> src2 */ + + dst2 = dst1; + dst2 = _mm_and_si64(dst2, rmask); /* dst & MASKRED -> dst2 */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + dst2 = _mm_and_si64(dst2, rmask); /* dst2 & MASKRED -> dst2 */ + + mm_res = dst2; /* RED -> mm_res */ + + /* green -- process the bits in place */ + src2 = src1; + src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */ + + dst2 = dst1; + dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + + mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */ + + /* blue */ + src2 = src1; /* src -> src2 */ + src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */ + + dst2 = dst1; /* dst -> dst2 */ + dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */ + + /* blend */ + src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */ + src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */ + src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */ + dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */ + dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */ + + mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */ + + *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */ + + srcp += 4; + dstp += 4; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -988,22 +988,22 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info) alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 s = *srcp++; - Uint32 d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x07e0f81f; - d = (d | d << 16) & 0x07e0f81f; - d += (s - d) * alpha >> 5; - d &= 0x07e0f81f; - *dstp++ = (Uint16)(d | d >> 16); - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 s = *srcp++; + Uint32 d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x07e0f81f; + d = (d | d << 16) & 0x07e0f81f; + d += (s - d) * alpha >> 5; + d &= 0x07e0f81f; + *dstp++ = (Uint16)(d | d >> 16); + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1027,22 +1027,22 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info) alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 s = *srcp++; - Uint32 d = *dstp; - /* - * shift out the middle component (green) to - * the high 16 bits, and process all three RGB - * components at the same time. - */ - s = (s | s << 16) & 0x03e07c1f; - d = (d | d << 16) & 0x03e07c1f; - d += (s - d) * alpha >> 5; - d &= 0x03e07c1f; - *dstp++ = (Uint16)(d | d >> 16); - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 s = *srcp++; + Uint32 d = *dstp; + /* + * shift out the middle component (green) to + * the high 16 bits, and process all three RGB + * components at the same time. + */ + s = (s | s << 16) & 0x03e07c1f; + d = (d | d << 16) & 0x03e07c1f; + d += (s - d) * alpha >> 5; + d &= 0x03e07c1f; + *dstp++ = (Uint16)(d | d >> 16); + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1061,35 +1061,35 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - Uint32 s = *srcp; - unsigned alpha = s >> 27; /* downscale alpha to 5 bits */ - /* FIXME: Here we special-case opaque alpha since the - compositioning used (>>8 instead of /255) doesn't handle - it correctly. Also special-case alpha=0 for speed? - Benchmark this! */ - if(alpha) { - if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { - *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f)); - } else { - Uint32 d = *dstp; - /* - * convert source and destination to G0RAB65565 - * and blend all components at the same time - */ - s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800) - + (s >> 3 & 0x1f); - d = (d | d << 16) & 0x07e0f81f; - d += (s - d) * alpha >> 5; - d &= 0x07e0f81f; - *dstp = (Uint16)(d | d >> 16); - } - } - srcp++; - dstp++; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + Uint32 s = *srcp; + unsigned alpha = s >> 27; /* downscale alpha to 5 bits */ + /* FIXME: Here we special-case opaque alpha since the + compositioning used (>>8 instead of /255) doesn't handle + it correctly. Also special-case alpha=0 for speed? + Benchmark this! */ + if(alpha) { + if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { + *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3 & 0x1f)); + } else { + Uint32 d = *dstp; + /* + * convert source and destination to G0RAB65565 + * and blend all components at the same time + */ + s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800) + + (s >> 3 & 0x1f); + d = (d | d << 16) & 0x07e0f81f; + d += (s - d) * alpha >> 5; + d &= 0x07e0f81f; + *dstp = (Uint16)(d | d >> 16); + } + } + srcp++; + dstp++; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1107,36 +1107,36 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4({ - unsigned alpha; - Uint32 s = *srcp; - alpha = s >> 27; /* downscale alpha to 5 bits */ - /* FIXME: Here we special-case opaque alpha since the - compositioning used (>>8 instead of /255) doesn't handle - it correctly. Also special-case alpha=0 for speed? - Benchmark this! */ - if(alpha) { - if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { - *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f)); - } else { - Uint32 d = *dstp; - /* - * convert source and destination to G0RAB65565 - * and blend all components at the same time - */ - s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00) - + (s >> 3 & 0x1f); - d = (d | d << 16) & 0x03e07c1f; - d += (s - d) * alpha >> 5; - d &= 0x03e07c1f; - *dstp = (Uint16)(d | d >> 16); - } - } - srcp++; - dstp++; - }, width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4({ + unsigned alpha; + Uint32 s = *srcp; + alpha = s >> 27; /* downscale alpha to 5 bits */ + /* FIXME: Here we special-case opaque alpha since the + compositioning used (>>8 instead of /255) doesn't handle + it correctly. Also special-case alpha=0 for speed? + Benchmark this! */ + if(alpha) { + if(alpha == (SDL_ALPHA_OPAQUE >> 3)) { + *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3 & 0x1f)); + } else { + Uint32 d = *dstp; + /* + * convert source and destination to G0RAB65565 + * and blend all components at the same time + */ + s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00) + + (s >> 3 & 0x1f); + d = (d | d << 16) & 0x03e07c1f; + d += (s - d) * alpha >> 5; + d &= 0x03e07c1f; + *dstp = (Uint16)(d | d >> 16); + } + } + srcp++; + dstp++; + }, width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1163,18 +1163,18 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info) if (sA) { while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4( - { - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); - DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); - ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); - src += srcbpp; - dst += dstbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4( + { + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); + DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); + ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); + src += srcbpp; + dst += dstbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1202,21 +1202,21 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info) const unsigned sA = info->a; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4( - { - RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); - if(sA && Pixel != ckey) { - RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); - DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); - ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); - } - src += srcbpp; - dst += dstbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4( + { + RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); + if(sA && Pixel != ckey) { + RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); + DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); + ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); + } + src += srcbpp; + dst += dstbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1245,20 +1245,20 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP4( - { - DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); - if(sA) { - DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); - ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); - } - src += srcbpp; - dst += dstbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP4( + { + DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); + if(sA) { + DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA); + ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA); + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); + } + src += srcbpp; + dst += dstbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1317,9 +1317,9 @@ SDL_CalculateBlitA(SDL_Surface * surface) case 3: default: - return BlitNtoNPixelAlpha; + break; } - break; + return BlitNtoNPixelAlpha; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: if (sf->Amask == 0) { diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_N.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_N.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_N.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_N.c index 94894a78ca..d6ec417fe2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_N.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,12 +118,6 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 16, 8, 0, 24, 0, NULL }; - if (!srcfmt) { - srcfmt = &default_pixel_format; - } - if (!dstfmt) { - dstfmt = &default_pixel_format; - } const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, @@ -131,11 +125,20 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0x0C); vector unsigned char vswiz; vector unsigned int srcvec; + Uint32 rmask, gmask, bmask, amask; + + if (!srcfmt) { + srcfmt = &default_pixel_format; + } + if (!dstfmt) { + dstfmt = &default_pixel_format; + } + #define RESHIFT(X) (3 - ((X) >> 3)) - Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); - Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); - Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); - Uint32 amask; + rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); + gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); + bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); + /* Use zero for alpha if either surface doesn't have alpha */ if (dstfmt->Amask) { amask = @@ -147,6 +150,7 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0xFFFFFFFF); } #undef RESHIFT + ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask); vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0)); return (vswiz); @@ -1109,6 +1113,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((*src)&0x0000F800)>>6)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB555_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ (((src[HI])&0x0000F800)>>6)| \ @@ -1117,6 +1122,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((src[LO])&0x0000F800)>>6)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB555(SDL_BlitInfo * info) { @@ -1233,6 +1239,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((*src)&0x0000FC00)>>5)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB565_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ (((src[HI])&0x0000FC00)>>5)| \ @@ -1241,6 +1248,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((src[LO])&0x0000FC00)>>5)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB565(SDL_BlitInfo * info) { @@ -2325,6 +2333,31 @@ BlitNtoNKey(SDL_BlitInfo * info) /* Set up some basic variables */ ckey &= rgbmask; + /* Fastpath: same source/destination format, no Amask, bpp 32, loop is vectorized. ~10x faster */ + if (srcfmt->format == dstfmt->format && + (srcfmt->format == SDL_PIXELFORMAT_RGB888 || srcfmt->format == SDL_PIXELFORMAT_BGR888)) { + Uint32 *src32 = (Uint32*)src; + Uint32 *dst32 = (Uint32*)dst; + srcskip /= sizeof(Uint32); + dstskip /= sizeof(Uint32); + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if (*src32 != ckey) { + *dst32 = *src32; + } + ++src32; + ++dst32; + }, + width); + /* *INDENT-ON* */ + src32 += srcskip; + dst32 += dstskip; + } + return; + } + while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP( @@ -2372,6 +2405,34 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; ckey &= rgbmask; + /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */ + if (srcfmt->format == dstfmt->format && + (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 || + srcfmt->format == SDL_PIXELFORMAT_ABGR8888 || + srcfmt->format == SDL_PIXELFORMAT_BGRA8888 || + srcfmt->format == SDL_PIXELFORMAT_RGBA8888)) { + Uint32 *src32 = (Uint32*)src; + Uint32 *dst32 = (Uint32*)dst; + srcskip /= sizeof(Uint32); + dstskip /= sizeof(Uint32); + while (height--) { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ((*src32 & rgbmask) != ckey) { + *dst32 = *src32; + } + ++src32; + ++dst32; + }, + width); + /* *INDENT-ON* */ + src32 += srcskip; + dst32 += dstskip; + } + return; + } + while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP( @@ -2455,6 +2516,9 @@ BlitNto2101010(SDL_BlitInfo * info) } /* Normal N to N optimized blitters */ +#define NO_ALPHA 1 +#define SET_ALPHA 2 +#define COPY_ALPHA 4 struct blit_table { Uint32 srcR, srcG, srcB; @@ -2462,8 +2526,7 @@ struct blit_table Uint32 dstR, dstG, dstB; Uint32 blit_features; SDL_BlitFunc blitfunc; - enum - { NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha; + Uint32 alpha; /* bitwise NO_ALPHA, SET_ALPHA, COPY_ALPHA */ }; static const struct blit_table normal_blit_1[] = { /* Default for 8-bit RGB source, never optimized */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.c index f122819133..d9d266f9be 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.h b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.h index 58a532db04..41a6a32088 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.c index 7b9a91ffdf..e86289845f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -109,10 +109,20 @@ SDL_BlitCopy(SDL_BlitInfo * info) overlap = (src < (dst + h*dstskip)); } if (overlap) { - while (h--) { - SDL_memmove(dst, src, w); - src += srcskip; - dst += dstskip; + if ( dst < src ) { + while ( h-- ) { + SDL_memmove(dst, src, w); + src += srcskip; + dst += dstskip; + } + } else { + src += ((h-1) * srcskip); + dst += ((h-1) * dstskip); + while ( h-- ) { + SDL_memmove(dst, src, w); + src -= srcskip; + dst -= dstskip; + } } return; } diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.h b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.h index 060026d8a7..d569ae00ca 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,11 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_blit_copy_h_ +#define SDL_blit_copy_h_ + void SDL_BlitCopy(SDL_BlitInfo * info); +#endif /* SDL_blit_copy_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.c b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.c index 3a462f6e27..20ca8ab81a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,8 @@ SDL_Blit_Slow(SDL_BlitInfo * info) SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; int dstbpp = dst_fmt->BytesPerPixel; + Uint32 rgbmask = ~src_fmt->Amask; + Uint32 ckey = info->colorkey & rgbmask; srcy = 0; posy = 0; @@ -85,7 +87,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info) srcpixel = (srcR << src_fmt->Rshift) | (srcG << src_fmt->Gshift) | (srcB << src_fmt->Bshift); } - if (srcpixel == info->colorkey) { + if ((srcpixel & rgbmask) == ckey) { posx += incx; dst += dstbpp; continue; @@ -127,6 +129,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info) dstR = srcR + ((255 - srcA) * dstR) / 255; dstG = srcG + ((255 - srcA) * dstG) / 255; dstB = srcB + ((255 - srcA) * dstB) / 255; + dstA = srcA + ((255 - srcA) * dstA) / 255; break; case SDL_COPY_ADD: dstR = srcR + dstR; diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.h b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.h index 75005fc531..d27fcd275f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,14 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_blit_slow_h_ +#define SDL_blit_slow_h_ + #include "../SDL_internal.h" extern void SDL_Blit_Slow(SDL_BlitInfo * info); +#endif /* SDL_blit_slow_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_bmp.c b/3rdparty/sdl2-2.0.9/src/video/SDL_bmp.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_bmp.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_bmp.c index f80f936962..ba908a659c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_bmp.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,7 @@ This code currently supports Win32 DIBs in uncompressed 8 and 24 bpp. */ +#include "SDL_hints.h" #include "SDL_video.h" #include "SDL_assert.h" #include "SDL_endian.h" @@ -47,6 +48,11 @@ #define BI_BITFIELDS 3 #endif +/* Logical color space values for BMP files */ +#ifndef LCS_WINDOWS_COLOR_SPACE +/* 0x57696E20 == "Win " */ +#define LCS_WINDOWS_COLOR_SPACE 0x57696E20 +#endif static void CorrectAlphaChannel(SDL_Surface *surface) { @@ -118,6 +124,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) Uint32 biClrUsed = 0; /* Uint32 biClrImportant = 0; */ + (void) haveRGBMasks; + (void) haveAlphaMask; + /* Make sure we are passed a valid data source */ surface = NULL; was_error = SDL_FALSE; @@ -457,6 +466,8 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) int i, pad; SDL_Surface *surface; Uint8 *bits; + SDL_bool save32bit = SDL_FALSE; + SDL_bool saveLegacyBMP = SDL_FALSE; /* The Win32 BMP file header (14 bytes) */ char magic[2] = { 'B', 'M' }; @@ -478,14 +489,24 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) Uint32 biClrUsed; Uint32 biClrImportant; + /* The additional header members from the Win32 BITMAPV4HEADER struct (108 bytes in total) */ + Uint32 bV4RedMask = 0; + Uint32 bV4GreenMask = 0; + Uint32 bV4BlueMask = 0; + Uint32 bV4AlphaMask = 0; + Uint32 bV4CSType = 0; + Sint32 bV4Endpoints[3 * 3] = {0}; + Uint32 bV4GammaRed = 0; + Uint32 bV4GammaGreen = 0; + Uint32 bV4GammaBlue = 0; + /* Make sure we have somewhere to save */ surface = NULL; if (dst) { - SDL_bool save32bit = SDL_FALSE; #ifdef SAVE_32BIT_BMP /* We can save alpha information in a 32-bit BMP */ - if (saveme->map->info.flags & SDL_COPY_COLORKEY || - saveme->format->Amask) { + if (saveme->format->BitsPerPixel >= 8 && (saveme->format->Amask || + saveme->map->info.flags & SDL_COPY_COLORKEY)) { save32bit = SDL_TRUE; } #endif /* SAVE_32BIT_BMP */ @@ -497,7 +518,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) SDL_SetError("%d bpp BMP files not supported", saveme->format->BitsPerPixel); } - } else if ((saveme->format->BitsPerPixel == 24) && + } else if ((saveme->format->BitsPerPixel == 24) && !save32bit && #if SDL_BYTEORDER == SDL_LIL_ENDIAN (saveme->format->Rmask == 0x00FF0000) && (saveme->format->Gmask == 0x0000FF00) && @@ -515,13 +536,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) /* If the surface has a colorkey or alpha channel we'll save a 32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */ if (save32bit) { - SDL_InitFormat(&format, -#if SDL_BYTEORDER == SDL_LIL_ENDIAN - SDL_PIXELFORMAT_ARGB8888 -#else - SDL_PIXELFORMAT_BGRA8888 -#endif - ); + SDL_InitFormat(&format, SDL_PIXELFORMAT_BGRA32); } else { SDL_InitFormat(&format, SDL_PIXELFORMAT_BGR24); } @@ -537,6 +552,10 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) return -1; } + if (save32bit) { + saveLegacyBMP = SDL_GetHintBoolean(SDL_HINT_BMP_SAVE_LEGACY_FORMAT, SDL_FALSE); + } + if (surface && (SDL_LockSurface(surface) == 0)) { const int bw = surface->w * surface->format->BytesPerPixel; @@ -572,6 +591,21 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) } biClrImportant = 0; + /* Set the BMP info values for the version 4 header */ + if (save32bit && !saveLegacyBMP) { + biSize = 108; + biCompression = BI_BITFIELDS; + /* The BMP format is always little endian, these masks stay the same */ + bV4RedMask = 0x00ff0000; + bV4GreenMask = 0x0000ff00; + bV4BlueMask = 0x000000ff; + bV4AlphaMask = 0xff000000; + bV4CSType = LCS_WINDOWS_COLOR_SPACE; + bV4GammaRed = 0; + bV4GammaGreen = 0; + bV4GammaBlue = 0; + } + /* Write the BMP info values */ SDL_WriteLE32(dst, biSize); SDL_WriteLE32(dst, biWidth); @@ -585,6 +619,21 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) SDL_WriteLE32(dst, biClrUsed); SDL_WriteLE32(dst, biClrImportant); + /* Write the BMP info values for the version 4 header */ + if (save32bit && !saveLegacyBMP) { + SDL_WriteLE32(dst, bV4RedMask); + SDL_WriteLE32(dst, bV4GreenMask); + SDL_WriteLE32(dst, bV4BlueMask); + SDL_WriteLE32(dst, bV4AlphaMask); + SDL_WriteLE32(dst, bV4CSType); + for (i = 0; i < 3 * 3; i++) { + SDL_WriteLE32(dst, bV4Endpoints[i]); + } + SDL_WriteLE32(dst, bV4GammaRed); + SDL_WriteLE32(dst, bV4GammaGreen); + SDL_WriteLE32(dst, bV4GammaBlue); + } + /* Write the palette (in BGR color order) */ if (surface->format->palette) { SDL_Color *colors; diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_clipboard.c b/3rdparty/sdl2-2.0.9/src/video/SDL_clipboard.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_clipboard.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_clipboard.c index 91d1eeea04..0dd6a05b9e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_clipboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_egl.c b/3rdparty/sdl2-2.0.9/src/video/SDL_egl.c similarity index 56% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_egl.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_egl.c index bfd4affb9c..78abc030ef 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_egl.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2016 Sam Lantinga + * Copyright (C) 1997-2018 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,12 @@ #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT #include "../core/windows/SDL_windows.h" #endif +#if SDL_VIDEO_DRIVER_ANDROID +#include +#endif #include "SDL_sysvideo.h" +#include "SDL_log.h" #include "SDL_egl_c.h" #include "SDL_loadso.h" #include "SDL_hints.h" @@ -40,10 +44,12 @@ #if SDL_VIDEO_DRIVER_RPI /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ -#define DEFAULT_EGL "/opt/vc/lib/libEGL.so" -#define DEFAULT_OGL_ES2 "/opt/vc/lib/libGLESv2.so" -#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so" -#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so" +#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" ) +#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" ) +#define ALT_EGL "libEGL.so" +#define ALT_OGL_ES2 "libGLESv2.so" +#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" ) +#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" ) #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE /* Android */ @@ -59,6 +65,13 @@ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" +#elif SDL_VIDEO_DRIVER_COCOA +/* EGL AND OpenGL ES support via ANGLE */ +#define DEFAULT_EGL "libEGL.dylib" +#define DEFAULT_OGL_ES2 "libGLESv2.dylib" +#define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? +#define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? + #else /* Desktop Linux */ #define DEFAULT_OGL "libGL.so.1" @@ -68,46 +81,130 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ +#ifdef SDL_VIDEO_STATIC_ANGLE +#define LOAD_FUNC(NAME) \ +_this->egl_data->NAME = (void *)NAME; +#else #define LOAD_FUNC(NAME) \ _this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ } - +#endif + +static const char * SDL_EGL_GetErrorName(EGLint eglErrorCode) +{ +#define SDL_EGL_ERROR_TRANSLATE(e) case e: return #e; + switch (eglErrorCode) { + SDL_EGL_ERROR_TRANSLATE(EGL_SUCCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_NOT_INITIALIZED); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ACCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ALLOC); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ATTRIBUTE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONTEXT); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONFIG); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CURRENT_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_DISPLAY); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_MATCH); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_PARAMETER); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_PIXMAP); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_WINDOW); + SDL_EGL_ERROR_TRANSLATE(EGL_CONTEXT_LOST); + } + return ""; +} + +int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode) +{ + const char * errorText = SDL_EGL_GetErrorName(eglErrorCode); + char altErrorText[32]; + if (errorText[0] == '\0') { + /* An unknown-to-SDL error code was reported. Report its hexadecimal value, instead of its name. */ + SDL_snprintf(altErrorText, SDL_arraysize(altErrorText), "0x%x", (unsigned int)eglErrorCode); + errorText = altErrorText; + } + return SDL_SetError("%s (call to %s failed, reporting an error of %s)", message, eglFunctionName, errorText); +} + /* EGL implementation of SDL OpenGL ES support */ -#ifdef EGL_KHR_create_context -static int SDL_EGL_HasExtension(_THIS, const char *ext) +typedef enum { + SDL_EGL_DISPLAY_EXTENSION, + SDL_EGL_CLIENT_EXTENSION +} SDL_EGL_ExtensionType; + +static SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext) { - int i; - int len = 0; size_t ext_len; - const char *exts; - const char *ext_word; + const char *ext_override; + const char *egl_extstr; + const char *ext_start; + + /* Invalid extensions can be rejected early */ + if (ext == NULL || *ext == 0 || SDL_strchr(ext, ' ') != NULL) { + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid EGL extension"); */ + return SDL_FALSE; + } + + /* Extensions can be masked with an environment variable. + * Unlike the OpenGL override, this will use the set bits of an integer + * to disable the extension. + * Bit Action + * 0 If set, the display extension is masked and not present to SDL. + * 1 If set, the client extension is masked and not present to SDL. + */ + ext_override = SDL_getenv(ext); + if (ext_override != NULL) { + int disable_ext = SDL_atoi(ext_override); + if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { + return SDL_FALSE; + } else if (disable_ext & 0x02 && type == SDL_EGL_CLIENT_EXTENSION) { + return SDL_FALSE; + } + } ext_len = SDL_strlen(ext); - exts = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + switch (type) { + case SDL_EGL_DISPLAY_EXTENSION: + egl_extstr = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + break; + case SDL_EGL_CLIENT_EXTENSION: + /* EGL_EXT_client_extensions modifies eglQueryString to return client extensions + * if EGL_NO_DISPLAY is passed. Implementations without it are required to return NULL. + * This behavior is included in EGL 1.5. + */ + egl_extstr = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + break; + default: + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid extension type"); */ + return SDL_FALSE; + } - if (exts) { - ext_word = exts; + if (egl_extstr != NULL) { + ext_start = egl_extstr; - for (i = 0; exts[i] != 0; i++) { - if (exts[i] == ' ') { - if (ext_len == len && !SDL_strncmp(ext_word, ext, len)) { - return 1; + while (*ext_start) { + ext_start = SDL_strstr(ext_start, ext); + if (ext_start == NULL) { + return SDL_FALSE; + } + /* Check if the match is not just a substring of one of the extensions */ + if (ext_start == egl_extstr || *(ext_start - 1) == ' ') { + if (ext_start[ext_len] == ' ' || ext_start[ext_len] == 0) { + return SDL_TRUE; } - - len = 0; - ext_word = &exts[i + 1]; - } else { - len++; + } + /* If the search stopped in the middle of an extension, skip to the end of it */ + ext_start += ext_len; + while (*ext_start != ' ' && *ext_start != 0) { + ext_start++; } } } - return 0; + return SDL_FALSE; } -#endif /* EGL_KHR_create_context */ void * SDL_EGL_GetProcAddress(_THIS, const char *proc) @@ -116,7 +213,7 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) void *retval; /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */ -#if !defined(SDL_VIDEO_DRIVER_ANDROID) && !defined(SDL_VIDEO_DRIVER_MIR) +#if !defined(SDL_VIDEO_DRIVER_ANDROID) if (_this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); if (retval) { @@ -158,16 +255,20 @@ SDL_EGL_UnloadLibrary(_THIS) } int -SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display) +SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform) { void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ - char *path = NULL; + const char *path = NULL; + int egl_version_major = 0, egl_version_minor = 0; #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT const char *d3dcompiler; #endif +#if SDL_VIDEO_DRIVER_RPI + SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); +#endif if (_this->egl_data) { - return SDL_SetError("OpenGL ES context already created"); + return SDL_SetError("EGL context already created"); } _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); @@ -185,10 +286,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } } if (SDL_strcasecmp(d3dcompiler, "none") != 0) { - SDL_LoadObject(d3dcompiler); + if (SDL_LoadObject(d3dcompiler) == NULL) { + SDL_ClearError(); + } } #endif +#ifndef SDL_VIDEO_STATIC_ANGLE /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path != NULL) { @@ -200,6 +304,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; egl_dll_handle = SDL_LoadObject(path); +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif + } else { path = DEFAULT_OGL_ES; egl_dll_handle = SDL_LoadObject(path); @@ -207,6 +318,12 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_OGL_ES_PVR; egl_dll_handle = SDL_LoadObject(path); } +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif } } #ifdef DEFAULT_OGL @@ -236,6 +353,14 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_EGL; } dll_handle = SDL_LoadObject(path); + +#ifdef ALT_EGL + if (dll_handle == NULL && !vc4) { + path = ALT_EGL; + dll_handle = SDL_LoadObject(path); + } +#endif + if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { if (dll_handle != NULL) { SDL_UnloadObject(dll_handle); @@ -244,6 +369,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } SDL_ClearError(); } +#endif _this->egl_data->dll_handle = dll_handle; @@ -256,6 +382,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); LOAD_FUNC(eglDestroyContext); + LOAD_FUNC(eglCreatePbufferSurface); LOAD_FUNC(eglCreateWindowSurface); LOAD_FUNC(eglDestroySurface); LOAD_FUNC(eglMakeCurrent); @@ -265,10 +392,46 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglWaitGL); LOAD_FUNC(eglBindAPI); LOAD_FUNC(eglQueryString); - + LOAD_FUNC(eglGetError); + + if (_this->egl_data->eglQueryString) { + /* EGL 1.5 allows querying for client version */ + const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION); + if (egl_version != NULL) { + if (SDL_sscanf(egl_version, "%d.%d", &egl_version_major, &egl_version_minor) != 2) { + egl_version_major = 0; + egl_version_minor = 0; + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version); + } + } + } + + _this->egl_data->egl_version_major = egl_version_major; + _this->egl_data->egl_version_minor = egl_version_minor; + + if (egl_version_major == 1 && egl_version_minor == 5) { + LOAD_FUNC(eglGetPlatformDisplay); + } + + _this->egl_data->egl_display = EGL_NO_DISPLAY; #if !defined(__WINRT__) - _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); - if (!_this->egl_data->egl_display) { + if (platform) { + if (egl_version_major == 1 && egl_version_minor == 5) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL); + } else { + if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) { + _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT"); + if (_this->egl_data->eglGetPlatformDisplayEXT) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL); + } + } + } + } + /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { + _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); + } + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { return SDL_SetError("Could not get EGL display"); } @@ -277,8 +440,6 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } #endif - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { @@ -288,16 +449,80 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa return 0; } +#ifdef DUMP_EGL_CONFIG + +#define ATTRIBUTE(_attr) { _attr, #_attr } + +typedef struct { + EGLint attribute; + char const* name; +} Attribute; + +Attribute attributes[] = { + ATTRIBUTE( EGL_BUFFER_SIZE ), + ATTRIBUTE( EGL_ALPHA_SIZE ), + ATTRIBUTE( EGL_BLUE_SIZE ), + ATTRIBUTE( EGL_GREEN_SIZE ), + ATTRIBUTE( EGL_RED_SIZE ), + ATTRIBUTE( EGL_DEPTH_SIZE ), + ATTRIBUTE( EGL_STENCIL_SIZE ), + ATTRIBUTE( EGL_CONFIG_CAVEAT ), + ATTRIBUTE( EGL_CONFIG_ID ), + ATTRIBUTE( EGL_LEVEL ), + ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ), + ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ), + ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ), + ATTRIBUTE( EGL_NATIVE_RENDERABLE ), + ATTRIBUTE( EGL_NATIVE_VISUAL_ID ), + ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ), + ATTRIBUTE( EGL_SAMPLES ), + ATTRIBUTE( EGL_SAMPLE_BUFFERS ), + ATTRIBUTE( EGL_SURFACE_TYPE ), + ATTRIBUTE( EGL_TRANSPARENT_TYPE ), + ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ), + ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ), + ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ), + ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ), + ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ), + ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ), + ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ), + ATTRIBUTE( EGL_LUMINANCE_SIZE ), + ATTRIBUTE( EGL_ALPHA_MASK_SIZE ), + ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ), + ATTRIBUTE( EGL_RENDERABLE_TYPE ), + ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ), + ATTRIBUTE( EGL_CONFORMANT ), +}; + + +static void dumpconfig(_THIS, EGLConfig config) +{ + int attr; + for (attr = 0 ; attregl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, attributes[attr].attribute, &value); + SDL_Log("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value); + } +} + +#endif /* DUMP_EGL_CONFIG */ + int SDL_EGL_ChooseConfig(_THIS) { - /* 64 seems nice. */ +/* 64 seems nice. */ EGLint attribs[64]; EGLint found_configs = 0, value; +#ifdef SDL_VIDEO_DRIVER_KMSDRM + /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */ + /* later in this function, so we simply use the first one when using the KMSDRM driver for now. */ + EGLConfig configs[1]; +#else /* 128 seems even nicer here */ EGLConfig configs[128]; +#endif int i, j, best_bitdiff = -1, bitdiff; - + if (!_this->egl_data) { /* The EGL library wasn't loaded, SDL_GetError() should have info */ return -1; @@ -340,23 +565,11 @@ SDL_EGL_ChooseConfig(_THIS) attribs[i++] = _this->gl_config.multisamplesamples; } - if (_this->gl_config.framebuffer_srgb_capable) { -#ifdef EGL_KHR_gl_colorspace - if (SDL_EGL_HasExtension(_this, "EGL_KHR_gl_colorspace")) { - attribs[i++] = EGL_GL_COLORSPACE_KHR; - attribs[i++] = EGL_GL_COLORSPACE_SRGB_KHR; - } else -#endif - { - return SDL_SetError("EGL implementation does not support sRGB system framebuffers"); - } - } - attribs[i++] = EGL_RENDERABLE_TYPE; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { #ifdef EGL_KHR_create_context if (_this->gl_config.major_version >= 3 && - SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[i++] = EGL_OPENGL_ES3_BIT_KHR; } else #endif @@ -371,6 +584,11 @@ SDL_EGL_ChooseConfig(_THIS) _this->egl_data->eglBindAPI(EGL_OPENGL_API); } + if (_this->egl_data->egl_surfacetype) { + attribs[i++] = EGL_SURFACE_TYPE; + attribs[i++] = _this->egl_data->egl_surfacetype; + } + attribs[i++] = EGL_NONE; if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display, @@ -378,7 +596,7 @@ SDL_EGL_ChooseConfig(_THIS) configs, SDL_arraysize(configs), &found_configs) == EGL_FALSE || found_configs == 0) { - return SDL_SetError("Couldn't find matching EGL config"); + return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig"); } /* eglChooseConfig returns a number of configurations that match or exceed the requested attribs. */ @@ -413,6 +631,10 @@ SDL_EGL_ChooseConfig(_THIS) break; /* we found an exact match! */ } } + +#ifdef DUMP_EGL_CONFIG + dumpconfig(_this, _this->egl_data->egl_config); +#endif return 0; } @@ -439,6 +661,24 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context = (EGLContext)SDL_GL_GetCurrentContext(); } +#if SDL_VIDEO_DRIVER_ANDROID + if ((_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) != 0) { + /* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset. + * This is required because some Android devices like to complain about it + * by "silently" failing, logging a hint which could be easily overlooked: + * E/libEGL (26984): validate_display:255 error 3008 (EGL_BAD_DISPLAY) + * The following explicitly checks for EGL_KHR_debug before EGL 1.5 + */ + int egl_version_major = _this->egl_data->egl_version_major; + int egl_version_minor = _this->egl_data->egl_version_minor; + if (((egl_version_major < 1) || (egl_version_major == 1 && egl_version_minor < 5)) && + !SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_debug")) { + /* SDL profile bits match EGL profile bits. */ + _this->gl_config.flags &= ~SDL_GL_CONTEXT_DEBUG_FLAG; + } + } +#endif + /* Set the context version and other attributes. */ if ((major_version < 3 || (minor_version == 0 && profile_es)) && _this->gl_config.flags == 0 && @@ -458,7 +698,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) /* The Major/minor version, context profiles, and context flags can * only be specified when this extension is available. */ - if (SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[attr++] = EGL_CONTEXT_MAJOR_VERSION_KHR; attribs[attr++] = major_version; attribs[attr++] = EGL_CONTEXT_MINOR_VERSION_KHR; @@ -483,6 +723,19 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) } } + if (_this->gl_config.no_error) { +#ifdef EGL_KHR_create_context_no_error + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context_no_error")) { + attribs[attr++] = EGL_CONTEXT_OPENGL_NO_ERROR_KHR; + attribs[attr++] = _this->gl_config.no_error; + } else +#endif + { + SDL_SetError("EGL implementation does not support no_error contexts"); + return NULL; + } + } + attribs[attr++] = EGL_NONE; /* Bind the API */ @@ -497,15 +750,23 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context, attribs); if (egl_context == EGL_NO_CONTEXT) { - SDL_SetError("Could not create EGL context"); + SDL_EGL_SetError("Could not create EGL context", "eglCreateContext"); return NULL; } _this->egl_data->egl_swapinterval = 0; if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) { + /* Save the SDL error set by SDL_EGL_MakeCurrent */ + char errorText[1024]; + SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText)); + + /* Delete the context, which may alter the value returned by SDL_GetError() */ SDL_EGL_DeleteContext(_this, egl_context); - SDL_SetError("Could not make EGL context current"); + + /* Restore the SDL error */ + SDL_SetError("%s", errorText); + return NULL; } @@ -529,7 +790,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) } else { if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, egl_surface, egl_surface, egl_context)) { - return SDL_SetError("Unable to make EGL context current"); + return SDL_EGL_SetError("Unable to make EGL context current", "eglMakeCurrent"); } } @@ -551,23 +812,27 @@ SDL_EGL_SetSwapInterval(_THIS, int interval) return 0; } - return SDL_SetError("Unable to set the EGL swap interval"); + return SDL_EGL_SetError("Unable to set the EGL swap interval", "eglSwapInterval"); } int SDL_EGL_GetSwapInterval(_THIS) { if (!_this->egl_data) { - return SDL_SetError("EGL not initialized"); + SDL_SetError("EGL not initialized"); + return 0; } return _this->egl_data->egl_swapinterval; } -void +int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface) { - _this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface); + if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface)) { + return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers"); + } + return 0; } void @@ -581,7 +846,6 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) } if (egl_context != NULL && egl_context != EGL_NO_CONTEXT) { - SDL_EGL_MakeCurrent(_this, NULL, NULL); _this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context); } @@ -590,11 +854,17 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface * SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) { + /* max 2 values plus terminator. */ + EGLint attribs[3]; + int attr = 0; + + EGLSurface * surface; + if (SDL_EGL_ChooseConfig(_this) != 0) { return EGL_NO_SURFACE; } -#if __ANDROID__ +#if SDL_VIDEO_DRIVER_ANDROID { /* Android docs recommend doing this! * Ref: http://developer.android.com/reference/android/app/NativeActivity.html @@ -607,11 +877,29 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) ANativeWindow_setBuffersGeometry(nw, 0, 0, format); } #endif + if (_this->gl_config.framebuffer_srgb_capable) { +#ifdef EGL_KHR_gl_colorspace + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) { + attribs[attr++] = EGL_GL_COLORSPACE_KHR; + attribs[attr++] = EGL_GL_COLORSPACE_SRGB_KHR; + } else +#endif + { + SDL_SetError("EGL implementation does not support sRGB system framebuffers"); + return EGL_NO_SURFACE; + } + } + + attribs[attr++] = EGL_NONE; - return _this->egl_data->eglCreateWindowSurface( + surface = _this->egl_data->eglCreateWindowSurface( _this->egl_data->egl_display, _this->egl_data->egl_config, - nw, NULL); + nw, &attribs[0]); + if (surface == EGL_NO_SURFACE) { + SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface"); + } + return surface; } void @@ -629,4 +917,4 @@ SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface) #endif /* SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ - + diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_egl_c.h b/3rdparty/sdl2-2.0.9/src/video/SDL_egl_c.h similarity index 77% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_egl_c.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_egl_c.h index c683dffa77..d1c41297c3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_egl_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_egl_h -#define _SDL_egl_h +#ifndef SDL_egl_h_ +#define SDL_egl_h_ #if SDL_VIDEO_OPENGL_EGL @@ -35,8 +35,16 @@ typedef struct SDL_EGL_VideoData EGLDisplay egl_display; EGLConfig egl_config; int egl_swapinterval; + int egl_surfacetype; + int egl_version_major, egl_version_minor; EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); @@ -55,6 +63,9 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); + EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, + EGLint const* attrib_list); + EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy, EGLConfig config, NativeWindowType window, @@ -79,11 +90,16 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); + EGLint(EGLAPIENTRY *eglGetError)(void); + } SDL_EGL_VideoData; /* OpenGLES functions */ extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value); -extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display); +/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*) + * or, if 0 is passed, let the implementation decide. + */ +extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc); extern void SDL_EGL_UnloadLibrary(_THIS); extern int SDL_EGL_ChooseConfig(_THIS); @@ -96,14 +112,18 @@ extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface); /* These need to be wrapped to get the surface for the window by the platform GLES implementation */ extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface); extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context); -extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); +extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); + +/* SDL Error-reporting */ +extern int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode); +#define SDL_EGL_SetError(message, eglFunctionName) SDL_EGL_SetErrorEx(message, eglFunctionName, _this->egl_data->eglGetError()) /* A few of useful macros */ -#define SDL_EGL_SwapWindow_impl(BACKEND) void \ +#define SDL_EGL_SwapWindow_impl(BACKEND) int \ BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \ {\ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ } #define SDL_EGL_MakeCurrent_impl(BACKEND) int \ @@ -125,6 +145,6 @@ BACKEND ## _GLES_CreateContext(_THIS, SDL_Window * window) \ #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_egl_h */ +#endif /* SDL_egl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_fillrect.c b/3rdparty/sdl2-2.0.9/src/video/SDL_fillrect.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_fillrect.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_fillrect.c index e34a43c442..63f5fcb305 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_fillrect.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -144,13 +144,13 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) switch ((uintptr_t) p & 3) { case 1: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 2: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 3: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ } SDL_memset4(p, color, (n >> 2)); } @@ -158,11 +158,11 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) p += (n & ~3); switch (n & 3) { case 3: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 2: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 1: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ } } pixels += pitch; diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_pixels.c b/3rdparty/sdl2-2.0.9/src/video/SDL_pixels.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_pixels.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_pixels.c index d905656cad..c2e41632ff 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_pixels.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, if (Rmask == 0) { return SDL_PIXELFORMAT_RGB555; } - /* Fall through to 16-bit checks */ + /* fallthrough */ case 16: if (Rmask == 0) { return SDL_PIXELFORMAT_RGB565; @@ -403,6 +403,13 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Amask == 0x0000) { return SDL_PIXELFORMAT_BGR565; } + if (Rmask == 0x003F && + Gmask == 0x07C0 && + Bmask == 0xF800 && + Amask == 0x0000) { + /* Technically this would be BGR556, but Witek says this works in bug 3158 */ + return SDL_PIXELFORMAT_RGB565; + } break; case 24: switch (Rmask) { @@ -483,16 +490,20 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, } static SDL_PixelFormat *formats; +static SDL_SpinLock formats_lock = 0; SDL_PixelFormat * SDL_AllocFormat(Uint32 pixel_format) { SDL_PixelFormat *format; + SDL_AtomicLock(&formats_lock); + /* Look it up in our list of previously allocated formats */ for (format = formats; format; format = format->next) { if (pixel_format == format->format) { ++format->refcount; + SDL_AtomicUnlock(&formats_lock); return format; } } @@ -500,10 +511,12 @@ SDL_AllocFormat(Uint32 pixel_format) /* Allocate an empty pixel format structure, and initialize it */ format = SDL_malloc(sizeof(*format)); if (format == NULL) { + SDL_AtomicUnlock(&formats_lock); SDL_OutOfMemory(); return NULL; } if (SDL_InitFormat(format, pixel_format) < 0) { + SDL_AtomicUnlock(&formats_lock); SDL_free(format); SDL_InvalidParamError("format"); return NULL; @@ -514,6 +527,9 @@ SDL_AllocFormat(Uint32 pixel_format) format->next = formats; formats = format; } + + SDL_AtomicUnlock(&formats_lock); + return format; } @@ -591,7 +607,11 @@ SDL_FreeFormat(SDL_PixelFormat *format) SDL_InvalidParamError("format"); return; } + + SDL_AtomicLock(&formats_lock); + if (--format->refcount > 0) { + SDL_AtomicUnlock(&formats_lock); return; } @@ -607,6 +627,8 @@ SDL_FreeFormat(SDL_PixelFormat *format) } } + SDL_AtomicUnlock(&formats_lock); + if (format->palette) { SDL_FreePalette(format->palette); } @@ -651,7 +673,7 @@ SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); } - if (palette && palette->ncolors != (1 << format->BitsPerPixel)) { + if (palette && palette->ncolors > (1 << format->BitsPerPixel)) { return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format"); } @@ -741,30 +763,6 @@ SDL_DitherColors(SDL_Color * colors, int bpp) } } -/* - * Calculate the pad-aligned scanline width of a surface - */ -int -SDL_CalculatePitch(SDL_Surface * surface) -{ - int pitch; - - /* Surface should be 4-byte aligned for speed */ - pitch = surface->w * surface->format->BytesPerPixel; - switch (surface->format->BitsPerPixel) { - case 1: - pitch = (pitch + 7) / 8; - break; - case 4: - pitch = (pitch + 1) / 2; - break; - default: - break; - } - pitch = (pitch + 3) & ~3; /* 4-byte aligning */ - return (pitch); -} - /* * Match an RGB value to a particular palette index */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_pixels_c.h b/3rdparty/sdl2-2.0.9/src/video/SDL_pixels_c.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_pixels_c.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_pixels_c.h index 4ee91b8a30..c84e155f1f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_pixels_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_pixels_c_h_ +#define SDL_pixels_c_h_ + #include "../SDL_internal.h" /* Useful functions and variables from SDL_pixel.c */ @@ -34,8 +38,9 @@ extern int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst); extern void SDL_FreeBlitMap(SDL_BlitMap * map); /* Miscellaneous functions */ -extern int SDL_CalculatePitch(SDL_Surface * surface); extern void SDL_DitherColors(SDL_Color * colors, int bpp); extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +#endif /* SDL_pixels_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_rect.c b/3rdparty/sdl2-2.0.9/src/video/SDL_rect.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_rect.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_rect.c index 2b29451c79..8c6ff2da79 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_rect.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "SDL_rect.h" #include "SDL_rect_c.h" - +#include "SDL_assert.h" SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) @@ -441,9 +441,15 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, y = recty2; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); } else if (outcode2 & CODE_LEFT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx1; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } else if (outcode2 & CODE_RIGHT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx2; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_rect_c.h b/3rdparty/sdl2-2.0.9/src/video/SDL_rect_c.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_rect_c.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_rect_c.h index aa5fbde791..56d6f2e07a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_rect_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,14 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_rect_c_h_ +#define SDL_rect_c_h_ + #include "../SDL_internal.h" extern SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect * rects, SDL_Rect *span); +#endif /* SDL_rect_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_shape.c b/3rdparty/sdl2-2.0.9/src/video/SDL_shape.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_shape.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_shape.c index 4a2e5465b6..6f029bceb5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_shape.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,10 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned SDL_Window *result = NULL; result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */); if(result != NULL) { + if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { + SDL_DestroyWindow(result); + return NULL; + } result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result); if(result->shaper != NULL) { result->shaper->userx = x; @@ -70,11 +74,14 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm int y = 0; Uint8 r = 0,g = 0,b = 0,alpha = 0; Uint8* pixel = NULL; - Uint32 bitmap_pixel,pixel_value = 0,mask_value = 0; + Uint32 pixel_value = 0,mask_value = 0; + int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb; + Uint8 *bitmap_scanline; SDL_Color key; if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); for(y = 0;yh;y++) { + bitmap_scanline = bitmap + y * bytes_per_scanline; for(x=0;xw;x++) { alpha = 0; pixel_value = 0; @@ -94,7 +101,6 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm break; } SDL_GetRGBA(pixel_value,shape->format,&r,&g,&b,&alpha); - bitmap_pixel = y*shape->w + x; switch(mode.mode) { case(ShapeModeDefault): mask_value = (alpha >= 1 ? 1 : 0); @@ -110,7 +116,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0); break; } - bitmap[bitmap_pixel / ppb] |= mask_value << (7 - ((ppb - 1) - (bitmap_pixel % ppb))); + bitmap_scanline[x / ppb] |= mask_value << (x % ppb); } } if(SDL_MUSTLOCK(shape)) @@ -206,8 +212,14 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) { - SDL_Rect dimensions = {0,0,shape->w,shape->h}; + SDL_Rect dimensions; SDL_ShapeTree* result = NULL; + + dimensions.x = 0; + dimensions.y = 0; + dimensions.w = shape->w; + dimensions.h = shape->h; + if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); result = RecursivelyCalculateShapeTree(mode,shape,dimensions); @@ -234,10 +246,10 @@ void SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) { if((*shape_tree)->kind == QuadShape) { - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upright); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downright); } SDL_free(*shape_tree); *shape_tree = NULL; diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_shape_internals.h b/3rdparty/sdl2-2.0.9/src/video/SDL_shape_internals.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_shape_internals.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_shape_internals.h index bdb0ee91be..49a8786a19 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_shape_internals.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_shape_internals_h -#define _SDL_shape_internals_h +#ifndef SDL_shape_internals_h_ +#define SDL_shape_internals_h_ #include "SDL_rect.h" #include "SDL_shape.h" @@ -36,21 +36,21 @@ extern "C" { #endif typedef struct { - struct SDL_ShapeTree *upleft,*upright,*downleft,*downright; + struct SDL_ShapeTree *upleft,*upright,*downleft,*downright; } SDL_QuadTreeChildren; typedef union { - SDL_QuadTreeChildren children; - SDL_Rect shape; + SDL_QuadTreeChildren children; + SDL_Rect shape; } SDL_ShapeUnion; typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind; typedef struct { - SDL_ShapeKind kind; - SDL_ShapeUnion data; + SDL_ShapeKind kind; + SDL_ShapeUnion data; } SDL_ShapeTree; - + typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*); extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb); diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_stretch.c b/3rdparty/sdl2-2.0.9/src/video/SDL_stretch.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_stretch.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_stretch.c index bb34dffb76..8cc6bf30b6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_stretch.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ into the general blitting mechanism. */ -#if ((defined(_MFC_VER) && defined(_M_IX86)) || \ - defined(__WATCOMC__) || \ +#if ((defined(_MSC_VER) && defined(_M_IX86)) || \ + (defined(__WATCOMC__) && defined(__386__)) || \ (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES /* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct * value after the first scanline. FIXME? */ @@ -53,7 +53,7 @@ #define PAGE_ALIGNED #endif -#if defined(_M_IX86) || defined(i386) +#if defined(_M_IX86) || defined(__i386__) || defined(__386__) #define PREFIX16 0x66 #define STORE_BYTE 0xAA #define STORE_WORD 0xAB @@ -102,7 +102,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) store = STORE_WORD; break; default: - return SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp); + return SDL_SetError("ASM stretch of %d bytes isn't supported", bpp); } #ifdef HAVE_MPROTECT /* Make the code writeable */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_surface.c b/3rdparty/sdl2-2.0.9/src/video/SDL_surface.c similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_surface.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_surface.c index dae07f2851..1b2ee6cea6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_surface.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,29 +25,52 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" #include "SDL_pixels_c.h" +#include "SDL_yuv_c.h" + + +/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */ +SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, + sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32)); /* Public routines */ + /* - * Create an empty RGB surface of the appropriate depth + * Calculate the pad-aligned scanline width of a surface + */ +static int +SDL_CalculatePitch(Uint32 format, int width) +{ + int pitch; + + /* Surface should be 4-byte aligned for speed */ + pitch = width * SDL_BYTESPERPIXEL(format); + switch (SDL_BITSPERPIXEL(format)) { + case 1: + pitch = (pitch + 7) / 8; + break; + case 4: + pitch = (pitch + 1) / 2; + break; + default: + break; + } + pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + return pitch; +} + +/* + * Create an empty RGB surface of the appropriate depth using the given + * enum SDL_PIXELFORMAT_* format */ SDL_Surface * -SDL_CreateRGBSurface(Uint32 flags, - int width, int height, int depth, - Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) +SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, + Uint32 format) { SDL_Surface *surface; - Uint32 format; /* The flags are no longer used, make the compiler happy */ (void)flags; - /* Get the pixel format */ - format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask); - if (format == SDL_PIXELFORMAT_UNKNOWN) { - SDL_SetError("Unknown pixel format"); - return NULL; - } - /* Allocate the surface */ surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface)); if (surface == NULL) { @@ -62,7 +85,7 @@ SDL_CreateRGBSurface(Uint32 flags, } surface->w = width; surface->h = height; - surface->pitch = SDL_CalculatePitch(surface); + surface->pitch = SDL_CalculatePitch(format, width); SDL_SetClipRect(surface, NULL); if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { @@ -87,7 +110,16 @@ SDL_CreateRGBSurface(Uint32 flags, /* Get the pixels */ if (surface->w && surface->h) { - surface->pixels = SDL_malloc(surface->h * surface->pitch); + /* Assumptions checked in surface_size_assumptions assert above */ + Sint64 size = ((Sint64)surface->h * surface->pitch); + if (size < 0 || size > SDL_MAX_SINT32) { + /* Overflow... */ + SDL_FreeSurface(surface); + SDL_OutOfMemory(); + return NULL; + } + + surface->pixels = SDL_malloc((size_t)size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); @@ -105,7 +137,7 @@ SDL_CreateRGBSurface(Uint32 flags, } /* By default surface with an alpha mask are set up for blending */ - if (Amask) { + if (surface->format->Amask) { SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); } @@ -114,6 +146,26 @@ SDL_CreateRGBSurface(Uint32 flags, return surface; } +/* + * Create an empty RGB surface of the appropriate depth + */ +SDL_Surface * +SDL_CreateRGBSurface(Uint32 flags, + int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) +{ + Uint32 format; + + /* Get the pixel format */ + format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask); + if (format == SDL_PIXELFORMAT_UNKNOWN) { + SDL_SetError("Unknown pixel format"); + return NULL; + } + + return SDL_CreateRGBSurfaceWithFormat(flags, width, height, depth, format); +} + /* * Create an RGB surface from an existing memory buffer */ @@ -125,8 +177,30 @@ SDL_CreateRGBSurfaceFrom(void *pixels, { SDL_Surface *surface; - surface = - SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask); + surface = SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask); + if (surface != NULL) { + surface->flags |= SDL_PREALLOC; + surface->pixels = pixels; + surface->w = width; + surface->h = height; + surface->pitch = pitch; + SDL_SetClipRect(surface, NULL); + } + return surface; +} + +/* + * Create an RGB surface from an existing memory buffer using the given given + * enum SDL_PIXELFORMAT_* format + */ +SDL_Surface * +SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, + int width, int height, int depth, int pitch, + Uint32 format) +{ + SDL_Surface *surface; + + surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); if (surface != NULL) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; @@ -218,15 +292,29 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key) return 0; } +SDL_bool +SDL_HasColorKey(SDL_Surface * surface) +{ + if (!surface) { + return SDL_FALSE; + } + + if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { + return SDL_FALSE; + } + + return SDL_TRUE; +} + int SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) { if (!surface) { - return -1; + return SDL_InvalidParamError("surface"); } if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { - return -1; + return SDL_SetError("Surface doesn't have a colorkey"); } if (key) { @@ -743,8 +831,8 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, final_src.x = (int)SDL_floor(src_x0 + 0.5); final_src.y = (int)SDL_floor(src_y0 + 0.5); - final_src.w = (int)SDL_floor(src_x1 - src_x0 + 1.5); - final_src.h = (int)SDL_floor(src_y1 - src_y0 + 1.5); + final_src.w = (int)SDL_floor(src_x1 + 1 + 0.5) - (int)SDL_floor(src_x0 + 0.5); + final_src.h = (int)SDL_floor(src_y1 + 1 + 0.5) - (int)SDL_floor(src_y0 + 0.5); final_dst.x = (int)SDL_floor(dst_x0 + 0.5); final_dst.y = (int)SDL_floor(dst_y0 + 0.5); @@ -835,6 +923,15 @@ SDL_UnlockSurface(SDL_Surface * surface) } } +/* + * Creates a new surface identical to the existing surface + */ +SDL_Surface * +SDL_DuplicateSurface(SDL_Surface * surface) +{ + return SDL_ConvertSurface(surface, surface->format, surface->flags); +} + /* * Convert a surface into the specified pixel format. */ @@ -847,6 +944,15 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, SDL_Color copy_color; SDL_Rect bounds; + if (!surface) { + SDL_InvalidParamError("surface"); + return NULL; + } + if (!format) { + SDL_InvalidParamError("format"); + return NULL; + } + /* Check for empty destination palette! (results in empty image) */ if (format->palette != NULL) { int i; @@ -935,13 +1041,37 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, } if (set_colorkey_by_color) { - /* Set the colorkey by color, which needs to be unique */ - Uint8 keyR, keyG, keyB, keyA; + SDL_Surface *tmp; + SDL_Surface *tmp2; + int converted_colorkey = 0; + + /* Create a dummy surface to get the colorkey converted */ + tmp = SDL_CreateRGBSurface(0, 1, 1, + surface->format->BitsPerPixel, surface->format->Rmask, + surface->format->Gmask, surface->format->Bmask, + surface->format->Amask); + + /* Share the palette, if any */ + if (surface->format->palette) { + SDL_SetSurfacePalette(tmp, surface->format->palette); + } + + SDL_FillRect(tmp, NULL, surface->map->info.colorkey); + + tmp->map->info.flags &= ~SDL_COPY_COLORKEY; + + /* Convertion of the colorkey */ + tmp2 = SDL_ConvertSurface(tmp, format, 0); + + /* Get the converted colorkey */ + SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel); + + SDL_FreeSurface(tmp); + SDL_FreeSurface(tmp2); + + /* Set the converted colorkey on the new surface */ + SDL_SetColorKey(convert, 1, converted_colorkey); - SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, - &keyG, &keyB, &keyA); - SDL_SetColorKey(convert, 1, - SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); /* This is needed when converting for 3D texture upload */ SDL_ConvertColorkeyToAlpha(convert); } @@ -951,7 +1081,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, /* Enable alpha blending by default if the new surface has an * alpha channel or alpha modulation */ if ((surface->format->Amask && format->Amask) || - (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) { + (copy_flags & SDL_COPY_MODULATE_ALPHA)) { SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); } if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) { @@ -1037,57 +1167,24 @@ int SDL_ConvertPixels(int width, int height, return SDL_InvalidParamError("dst_pitch"); } + if (SDL_ISPIXELFORMAT_FOURCC(src_format) && SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_YUV_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { + return SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_RGB_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } + /* Fast path for same format copy */ if (src_format == dst_format) { - int bpp, i; - - if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { - switch (src_format) { - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - bpp = 2; - break; - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - case SDL_PIXELFORMAT_NV12: - case SDL_PIXELFORMAT_NV21: - bpp = 1; - break; - default: - return SDL_SetError("Unknown FOURCC pixel format"); - } - } else { - bpp = SDL_BYTESPERPIXEL(src_format); - } + int i; + const int bpp = SDL_BYTESPERPIXEL(src_format); width *= bpp; - for (i = height; i--;) { SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; + src = (const Uint8*)src + src_pitch; dst = (Uint8*)dst + dst_pitch; } - - if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV) { - /* U and V planes are a quarter the size of the Y plane */ - width /= 2; - height /= 2; - src_pitch /= 2; - dst_pitch /= 2; - for (i = height * 2; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } else if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { - /* U/V plane is half the height of the Y plane */ - height /= 2; - for (i = height; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } return 0; } @@ -1121,6 +1218,8 @@ SDL_FreeSurface(SDL_Surface * surface) if (surface->flags & SDL_DONTFREE) { return; } + SDL_InvalidateMap(surface->map); + if (--surface->refcount > 0) { return; } @@ -1135,13 +1234,12 @@ SDL_FreeSurface(SDL_Surface * surface) SDL_FreeFormat(surface->format); surface->format = NULL; } - if (surface->map != NULL) { - SDL_FreeBlitMap(surface->map); - surface->map = NULL; - } if (!(surface->flags & SDL_PREALLOC)) { SDL_free(surface->pixels); } + if (surface->map) { + SDL_FreeBlitMap(surface->map); + } SDL_free(surface); } diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_sysvideo.h b/3rdparty/sdl2-2.0.9/src/video/SDL_sysvideo.h similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_sysvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/SDL_sysvideo.h index 77426c3eb4..25862ca1b5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_sysvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,15 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysvideo_h -#define _SDL_sysvideo_h +#ifndef SDL_sysvideo_h_ +#define SDL_sysvideo_h_ #include "SDL_messagebox.h" #include "SDL_shape.h" #include "SDL_thread.h" +#include "SDL_vulkan_internal.h" + /* The SDL video driver */ typedef struct SDL_WindowShaper SDL_WindowShaper; @@ -86,6 +88,8 @@ struct SDL_Window SDL_DisplayMode fullscreen_mode; + float opacity; + float brightness; Uint16 *gamma; Uint16 *saved_gamma; /* (just offset into gamma) */ @@ -95,6 +99,7 @@ struct SDL_Window SDL_bool is_hiding; SDL_bool is_destroying; + SDL_bool is_dropping; /* drag/drop in progress, expecting SDL_SendDropComplete(). */ SDL_WindowShaper *shaper; @@ -114,8 +119,8 @@ struct SDL_Window !((W)->flags & SDL_WINDOW_MINIMIZED)) /* - * Define the SDL display structure This corresponds to physical monitors - * attached to the system. + * Define the SDL display structure. + * This corresponds to physical monitors attached to the system. */ struct SDL_VideoDisplay { @@ -125,6 +130,7 @@ struct SDL_VideoDisplay SDL_DisplayMode *display_modes; SDL_DisplayMode desktop_mode; SDL_DisplayMode current_mode; + SDL_DisplayOrientation orientation; SDL_Window *fullscreen_window; @@ -160,6 +166,11 @@ struct SDL_VideoDevice */ void (*VideoQuit) (_THIS); + /* + * Reinitialize the touch devices -- called if an unknown touch ID occurs. + */ + void (*ResetTouch) (_THIS); + /* * * */ /* * Display functions @@ -170,6 +181,11 @@ struct SDL_VideoDevice */ int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); + /* + * Get the usable bounds of a display (bounds minus menubar or whatever) + */ + int (*GetDisplayUsableBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); + /* * Get the dots/pixels-per-inch of a display */ @@ -192,14 +208,18 @@ struct SDL_VideoDevice /* * Window functions */ - int (*CreateWindow) (_THIS, SDL_Window * window); - int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data); + int (*CreateSDLWindow) (_THIS, SDL_Window * window); + int (*CreateSDLWindowFrom) (_THIS, SDL_Window * window, const void *data); void (*SetWindowTitle) (_THIS, SDL_Window * window); void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon); void (*SetWindowPosition) (_THIS, SDL_Window * window); void (*SetWindowSize) (_THIS, SDL_Window * window); void (*SetWindowMinimumSize) (_THIS, SDL_Window * window); void (*SetWindowMaximumSize) (_THIS, SDL_Window * window); + int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); + int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity); + int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window); + int (*SetWindowInputFocus) (_THIS, SDL_Window * window); void (*ShowWindow) (_THIS, SDL_Window * window); void (*HideWindow) (_THIS, SDL_Window * window); void (*RaiseWindow) (_THIS, SDL_Window * window); @@ -207,6 +227,7 @@ struct SDL_VideoDevice void (*MinimizeWindow) (_THIS, SDL_Window * window); void (*RestoreWindow) (_THIS, SDL_Window * window); void (*SetWindowBordered) (_THIS, SDL_Window * window, SDL_bool bordered); + void (*SetWindowResizable) (_THIS, SDL_Window * window, SDL_bool resizable); void (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp); int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp); @@ -239,8 +260,19 @@ struct SDL_VideoDevice void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); int (*GL_SetSwapInterval) (_THIS, int interval); int (*GL_GetSwapInterval) (_THIS); - void (*GL_SwapWindow) (_THIS, SDL_Window * window); + int (*GL_SwapWindow) (_THIS, SDL_Window * window); void (*GL_DeleteContext) (_THIS, SDL_GLContext context); + void (*GL_DefaultProfileConfig) (_THIS, int *mask, int *major, int *minor); + + /* * * */ + /* + * Vulkan support + */ + int (*Vulkan_LoadLibrary) (_THIS, const char *path); + void (*Vulkan_UnloadLibrary) (_THIS); + SDL_bool (*Vulkan_GetInstanceExtensions) (_THIS, SDL_Window *window, unsigned *count, const char **names); + SDL_bool (*Vulkan_CreateSurface) (_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface); + void (*Vulkan_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); /* * * */ /* @@ -273,8 +305,12 @@ struct SDL_VideoDevice /* Hit-testing */ int (*SetWindowHitTest)(SDL_Window * window, SDL_bool enabled); + /* Tell window that app enabled drag'n'drop events */ + void (*AcceptDragAndDrop)(SDL_Window * window, SDL_bool accept); + /* * * */ /* Data common to all drivers */ + SDL_bool is_dummy; SDL_bool suspend_screensaver; int num_displays; SDL_VideoDisplay *displays; @@ -282,7 +318,7 @@ struct SDL_VideoDevice SDL_Window *grabbed_window; Uint8 window_magic; Uint32 next_object_id; - char * clipboard_text; + char *clipboard_text; /* * * */ /* Data used by the GL drivers */ @@ -310,7 +346,9 @@ struct SDL_VideoDevice int profile_mask; int share_with_current_context; int release_behavior; + int reset_notification; int framebuffer_srgb_capable; + int no_error; int retained_backing; int driver_loaded; char driver_path[256]; @@ -327,6 +365,17 @@ struct SDL_VideoDevice SDL_TLSID current_glwin_tls; SDL_TLSID current_glctx_tls; + /* * * */ + /* Data used by the Vulkan drivers */ + struct + { + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; + int loader_loaded; + char loader_path[256]; + void *loader_handle; + } vulkan_config; + /* * * */ /* Data private to this driver */ void *driverdata; @@ -353,66 +402,40 @@ typedef struct VideoBootStrap SDL_VideoDevice *(*create) (int devindex); } VideoBootStrap; -#if SDL_VIDEO_DRIVER_COCOA +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern VideoBootStrap COCOA_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_X11 extern VideoBootStrap X11_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_MIR extern VideoBootStrap MIR_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DIRECTFB extern VideoBootStrap DirectFB_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINDOWS extern VideoBootStrap WINDOWS_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINRT extern VideoBootStrap WINRT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_HAIKU extern VideoBootStrap HAIKU_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PANDORA extern VideoBootStrap PND_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_UIKIT extern VideoBootStrap UIKIT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_ANDROID extern VideoBootStrap Android_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PSP extern VideoBootStrap PSP_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_RPI extern VideoBootStrap RPI_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DUMMY +extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap DUMMY_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WAYLAND extern VideoBootStrap Wayland_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_NACL extern VideoBootStrap NACL_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_VIVANTE extern VideoBootStrap VIVANTE_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_EMSCRIPTEN extern VideoBootStrap Emscripten_bootstrap; -#endif +extern VideoBootStrap QNX_bootstrap; extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display); extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode); +extern int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display); +extern SDL_VideoDisplay *SDL_GetDisplay(int displayIndex); extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window); extern void *SDL_GetDisplayDriverData( int displayIndex ); +extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor); + extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); +extern SDL_bool SDL_HasWindows(void); extern void SDL_OnWindowShown(SDL_Window * window); extern void SDL_OnWindowHidden(SDL_Window * window); @@ -430,6 +453,15 @@ extern SDL_bool SDL_ShouldAllowTopmost(void); extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches); -#endif /* _SDL_sysvideo_h */ +extern void SDL_OnApplicationWillTerminate(void); +extern void SDL_OnApplicationDidReceiveMemoryWarning(void); +extern void SDL_OnApplicationWillResignActive(void); +extern void SDL_OnApplicationDidEnterBackground(void); +extern void SDL_OnApplicationWillEnterForeground(void); +extern void SDL_OnApplicationDidBecomeActive(void); + +extern void SDL_ToggleDragAndDropSupport(void); + +#endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/SDL_video.c b/3rdparty/sdl2-2.0.9/src/video/SDL_video.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/SDL_video.c rename to 3rdparty/sdl2-2.0.9/src/video/SDL_video.c index 511b4c087d..336fdaa509 100644 --- a/3rdparty/sdl2-2.0.4/src/video/SDL_video.c +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,13 +46,14 @@ #include "SDL_opengles2.h" #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ +#if !SDL_VIDEO_OPENGL #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif +#endif -/* On Windows, windows.h defines CreateWindow */ -#ifdef CreateWindow -#undef CreateWindow +#ifdef __EMSCRIPTEN__ +#include #endif /* Available video drivers */ @@ -96,15 +97,21 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif +#if SDL_VIDEO_DRIVER_KMSDRM + &KMSDRM_bootstrap, +#endif #if SDL_VIDEO_DRIVER_RPI &RPI_bootstrap, -#endif +#endif #if SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif #if SDL_VIDEO_DRIVER_EMSCRIPTEN &Emscripten_bootstrap, #endif +#if SDL_VIDEO_DRIVER_QNX + &QNX_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #endif @@ -118,6 +125,7 @@ static SDL_VideoDevice *_this = NULL; SDL_UninitializedVideo(); \ return retval; \ } \ + SDL_assert(window && window->magic == &_this->window_magic); \ if (!window || window->magic != &_this->window_magic) { \ SDL_SetError("Invalid window"); \ return retval; \ @@ -129,6 +137,7 @@ static SDL_VideoDevice *_this = NULL; return retval; \ } \ SDL_assert(_this->displays != NULL); \ + SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \ if (displayIndex < 0 || displayIndex >= _this->num_displays) { \ SDL_SetError("displayIndex must be in the range 0 - %d", \ _this->num_displays - 1); \ @@ -166,6 +175,11 @@ ShouldUseTextureFramebuffer() return SDL_TRUE; } + /* If this is the dummy driver there is no texture support */ + if (_this->is_dummy) { + return SDL_FALSE; + } + /* If the user has specified a software renderer we can't use a texture framebuffer, or renderer creation will go recursive. */ @@ -177,7 +191,7 @@ ShouldUseTextureFramebuffer() /* See if the user or application wants a specific behavior */ hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); if (hint) { - if (*hint == '0') { + if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { return SDL_FALSE; } else { return SDL_TRUE; @@ -191,7 +205,7 @@ ShouldUseTextureFramebuffer() return SDL_FALSE; #elif defined(__MACOSX__) - /* Mac OS X uses OpenGL as the native fast path */ + /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */ return SDL_TRUE; #elif defined(__LINUX__) @@ -254,6 +268,8 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f /* Check to see if there's a specific driver requested */ if (hint && *hint != '0' && *hint != '1' && + SDL_strcasecmp(hint, "true") != 0 && + SDL_strcasecmp(hint, "false") != 0 && SDL_strcasecmp(hint, "software") != 0) { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { SDL_RendererInfo info; @@ -330,9 +346,14 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f /* Create framebuffer data */ data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format); data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3); - data->pixels = SDL_malloc(window->h * data->pitch); - if (!data->pixels) { - return SDL_OutOfMemory(); + + { + /* Make static analysis happy about potential malloc(0) calls. */ + const size_t allocsize = window->h * data->pitch; + data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1); + if (!data->pixels) { + return SDL_OutOfMemory(); + } } *pixels = data->pixels; @@ -443,10 +464,8 @@ int SDL_VideoInit(const char *driver_name) { SDL_VideoDevice *video; - const char *hint; int index; int i; - SDL_bool allow_screensaver; /* Check to make sure we don't overwrite '_this' */ if (_this != NULL) { @@ -534,13 +553,7 @@ SDL_VideoInit(const char *driver_name) joystick, or passively watching a movie. Things that use SDL but function more like a normal desktop app should explicitly reenable the screensaver. */ - hint = SDL_GetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER); - if (hint) { - allow_screensaver = SDL_atoi(hint) ? SDL_TRUE : SDL_FALSE; - } else { - allow_screensaver = SDL_FALSE; - } - if (!allow_screensaver) { + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, SDL_FALSE)) { SDL_DisableScreenSaver(); } @@ -628,7 +641,7 @@ SDL_GetNumVideoDisplays(void) return _this->num_displays; } -static int +int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display) { int displayIndex; @@ -684,25 +697,57 @@ SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) rect->w = display->current_mode.w; rect->h = display->current_mode.h; } - return 0; + return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ +} + +int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) +{ + CHECK_DISPLAY_INDEX(displayIndex, -1); + + if (rect) { + SDL_VideoDisplay *display = &_this->displays[displayIndex]; + + if (_this->GetDisplayUsableBounds) { + if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) { + return 0; + } + } + + /* Oh well, just give the entire display bounds. */ + return SDL_GetDisplayBounds(displayIndex, rect); + } + return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ } int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { - SDL_VideoDisplay *display; + SDL_VideoDisplay *display; CHECK_DISPLAY_INDEX(displayIndex, -1); display = &_this->displays[displayIndex]; - if (_this->GetDisplayDPI) { - if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { - return 0; - } - } + if (_this->GetDisplayDPI) { + if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { + return 0; + } + } else { + return SDL_Unsupported(); + } - return -1; + return -1; +} + +SDL_DisplayOrientation +SDL_GetDisplayOrientation(int displayIndex) +{ + SDL_VideoDisplay *display; + + CHECK_DISPLAY_INDEX(displayIndex, SDL_ORIENTATION_UNKNOWN); + + display = &_this->displays[displayIndex]; + return display->orientation; } SDL_bool @@ -966,7 +1011,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * /* Actually change the display mode */ if (!_this->SetDisplayMode) { - return SDL_SetError("Video driver doesn't support changing display mode"); + return SDL_SetError("SDL video driver doesn't support changing display mode"); } if (_this->SetDisplayMode(_this, display, &display_mode) < 0) { return -1; @@ -975,6 +1020,14 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * return 0; } +SDL_VideoDisplay * +SDL_GetDisplay(int displayIndex) +{ + CHECK_DISPLAY_INDEX(displayIndex, NULL); + + return &_this->displays[displayIndex]; +} + int SDL_GetWindowDisplayIndex(SDL_Window * window) { @@ -1138,35 +1191,38 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) CHECK_WINDOW_MAGIC(window,-1); /* if we are in the process of hiding don't go back to fullscreen */ - if ( window->is_hiding && fullscreen ) + if (window->is_hiding && fullscreen) { return 0; + } #ifdef __MACOSX__ /* if the window is going away and no resolution change is necessary, - do nothing, or else we may trigger an ugly double-transition + do nothing, or else we may trigger an ugly double-transition */ - if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) - return 0; + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) + return 0; - /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ - if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { - if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { - return -1; - } - } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { - display = SDL_GetDisplayForWindow(window); - SDL_SetDisplayModeForDisplay(display, NULL); - if (_this->SetWindowFullscreen) { - _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); + /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ + if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { + if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { + return -1; + } + } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { + display = SDL_GetDisplayForWindow(window); + SDL_SetDisplayModeForDisplay(display, NULL); + if (_this->SetWindowFullscreen) { + _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); + } } - } - if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { - if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { - return -1; + if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { + if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { + return -1; + } + window->last_fullscreen_flags = window->flags; + return 0; } - window->last_fullscreen_flags = window->flags; - return 0; } #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen @@ -1252,8 +1308,15 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) /* Generate a mode change event here */ if (resized) { +#ifndef ANDROID + // Android may not resize the window to exactly what our fullscreen mode is, especially on + // windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't + // use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, + // Android's SetWindowFullscreen will generate the window event for us with the proper final size. + SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, fullscreen_mode.w, fullscreen_mode.h); +#endif } else { SDL_OnWindowResized(other); } @@ -1285,15 +1348,44 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED) + +static SDL_INLINE SDL_bool +IsAcceptingDragAndDrop(void) +{ + if ((SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) || + (SDL_GetEventState(SDL_DROPTEXT) == SDL_ENABLE)) { + return SDL_TRUE; + } + return SDL_FALSE; +} + +/* prepare a newly-created window */ +static SDL_INLINE void +PrepareDragAndDropSupport(SDL_Window *window) +{ + if (_this->AcceptDragAndDrop) { + _this->AcceptDragAndDrop(window, IsAcceptingDragAndDrop()); + } +} + +/* toggle d'n'd for all existing windows. */ +void +SDL_ToggleDragAndDropSupport(void) +{ + if (_this && _this->AcceptDragAndDrop) { + const SDL_bool enable = IsAcceptingDragAndDrop(); + SDL_Window *window; + for (window = _this->windows; window; window = window->next) { + _this->AcceptDragAndDrop(window, enable); + } + } +} static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) { - window->windowed.x = window->x; - window->windowed.y = window->y; - window->windowed.w = window->w; - window->windowed.h = window->h; + PrepareDragAndDropSupport(window); if (flags & SDL_WINDOW_MAXIMIZED) { SDL_MaximizeWindow(window); @@ -1316,7 +1408,6 @@ SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) { SDL_Window *window; - const char *hint; if (!_this) { /* Initialize the video system if needed */ @@ -1325,6 +1416,11 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) { + SDL_SetError("Conflicting window flags specified"); + return NULL; + } + /* Some platforms can't create zero-sized windows */ if (w < 1) { w = 1; @@ -1341,11 +1437,15 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* Some platforms have OpenGL enabled by default */ #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__ - flags |= SDL_WINDOW_OPENGL; + if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN)) { + flags |= SDL_WINDOW_OPENGL; + } #endif if (flags & SDL_WINDOW_OPENGL) { if (!_this->GL_CreateContext) { - SDL_SetError("No OpenGL support in video driver"); + SDL_SetError("OpenGL support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); return NULL; } if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -1353,12 +1453,27 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + if (flags & SDL_WINDOW_VULKAN) { + if (!_this->Vulkan_CreateSurface) { + SDL_SetError("Vulkan support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); + return NULL; + } + if (flags & SDL_WINDOW_OPENGL) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return NULL; + } + if (SDL_Vulkan_LoadLibrary(NULL) < 0) { + return NULL; + } + } + /* Unless the user has specified the high-DPI disabling hint, respect the * SDL_WINDOW_ALLOW_HIGHDPI flag. */ if (flags & SDL_WINDOW_ALLOW_HIGHDPI) { - hint = SDL_GetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED); - if (hint && SDL_atoi(hint) > 0) { + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_FALSE)) { flags &= ~SDL_WINDOW_ALLOW_HIGHDPI; } } @@ -1389,8 +1504,28 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) window->y = bounds.y + (bounds.h - h) / 2; } } + window->windowed.x = window->x; + window->windowed.y = window->y; + window->windowed.w = window->w; + window->windowed.h = window->h; + + if (flags & SDL_WINDOW_FULLSCREEN) { + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + int displayIndex; + SDL_Rect bounds; + + displayIndex = SDL_GetIndexOfDisplay(display); + SDL_GetDisplayBounds(displayIndex, &bounds); + + window->x = bounds.x; + window->y = bounds.y; + window->w = bounds.w; + window->h = bounds.h; + } + window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; + window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; window->is_destroying = SDL_FALSE; @@ -1400,11 +1535,20 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } _this->windows = window; - if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && _this->CreateSDLWindow(_this, window) < 0) { SDL_DestroyWindow(window); return NULL; } + /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation, + * but it's important or window focus will get broken on windows! + */ +#if !defined(__WIN32__) + if (window->flags & SDL_WINDOW_MINIMIZED) { + window->flags &= ~SDL_WINDOW_MINIMIZED; + } +#endif + #if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen or not. The user can choose this, via OS-provided UI, but this can't @@ -1437,7 +1581,7 @@ SDL_CreateWindowFrom(const void *data) SDL_UninitializedVideo(); return NULL; } - if (!_this->CreateWindowFrom) { + if (!_this->CreateSDLWindowFrom) { SDL_Unsupported(); return NULL; } @@ -1451,6 +1595,7 @@ SDL_CreateWindowFrom(const void *data) window->flags = SDL_WINDOW_FOREIGN; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; + window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; if (_this->windows) { @@ -1458,10 +1603,13 @@ SDL_CreateWindowFrom(const void *data) } _this->windows = window; - if (_this->CreateWindowFrom(_this, window, data) < 0) { + if (_this->CreateSDLWindowFrom(_this, window, data) < 0) { SDL_DestroyWindow(window); return NULL; } + + PrepareDragAndDropSupport(window); + return window; } @@ -1471,7 +1619,9 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) SDL_bool loaded_opengl = SDL_FALSE; if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) { - return SDL_SetError("No OpenGL support in video driver"); + return SDL_SetError("OpenGL support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); } if (window->flags & SDL_WINDOW_FOREIGN) { @@ -1508,12 +1658,22 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } } + if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { + SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag"); + return -1; + } + + if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return -1; + } + window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; - if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) { - if (_this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) { + if (_this->CreateSDLWindow(_this, window) < 0) { if (loaded_opengl) { SDL_GL_UnloadLibrary(); window->flags &= ~SDL_WINDOW_OPENGL; @@ -1543,6 +1703,12 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) return 0; } +SDL_bool +SDL_HasWindows(void) +{ + return (_this && _this->windows != NULL); +} + Uint32 SDL_GetWindowID(SDL_Window * window) { @@ -1698,7 +1864,7 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) { int displayIndex = (x & 0xFFFF); SDL_Rect bounds; - if (displayIndex > _this->num_displays) { + if (displayIndex >= _this->num_displays) { displayIndex = 0; } @@ -1795,6 +1961,24 @@ SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered) } } +void +SDL_SetWindowResizable(SDL_Window * window, SDL_bool resizable) +{ + CHECK_WINDOW_MAGIC(window,); + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + const int want = (resizable != SDL_FALSE); /* normalize the flag. */ + const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0); + if ((want != have) && (_this->SetWindowResizable)) { + if (want) { + window->flags |= SDL_WINDOW_RESIZABLE; + } else { + window->flags &= ~SDL_WINDOW_RESIZABLE; + } + _this->SetWindowResizable(_this, window, (SDL_bool) want); + } + } +} + void SDL_SetWindowSize(SDL_Window * window, int w, int h) { @@ -1809,20 +1993,16 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) } /* Make sure we don't exceed any window size limits */ - if (window->min_w && w < window->min_w) - { + if (window->min_w && w < window->min_w) { w = window->min_w; } - if (window->max_w && w > window->max_w) - { + if (window->max_w && w > window->max_w) { w = window->max_w; } - if (window->min_h && h < window->min_h) - { + if (window->min_h && h < window->min_h) { h = window->min_h; } - if (window->max_h && h > window->max_h) - { + if (window->max_h && h > window->max_h) { h = window->max_h; } @@ -1859,6 +2039,28 @@ SDL_GetWindowSize(SDL_Window * window, int *w, int *h) } } +int +SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + int dummy = 0; + + if (!top) { top = &dummy; } + if (!left) { left = &dummy; } + if (!right) { right = &dummy; } + if (!bottom) { bottom = &dummy; } + + /* Always initialize, so applications don't have to care */ + *top = *left = *bottom = *right = 0; + + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->GetWindowBordersSize) { + return SDL_Unsupported(); + } + + return _this->GetWindowBordersSize(_this, window, top, left, bottom, right); +} + void SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) { @@ -1872,9 +2074,16 @@ SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) return; } + if ((window->max_w && min_w >= window->max_w) || + (window->max_h && min_h >= window->max_h)) { + SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size"); + return; + } + + window->min_w = min_w; + window->min_h = min_h; + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->min_w = min_w; - window->min_h = min_h; if (_this->SetWindowMinimumSize) { _this->SetWindowMinimumSize(_this, window); } @@ -1908,9 +2117,15 @@ SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h) return; } + if (max_w <= window->min_w || max_h <= window->min_h) { + SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); + return; + } + + window->max_w = max_w; + window->max_h = max_h; + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->max_w = max_w; - window->max_h = max_h; if (_this->SetWindowMaximumSize) { _this->SetWindowMaximumSize(_this, window); } @@ -1955,13 +2170,13 @@ SDL_HideWindow(SDL_Window * window) return; } - window->is_hiding = SDL_TRUE; + window->is_hiding = SDL_TRUE; SDL_UpdateFullscreenMode(window, SDL_FALSE); if (_this->HideWindow) { _this->HideWindow(_this, window); } - window->is_hiding = SDL_FALSE; + window->is_hiding = SDL_FALSE; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } @@ -2144,6 +2359,68 @@ SDL_GetWindowBrightness(SDL_Window * window) return window->brightness; } +int +SDL_SetWindowOpacity(SDL_Window * window, float opacity) +{ + int retval; + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->SetWindowOpacity) { + return SDL_Unsupported(); + } + + if (opacity < 0.0f) { + opacity = 0.0f; + } else if (opacity > 1.0f) { + opacity = 1.0f; + } + + retval = _this->SetWindowOpacity(_this, window, opacity); + if (retval == 0) { + window->opacity = opacity; + } + + return retval; +} + +int +SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (out_opacity) { + *out_opacity = window->opacity; + } + + return 0; +} + +int +SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window) +{ + CHECK_WINDOW_MAGIC(modal_window, -1); + CHECK_WINDOW_MAGIC(parent_window, -1); + + if (!_this->SetWindowModalFor) { + return SDL_Unsupported(); + } + + return _this->SetWindowModalFor(_this, modal_window, parent_window); +} + +int +SDL_SetWindowInputFocus(SDL_Window * window) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (!_this->SetWindowInputFocus) { + return SDL_Unsupported(); + } + + return _this->SetWindowInputFocus(_this, window); +} + + int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, @@ -2359,28 +2636,19 @@ SDL_OnWindowFocusGained(SDL_Window * window) static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window * window) { - const char *hint; - if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) { return SDL_FALSE; } #ifdef __MACOSX__ - if (Cocoa_IsWindowInFullscreenSpace(window)) { - return SDL_FALSE; - } -#endif - - hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); - if (hint) { - if (*hint == '0') { + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (Cocoa_IsWindowInFullscreenSpace(window)) { return SDL_FALSE; - } else { - return SDL_TRUE; } } +#endif - return SDL_TRUE; + return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_TRUE); } void @@ -2455,6 +2723,9 @@ SDL_DestroyWindow(SDL_Window * window) if (window->flags & SDL_WINDOW_OPENGL) { SDL_GL_UnloadLibrary(); } + if (window->flags & SDL_WINDOW_VULKAN) { + SDL_Vulkan_UnloadLibrary(); + } display = SDL_GetDisplayForWindow(window); if (display->fullscreen_window == window) { @@ -2593,7 +2864,7 @@ SDL_GL_LoadLibrary(const char *path) retval = 0; } else { if (!_this->GL_LoadLibrary) { - return SDL_SetError("No dynamic GL support in video driver"); + return SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name); } retval = _this->GL_LoadLibrary(_this, path); } @@ -2624,7 +2895,7 @@ SDL_GL_GetProcAddress(const char *proc) SDL_SetError("No GL driver has been loaded"); } } else { - SDL_SetError("No dynamic GL support in video driver"); + SDL_SetError("No dynamic GL support in current SDL video driver (%s)", _this->name); } return func; } @@ -2646,11 +2917,13 @@ SDL_GL_UnloadLibrary(void) } } +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) { return (verstr && (SDL_atoi(verstr) >= 3)); } +#endif SDL_bool SDL_GL_ExtensionSupported(const char *extension) @@ -2724,7 +2997,7 @@ SDL_GL_ExtensionSupported(const char *extension) break; terminator = where + SDL_strlen(extension); - if (where == start || *(where - 1) == ' ') + if (where == extensions || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') return SDL_TRUE; @@ -2736,6 +3009,37 @@ SDL_GL_ExtensionSupported(const char *extension) #endif } +/* Deduce supported ES profile versions from the supported + ARB_ES*_compatibility extensions. There is no direct query. + + This is normally only called when the OpenGL driver supports + {GLX,WGL}_EXT_create_context_es2_profile. + */ +void +SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor) +{ +/* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */ +/* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */ +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* XXX This is fragile; it will break in the event of release of + * new versions of OpenGL ES. + */ + if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) { + *major = 3; + *minor = 2; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) { + *major = 3; + *minor = 1; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) { + *major = 3; + *minor = 0; + } else { + *major = 2; + *minor = 0; + } +#endif +} + void SDL_GL_ResetAttributes() { @@ -2760,22 +3064,32 @@ SDL_GL_ResetAttributes() _this->gl_config.multisamplesamples = 0; _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ - _this->gl_config.profile_mask = 0; + + if (_this->GL_DefaultProfileConfig) { + _this->GL_DefaultProfileConfig(_this, &_this->gl_config.profile_mask, + &_this->gl_config.major_version, + &_this->gl_config.minor_version); + } else { #if SDL_VIDEO_OPENGL - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 1; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = 0; #elif SDL_VIDEO_OPENGL_ES2 - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 0; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 0; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #elif SDL_VIDEO_OPENGL_ES - _this->gl_config.major_version = 1; - _this->gl_config.minor_version = 1; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 1; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #endif + } + _this->gl_config.flags = 0; _this->gl_config.framebuffer_srgb_capable = 0; + _this->gl_config.no_error = 0; _this->gl_config.release_behavior = SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; + _this->gl_config.reset_notification = SDL_GL_CONTEXT_RESET_NO_NOTIFICATION; _this->gl_config.share_with_current_context = 0; } @@ -2885,6 +3199,12 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: _this->gl_config.release_behavior = value; break; + case SDL_GL_CONTEXT_RESET_NOTIFICATION: + _this->gl_config.reset_notification = value; + break; + case SDL_GL_CONTEXT_NO_ERROR: + _this->gl_config.no_error = value; + break; default: retval = SDL_SetError("Unknown OpenGL attribute"); break; @@ -2916,9 +3236,17 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) GLenum attachmentattrib = 0; #endif + if (!value) { + return SDL_InvalidParamError("value"); + } + /* Clear value in any case */ *value = 0; + if (!_this) { + return SDL_UninitializedVideo(); + } + switch (attr) { case SDL_GL_RED_SIZE: #if SDL_VIDEO_OPENGL @@ -3081,6 +3409,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) *value = _this->gl_config.framebuffer_srgb_capable; return 0; } + case SDL_GL_CONTEXT_NO_ERROR: + { + *value = _this->gl_config.no_error; + return 0; + } default: return SDL_SetError("Unknown OpenGL attribute"); } @@ -3088,7 +3421,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) #if SDL_VIDEO_OPENGL glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - return SDL_SetError("Failed getting OpenGL glGetString entry point"); + return -1; } if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { @@ -3097,7 +3430,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetFramebufferAttachmentParameterivFunc) { glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point"); + return -1; } } else #endif @@ -3107,13 +3440,13 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetIntegervFunc) { glGetIntegervFunc(attrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point"); + return -1; } } glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); if (!glGetErrorFunc) { - return SDL_SetError("Failed getting OpenGL glGetError entry point"); + return -1; } error = glGetErrorFunc(); @@ -3486,8 +3819,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "x11/SDL_x11messagebox.h" #endif -// This function will be unused if none of the above video drivers are present. -SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) + +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 +static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; SDL_Window *window = messageboxdata->window; @@ -3503,6 +3837,7 @@ SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData return (info.subsystem == drivertype); } } +#endif int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) @@ -3516,6 +3851,8 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) if (!messageboxdata) { return SDL_InvalidParamError("messageboxdata"); + } else if (messageboxdata->numbuttons < 0) { + return SDL_SetError("Invalid number of buttons"); } current_window = SDL_GetKeyboardFocus(); @@ -3596,6 +3933,16 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window) { +#ifdef __EMSCRIPTEN__ + /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */ + /* Web browsers don't (currently) have an API for a custom message box + that can block, but for the most common case (SDL_ShowSimpleMessageBox), + we can use the standard Javascript alert() function. */ + EM_ASM_({ + alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1)); + }, title, message); + return 0; +#else SDL_MessageBoxData data; SDL_MessageBoxButtonData button; @@ -3613,20 +3960,13 @@ SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, S button.text = "OK"; return SDL_ShowMessageBox(&data, NULL); +#endif } SDL_bool SDL_ShouldAllowTopmost(void) { - const char *hint = SDL_GetHint(SDL_HINT_ALLOW_TOPMOST); - if (hint) { - if (*hint == '0') { - return SDL_FALSE; - } else { - return SDL_TRUE; - } - } - return SDL_TRUE; + return SDL_GetHintBoolean(SDL_HINT_ALLOW_TOPMOST, SDL_TRUE); } int @@ -3646,15 +3986,176 @@ SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *userdata) return 0; } -float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) +float +SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) +{ + float den2 = hinches * hinches + vinches * vinches; + if (den2 <= 0.0f) { + return 0.0f; + } + + return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / + SDL_sqrt((double)den2)); +} + +/* + * Functions used by iOS application delegates + */ +void SDL_OnApplicationWillTerminate(void) +{ + SDL_SendAppEvent(SDL_APP_TERMINATING); +} + +void SDL_OnApplicationDidReceiveMemoryWarning(void) +{ + SDL_SendAppEvent(SDL_APP_LOWMEMORY); +} + +void SDL_OnApplicationWillResignActive(void) +{ + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + } + } + SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); +} + +void SDL_OnApplicationDidEnterBackground(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); +} + +void SDL_OnApplicationWillEnterForeground(void) +{ + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); +} + +void SDL_OnApplicationDidBecomeActive(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); + + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } + } +} + +#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window" + +int SDL_Vulkan_LoadLibrary(const char *path) +{ + int retval; + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + if (_this->vulkan_config.loader_loaded) { + if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) { + return SDL_SetError("Vulkan loader library already loaded"); + } + retval = 0; + } else { + if (!_this->Vulkan_LoadLibrary) { + return SDL_SetError("Vulkan support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); + } + retval = _this->Vulkan_LoadLibrary(_this, path); + } + if (retval == 0) { + _this->vulkan_config.loader_loaded++; + } + return retval; +} + +void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return NULL; + } + if (!_this->vulkan_config.loader_loaded) { + SDL_SetError("No Vulkan loader has been loaded"); + return NULL; + } + return _this->vulkan_config.vkGetInstanceProcAddr; +} + +void SDL_Vulkan_UnloadLibrary(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return; + } + if (_this->vulkan_config.loader_loaded > 0) { + if (--_this->vulkan_config.loader_loaded > 0) { + return; + } + if (_this->Vulkan_UnloadLibrary) { + _this->Vulkan_UnloadLibrary(_this); + } + } +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names) +{ + if (window) { + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) + { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + } + + if (!count) { + SDL_InvalidParamError("count"); + return SDL_FALSE; + } + + return _this->Vulkan_GetInstanceExtensions(_this, window, count, names); +} + +SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) { - float den2 = hinches * hinches + vinches * vinches; - if ( den2 <= 0.0f ) { - return 0.0f; - } - - return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / - SDL_sqrt((double)den2)); + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + + if (!instance) { + SDL_InvalidParamError("instance"); + return SDL_FALSE; + } + + if (!surface) { + SDL_InvalidParamError("surface"); + return SDL_FALSE; + } + + return _this->Vulkan_CreateSurface(_this, window, instance, surface); +} + +void SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h) +{ + CHECK_WINDOW_MAGIC(window,); + + if (_this->Vulkan_GetDrawableSize) { + _this->Vulkan_GetDrawableSize(_this, window, w, h); + } else { + SDL_GetWindowSize(window, w, h); + } } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_internal.h b/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_internal.h new file mode 100644 index 0000000000..cdf464ee09 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_internal.h @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_vulkan_internal_h_ +#define SDL_vulkan_internal_h_ + +#include "../SDL_internal.h" + +#include "SDL_stdinc.h" + +#if defined(SDL_LOADSO_DISABLED) +#undef SDL_VIDEO_VULKAN +#define SDL_VIDEO_VULKAN 0 +#endif + +#if SDL_VIDEO_VULKAN + +#if SDL_VIDEO_DRIVER_ANDROID +#define VK_USE_PLATFORM_ANDROID_KHR +#endif +#if SDL_VIDEO_DRIVER_COCOA +#define VK_USE_PLATFORM_MACOS_MVK +#endif +#if SDL_VIDEO_DRIVER_MIR +#define VK_USE_PLATFORM_MIR_KHR +#endif +#if SDL_VIDEO_DRIVER_UIKIT +#define VK_USE_PLATFORM_IOS_MVK +#endif +#if SDL_VIDEO_DRIVER_WAYLAND +#define VK_USE_PLATFORM_WAYLAND_KHR +#include "wayland/SDL_waylanddyn.h" +#endif +#if SDL_VIDEO_DRIVER_WINDOWS +#define VK_USE_PLATFORM_WIN32_KHR +#include "../core/windows/SDL_windows.h" +#endif +#if SDL_VIDEO_DRIVER_X11 +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#endif + +#define VK_NO_PROTOTYPES +#include "./khronos/vulkan/vulkan.h" + +#include "SDL_vulkan.h" + + +extern const char *SDL_Vulkan_GetResultString(VkResult result); + +extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount); /* free returned list with SDL_free */ + +/* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of + * names passed in nameCount and names. */ +extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names); + +#else + +/* No SDL Vulkan support, just include the header for typedefs */ +#include "SDL_vulkan.h" + +typedef void (*PFN_vkGetInstanceProcAddr) (void); +typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void); + +#endif /* SDL_VIDEO_VULKAN */ + +#endif /* SDL_vulkan_internal_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_utils.c b/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_utils.c new file mode 100644 index 0000000000..1b242f1329 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_utils.c @@ -0,0 +1,172 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_vulkan_internal.h" +#include "SDL_error.h" + +#if SDL_VIDEO_VULKAN + +const char *SDL_Vulkan_GetResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount) +{ + Uint32 count = 0; + VkResult result = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL); + VkExtensionProperties *retval; + if(result == VK_ERROR_INCOMPATIBLE_DRIVER) + { + /* Avoid the ERR_MAX_STRLEN limit by passing part of the message + * as a string argument. + */ + SDL_SetError( + "You probably don't have a working Vulkan driver installed. %s %s %s(%d)", + "Getting Vulkan extensions failed:", + "vkEnumerateInstanceExtensionProperties returned", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + else if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + if(count == 0) + { + retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null + } + else + { + retval = SDL_calloc(count, sizeof(VkExtensionProperties)); + } + if(!retval) + { + SDL_OutOfMemory(); + return NULL; + } + result = vkEnumerateInstanceExtensionProperties(NULL, &count, retval); + if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + SDL_free(retval); + return NULL; + } + *extensionCount = count; + return retval; +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names) +{ + if (userNames) { + unsigned i; + + if (*userCount < nameCount) { + SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount); + return SDL_FALSE; + } + for (i = 0; i < nameCount; i++) { + userNames[i] = names[i]; + } + } + *userCount = nameCount; + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/SDL_yuv.c b/3rdparty/sdl2-2.0.9/src/video/SDL_yuv.c new file mode 100644 index 0000000000..03b04dc8a1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_yuv.c @@ -0,0 +1,1835 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_endian.h" +#include "SDL_video.h" +#include "SDL_pixels_c.h" +#include "SDL_yuv_c.h" + +#include "yuv2rgb/yuv_rgb.h" + +#define SDL_YUV_SD_THRESHOLD 576 + + +static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601; + + +void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode) +{ + SDL_YUV_ConversionMode = mode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode() +{ + return SDL_YUV_ConversionMode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height) +{ + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionMode(); + if (mode == SDL_YUV_CONVERSION_AUTOMATIC) { + if (height <= SDL_YUV_SD_THRESHOLD) { + mode = SDL_YUV_CONVERSION_BT601; + } else { + mode = SDL_YUV_CONVERSION_BT709; + } + } + return mode; +} + +static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type) +{ + switch (SDL_GetYUVConversionModeForResolution(width, height)) { + case SDL_YUV_CONVERSION_JPEG: + *yuv_type = YCBCR_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + *yuv_type = YCBCR_601; + break; + case SDL_YUV_CONVERSION_BT709: + *yuv_type = YCBCR_709; + break; + default: + return SDL_SetError("Unexpected YUV conversion mode"); + } + return 0; +} + +static SDL_bool IsPlanar2x2Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YV12 || + format == SDL_PIXELFORMAT_IYUV || + format == SDL_PIXELFORMAT_NV12 || + format == SDL_PIXELFORMAT_NV21); +} + +static SDL_bool IsPacked4Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch, + const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride) +{ + const Uint8 *planes[3] = { NULL, NULL, NULL }; + int pitches[3] = { 0, 0, 0 }; + + switch (format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + pitches[0] = yuv_pitch; + pitches[1] = (pitches[0] + 1) / 2; + pitches[2] = (pitches[0] + 1) / 2; + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + planes[2] = planes[1] + pitches[1] * ((height + 1) / 2); + break; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + pitches[0] = yuv_pitch; + planes[0] = (const Uint8 *)yuv; + break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pitches[0] = yuv_pitch; + pitches[1] = 2 * ((pitches[0] + 1) / 2); + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + break; + default: + return SDL_SetError("GetYUVPlanes(): Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + + switch (format) { + case SDL_PIXELFORMAT_YV12: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = planes[2]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_IYUV: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[2]; + *u = planes[1]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_YUY2: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 3; + *u = *y + 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_UYVY: + *y = planes[0] + 1; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y - 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_YVYU: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y + 3; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_NV12: + *y = planes[0]; + *y_stride = pitches[0]; + *u = planes[1]; + *v = *u + 1; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_NV21: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = *v + 1; + *uv_stride = pitches[1]; + break; + default: + /* Should have caught this above */ + return SDL_SetError("GetYUVPlanes[2]: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + return 0; +} + +static SDL_bool yuv_rgb_sse( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ +#ifdef __SSE2__ + if (!SDL_HasSSE2()) { + return SDL_FALSE; + } + + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } +#endif + return SDL_FALSE; +} + +static SDL_bool yuv_rgb_std( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + return SDL_FALSE; +} + +int +SDL_ConvertPixels_YUV_to_RGB(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + const Uint8 *y = NULL; + const Uint8 *u = NULL; + const Uint8 *v = NULL; + Uint32 y_stride = 0; + Uint32 uv_stride = 0; + YCbCrType yuv_type = YCBCR_601; + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, &y, &u, &v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + if (yuv_rgb_sse(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + /* No fast path for the RGB format, instead convert using an intermediate buffer */ + if (dst_format != SDL_PIXELFORMAT_ARGB8888) { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret < 0) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/RGB */ + ret = SDL_ConvertPixels(width, height, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } + + return SDL_SetError("Unsupported YUV conversion"); +} + +struct RGB2YUVFactors +{ + int y_offset; + float y[3]; /* Rfactor, Gfactor, Bfactor */ + float u[3]; /* Rfactor, Gfactor, Bfactor */ + float v[3]; /* Rfactor, Gfactor, Bfactor */ +}; + +static int +SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) +{ + const int src_pitch_x_2 = src_pitch * 2; + const int height_half = height / 2; + const int height_remainder = (height & 0x1); + const int width_half = width / 2; + const int width_remainder = (width & 0x1); + int i, j; + + static struct RGB2YUVFactors RGB2YUVFactorTables[SDL_YUV_CONVERSION_BT709 + 1] = + { + /* ITU-T T.871 (JPEG) */ + { + 0, + { 0.2990f, 0.5870f, 0.1140f }, + { -0.1687f, -0.3313f, 0.5000f }, + { 0.5000f, -0.4187f, -0.0813f }, + }, + /* ITU-R BT.601-7 */ + { + 16, + { 0.2568f, 0.5041f, 0.0979f }, + { -0.1482f, -0.2910f, 0.4392f }, + { 0.4392f, -0.3678f, -0.0714f }, + }, + /* ITU-R BT.709-6 */ + { + 16, + { 0.1826f, 0.6142f, 0.0620f }, + {-0.1006f, -0.3386f, 0.4392f }, + { 0.4392f, -0.3989f, -0.0403f }, + }, + }; + const struct RGB2YUVFactors *cvt = &RGB2YUVFactorTables[SDL_GetYUVConversionModeForResolution(width, height)]; + +#define MAKE_Y(r, g, b) (Uint8)((int)(cvt->y[0] * (r) + cvt->y[1] * (g) + cvt->y[2] * (b) + 0.5f) + cvt->y_offset) +#define MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128) +#define MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128) + +#define READ_2x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \ + +#define READ_2x1_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x1_PIXEL \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + +#define READ_TWO_RGB_PIXELS \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r1 = (p1 & 0x00ff0000) >> 16; \ + const Uint32 g1 = (p1 & 0x0000ff00) >> 8; \ + const Uint32 b1 = (p1 & 0x000000ff); \ + const Uint32 R = (r + r1)/2; \ + const Uint32 G = (g + g1)/2; \ + const Uint32 B = (b + b1)/2; \ + +#define READ_ONE_RGB_PIXEL READ_1x1_PIXEL + + switch (dst_format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + const Uint8 *curr_row, *next_row; + + Uint8 *plane_y; + Uint8 *plane_u; + Uint8 *plane_v; + Uint8 *plane_interleaved_uv; + Uint32 y_stride, uv_stride, y_skip, uv_skip; + + GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, + &y_stride, &uv_stride); + plane_interleaved_uv = (plane_y + height * y_stride); + y_skip = (y_stride - width); + + curr_row = (const Uint8*)src; + + /* Write Y plane */ + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + const Uint32 p1 = ((const Uint32 *)curr_row)[i]; + const Uint32 r = (p1 & 0x00ff0000) >> 16; + const Uint32 g = (p1 & 0x0000ff00) >> 8; + const Uint32 b = (p1 & 0x000000ff); + *plane_y++ = MAKE_Y(r, g, b); + } + plane_y += y_skip; + curr_row += src_pitch; + } + + curr_row = (const Uint8*)src; + next_row = (const Uint8*)src; + next_row += src_pitch; + + if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV) + { + /* Write UV planes, not interleaved */ + uv_skip = (uv_stride - (width + 1)/2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + } + } + else if (dst_format == SDL_PIXELFORMAT_NV12) + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + } + } + else /* dst_format == SDL_PIXELFORMAT_NV21 */ + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + } + } + } + break; + + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + { + const Uint8 *curr_row = (const Uint8*) src; + Uint8 *plane = (Uint8*) dst; + const int row_size = (4 * ((width + 1) / 2)); + int plane_skip; + + if (dst_pitch < row_size) { + return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size); + } + plane_skip = (dst_pitch - row_size); + + /* Write YUV plane, packed */ + if (dst_format == SDL_PIXELFORMAT_YUY2) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y U Y1 V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_V(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y U Y V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_UYVY) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* U Y V Y1 */ + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* U Y V Y */ + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_YVYU) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y V Y1 U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_U(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y V Y U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + } + break; + + default: + return SDL_SetError("Unsupported YUV destination format: %s", SDL_GetPixelFormatName(dst_format)); + } +#undef MAKE_Y +#undef MAKE_U +#undef MAKE_V +#undef READ_2x2_PIXELS +#undef READ_2x1_PIXELS +#undef READ_1x2_PIXELS +#undef READ_1x1_PIXEL +#undef READ_TWO_RGB_PIXELS +#undef READ_ONE_RGB_PIXEL + return 0; +} + +int +SDL_ConvertPixels_RGB_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ +#if 0 /* Doesn't handle odd widths */ + /* RGB24 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_RGB24) { + Uint8 *y; + Uint8 *u; + Uint8 *v; + Uint32 y_stride; + Uint32 uv_stride; + YCbCrType yuv_type; + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, (const Uint8 **)&y, (const Uint8 **)&u, (const Uint8 **)&v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + rgb24_yuv420_std(width, height, src, src_pitch, y, u, v, y_stride, uv_stride, yuv_type); + return 0; + } +#endif + + /* ARGB8888 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_ARGB8888) { + return SDL_ConvertPixels_ARGB8888_to_YUV(width, height, src, src_pitch, dst_format, dst, dst_pitch); + } + + /* not ARGB8888 to FOURCC : need an intermediate conversion */ + { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret == -1) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/FOURCC */ + ret = SDL_ConvertPixels_ARGB8888_to_YUV(width, height, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } +} + +static int +SDL_ConvertPixels_YUV_to_YUV_Copy(int width, int height, Uint32 format, + const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int i; + + if (IsPlanar2x2Format(format)) { + /* Y plane */ + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + + if (format == SDL_PIXELFORMAT_YV12 || format == SDL_PIXELFORMAT_IYUV) { + /* U and V planes are a quarter the size of the Y plane, rounded up */ + width = (width + 1) / 2; + height = (height + 1) / 2; + src_pitch = (src_pitch + 1) / 2; + dst_pitch = (dst_pitch + 1) / 2; + for (i = height * 2; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } else if (format == SDL_PIXELFORMAT_NV12 || format == SDL_PIXELFORMAT_NV21) { + /* U/V plane is half the height of the Y plane, rounded up */ + height = (height + 1) / 2; + width = ((width + 1) / 2)*2; + src_pitch = ((src_pitch + 1) / 2)*2; + dst_pitch = ((dst_pitch + 1) / 2)*2; + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } + return 0; + } + + if (IsPacked4Format(format)) { + /* Packed planes */ + width = 4 * ((width + 1) / 2); + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + return 0; + } + + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV_Copy: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); +} + +static int +SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + int UVpitch = (dst_pitch + 1)/2; + Uint8 *tmp; + Uint8 *row1 = dst; + Uint8 *row2 = (Uint8 *)dst + UVheight * UVpitch; + + /* Allocate a temporary row for the swap */ + tmp = (Uint8 *)SDL_malloc(UVwidth); + if (!tmp) { + return SDL_OutOfMemory(); + } + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(tmp, row1, UVwidth); + SDL_memcpy(row1, row2, UVwidth); + SDL_memcpy(row2, tmp, UVwidth); + row1 += UVpitch; + row2 += UVpitch; + } + SDL_free(tmp); + } else { + const Uint8 *srcUV; + Uint8 *dstUV; + int srcUVPitch = ((src_pitch + 1)/2); + int dstUVPitch = ((dst_pitch + 1)/2); + + /* Copy the first plane */ + srcUV = (const Uint8 *)src; + dstUV = (Uint8 *)dst + UVheight * dstUVPitch; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + + /* Copy the second plane */ + dstUV = (Uint8 *)dst; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + } + return 0; +} + +static int +SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2); + const int srcUVPitchLeft = srcUVPitch - UVwidth; + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = dstUVPitch - UVwidth*2; + const Uint8 *src1, *src2; + Uint8 *dstUV; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(2*UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, 2*UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + src2 = (const Uint8 *)src; + src1 = src2 + UVheight * srcUVPitch; + } else { + src1 = (const Uint8 *)src; + src2 = src1 + UVheight * srcUVPitch; + } + dstUV = (Uint8 *)dst; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 16) { + __m128i u = _mm_loadu_si128((__m128i *)src1); + __m128i v = _mm_loadu_si128((__m128i *)src2); + __m128i uv1 = _mm_unpacklo_epi8(u, v); + __m128i uv2 = _mm_unpackhi_epi8(u, v); + _mm_storeu_si128((__m128i*)dstUV, uv1); + _mm_storeu_si128((__m128i*)(dstUV + 16), uv2); + src1 += 16; + src2 += 16; + dstUV += 32; + x -= 16; + } + } +#endif + while (x--) { + *dstUV++ = *src1++; + *dstUV++ = *src2++; + } + src1 += srcUVPitchLeft; + src2 += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = srcUVPitch - UVwidth*2; + const int dstUVPitch = ((dst_pitch + 1)/2); + const int dstUVPitchLeft = dstUVPitch - UVwidth; + const Uint8 *srcUV; + Uint8 *dst1, *dst2; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + dst2 = (Uint8 *)dst; + dst1 = dst2 + UVheight * dstUVPitch; + } else { + dst1 = (Uint8 *)dst; + dst2 = dst1 + UVheight * dstUVPitch; + } + srcUV = (const Uint8 *)src; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + __m128i mask = _mm_set1_epi16(0x00FF); + while (x >= 16) { + __m128i uv1 = _mm_loadu_si128((__m128i*)srcUV); + __m128i uv2 = _mm_loadu_si128((__m128i*)(srcUV+16)); + __m128i u1 = _mm_and_si128(uv1, mask); + __m128i u2 = _mm_and_si128(uv2, mask); + __m128i u = _mm_packus_epi16(u1, u2); + __m128i v1 = _mm_srli_epi16(uv1, 8); + __m128i v2 = _mm_srli_epi16(uv2, 8); + __m128i v = _mm_packus_epi16(v1, v2); + _mm_storeu_si128((__m128i*)dst1, u); + _mm_storeu_si128((__m128i*)dst2, v); + srcUV += 32; + dst1 += 16; + dst2 += 16; + x -= 16; + } + } +#endif + while (x--) { + *dst1++ = *srcUV++; + *dst2++ = *srcUV++; + } + srcUV += srcUVPitchLeft; + dst1 += dstUVPitchLeft; + dst2 += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = (srcUVPitch - UVwidth*2)/sizeof(Uint16); + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = (dstUVPitch - UVwidth*2)/sizeof(Uint16); + const Uint16 *srcUV; + Uint16 *dstUV; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + srcUV = (const Uint16 *)src; + dstUV = (Uint16 *)dst; + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 8) { + __m128i uv = _mm_loadu_si128((__m128i*)srcUV); + __m128i v = _mm_slli_epi16(uv, 8); + __m128i u = _mm_srli_epi16(uv, 8); + __m128i vu = _mm_or_si128(v, u); + _mm_storeu_si128((__m128i*)dstUV, vu); + srcUV += 8; + dstUV += 8; + x -= 8; + } + } +#endif + while (x--) { + *dstUV++ = SDL_Swap16(*srcUV++); + } + srcUV += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src != dst) { + /* Copy Y plane */ + int i; + const Uint8 *srcY = (const Uint8 *)src; + Uint8 *dstY = (Uint8 *)dst; + for (i = height; i--; ) { + SDL_memcpy(dstY, srcY, width); + srcY += src_pitch; + dstY += dst_pitch; + } + } + + switch (src_format) { + case SDL_PIXELFORMAT_YV12: + switch (dst_format) { + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + default: + break; + } + break; + case SDL_PIXELFORMAT_IYUV: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV12: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV21: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \ + while (x >= 4) { \ + __m128i yuv = _mm_loadu_si128((__m128i*)srcYUV); \ + __m128i lo = _mm_unpacklo_epi8(yuv, _mm_setzero_si128()); \ + __m128i hi = _mm_unpackhi_epi8(yuv, _mm_setzero_si128()); \ + lo = _mm_shufflelo_epi16(lo, shuffle); \ + lo = _mm_shufflehi_epi16(lo, shuffle); \ + hi = _mm_shufflelo_epi16(hi, shuffle); \ + hi = _mm_shufflehi_epi16(hi, shuffle); \ + yuv = _mm_packus_epi16(lo, hi); \ + _mm_storeu_si128((__m128i*)dstYUV, yuv); \ + srcYUV += 16; \ + dstYUV += 16; \ + x -= 4; \ + } \ + +static int +SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(0, 3, 2, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 1, 0, 3)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + switch (src_format) { + case SDL_PIXELFORMAT_YUY2: + switch (dst_format) { + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YUY2_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_YUY2_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_UYVY: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_UYVY_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_UYVY_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_YVYU: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_YVYU_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YVYU_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +static int +SDL_ConvertPixels_Planar2x2_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU, *srcV; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 srcY_pitch_left, srcUV_pitch_left, srcUV_pixel_stride; + Uint8 *dstY1, *dstY2, *dstU1, *dstU2, *dstV1, *dstV2; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dst_pitch_left; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU, &srcV, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcY_pitch_left = (srcY_pitch - width); + + if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { + srcUV_pixel_stride = 2; + srcUV_pitch_left = (srcUV_pitch - 2*((width + 1)/2)); + } else { + srcUV_pixel_stride = 1; + srcUV_pitch_left = (srcUV_pitch - ((width + 1)/2)); + } + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU1, (const Uint8 **)&dstV1, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstU2 = dstU1 + dstUV_pitch; + dstV2 = dstV1 + dstUV_pitch; + dst_pitch_left = (dstY_pitch - 4*((width + 1)/2)); + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2++; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + srcY1 += srcY_pitch_left + srcY_pitch; + srcY2 += srcY_pitch_left + srcY_pitch; + srcU += srcUV_pitch_left; + srcV += srcUV_pitch_left; + dstY1 += dst_pitch_left + dstY_pitch; + dstY2 += dst_pitch_left + dstY_pitch; + dstU1 += dst_pitch_left + dstUV_pitch; + dstU2 += dst_pitch_left + dstUV_pitch; + dstV1 += dst_pitch_left + dstUV_pitch; + dstV2 += dst_pitch_left + dstUV_pitch; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU1, *srcU2, *srcV1, *srcV2; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 src_pitch_left; + Uint8 *dstY1, *dstY2, *dstU, *dstV; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dstY_pitch_left, dstUV_pitch_left, dstUV_pixel_stride; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU1, &srcV1, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcU2 = srcU1 + srcUV_pitch; + srcV2 = srcV1 + srcUV_pitch; + src_pitch_left = (srcY_pitch - 4*((width + 1)/2)); + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU, (const Uint8 **)&dstV, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstY_pitch_left = (dstY_pitch - width); + + if (dst_format == SDL_PIXELFORMAT_NV12 || dst_format == SDL_PIXELFORMAT_NV21) { + dstUV_pixel_stride = 2; + dstUV_pitch_left = (dstUV_pitch - 2*((width + 1)/2)); + } else { + dstUV_pixel_stride = 1; + dstUV_pitch_left = (dstUV_pitch - ((width + 1)/2)); + } + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2++ = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2 = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + srcY1 += src_pitch_left + srcY_pitch; + srcY2 += src_pitch_left + srcY_pitch; + srcU1 += src_pitch_left + srcUV_pitch; + srcU2 += src_pitch_left + srcUV_pitch; + srcV1 += src_pitch_left + srcUV_pitch; + srcV2 += src_pitch_left + srcUV_pitch; + dstY1 += dstY_pitch_left + dstY_pitch; + dstY2 += dstY_pitch_left + dstY_pitch; + dstU += dstUV_pitch_left; + dstV += dstUV_pitch_left; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + *dstU = *srcU1; + *dstV = *srcV1; + + srcU1 += 4; + srcV1 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + *dstY1 = *srcY1; + *dstU = *srcU1; + *dstV = *srcV1; + } + } + return 0; +} + +int +SDL_ConvertPixels_YUV_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src_format == dst_format) { + if (src == dst) { + /* Nothing to do */ + return 0; + } + return SDL_ConvertPixels_YUV_to_YUV_Copy(width, height, src_format, src, src_pitch, dst, dst_pitch); + } + + if (IsPlanar2x2Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPlanar2x2Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else { + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/SDL_yuv_c.h b/3rdparty/sdl2-2.0.9/src/video/SDL_yuv_c.h new file mode 100644 index 0000000000..192bd2c571 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/SDL_yuv_c.h @@ -0,0 +1,36 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_yuv_c_h_ +#define SDL_yuv_c_h_ + +#include "../SDL_internal.h" + + +/* YUV conversion functions */ + +extern int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); + +#endif /* SDL_yuv_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.c index b996e7a409..c913af513e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" - +#include "SDL_androidclipboard.h" #include "../../core/android/SDL_android.h" int diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.h index a61045ae8f..7f48b0e46b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidclipboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidclipboard_h -#define _SDL_androidclipboard_h +#ifndef SDL_androidclipboard_h_ +#define SDL_androidclipboard_h_ extern int Android_SetClipboardText(_THIS, const char *text); extern char *Android_GetClipboardText(_THIS); extern SDL_bool Android_HasClipboardText(_THIS); -#endif /* _SDL_androidclipboard_h */ +#endif /* SDL_androidclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.c index 326361af07..6cf9af2162 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,19 +29,17 @@ #include "SDL_events.h" #include "SDL_androidwindow.h" - -void android_egl_context_backup(); -void android_egl_context_restore(); - -#if SDL_AUDIO_DRIVER_ANDROID -void AndroidAUD_ResumeDevices(void); -void AndroidAUD_PauseDevices(void); +#if !SDL_AUDIO_DISABLED +/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" + * because of THIS redefinition */ +extern void ANDROIDAUDIO_ResumeDevices(void); +extern void ANDROIDAUDIO_PauseDevices(void); #else -static void AndroidAUD_ResumeDevices(void) {} -static void AndroidAUD_PauseDevices(void) {} +static void ANDROIDAUDIO_ResumeDevices(void) {} +static void ANDROIDAUDIO_PauseDevices(void) {} #endif -void +static void android_egl_context_restore() { SDL_Event event; @@ -55,7 +53,7 @@ android_egl_context_restore() } } -void +static void android_egl_context_backup() { /* Keep a copy of the EGL Context so we can try to restore it when we resume */ @@ -83,14 +81,14 @@ Android_PumpEvents(_THIS) if (isPaused && !isPausing) { /* Make sure this is the last thing we do before pausing */ android_egl_context_backup(); - AndroidAUD_PauseDevices(); + ANDROIDAUDIO_PauseDevices(); if(SDL_SemWait(Android_ResumeSem) == 0) { #else if (isPaused) { if(SDL_SemTryWait(Android_ResumeSem) == 0) { #endif isPaused = 0; - AndroidAUD_ResumeDevices(); + ANDROIDAUDIO_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ if (!SDL_HasEvent(SDL_QUIT)) { android_egl_context_restore(); @@ -113,7 +111,7 @@ Android_PumpEvents(_THIS) #else if(SDL_SemTryWait(Android_PauseSem) == 0) { android_egl_context_backup(); - AndroidAUD_PauseDevices(); + ANDROIDAUDIO_PauseDevices(); isPaused = 1; } #endif diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.h index 4a2230e205..00e7427517 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidgl.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidgl.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.c index 4cfe86357c..859b46e9f6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidgl.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_androidwindow.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "../../core/android/SDL_android.h" #include @@ -38,7 +39,7 @@ SDL_EGL_CreateContext_impl(Android) SDL_EGL_MakeCurrent_impl(Android) -void +int Android_GLES_SwapWindow(_THIS, SDL_Window * window) { /* The following two calls existed in the original Java code @@ -48,12 +49,12 @@ Android_GLES_SwapWindow(_THIS, SDL_Window * window) /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE); _this->egl_data->eglWaitGL();*/ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); } int Android_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0, 0); } #endif /* SDL_VIDEO_DRIVER_ANDROID */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents_c.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.h similarity index 70% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.h index 62b163bf6e..1dab5a6d14 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidgl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,20 +18,17 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "../../SDL_internal.h" -#ifndef _SDL_waylandevents_h -#define _SDL_waylandevents_h - -#include "SDL_waylandvideo.h" -#include "SDL_waylandwindow.h" +#ifndef SDL_androidgl_h_ +#define SDL_androidgl_h_ -extern void Wayland_PumpEvents(_THIS); +SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); +int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int Android_GLES_SwapWindow(_THIS, SDL_Window * window); +int Android_GLES_LoadLibrary(_THIS, const char *path); -extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id); -extern void Wayland_display_destroy_input(SDL_VideoData *d); -#endif /* _SDL_waylandevents_h */ +#endif /* SDL_androidgl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.c index dc8951ff99..6c94caca6b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,8 +129,8 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_AUDIOSTOP, /* AKEYCODE_MEDIA_STOP */ SDL_SCANCODE_AUDIONEXT, /* AKEYCODE_MEDIA_NEXT */ SDL_SCANCODE_AUDIOPREV, /* AKEYCODE_MEDIA_PREVIOUS */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_REWIND */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_FAST_FORWARD */ + SDL_SCANCODE_AUDIOREWIND, /* AKEYCODE_MEDIA_REWIND */ + SDL_SCANCODE_AUDIOFASTFORWARD, /* AKEYCODE_MEDIA_FAST_FORWARD */ SDL_SCANCODE_MUTE, /* AKEYCODE_MUTE */ SDL_SCANCODE_PAGEUP, /* AKEYCODE_PAGE_UP */ SDL_SCANCODE_PAGEDOWN, /* AKEYCODE_PAGE_DOWN */ @@ -304,18 +304,22 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_NEXT */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_IN */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_NAVIGATE_OUT */ - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, - SDL_SCANCODE_UNKNOWN, + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_PRIMARY */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_1 */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_2 */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_STEM_3 */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_UP_LEFT */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_DOWN_LEFT */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_UP_RIGHT */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_DPAD_DOWN_RIGHT */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_FORWARD */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_SKIP_BACKWARD */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_FORWARD */ SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_STEP_BACKWARD */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_SLEEP */ + SDL_SCANCODE_CUT, /* AKEYCODE_CUT */ + SDL_SCANCODE_COPY, /* AKEYCODE_COPY */ + SDL_SCANCODE_PASTE, /* AKEYCODE_PASTE */ }; static SDL_Scancode @@ -353,7 +357,7 @@ Android_HasScreenKeyboardSupport(_THIS) SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window) { - return SDL_IsTextInputActive(); + return Android_JNI_IsScreenKeyboardShown(); } void diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.h index ced9bc24e9..a1a10f569b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidkeyboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.c index 61f67636a1..1716024816 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,12 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" +#include "SDL_androidmessagebox.h" +#include "../../core/android/SDL_android.h" int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { - int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - return Android_JNI_ShowMessageBox(messageboxdata, buttonid); } diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.h index 3c680c62ff..2c3a44f5d1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmessagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.c new file mode 100644 index 0000000000..037b4538cb --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.c @@ -0,0 +1,266 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_ANDROID + +#include "SDL_androidmouse.h" + +#include "SDL_events.h" +#include "../../events/SDL_mouse_c.h" + +#include "../../core/android/SDL_android.h" + +/* See Android's MotionEvent class for constants */ +#define ACTION_DOWN 0 +#define ACTION_UP 1 +#define ACTION_MOVE 2 +#define ACTION_HOVER_MOVE 7 +#define ACTION_SCROLL 8 +#define BUTTON_PRIMARY 1 +#define BUTTON_SECONDARY 2 +#define BUTTON_TERTIARY 4 +#define BUTTON_BACK 8 +#define BUTTON_FORWARD 16 + +typedef struct +{ + int custom_cursor; + int system_cursor; + +} SDL_AndroidCursorData; + +/* Last known Android mouse button state (includes all buttons) */ +static int last_state; + +/* Blank cursor */ +static SDL_Cursor *empty_cursor; + +static SDL_Cursor * +Android_WrapCursor(int custom_cursor, int system_cursor) +{ + SDL_Cursor *cursor; + + cursor = SDL_calloc(1, sizeof(*cursor)); + if (cursor) { + SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)SDL_calloc(1, sizeof(*data)); + if (data) { + data->custom_cursor = custom_cursor; + data->system_cursor = system_cursor; + cursor->driverdata = data; + } else { + SDL_free(cursor); + cursor = NULL; + SDL_OutOfMemory(); + } + } else { + SDL_OutOfMemory(); + } + + return cursor; +} + +static SDL_Cursor * +Android_CreateDefaultCursor() +{ + return Android_WrapCursor(0, SDL_SYSTEM_CURSOR_ARROW); +} + +static SDL_Cursor * +Android_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) +{ + int custom_cursor; + SDL_Surface *converted; + + converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); + if (!converted) { + return NULL; + } + custom_cursor = Android_JNI_CreateCustomCursor(converted, hot_x, hot_y); + SDL_FreeSurface(converted); + if (!custom_cursor) { + SDL_Unsupported(); + return NULL; + } + return Android_WrapCursor(custom_cursor, 0); +} + +static SDL_Cursor * +Android_CreateSystemCursor(SDL_SystemCursor id) +{ + return Android_WrapCursor(0, id); +} + +static void +Android_FreeCursor(SDL_Cursor * cursor) +{ + SDL_free(cursor->driverdata); + SDL_free(cursor); +} + +static SDL_Cursor * +Android_CreateEmptyCursor() +{ + if (!empty_cursor) { + SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888); + if (empty_surface) { + SDL_memset(empty_surface->pixels, 0, empty_surface->h * empty_surface->pitch); + empty_cursor = Android_CreateCursor(empty_surface, 0, 0); + SDL_FreeSurface(empty_surface); + } + } + return empty_cursor; +} + +static void +Android_DestroyEmptyCursor() +{ + if (empty_cursor) { + Android_FreeCursor(empty_cursor); + empty_cursor = NULL; + } +} + +static int +Android_ShowCursor(SDL_Cursor * cursor) +{ + if (!cursor) { + cursor = Android_CreateEmptyCursor(); + } + if (cursor) { + SDL_AndroidCursorData *data = (SDL_AndroidCursorData*)cursor->driverdata; + if (data->custom_cursor) { + if (!Android_JNI_SetCustomCursor(data->custom_cursor)) { + return SDL_Unsupported(); + } + } else { + if (!Android_JNI_SetSystemCursor(data->system_cursor)) { + return SDL_Unsupported(); + } + } + return 0; + } else { + /* SDL error set inside Android_CreateEmptyCursor() */ + return -1; + } +} + +static int +Android_SetRelativeMouseMode(SDL_bool enabled) +{ + if (!Android_JNI_SupportsRelativeMouse()) { + return SDL_Unsupported(); + } + + if (!Android_JNI_SetRelativeMouseEnabled(enabled)) { + return SDL_Unsupported(); + } + + return 0; +} + +void +Android_InitMouse(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + mouse->CreateCursor = Android_CreateCursor; + mouse->CreateSystemCursor = Android_CreateSystemCursor; + mouse->ShowCursor = Android_ShowCursor; + mouse->FreeCursor = Android_FreeCursor; + mouse->SetRelativeMouseMode = Android_SetRelativeMouseMode; + + SDL_SetDefaultCursor(Android_CreateDefaultCursor()); + + last_state = 0; +} + +void +Android_QuitMouse(void) +{ + Android_DestroyEmptyCursor(); +} + +/* Translate Android mouse button state to SDL mouse button */ +static Uint8 +TranslateButton(int state) +{ + if (state & BUTTON_PRIMARY) { + return SDL_BUTTON_LEFT; + } else if (state & BUTTON_SECONDARY) { + return SDL_BUTTON_RIGHT; + } else if (state & BUTTON_TERTIARY) { + return SDL_BUTTON_MIDDLE; + } else if (state & BUTTON_FORWARD) { + return SDL_BUTTON_X1; + } else if (state & BUTTON_BACK) { + return SDL_BUTTON_X2; + } else { + return 0; + } +} + +void +Android_OnMouse(int state, int action, float x, float y, SDL_bool relative) +{ + int changes; + Uint8 button; + + if (!Android_Window) { + return; + } + + switch(action) { + case ACTION_DOWN: + changes = state & ~last_state; + button = TranslateButton(changes); + last_state = state; + SDL_SendMouseMotion(Android_Window, 0, relative, x, y); + SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button); + break; + + case ACTION_UP: + changes = last_state & ~state; + button = TranslateButton(changes); + last_state = state; + SDL_SendMouseMotion(Android_Window, 0, relative, x, y); + SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button); + break; + + case ACTION_MOVE: + case ACTION_HOVER_MOVE: + SDL_SendMouseMotion(Android_Window, 0, relative, x, y); + break; + + case ACTION_SCROLL: + SDL_SendMouseWheel(Android_Window, 0, x, y, SDL_MOUSEWHEEL_NORMAL); + break; + + default: + break; + } +} + +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.h index 9b68eed57c..eca9e476aa 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidmouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,13 +19,15 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_androidmouse_h -#define _SDL_androidmouse_h +#ifndef SDL_androidmouse_h_ +#define SDL_androidmouse_h_ #include "SDL_androidvideo.h" -extern void Android_OnMouse( int button, int action, float x, float y); +extern void Android_InitMouse(void); +extern void Android_OnMouse(int button, int action, float x, float y, SDL_bool relative); +extern void Android_QuitMouse(void); -#endif /* _SDL_androidmouse_h */ +#endif /* SDL_androidmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.c index a6e0b896a7..5c3e4aaccd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,18 +50,15 @@ static void Android_GetWindowCoordinates(float x, float y, *window_y = (int)(y * window_h); } -static volatile SDL_bool separate_mouse_and_touch = SDL_FALSE; +static SDL_bool separate_mouse_and_touch = SDL_FALSE; -static void +static void SDLCALL SeparateEventsHintWatcher(void *userdata, const char *name, const char *oldValue, const char *newValue) { - jclass mActivityClass = Android_JNI_GetActivityClass(); - JNIEnv *env = Android_JNI_GetEnv(); - jfieldID fid = (*env)->GetStaticFieldID(env, mActivityClass, "mSeparateMouseAndTouch", "Z"); - separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); - (*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE); + + Android_JNI_SetSeparateMouseAndTouch(separate_mouse_and_touch); } void Android_InitTouch(void) diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.h index 2ad096ce80..e10be4f992 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidtouch.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.c similarity index 66% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.c index e14b96641c..589461afbe 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,24 +33,23 @@ #include "../../events/SDL_windowevents_c.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "SDL_androidclipboard.h" #include "SDL_androidevents.h" #include "SDL_androidkeyboard.h" +#include "SDL_androidmouse.h" #include "SDL_androidtouch.h" #include "SDL_androidwindow.h" +#include "SDL_androidvulkan.h" #define ANDROID_VID_DRIVER_NAME "Android" /* Initialization/Query functions */ static int Android_VideoInit(_THIS); static void Android_VideoQuit(_THIS); +int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); #include "../SDL_egl_c.h" -/* GL functions (SDL_androidgl.c) */ -extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); -extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void Android_GLES_SwapWindow(_THIS, SDL_Window * window); -extern int Android_GLES_LoadLibrary(_THIS, const char *path); #define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress #define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval @@ -61,10 +60,12 @@ extern int Android_GLES_LoadLibrary(_THIS, const char *path); /* These are filled in with real values in Android_SetScreenResolution on init (before SDL_main()) */ -int Android_ScreenWidth = 0; -int Android_ScreenHeight = 0; +int Android_SurfaceWidth = 0; +int Android_SurfaceHeight = 0; +int Android_DeviceWidth = 0; +int Android_DeviceHeight = 0; Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; -int Android_ScreenRate = 0; +static int Android_ScreenRate = 0; SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL; @@ -117,8 +118,11 @@ Android_CreateDevice(int devindex) device->VideoQuit = Android_VideoQuit; device->PumpEvents = Android_PumpEvents; - device->CreateWindow = Android_CreateWindow; + device->GetDisplayDPI = Android_GetDisplayDPI; + + device->CreateSDLWindow = Android_CreateWindow; device->SetWindowTitle = Android_SetWindowTitle; + device->SetWindowFullscreen = Android_SetWindowFullscreen; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; @@ -135,6 +139,13 @@ Android_CreateDevice(int devindex) device->GL_SwapWindow = Android_GLES_SwapWindow; device->GL_DeleteContext = Android_GLES_DeleteContext; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Android_Vulkan_CreateSurface; +#endif + /* Screensaver */ device->SuspendScreenSaver = Android_SuspendScreenSaver; @@ -167,8 +178,8 @@ Android_VideoInit(_THIS) SDL_DisplayMode mode; mode.format = Android_ScreenFormat; - mode.w = Android_ScreenWidth; - mode.h = Android_ScreenHeight; + mode.w = Android_DeviceWidth; + mode.h = Android_DeviceHeight; mode.refresh_rate = Android_ScreenRate; mode.driverdata = NULL; if (SDL_AddBasicVideoDisplay(&mode) < 0) { @@ -181,6 +192,8 @@ Android_VideoInit(_THIS) Android_InitTouch(); + Android_InitMouse(); + /* We're done! */ return 0; } @@ -188,20 +201,56 @@ Android_VideoInit(_THIS) void Android_VideoQuit(_THIS) { + Android_QuitMouse(); Android_QuitTouch(); } -/* This function gets called before VideoInit() */ +int +Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +{ + return Android_JNI_GetDisplayDPI(ddpi, hdpi, vdpi); +} + void -Android_SetScreenResolution(int width, int height, Uint32 format, float rate) +Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate) { - Android_ScreenWidth = width; - Android_ScreenHeight = height; + SDL_VideoDevice* device; + SDL_VideoDisplay *display; + Android_SurfaceWidth = surfaceWidth; + Android_SurfaceHeight = surfaceHeight; + Android_DeviceWidth = deviceWidth; + Android_DeviceHeight = deviceHeight; Android_ScreenFormat = format; Android_ScreenRate = rate; + /* + Update the resolution of the desktop mode, so that the window + can be properly resized. The screen resolution change can for + example happen when the Activity enters or exits immersive mode, + which can happen after VideoInit(). + */ + device = SDL_GetVideoDevice(); + if (device && device->num_displays > 0) + { + display = &device->displays[0]; + display->desktop_mode.format = Android_ScreenFormat; + display->desktop_mode.w = Android_DeviceWidth; + display->desktop_mode.h = Android_DeviceHeight; + display->desktop_mode.refresh_rate = Android_ScreenRate; + } + if (Android_Window) { - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); + /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event + * will fall back to the old mode */ + display = SDL_GetDisplayForWindow(Android_Window); + + display->display_modes[0].format = format; + display->display_modes[0].w = Android_DeviceWidth; + display->display_modes[0].h = Android_DeviceHeight; + display->display_modes[0].refresh_rate = rate; + display->current_mode = display->display_modes[0]; + + SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, surfaceWidth, surfaceHeight); } } diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.h similarity index 75% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.h index 0f76a91b17..6dce7ed7dd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidvideo_h -#define _SDL_androidvideo_h +#ifndef SDL_androidvideo_h_ +#define SDL_androidvideo_h_ #include "SDL_mutex.h" #include "SDL_rect.h" #include "../SDL_sysvideo.h" /* Called by the JNI layer when the screen changes size or format */ -extern void Android_SetScreenResolution(int width, int height, Uint32 format, float rate); +extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate); /* Private display data */ @@ -37,13 +37,15 @@ typedef struct SDL_VideoData SDL_Rect textRect; } SDL_VideoData; -extern int Android_ScreenWidth; -extern int Android_ScreenHeight; +extern int Android_SurfaceWidth; +extern int Android_SurfaceHeight; +extern int Android_DeviceWidth; +extern int Android_DeviceHeight; extern Uint32 Android_ScreenFormat; extern SDL_sem *Android_PauseSem, *Android_ResumeSem; extern SDL_Window *Android_Window; -#endif /* _SDL_androidvideo_h */ +#endif /* SDL_androidvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.c new file mode 100644 index 0000000000..e0130349eb --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.c @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +#include "SDL_androidvideo.h" +#include "SDL_androidwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_androidvulkan.h" +#include "SDL_syswm.h" + +int Android_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasAndroidSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasAndroidSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasAndroidSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Android_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForAndroid[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForAndroid), + extensionsForAndroid); +} + +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = + (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateAndroidSurfaceKHR"); + VkAndroidSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateAndroidSurfaceKHR) + { + SDL_SetError(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.window = windowData->native_window; + result = vkCreateAndroidSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateAndroidSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.h new file mode 100644 index 0000000000..2634c61f9a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_androidvulkan_h_ +#define SDL_androidvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +int Android_Vulkan_LoadLibrary(_THIS, const char *path); +void Android_Vulkan_UnloadLibrary(_THIS); +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_androidvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.c b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.c similarity index 64% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.c rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.c index 37a928faf0..cf18e67b43 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.c +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,9 +26,12 @@ #include "../SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_windowevents_c.h" +#include "../../core/android/SDL_android.h" #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" +#include "SDL_hints.h" int Android_CreateWindow(_THIS, SDL_Window * window) @@ -42,14 +45,16 @@ Android_CreateWindow(_THIS, SDL_Window * window) Android_PauseSem = SDL_CreateSemaphore(0); Android_ResumeSem = SDL_CreateSemaphore(0); + /* Set orientation */ + Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); + /* Adjust the window data to match the screen */ window->x = 0; window->y = 0; - window->w = Android_ScreenWidth; - window->h = Android_ScreenHeight; + window->w = Android_SurfaceWidth; + window->h = Android_SurfaceHeight; window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ - window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ window->flags &= ~SDL_WINDOW_HIDDEN; window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ @@ -69,13 +74,17 @@ Android_CreateWindow(_THIS, SDL_Window * window) SDL_free(data); return SDL_SetError("Could not fetch native window"); } - - data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); - if (data->egl_surface == EGL_NO_SURFACE) { - ANativeWindow_release(data->native_window); - SDL_free(data); - return SDL_SetError("Could not create GLES window surface"); + /* Do not create EGLSurface for Vulkan window since it will then make the window + incompatible with vkCreateAndroidSurfaceKHR */ + if ((window->flags & SDL_WINDOW_VULKAN) == 0) { + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); + + if (data->egl_surface == EGL_NO_SURFACE) { + ANativeWindow_release(data->native_window); + SDL_free(data); + return SDL_SetError("Could not create GLES window surface"); + } } window->driverdata = data; @@ -90,6 +99,41 @@ Android_SetWindowTitle(_THIS, SDL_Window * window) Android_JNI_SetActivityTitle(window->title); } +void +Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) +{ + /* If the window is being destroyed don't change visible state */ + if (!window->is_destroying) { + Android_JNI_SetWindowStyle(fullscreen); + } + + /* Ensure our size matches reality after we've executed the window style change. + * + * It is possible that we've set width and height to the full-size display, but on + * Samsung DeX or Chromebooks or other windowed Android environemtns, our window may + * still not be the full display size. + */ + if (!SDL_IsDeXMode() && !SDL_IsChromebook()) { + return; + } + + SDL_WindowData * data = (SDL_WindowData *)window->driverdata; + + if (!data || !data->native_window) { + return; + } + + int old_w = window->w; + int old_h = window->h; + + int new_w = ANativeWindow_getWidth(data->native_window); + int new_h = ANativeWindow_getHeight(data->native_window); + + if (old_w != new_w || old_h != new_h) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); + } +} + void Android_DestroyWindow(_THIS, SDL_Window * window) { @@ -128,7 +172,7 @@ Android_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.android.surface = data->egl_surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.h b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.h rename to 3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.h index 3ac99f42be..df99567ace 100644 --- a/3rdparty/sdl2-2.0.4/src/video/android/SDL_androidwindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidwindow_h -#define _SDL_androidwindow_h +#ifndef SDL_androidwindow_h_ +#define SDL_androidwindow_h_ #include "../../core/android/SDL_android.h" #include "../SDL_egl_c.h" extern int Android_CreateWindow(_THIS, SDL_Window * window); extern void Android_SetWindowTitle(_THIS, SDL_Window * window); +extern void Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern void Android_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info); @@ -39,6 +40,6 @@ typedef struct } SDL_WindowData; -#endif /* _SDL_androidwindow_h */ +#endif /* SDL_androidwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.h index 871b394f53..54e4c8813e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaclipboard_h -#define _SDL_cocoaclipboard_h +#ifndef SDL_cocoaclipboard_h_ +#define SDL_cocoaclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_cocoaclipboard_h */ +#endif /* SDL_cocoaclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.m similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.m index 015d771065..9c966342e7 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,23 +25,13 @@ #include "SDL_cocoavideo.h" #include "../../events/SDL_clipboardevents_c.h" -static NSString * -GetTextFormat(_THIS) -{ - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { - return NSPasteboardTypeString; - } else { - return NSStringPboardType; - } -} - int Cocoa_SetClipboardText(_THIS, const char *text) { @autoreleasepool { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSPasteboard *pasteboard; - NSString *format = GetTextFormat(_this); + NSString *format = NSPasteboardTypeString; pasteboard = [NSPasteboard generalPasteboard]; data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; @@ -55,12 +45,12 @@ { @autoreleasepool { NSPasteboard *pasteboard; - NSString *format = GetTextFormat(_this); + NSString *format = NSPasteboardTypeString; NSString *available; char *text; pasteboard = [NSPasteboard generalPasteboard]; - available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]]; + available = [pasteboard availableTypeFromArray:[NSArray arrayWithObject:format]]; if ([available isEqualToString:format]) { NSString* string; const char *utf8; diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.h index ea40e53170..986168ea31 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaevents_h -#define _SDL_cocoaevents_h +#ifndef SDL_cocoaevents_h_ +#define SDL_cocoaevents_h_ extern void Cocoa_RegisterApp(void); extern void Cocoa_PumpEvents(_THIS); extern void Cocoa_SuspendScreenSaver(_THIS); -#endif /* _SDL_cocoaevents_h */ +#endif /* SDL_cocoaevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.m similarity index 73% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.m index e0da11fd4e..76d235e3bb 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,9 @@ @interface SDLApplication : NSApplication - (void)terminate:(id)sender; +- (void)sendEvent:(NSEvent *)theEvent; + ++ (void)registerUserDefaults; @end @@ -47,6 +50,59 @@ - (void)terminate:(id)sender SDL_SendQuit(); } +static SDL_bool s_bShouldHandleEventsInSDLApplication = SDL_FALSE; + +static void Cocoa_DispatchEvent(NSEvent *theEvent) +{ + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + switch ([theEvent type]) { + case NSEventTypeLeftMouseDown: + case NSEventTypeOtherMouseDown: + case NSEventTypeRightMouseDown: + case NSEventTypeLeftMouseUp: + case NSEventTypeOtherMouseUp: + case NSEventTypeRightMouseUp: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */ + case NSEventTypeMouseMoved: + case NSEventTypeScrollWheel: + Cocoa_HandleMouseEvent(_this, theEvent); + break; + case NSEventTypeKeyDown: + case NSEventTypeKeyUp: + case NSEventTypeFlagsChanged: + Cocoa_HandleKeyEvent(_this, theEvent); + break; + default: + break; + } +} + +// Dispatch events here so that we can handle events caught by +// nextEventMatchingMask in SDL, as well as events caught by other +// processes (such as CEF) that are passed down to NSApp. +- (void)sendEvent:(NSEvent *)theEvent +{ + if (s_bShouldHandleEventsInSDLApplication) { + Cocoa_DispatchEvent(theEvent); + } + + [super sendEvent:theEvent]; +} + ++ (void)registerUserDefaults +{ + NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", + [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", + [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", + nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; + [appDefaults release]; +} + @end // SDLApplication /* setAppleMenu disappeared from the headers in 10.4 */ @@ -114,28 +170,23 @@ - (void)windowWillClose:(NSNotification *)notification; */ for (NSWindow *window in [NSApp orderedWindows]) { if (window != win && [window canBecomeKeyWindow]) { - if ([window respondsToSelector:@selector(isOnActiveSpace)]) { - if (![window isOnActiveSpace]) { - continue; - } + if (![window isOnActiveSpace]) { + continue; } [window makeKeyAndOrderFront:self]; return; } } - /* If a window wasn't found above, iterate through all visible windows - * (including the 'About' window, if it's shown) and make the first one key. - * Note that +[NSWindow windowNumbersWithOptions:] was added in 10.6. + /* If a window wasn't found above, iterate through all visible windows in + * the active Space in z-order (including the 'About' window, if it's shown) + * and make the first one key. */ - if ([NSWindow respondsToSelector:@selector(windowNumbersWithOptions:)]) { - /* Get all visible windows in the active Space, in z-order. */ - for (NSNumber *num in [NSWindow windowNumbersWithOptions:0]) { - NSWindow *window = [NSApp windowWithWindowNumber:[num integerValue]]; - if (window && window != win && [window canBecomeKeyWindow]) { - [window makeKeyAndOrderFront:self]; - return; - } + for (NSNumber *num in [NSWindow windowNumbersWithOptions:0]) { + NSWindow *window = [NSApp windowWithWindowNumber:[num integerValue]]; + if (window && window != win && [window canBecomeKeyWindow]) { + [window makeKeyAndOrderFront:self]; + return; } } } @@ -176,7 +227,23 @@ - (void)focusSomeWindow:(NSNotification *)aNotification - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { - return (BOOL)SDL_SendDropFile([filename UTF8String]); + return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL); +} + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + /* The menu bar of SDL apps which don't have the typical .app bundle + * structure fails to work the first time a window is created (until it's + * de-focused and re-focused), if this call is in Cocoa_RegisterApp instead + * of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051 + */ + if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { + [NSApp activateIgnoringOtherApps:YES]; + } + + /* If we call this before NSApp activation, macOS might print a complaint + * about ApplePersistenceIgnoreState. */ + [SDLApplication registerUserDefaults]; } @end @@ -251,7 +318,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)]; [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; @@ -291,13 +358,13 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam /* Add the fullscreen view toggle menu option, if supported */ - if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) { + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { /* Create the view menu */ viewMenu = [[NSMenu alloc] initWithTitle:@"View"]; /* Add menu items */ menuItem = [viewMenu addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""]; @@ -319,32 +386,22 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam [SDLApplication sharedApplication]; SDL_assert(NSApp != nil); - const char *hint = SDL_GetHint(SDL_HINT_MAC_BACKGROUND_APP); - if (!hint || *hint == '0') { -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 - if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) { -#endif - [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 - } else { - ProcessSerialNumber psn = {0, kCurrentProcess}; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - } -#endif - [NSApp activateIgnoringOtherApps:YES]; - } - + s_bShouldHandleEventsInSDLApplication = SDL_TRUE; + + if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + } + if ([NSApp mainMenu] == nil) { CreateApplicationMenus(); } [NSApp finishLaunching]; - NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", - [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", - [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", - nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [appDefaults release]; + if ([NSApp delegate]) { + /* The SDL app delegate calls this in didFinishLaunching if it's + * attached to the NSApp, otherwise we need to call it manually. + */ + [SDLApplication registerUserDefaults]; + } } if (NSApp && !appDelegate) { appDelegate = [[SDLAppDelegate alloc] init]; @@ -364,6 +421,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam Cocoa_PumpEvents(_THIS) { @autoreleasepool { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 /* Update activity every 30 seconds to prevent screensaver */ SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; if (_this->suspend_screensaver && !data->screensaver_use_iopm) { @@ -374,36 +432,19 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam data->screensaver_activity = now; } } +#endif for ( ; ; ) { - NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; + NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { break; } - switch ([event type]) { - case NSLeftMouseDown: - case NSOtherMouseDown: - case NSRightMouseDown: - case NSLeftMouseUp: - case NSOtherMouseUp: - case NSRightMouseUp: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: /* usually middle mouse dragged */ - case NSMouseMoved: - case NSScrollWheel: - Cocoa_HandleMouseEvent(_this, event); - break; - case NSKeyDown: - case NSKeyUp: - case NSFlagsChanged: - Cocoa_HandleKeyEvent(_this, event); - break; - default: - break; + if (!s_bShouldHandleEventsInSDLApplication) { + Cocoa_DispatchEvent(event); } - /* Pass through to NSApp to make sure everything stays in sync */ + + // Pass events down to SDLApplication to be handled in sendEvent: [NSApp sendEvent:event]; } }} diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.h index 4f9da0185c..7d89523812 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoakeyboard_h -#define _SDL_cocoakeyboard_h +#ifndef SDL_cocoakeyboard_h_ +#define SDL_cocoakeyboard_h_ extern void Cocoa_InitKeyboard(_THIS); extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event); @@ -31,6 +31,6 @@ extern void Cocoa_StartTextInput(_THIS); extern void Cocoa_StopTextInput(_THIS); extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect); -#endif /* _SDL_cocoakeyboard_h */ +#endif /* SDL_cocoakeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.m similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.m index 7f1d2308f3..8436047f9a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "../../events/scancodes_darwin.h" #include +#include /*#define DEBUG_IME NSLog */ #define DEBUG_IME(...) @@ -69,14 +70,6 @@ - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange SDL_SendKeyboardText(str); } -- (void)insertText:(id)insertString -{ - /* This method is part of NSTextInput and not NSTextInputClient, but - * apparently it still might be called in OS X 10.5 and can cause beeps if - * the implementation is missing: http://crbug.com/47890 */ - [self insertText:insertString replacementRange:NSMakeRange(0, 0)]; -} - - (void)doCommandBySelector:(SEL)myselector { /* No need to do anything since we are not using Cocoa @@ -100,9 +93,9 @@ - (NSRange)selectedRange return _selectedRange; } -- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange; +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { - if ([aString isKindOfClass: [NSAttributedString class]]) { + if ([aString isKindOfClass:[NSAttributedString class]]) { aString = [aString string]; } @@ -120,7 +113,7 @@ - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replaceme _markedRange = NSMakeRange(0, [aString length]); SDL_SendEditingText([aString UTF8String], - selectedRange.location, selectedRange.length); + (int) selectedRange.location, (int) selectedRange.length); DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText, selRange.location, selRange.length); @@ -134,7 +127,7 @@ - (void)unmarkText SDL_SendEditingText("", 0, 0); } -- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { NSWindow *window = [self window]; NSRect contentRect = [window contentRectForFrameRect:[window frame]]; @@ -150,16 +143,19 @@ - (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); - if ([[self window] respondsToSelector:@selector(convertRectToScreen:)]) { - rect = [[self window] convertRectToScreen:rect]; - } else { - rect.origin = [[self window] convertBaseToScreen:rect.origin]; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if (![window respondsToSelector:@selector(convertRectToScreen:)]) { + rect.origin = [window convertBaseToScreen:rect.origin]; + } else +#endif + { + rect = [window convertRectToScreen:rect]; } return rect; } -- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", aRange.location, aRange.length); return nil; @@ -191,6 +187,116 @@ - (NSArray *)validAttributesForMarkedText @end +/*------------------------------------------------------------------------------ +Set up a HID callback to properly detect Caps Lock up/down events. +Derived from: +http://stackoverflow.com/questions/7190852/using-iohidmanager-to-get-modifier-key-events +*/ + +static IOHIDManagerRef s_hidManager = NULL; + +static void +HIDCallback(void *context, IOReturn result, void *sender, IOHIDValueRef value) +{ + if (context != s_hidManager) { + /* An old callback, ignore it (related to bug 2157 below) */ + return; + } + + IOHIDElementRef elem = IOHIDValueGetElement(value); + if (IOHIDElementGetUsagePage(elem) != kHIDPage_KeyboardOrKeypad + || IOHIDElementGetUsage(elem) != kHIDUsage_KeyboardCapsLock) { + return; + } + CFIndex pressed = IOHIDValueGetIntegerValue(value); + SDL_SendKeyboardKey(pressed ? SDL_PRESSED : SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); +} + +static CFDictionaryRef +CreateHIDDeviceMatchingDictionary(UInt32 usagePage, UInt32 usage) +{ + CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, + 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + if (dict) { + CFNumberRef number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usagePage); + if (number) { + CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), number); + CFRelease(number); + number = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); + if (number) { + CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), number); + CFRelease(number); + return dict; + } + } + CFRelease(dict); + } + return NULL; +} + +static void +QuitHIDCallback() +{ + if (!s_hidManager) { + return; + } + +#if 0 /* Releasing here causes a crash on Mac OS X 10.10 and earlier, + * so just leak it for now. See bug 2157 for details. + */ + IOHIDManagerUnscheduleFromRunLoop(s_hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + IOHIDManagerRegisterInputValueCallback(s_hidManager, NULL, NULL); + IOHIDManagerClose(s_hidManager, 0); + + CFRelease(s_hidManager); +#endif + s_hidManager = NULL; +} + +static void +InitHIDCallback() +{ + s_hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + if (!s_hidManager) { + return; + } + CFDictionaryRef keyboard = NULL, keypad = NULL; + CFArrayRef matches = NULL; + keyboard = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard); + if (!keyboard) { + goto fail; + } + keypad = CreateHIDDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Keypad); + if (!keypad) { + goto fail; + } + CFDictionaryRef matchesList[] = { keyboard, keypad }; + matches = CFArrayCreate(kCFAllocatorDefault, (const void **)matchesList, 2, NULL); + if (!matches) { + goto fail; + } + IOHIDManagerSetDeviceMatchingMultiple(s_hidManager, matches); + IOHIDManagerRegisterInputValueCallback(s_hidManager, HIDCallback, s_hidManager); + IOHIDManagerScheduleWithRunLoop(s_hidManager, CFRunLoopGetMain(), kCFRunLoopDefaultMode); + if (IOHIDManagerOpen(s_hidManager, kIOHIDOptionsTypeNone) == kIOReturnSuccess) { + goto cleanup; + } + +fail: + QuitHIDCallback(); + +cleanup: + if (matches) { + CFRelease(matches); + } + if (keypad) { + CFRelease(keypad); + } + if (keyboard) { + CFRelease(keyboard); + } +} + /* This is a helper function for HandleModifierSide. This * function reverts back to behavior before the distinction between * sides was made. @@ -328,24 +434,6 @@ - (NSArray *)validAttributesForMarkedText } } -/* This is a helper function for DoSidedModifiers. - * This function handles the CapsLock case. - */ -static void -HandleCapsLock(unsigned short scancode, - unsigned int oldMods, unsigned int newMods) -{ - unsigned int oldMask, newMask; - - oldMask = oldMods & NSAlphaShiftKeyMask; - newMask = newMods & NSAlphaShiftKeyMask; - - if (oldMask != newMask) { - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK); - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); - } -} - /* This function will handle the modifier keys and also determine the * correct side of the key. */ @@ -374,11 +462,8 @@ - (NSArray *)validAttributesForMarkedText unsigned int i, bit; - /* Handle CAPSLOCK separately because it doesn't have a left/right side */ - HandleCapsLock(scancode, oldMods, newMods); - /* Iterate through the bits, testing each against the old modifiers */ - for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { + for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) { unsigned int oldMask, newMask; oldMask = oldMods & bit; @@ -498,11 +583,10 @@ - (NSArray *)validAttributesForMarkedText SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); - /* On pre-10.6, you might have the initial capslock key state wrong. */ - if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { - data->modifierFlags = [NSEvent modifierFlags]; - SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0); - } + data->modifierFlags = [NSEvent modifierFlags]; + SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); + + InitHIDCallback(); } void @@ -565,7 +649,7 @@ - (NSArray *)validAttributesForMarkedText void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ } @@ -589,7 +673,7 @@ - (NSArray *)validAttributesForMarkedText } switch ([event type]) { - case NSKeyDown: + case NSEventTypeKeyDown: if (![event isARepeat]) { /* See if we need to rebuild the keyboard layout */ UpdateKeymap(data, SDL_TRUE); @@ -598,7 +682,7 @@ - (NSArray *)validAttributesForMarkedText SDL_SendKeyboardKey(SDL_PRESSED, code); #if 1 if (code == SDL_SCANCODE_UNKNOWN) { - fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); + fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { @@ -613,10 +697,10 @@ - (NSArray *)validAttributesForMarkedText #endif } break; - case NSKeyUp: + case NSEventTypeKeyUp: SDL_SendKeyboardKey(SDL_RELEASED, code); break; - case NSFlagsChanged: + case NSEventTypeFlagsChanged: /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ HandleModifiers(_this, scancode, [event modifierFlags]); break; @@ -628,6 +712,7 @@ - (NSArray *)validAttributesForMarkedText void Cocoa_QuitKeyboard(_THIS) { + QuitHIDCallback(); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.h index d1ca7882e7..74a815ad65 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.m similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.m index ed59e728c6..a98237f453 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,11 +57,24 @@ - (id) initWithParentWindow:(SDL_Window *)window - (void)showAlert:(NSAlert*)alert { if (nswindow) { - [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#ifdef MAC_OS_X_VERSION_10_9 + if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) { + [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) { + clicked = returnCode; + }]; + } else +#endif + { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 + [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#endif + } + while (clicked < 0) { SDL_PumpEvents(); SDL_Delay(100); } + [nswindow release]; } else { clicked = [alert runModal]; @@ -86,11 +99,11 @@ - (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextIn NSAlert* alert = [[[NSAlert alloc] init] autorelease]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; } else { - [alert setAlertStyle:NSInformationalAlertStyle]; + [alert setAlertStyle:NSAlertStyleInformational]; } [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.h new file mode 100644 index 0000000000..185d45deb6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_cocoametalview_h_ +#define SDL_cocoametalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_cocoawindow.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_cocoametalview : NSView + +- (instancetype)initWithFrame:(NSRect)frame + highDPI:(BOOL)highDPI; + +/* Override superclass tag so this class can set it. */ +@property (assign, readonly) NSInteger tag; + +@property (nonatomic) BOOL highDPI; + +@end + +SDL_cocoametalview* Cocoa_Mtl_AddMetalView(SDL_Window* window); + +void Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +#endif /* SDL_cocoametalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.m new file mode 100644 index 0000000000..9447fb8c6f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.m @@ -0,0 +1,138 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#import "SDL_cocoametalview.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#include "SDL_assert.h" + +@implementation SDL_cocoametalview + +/* Return a Metal-compatible layer. */ ++ (Class)layerClass +{ + return NSClassFromString(@"CAMetalLayer"); +} + +/* Indicate the view wants to draw using a backing layer instead of drawRect. */ +- (BOOL)wantsUpdateLayer +{ + return YES; +} + +/* When the wantsLayer property is set to YES, this method will be invoked to + * return a layer instance. + */ +- (CALayer*)makeBackingLayer +{ + return [self.class.layerClass layer]; +} + +- (instancetype)initWithFrame:(NSRect)frame + highDPI:(BOOL)highDPI +{ + if ((self = [super initWithFrame:frame])) { + self.highDPI = highDPI; + self.wantsLayer = YES; + + /* Allow resize. */ + self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + + [self updateDrawableSize]; + } + + return self; +} + +- (NSInteger)tag +{ + return METALVIEW_TAG; +} + +- (void)updateDrawableSize +{ + CAMetalLayer *metalLayer = (CAMetalLayer *)self.layer; + CGSize size = self.bounds.size; + CGSize backingSize = size; + + if (self.highDPI) { + /* Note: NSHighResolutionCapable must be set to true in the app's + * Info.plist in order for the backing size to be high res. + */ + backingSize = [self convertSizeToBacking:size]; + } + + metalLayer.contentsScale = backingSize.height / size.height; + metalLayer.drawableSize = backingSize; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize +{ + [super resizeWithOldSuperviewSize:oldSize]; + [self updateDrawableSize]; +} + +@end + +SDL_cocoametalview* +Cocoa_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + BOOL highDPI = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + SDL_cocoametalview *metalview; + + metalview = [[SDL_cocoametalview alloc] initWithFrame:view.frame highDPI:highDPI]; + [view addSubview:metalview]; + return metalview; +} + +void +Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.h similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.h index a0a29f5010..05482e891b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamodes_h -#define _SDL_cocoamodes_h +#ifndef SDL_cocoamodes_h_ +#define SDL_cocoamodes_h_ typedef struct { @@ -30,15 +30,17 @@ typedef struct typedef struct { - const void *moderef; + CGDisplayModeRef moderef; } SDL_DisplayModeData; extern void Cocoa_InitModes(_THIS); extern int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +extern int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +extern int Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hpdi, float * vdpi); extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void Cocoa_QuitModes(_THIS); -#endif /* _SDL_cocoamodes_h */ +#endif /* SDL_cocoamodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.m similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.m index 7d98264a72..97ccd945dc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "SDL_assert.h" #if SDL_VIDEO_DRIVER_COCOA @@ -55,25 +56,6 @@ #endif } - -/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */ -#define FORCE_OLD_API 0 - -#if FORCE_OLD_API -#undef MAC_OS_X_VERSION_MIN_REQUIRED -#define MAC_OS_X_VERSION_MIN_REQUIRED 1050 -#endif - -static BOOL -IS_SNOW_LEOPARD_OR_LATER() -{ -#if FORCE_OLD_API - return NO; -#else - return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5; -#endif -} - static int CG_SetError(const char *prefix, CGDisplayErr result) { @@ -118,65 +100,46 @@ } static SDL_bool -GetDisplayMode(_THIS, const void *moderef, CVDisplayLinkRef link, SDL_DisplayMode *mode) +GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode) { SDL_DisplayModeData *data; - long width = 0; - long height = 0; - long bpp = 0; - long refreshRate = 0; + int width = 0; + int height = 0; + int bpp = 0; + int refreshRate = 0; + CFStringRef fmt; data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); if (!data) { return SDL_FALSE; } - data->moderef = moderef; - - if (IS_SNOW_LEOPARD_OR_LATER()) { - CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef; - CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode); - width = (long) CGDisplayModeGetWidth(vidmode); - height = (long) CGDisplayModeGetHeight(vidmode); - refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5); - - if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - bpp = 32; - } else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - bpp = 16; - } else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels), - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - bpp = 30; - } else { - bpp = 0; /* ignore 8-bit and such for now. */ - } - - CFRelease(fmt); + data->moderef = vidmode; + + fmt = CGDisplayModeCopyPixelEncoding(vidmode); + width = (int) CGDisplayModeGetWidth(vidmode); + height = (int) CGDisplayModeGetHeight(vidmode); + refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5); + + if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels), + kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bpp = 32; + } else if (CFStringCompare(fmt, CFSTR(IO16BitDirectPixels), + kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bpp = 16; + } else if (CFStringCompare(fmt, CFSTR(kIO30BitDirectPixels), + kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bpp = 30; + } else { + bpp = 0; /* ignore 8-bit and such for now. */ } - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (!IS_SNOW_LEOPARD_OR_LATER()) { - CFNumberRef number; - double refresh; - CFDictionaryRef vidmode = (CFDictionaryRef) moderef; - number = CFDictionaryGetValue(vidmode, kCGDisplayWidth); - CFNumberGetValue(number, kCFNumberLongType, &width); - number = CFDictionaryGetValue(vidmode, kCGDisplayHeight); - CFNumberGetValue(number, kCFNumberLongType, &height); - number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel); - CFNumberGetValue(number, kCFNumberLongType, &bpp); - number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate); - CFNumberGetValue(number, kCFNumberDoubleType, &refresh); - refreshRate = (long) (refresh + 0.5); - } - #endif + CFRelease(fmt); /* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */ if (refreshRate == 0 && link != NULL) { CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link); if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) { - refreshRate = (long) ((time.timeScale / (double) time.timeValue) + 0.5); + refreshRate = (int) ((time.timeScale / (double) time.timeValue) + 0.5); } } @@ -203,22 +166,6 @@ return SDL_TRUE; } -static void -Cocoa_ReleaseDisplayMode(_THIS, const void *moderef) -{ - if (IS_SNOW_LEOPARD_OR_LATER()) { - CGDisplayModeRelease((CGDisplayModeRef) moderef); /* NULL is ok */ - } -} - -static void -Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist) -{ - if (IS_SNOW_LEOPARD_OR_LATER()) { - CFRelease(modelist); /* NULL is ok */ - } -} - static const char * Cocoa_GetDisplayName(CGDirectDisplayID displayID) { @@ -261,7 +208,7 @@ SDL_VideoDisplay display; SDL_DisplayData *displaydata; SDL_DisplayMode mode; - const void *moderef = NULL; + CGDisplayModeRef moderef = NULL; CVDisplayLinkRef link = NULL; if (pass == 0) { @@ -278,15 +225,7 @@ continue; } - if (IS_SNOW_LEOPARD_OR_LATER()) { - moderef = CGDisplayCopyDisplayMode(displays[i]); - } - - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (!IS_SNOW_LEOPARD_OR_LATER()) { - moderef = CGDisplayCurrentMode(displays[i]); - } - #endif + moderef = CGDisplayCopyDisplayMode(displays[i]); if (!moderef) { continue; @@ -294,7 +233,7 @@ displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); if (!displaydata) { - Cocoa_ReleaseDisplayMode(_this, moderef); + CGDisplayModeRelease(moderef); continue; } displaydata->display = displays[i]; @@ -306,7 +245,7 @@ display.name = (char *)Cocoa_GetDisplayName(displays[i]); if (!GetDisplayMode(_this, moderef, link, &mode)) { CVDisplayLinkRelease(link); - Cocoa_ReleaseDisplayMode(_this, moderef); + CGDisplayModeRelease(moderef); SDL_free(display.name); SDL_free(displaydata); continue; @@ -338,59 +277,116 @@ return 0; } +int +Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + const CGDirectDisplayID cgdisplay = displaydata->display; + NSArray *screens = [NSScreen screens]; + NSScreen *screen = nil; + + /* !!! FIXME: maybe track the NSScreen in SDL_DisplayData? */ + for (NSScreen *i in screens) { + const CGDirectDisplayID thisDisplay = (CGDirectDisplayID) [[[i deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + if (thisDisplay == cgdisplay) { + screen = i; + break; + } + } + + SDL_assert(screen != nil); /* didn't find it?! */ + if (screen == nil) { + return -1; + } + + const CGRect cgrect = CGDisplayBounds(cgdisplay); + const NSRect frame = [screen visibleFrame]; + + // !!! FIXME: I assume -[NSScreen visibleFrame] is relative to the origin of the screen in question and not the whole desktop. + // !!! FIXME: The math vs CGDisplayBounds might be incorrect if that's not the case, though. Check this. + rect->x = (int)(cgrect.origin.x + frame.origin.x); + rect->y = (int)(cgrect.origin.y + frame.origin.y); + rect->w = (int)frame.size.width; + rect->h = (int)frame.size.height; + + return 0; +} + +int +Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +{ + const float MM_IN_INCH = 25.4f; + + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + + CGSize displaySize = CGDisplayScreenSize(data->display); + int pixelWidth = (int) CGDisplayPixelsWide(data->display); + int pixelHeight = (int) CGDisplayPixelsHigh(data->display); + + if (ddpi) { + *ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH); + } + if (hdpi) { + *hdpi = pixelWidth * MM_IN_INCH / displaySize.width; + } + if (vdpi) { + *vdpi = pixelHeight * MM_IN_INCH / displaySize.height; + } + + return 0; +} + void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; - CFArrayRef modes = NULL; + CVDisplayLinkRef link = NULL; + CGDisplayModeRef desktopmoderef; + SDL_DisplayMode desktopmode; + CFArrayRef modes; - if (IS_SNOW_LEOPARD_OR_LATER()) { - modes = CGDisplayCopyAllDisplayModes(data->display, NULL); - } + CVDisplayLinkCreateWithCGDisplay(data->display, &link); - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (!IS_SNOW_LEOPARD_OR_LATER()) { - modes = CGDisplayAvailableModes(data->display); + desktopmoderef = CGDisplayCopyDisplayMode(data->display); + + /* CopyAllDisplayModes won't always contain the desktop display mode (if + * NULL is passed in) - for example on a retina 15" MBP, System Preferences + * allows choosing 1920x1200 but it's not in the list. AddDisplayMode makes + * sure there are no duplicates so it's safe to always add the desktop mode + * even in cases where it is in the CopyAllDisplayModes list. + */ + if (desktopmoderef && GetDisplayMode(_this, desktopmoderef, link, &desktopmode)) { + if (!SDL_AddDisplayMode(display, &desktopmode)) { + CGDisplayModeRelease(desktopmoderef); + SDL_free(desktopmode.driverdata); + } + } else { + CGDisplayModeRelease(desktopmoderef); } - #endif + + modes = CGDisplayCopyAllDisplayModes(data->display, NULL); if (modes) { - CVDisplayLinkRef link = NULL; - const CFIndex count = CFArrayGetCount(modes); CFIndex i; - - CVDisplayLinkCreateWithCGDisplay(data->display, &link); + const CFIndex count = CFArrayGetCount(modes); for (i = 0; i < count; i++) { - const void *moderef = CFArrayGetValueAtIndex(modes, i); + CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); SDL_DisplayMode mode; + if (GetDisplayMode(_this, moderef, link, &mode)) { - if (IS_SNOW_LEOPARD_OR_LATER()) { - CGDisplayModeRetain((CGDisplayModeRef) moderef); + if (SDL_AddDisplayMode(display, &mode)) { + CGDisplayModeRetain(moderef); + } else { + SDL_free(mode.driverdata); } - SDL_AddDisplayMode(display, &mode); } } - CVDisplayLinkRelease(link); - Cocoa_ReleaseDisplayModeList(_this, modes); - } -} - -static CGError -Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode) -{ - if (IS_SNOW_LEOPARD_OR_LATER()) { - return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL); - } - - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (!IS_SNOW_LEOPARD_OR_LATER()) { - return CGDisplaySwitchToMode(display, (CFDictionaryRef) mode); + CFRelease(modes); } - #endif - return kCGErrorFailure; + CVDisplayLinkRelease(link); } int @@ -408,7 +404,7 @@ if (data == display->desktop_mode.driverdata) { /* Restoring desktop mode */ - Cocoa_SwitchMode(_this, displaydata->display, data->moderef); + CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); if (CGDisplayIsMain(displaydata->display)) { CGReleaseAllDisplays(); @@ -433,7 +429,7 @@ } /* Do the physical switch */ - result = Cocoa_SwitchMode(_this, displaydata->display, data->moderef); + result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); if (result != kCGErrorSuccess) { CG_SetError("CGDisplaySwitchToMode()", result); goto ERR_NO_SWITCH; @@ -478,11 +474,11 @@ } mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata; - Cocoa_ReleaseDisplayMode(_this, mode->moderef); + CGDisplayModeRelease(mode->moderef); for (j = 0; j < display->num_display_modes; j++) { mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata; - Cocoa_ReleaseDisplayMode(_this, mode->moderef); + CGDisplayModeRelease(mode->moderef); } } diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.h index 4f60c8372b..b79a3cf987 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamouse_h -#define _SDL_cocoamouse_h +#ifndef SDL_cocoamouse_h_ +#define SDL_cocoamouse_h_ #include "SDL_cocoavideo.h" @@ -47,6 +47,6 @@ typedef struct { + (NSCursor *)invisibleCursor; @end -#endif /* _SDL_cocoamouse_h */ +#endif /* SDL_cocoamouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.m similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.m index c768331233..c9db253942 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_events.h" #include "SDL_cocoamouse.h" #include "SDL_cocoamousetap.h" +#include "SDL_cocoavideo.h" #include "../../events/SDL_mouse_c.h" @@ -226,13 +227,15 @@ + (NSCursor *)invisibleCursor Cocoa_HandleMouseWarp(point.x, point.y); - /* According to the docs, this was deprecated in 10.6, but it's still - * around. The substitute requires a CGEventSource, but I'm not entirely - * sure how we'd procure the right one for this event. - */ - CGSetLocalEventsSuppressionInterval(0.0); CGWarpMouseCursorPosition(point); - CGSetLocalEventsSuppressionInterval(0.25); + + /* CGWarpMouse causes a short delay by default, which is preventable by + * Calling this directly after. CGSetLocalEventsSuppressionInterval can also + * prevent it, but it's deprecated as of OS X 10.6. + */ + if (!mouse->relative_mode) { + CGAssociateMouseAndMouseCursorPosition(YES); + } /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our * other implementations' APIs. Send what's appropriate. @@ -314,7 +317,7 @@ + (NSCursor *)invisibleCursor for (NSScreen *screen in [NSScreen screens]) { NSRect frame = [screen frame]; - if (NSPointInRect(cocoaLocation, frame)) { + if (NSMouseInRect(cocoaLocation, frame, NO)) { *x = (int) cocoaLocation.x; *y = (int) ((frame.origin.y + frame.size.height) - cocoaLocation.y); break; @@ -361,10 +364,10 @@ + (NSCursor *)invisibleCursor Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { switch ([event type]) { - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: + case NSEventTypeMouseMoved: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: break; default: @@ -396,7 +399,7 @@ + (NSCursor *)invisibleCursor /* Ignore events that aren't inside the client area (i.e. title bar.) */ if ([event window]) { NSRect windowRect = [[[event window] contentView] frame]; - if (!NSPointInRect([event locationInWindow], windowRect)) { + if (!NSMouseInRect([event locationInWindow], windowRect, NO)) { return; } } @@ -419,8 +422,8 @@ + (NSCursor *)invisibleCursor { SDL_Mouse *mouse = SDL_GetMouse(); - float x = -[event deltaX]; - float y = [event deltaY]; + CGFloat x = -[event deltaX]; + CGFloat y = [event deltaY]; SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { @@ -430,16 +433,16 @@ + (NSCursor *)invisibleCursor } if (x > 0) { - x += 0.9f; + x = SDL_ceil(x); } else if (x < 0) { - x -= 0.9f; + x = SDL_floor(x); } if (y > 0) { - y += 0.9f; + y = SDL_ceil(y); } else if (y < 0) { - y -= 0.9f; + y = SDL_floor(y); } - SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction); + SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction); } void diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.h index af92314b64..40ce3861f1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamousetap_h -#define _SDL_cocoamousetap_h +#ifndef SDL_cocoamousetap_h_ +#define SDL_cocoamousetap_h_ #include "SDL_cocoamouse.h" extern void Cocoa_InitMouseEventTap(SDL_MouseData *driverdata); +extern void Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled); extern void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata); -#endif /* _SDL_cocoamousetap_h */ +#endif /* SDL_cocoamousetap_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.m similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.m index ed70f3ca34..aa4f152e6a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,8 @@ #if SDL_MAC_NO_SANDBOX #include "SDL_keyboard.h" -#include "SDL_thread.h" #include "SDL_cocoavideo.h" +#include "../../thread/SDL_systhread.h" #include "../../events/SDL_mouse_c.h" @@ -69,11 +69,14 @@ switch (type) { case kCGEventTapDisabledByTimeout: - case kCGEventTapDisabledByUserInput: { CGEventTapEnable(tapdata->tap, true); return NULL; } + case kCGEventTapDisabledByUserInput: + { + return NULL; + } default: break; } @@ -96,7 +99,7 @@ eventLocation = CGEventGetUnflippedLocation(event); windowRect = [nswindow contentRectForFrameRect:[nswindow frame]]; - if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) { + if (!NSMouseInRect(NSPointFromCGPoint(eventLocation), windowRect, NO)) { /* This is in CGs global screenspace coordinate system, which has a * flipped Y. @@ -109,15 +112,14 @@ newLocation.x = NSMaxX(windowRect) - 1.0; } - if (eventLocation.y < NSMinY(windowRect)) { + if (eventLocation.y <= NSMinY(windowRect)) { newLocation.y -= (NSMinY(windowRect) - eventLocation.y + 1); - } else if (eventLocation.y >= NSMaxY(windowRect)) { - newLocation.y += (eventLocation.y - NSMaxY(windowRect) + 1); + } else if (eventLocation.y > NSMaxY(windowRect)) { + newLocation.y += (eventLocation.y - NSMaxY(windowRect)); } - CGSetLocalEventsSuppressionInterval(0); CGWarpMouseCursorPosition(newLocation); - CGSetLocalEventsSuppressionInterval(0.25); + CGAssociateMouseAndMouseCursorPosition(YES); if ((CGEventMaskBit(type) & movementEventsMask) == 0) { /* For click events, we just constrain the event to the window, so @@ -143,15 +145,12 @@ { SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)data; - /* Create a tap. */ - CFMachPortRef eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, - kCGEventTapOptionDefault, allGrabbedEventsMask, - &Cocoa_MouseTapCallback, tapdata); + /* Tap was created on main thread but we own it now. */ + CFMachPortRef eventTap = tapdata->tap; if (eventTap) { /* Try to create a runloop source we can schedule. */ CFRunLoopSourceRef runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0); if (runloopSource) { - tapdata->tap = eventTap; tapdata->runloopSource = runloopSource; } else { CFRelease(eventTap); @@ -203,15 +202,32 @@ tapdata->runloopStartedSemaphore = SDL_CreateSemaphore(0); if (tapdata->runloopStartedSemaphore) { - tapdata->thread = SDL_CreateThread(&Cocoa_MouseTapThread, "Event Tap Loop", tapdata); - if (!tapdata->thread) { - SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); + tapdata->tap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, + kCGEventTapOptionDefault, allGrabbedEventsMask, + &Cocoa_MouseTapCallback, tapdata); + if (tapdata->tap) { + /* Tap starts disabled, until app requests mouse grab */ + CGEventTapEnable(tapdata->tap, false); + tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); + if (tapdata->thread) { + /* Success - early out. Ownership transferred to thread. */ + return; + } + CFRelease(tapdata->tap); } + SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); } + SDL_free(driverdata->tapdata); + driverdata->tapdata = NULL; +} - if (!tapdata->thread) { - SDL_free(driverdata->tapdata); - driverdata->tapdata = NULL; +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ + SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; + if (tapdata && tapdata->tap) + { + CGEventTapEnable(tapdata->tap, !!enabled); } } @@ -221,6 +237,13 @@ SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; int status; + if (tapdata == NULL) { + /* event tap was already cleaned up (possibly due to CGEventTapCreate + * returning null.) + */ + return; + } + /* Ensure that the runloop has been started first. * TODO: Move this to InitMouseEventTap, check for error conditions that can * happen in Cocoa_MouseTapThread, and fall back to the non-EventTap way of @@ -246,6 +269,11 @@ { } +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ +} + void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata) { diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.h index 1f7bd57f05..81ca5edd5c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaopengl_h -#define _SDL_cocoaopengl_h +#ifndef SDL_cocoaopengl_h_ +#define SDL_cocoaopengl_h_ #if SDL_VIDEO_OPENGL_CGL @@ -58,11 +58,11 @@ extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); extern int Cocoa_GL_SetSwapInterval(_THIS, int interval); extern int Cocoa_GL_GetSwapInterval(_THIS); -extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_CGL */ -#endif /* _SDL_cocoaopengl_h */ +#endif /* SDL_cocoaopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.m similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.m index aa36099844..9539c17799 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #if SDL_VIDEO_OPENGL_CGL #include "SDL_cocoavideo.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include #include @@ -165,14 +166,35 @@ - (void)setWindow:(SDL_Window *)newWindow int glversion_minor; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { - SDL_SetError ("OpenGL ES is not supported on this platform"); +#if SDL_VIDEO_OPENGL_EGL + /* Switch to EGL based functions */ + Cocoa_GL_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GLES_CreateContext; + _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GLES_SwapWindow; + _this->GL_DeleteContext = Cocoa_GLES_DeleteContext; + + if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + return Cocoa_GLES_CreateContext(_this, window); +#else + SDL_SetError("SDL not configured with EGL support"); return NULL; +#endif } if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) { SDL_SetError ("OpenGL Core Profile is not supported on this platform version"); return NULL; } + attr[i++] = NSOpenGLPFAAllowOfflineRenderers; + /* specify a profile if we're on Lion (10.7) or later. */ if (lion_or_later) { NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; @@ -325,10 +347,12 @@ - (void)setWindow:(SDL_Window *)newWindow NSView *contentView = [windata->nswindow contentView]; NSRect viewport = [contentView bounds]; - /* This gives us the correct viewport for a Retina-enabled view, only - * supported on 10.7+. */ - if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { - viewport = [contentView convertRectToBacking:viewport]; + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* This gives us the correct viewport for a Retina-enabled view, only + * supported on 10.7+. */ + if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { + viewport = [contentView convertRectToBacking:viewport]; + } } if (w) { @@ -381,13 +405,20 @@ - (void)setWindow:(SDL_Window *)newWindow return status; }} -void +int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + + /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two + threads try to swap at the same time, so put a mutex around it. */ + SDL_LockMutex(videodata->swaplock); [nscontext flushBuffer]; [nscontext updateIfNeeded]; + SDL_UnlockMutex(videodata->swaplock); + return 0; }} void diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.h new file mode 100644 index 0000000000..fc7f5c054c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.h @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_cocoaopengles_h_ +#define SDL_cocoaopengles_h_ + +#if SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define Cocoa_GLES_GetAttribute SDL_EGL_GetAttribute +#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define Cocoa_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval +#define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval + +extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window); +extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context); +extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window); + +#endif /* SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_cocoaopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.m new file mode 100644 index 0000000000..e0a05a1a36 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.m @@ -0,0 +1,132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL + +#include "SDL_cocoavideo.h" +#include "SDL_cocoaopengles.h" +#include "SDL_cocoaopengl.h" +#include "SDL_log.h" + +/* EGL implementation of SDL OpenGL support */ + +int +Cocoa_GLES_LoadLibrary(_THIS, const char *path) { + + /* If the profile requested is not GL ES, switch over to WIN_GL functions */ + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_CGL + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + return Cocoa_GL_LoadLibrary(_this, path); +#else + return SDL_SetError("SDL not configured with OpenGL/CGL support"); +#endif + } + + if (_this->egl_data == NULL) { + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); + } + + return 0; +} + +SDL_GLContext +Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) +{ + SDL_GLContext context; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + +#if SDL_VIDEO_OPENGL_CGL + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { + /* Switch to CGL based functions */ + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + + if (Cocoa_GL_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + + return Cocoa_GL_CreateContext(_this, window); + } +#endif + + context = SDL_EGL_CreateContext(_this, data->egl_surface); + return context; +} + +void +Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context) +{ + SDL_EGL_DeleteContext(_this, context); + Cocoa_GLES_UnloadLibrary(_this); +} + +SDL_EGL_SwapWindow_impl(Cocoa) +SDL_EGL_MakeCurrent_impl(Cocoa) + +int +Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) +{ + /* The current context is lost in here; save it and reset it. */ + SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; + SDL_Window *current_win = SDL_GL_GetCurrentWindow(); + SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); + + + if (_this->egl_data == NULL) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { + SDL_EGL_UnloadLibrary(_this); + return -1; + } + } + + /* Create the GLES window surface */ + NSView* v = windowdata->nswindow.contentView; + windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]); + + if (windowdata->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("Could not create GLES window surface"); + } + + return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx); +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.h index f64b59178b..da1b5eb8ee 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_cocoashape_h -#define _SDL_cocoashape_h +#ifndef SDL_cocoashape_h_ +#define SDL_cocoashape_h_ #include "SDL_stdinc.h" #include "SDL_video.h" @@ -40,4 +40,6 @@ extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window); extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Cocoa_ResizeWindowShape(SDL_Window *window); -#endif +#endif /* SDL_cocoashape_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.m similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.m index cd5d97b70e..7a2f04f6e3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,9 +35,7 @@ SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; [windata->nswindow setOpaque:NO]; - if ([windata->nswindow respondsToSelector:@selector(setStyleMask:)]) { - [windata->nswindow setStyleMask:NSBorderlessWindowMask]; - } + [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless]; SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper)); result->window = window; diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.h new file mode 100644 index 0000000000..b1c26fa7e8 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.h @@ -0,0 +1,118 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_cocoavideo_h_ +#define SDL_cocoavideo_h_ + +#include "SDL_opengl.h" + +#include +#include +#include + +#include "SDL_keycode.h" +#include "../SDL_sysvideo.h" + +#include "SDL_cocoaclipboard.h" +#include "SDL_cocoaevents.h" +#include "SDL_cocoakeyboard.h" +#include "SDL_cocoamodes.h" +#include "SDL_cocoamouse.h" +#include "SDL_cocoaopengl.h" +#include "SDL_cocoawindow.h" + +#ifndef MAC_OS_X_VERSION_10_12 +#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name +DECLARE_EVENT(LeftMouseDown); +DECLARE_EVENT(LeftMouseUp); +DECLARE_EVENT(RightMouseDown); +DECLARE_EVENT(RightMouseUp); +DECLARE_EVENT(OtherMouseDown); +DECLARE_EVENT(OtherMouseUp); +DECLARE_EVENT(MouseMoved); +DECLARE_EVENT(LeftMouseDragged); +DECLARE_EVENT(RightMouseDragged); +DECLARE_EVENT(OtherMouseDragged); +DECLARE_EVENT(ScrollWheel); +DECLARE_EVENT(KeyDown); +DECLARE_EVENT(KeyUp); +DECLARE_EVENT(FlagsChanged); +#undef DECLARE_EVENT + +static const NSEventMask NSEventMaskAny = NSAnyEventMask; + +#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask +DECLARE_MODIFIER_FLAG(Shift); +DECLARE_MODIFIER_FLAG(Control); +DECLARE_MODIFIER_FLAG(Command); +DECLARE_MODIFIER_FLAG(NumericPad); +DECLARE_MODIFIER_FLAG(Help); +DECLARE_MODIFIER_FLAG(Function); +#undef DECLARE_MODIFIER_FLAG +static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask; +static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask; + +#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask +DECLARE_WINDOW_MASK(Borderless); +DECLARE_WINDOW_MASK(Titled); +DECLARE_WINDOW_MASK(Closable); +DECLARE_WINDOW_MASK(Miniaturizable); +DECLARE_WINDOW_MASK(Resizable); +DECLARE_WINDOW_MASK(TexturedBackground); +DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar); +DECLARE_WINDOW_MASK(FullScreen); +/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ /* Not used, fails compile on older SDKs */ +static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask; +static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; +static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask; +#undef DECLARE_WINDOW_MASK + +#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle +DECLARE_ALERT_STYLE(Warning); +DECLARE_ALERT_STYLE(Informational); +DECLARE_ALERT_STYLE(Critical); +#undef DECLARE_ALERT_STYLE +#endif + +/* Private display data */ + +@class SDLTranslatorResponder; + +typedef struct SDL_VideoData +{ + int allow_spaces; + unsigned int modifierFlags; + void *key_layout; + SDLTranslatorResponder *fieldEdit; + NSInteger clipboard_count; + Uint32 screensaver_activity; + BOOL screensaver_use_iopm; + IOPMAssertionID screensaver_assertion; + SDL_mutex *swaplock; +} SDL_VideoData; + +/* Utility functions */ +extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); + +#endif /* SDL_cocoavideo_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.m similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.m index b8f775ddb2..20bdfa7916 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_endian.h" #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" +#include "SDL_cocoavulkan.h" #include "SDL_assert.h" /* Initialization/Query functions */ @@ -73,19 +74,22 @@ device->VideoInit = Cocoa_VideoInit; device->VideoQuit = Cocoa_VideoQuit; device->GetDisplayBounds = Cocoa_GetDisplayBounds; + device->GetDisplayUsableBounds = Cocoa_GetDisplayUsableBounds; + device->GetDisplayDPI = Cocoa_GetDisplayDPI; device->GetDisplayModes = Cocoa_GetDisplayModes; device->SetDisplayMode = Cocoa_SetDisplayMode; device->PumpEvents = Cocoa_PumpEvents; device->SuspendScreenSaver = Cocoa_SuspendScreenSaver; - device->CreateWindow = Cocoa_CreateWindow; - device->CreateWindowFrom = Cocoa_CreateWindowFrom; + device->CreateSDLWindow = Cocoa_CreateWindow; + device->CreateSDLWindowFrom = Cocoa_CreateWindowFrom; device->SetWindowTitle = Cocoa_SetWindowTitle; device->SetWindowIcon = Cocoa_SetWindowIcon; device->SetWindowPosition = Cocoa_SetWindowPosition; device->SetWindowSize = Cocoa_SetWindowSize; device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize; device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize; + device->SetWindowOpacity = Cocoa_SetWindowOpacity; device->ShowWindow = Cocoa_ShowWindow; device->HideWindow = Cocoa_HideWindow; device->RaiseWindow = Cocoa_RaiseWindow; @@ -93,6 +97,7 @@ device->MinimizeWindow = Cocoa_MinimizeWindow; device->RestoreWindow = Cocoa_RestoreWindow; device->SetWindowBordered = Cocoa_SetWindowBordered; + device->SetWindowResizable = Cocoa_SetWindowResizable; device->SetWindowFullscreen = Cocoa_SetWindowFullscreen; device->SetWindowGammaRamp = Cocoa_SetWindowGammaRamp; device->GetWindowGammaRamp = Cocoa_GetWindowGammaRamp; @@ -100,6 +105,7 @@ device->DestroyWindow = Cocoa_DestroyWindow; device->GetWindowWMInfo = Cocoa_GetWindowWMInfo; device->SetWindowHitTest = Cocoa_SetWindowHitTest; + device->AcceptDragAndDrop = Cocoa_AcceptDragAndDrop; device->shape_driver.CreateShaper = Cocoa_CreateShaper; device->shape_driver.SetWindowShape = Cocoa_SetWindowShape; @@ -116,6 +122,24 @@ device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; device->GL_SwapWindow = Cocoa_GL_SwapWindow; device->GL_DeleteContext = Cocoa_GL_DeleteContext; +#elif SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + device->GL_CreateContext = Cocoa_GLES_CreateContext; + device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + device->GL_SwapWindow = Cocoa_GLES_SwapWindow; + device->GL_DeleteContext = Cocoa_GLES_DeleteContext; +#endif + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize; #endif device->StartTextInput = Cocoa_StartTextInput; @@ -146,21 +170,28 @@ Cocoa_InitKeyboard(_this); Cocoa_InitMouse(_this); - const char *hint = SDL_GetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES); - data->allow_spaces = ( (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && (!hint || (*hint != '0')) ); + data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); /* The IOPM assertion API can disable the screensaver as of 10.7. */ data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; + data->swaplock = SDL_CreateMutex(); + if (!data->swaplock) { + return -1; + } + return 0; } void Cocoa_VideoQuit(_THIS) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Cocoa_QuitModes(_this); Cocoa_QuitKeyboard(_this); Cocoa_QuitMouse(_this); + SDL_DestroyMutex(data->swaplock); + data->swaplock = NULL; } /* This function assumes that it's called from within an autorelease pool */ @@ -173,13 +204,7 @@ int i; NSImage *img; - converted = SDL_ConvertSurfaceFormat(surface, -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - SDL_PIXELFORMAT_RGBA8888, -#else - SDL_PIXELFORMAT_ABGR8888, -#endif - 0); + converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32, 0); if (!converted) { return nil; } diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.h similarity index 50% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.h index 498ce6ccaa..a49c148c10 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,48 +18,38 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "../../SDL_internal.h" - -#ifndef _SDL_cocoavideo_h -#define _SDL_cocoavideo_h -#include "SDL_opengl.h" +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ -#include -#include -#include -#include "SDL_keycode.h" -#include "../SDL_sysvideo.h" +#include "../../SDL_internal.h" -#include "SDL_cocoaclipboard.h" -#include "SDL_cocoaevents.h" -#include "SDL_cocoakeyboard.h" -#include "SDL_cocoamodes.h" -#include "SDL_cocoamouse.h" -#include "SDL_cocoaopengl.h" -#include "SDL_cocoawindow.h" +#ifndef SDL_cocoavulkan_h_ +#define SDL_cocoavulkan_h_ -/* Private display data */ +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" -@class SDLTranslatorResponder; +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA -typedef struct SDL_VideoData -{ - int allow_spaces; - unsigned int modifierFlags; - void *key_layout; - SDLTranslatorResponder *fieldEdit; - NSInteger clipboard_count; - Uint32 screensaver_activity; - BOOL screensaver_use_iopm; - IOPMAssertionID screensaver_assertion; +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); +void Cocoa_Vulkan_UnloadLibrary(_THIS); +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); -} SDL_VideoData; +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); -/* Utility functions */ -extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); +#endif -#endif /* _SDL_cocoavideo_h */ +#endif /* SDL_cocoavulkan_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.m new file mode 100644 index 0000000000..0e53d219dd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.m @@ -0,0 +1,230 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA + +#include "SDL_cocoavideo.h" +#include "SDL_cocoawindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_cocoametalview.h" +#include "SDL_cocoavulkan.h" +#include "SDL_syswm.h" + +#include + +const char* defaultPaths[] = { + "vulkan.framework/vulkan", + "libvulkan.1.dylib", + "MoltenVK.framework/MoltenVK", + "libMoltenVK.dylib" +}; + +/* Since libSDL is most likely a .dylib, need RTLD_DEFAULT not RTLD_SELF. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMacOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + return SDL_SetError("Vulkan/MoltenVK already loaded"); + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + const char** paths; + const char *foundPath = NULL; + int numPaths; + int i; + + if (path) { + paths = &path; + numPaths = 1; + } else { + /* Look for framework or .dylib packaged with the application + * instead. */ + paths = defaultPaths; + numPaths = SDL_arraysize(defaultPaths); + } + + for (i = 0; i < numPaths && _this->vulkan_config.loader_handle == NULL; i++) { + foundPath = paths[i]; + _this->vulkan_config.loader_handle = SDL_LoadObject(foundPath); + } + + if (_this->vulkan_config.loader_handle == NULL) { + return SDL_SetError("Failed to load Vulkan/MoltenVK library"); + } + + SDL_strlcpy(_this->vulkan_config.loader_path, foundPath, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + _this->vulkan_config.loader_path, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + goto fail; + } + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if (!extensions) { + goto fail; + } + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasMacOSSurfaceExtension = SDL_TRUE; + } + } + SDL_free(extensions); + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasMacOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_MACOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Cocoa_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForCocoa[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForCocoa), + extensionsForCocoa); +} + +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK = + (PFN_vkCreateMacOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMacOSSurfaceMVK"); + VkMacOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateMacOSSurfaceMVK) { + SDL_SetError(VK_MVK_MACOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = Cocoa_Mtl_AddMetalView(window); + result = vkCreateMacOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateMacOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + Cocoa_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.h b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.h rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.h index 1037badfc5..2311e3d740 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoawindow_h -#define _SDL_cocoawindow_h +#ifndef SDL_cocoawindow_h_ +#define SDL_cocoawindow_h_ #import +#if SDL_VIDEO_OPENGL_EGL +#include "../SDL_egl_c.h" +#endif + typedef struct SDL_WindowData SDL_WindowData; typedef enum @@ -114,6 +118,9 @@ struct SDL_WindowData SDL_bool inWindowMove; Cocoa_WindowListener *listener; struct SDL_VideoData *videodata; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif }; extern int Cocoa_CreateWindow(_THIS, SDL_Window * window); @@ -125,6 +132,7 @@ extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window); extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window); +extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void Cocoa_ShowWindow(_THIS, SDL_Window * window); extern void Cocoa_HideWindow(_THIS, SDL_Window * window); extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window); @@ -132,6 +140,7 @@ extern void Cocoa_MaximizeWindow(_THIS, SDL_Window * window); extern void Cocoa_MinimizeWindow(_THIS, SDL_Window * window); extern void Cocoa_RestoreWindow(_THIS, SDL_Window * window); extern void Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); +extern void Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable); extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); @@ -139,7 +148,8 @@ extern void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); +extern void Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); -#endif /* _SDL_cocoawindow_h */ +#endif /* SDL_cocoawindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.m b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.m similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.m rename to 3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.m index a4da6cb2de..a8e95ccd98 100644 --- a/3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.m +++ b/3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,9 @@ #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" #include "SDL_cocoamouse.h" +#include "SDL_cocoamousetap.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include "SDL_assert.h" /* #define DEBUG_COCOAWINDOW */ @@ -64,10 +66,31 @@ - (void)doCommandBySelector:(SEL)aSelector; - (NSDragOperation)draggingEntered:(id )sender; - (BOOL)performDragOperation:(id )sender; - (BOOL)wantsPeriodicDraggingUpdates; +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem; + +- (SDL_Window*)findSDLWindow; @end @implementation SDLWindow +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + /* Only allow using the macOS native fullscreen toggle menubar item if the + * window is resizable and not in a SDL fullscreen mode. + */ + if ([menuItem action] == @selector(toggleFullScreen:)) { + SDL_Window *window = [self findSDLWindow]; + if (window == NULL) { + return NO; + } else if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { + return NO; + } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { + return NO; + } + } + return [super validateMenuItem:menuItem]; +} + - (BOOL)canBecomeKeyWindow { return YES; @@ -80,20 +103,20 @@ - (BOOL)canBecomeMainWindow - (void)sendEvent:(NSEvent *)event { - [super sendEvent:event]; + [super sendEvent:event]; - if ([event type] != NSLeftMouseUp) { - return; - } + if ([event type] != NSEventTypeLeftMouseUp) { + return; + } - id delegate = [self delegate]; - if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) { - return; - } + id delegate = [self delegate]; + if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) { + return; + } - if ([delegate isMoving]) { - [delegate windowDidFinishMoving]; - } + if ([delegate isMoving]) { + [delegate windowDidFinishMoving]; + } } /* We'll respond to selectors by doing nothing so we don't beep. @@ -119,6 +142,8 @@ - (BOOL)performDragOperation:(id )sender NSPasteboard *pasteboard = [sender draggingPasteboard]; NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; NSString *desiredType = [pasteboard availableTypeFromArray:types]; + SDL_Window *sdlwindow = [self findSDLWindow]; + if (desiredType == nil) { return NO; /* can't accept anything that's being dropped here. */ } @@ -132,13 +157,10 @@ - (BOOL)performDragOperation:(id )sender NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; for (NSString *path in array) { - NSURL *fileURL = [[NSURL fileURLWithPath:path] autorelease]; + NSURL *fileURL = [NSURL fileURLWithPath:path]; NSNumber *isAlias = nil; - /* Functionality for resolving URL aliases was added with OS X 10.6. */ - if ([fileURL respondsToSelector:@selector(getResourceValue:forKey:error:)]) { - [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil]; - } + [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil]; /* If the URL is an alias, resolve it. */ if ([isAlias boolValue]) { @@ -157,11 +179,12 @@ - (BOOL)performDragOperation:(id )sender } } - if (!SDL_SendDropFile([[fileURL path] UTF8String])) { + if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { return NO; } } + SDL_SendDropComplete(sdlwindow); return YES; }} @@ -170,6 +193,24 @@ - (BOOL)wantsPeriodicDraggingUpdates return NO; } +- (SDL_Window*)findSDLWindow +{ + SDL_Window *sdlwindow = NULL; + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + /* !!! FIXME: is there a better way to do this? */ + if (_this) { + for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + if (nswindow == self) { + break; + } + } + } + + return sdlwindow; +} + @end @@ -196,49 +237,45 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) } } +/* !!! FIXME: this should use a hint callback. */ static int GetHintCtrlClickEmulateRightClick() { - const char *hint = SDL_GetHint( SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK ); - return hint != NULL && *hint != '0'; + return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE); } -static unsigned int +static NSUInteger GetWindowStyle(SDL_Window * window) { - unsigned int style; + NSUInteger style = 0; if (window->flags & SDL_WINDOW_FULLSCREEN) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { - style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); + style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); } if (window->flags & SDL_WINDOW_RESIZABLE) { - style |= NSResizableWindowMask; + style |= NSWindowStyleMaskResizable; } } return style; } static SDL_bool -SetWindowStyle(SDL_Window * window, unsigned int style) +SetWindowStyle(SDL_Window * window, NSUInteger style) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; NSWindow *nswindow = data->nswindow; - if (![nswindow respondsToSelector: @selector(setStyleMask:)]) { - return SDL_FALSE; - } - /* The view responder chain gets messed with during setStyleMask */ if ([[nswindow contentView] nextResponder] == data->listener) { [[nswindow contentView] setNextResponder:nil]; } - [nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)style]; + [nswindow setStyleMask:style]; /* The view responder chain gets messed with during setStyleMask */ if ([[nswindow contentView] nextResponder] != data->listener) { @@ -302,9 +339,7 @@ - (void)listen:(SDL_WindowData *)data [view setNextResponder:self]; - if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) { - [view setAcceptsTouchEvents:YES]; - } + [view setAcceptsTouchEvents:YES]; } - (void)observeValueForKeyPath:(NSString *)keyPath @@ -486,6 +521,11 @@ - (void)windowDidMove:(NSNotification *)aNotification NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], fullscreen, &rect); + if (inFullscreenTransition) { + /* We'll take care of this at the end of the transition */ + return; + } + if (s_moveHack) { SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500); @@ -589,12 +629,9 @@ - (void)windowDidBecomeKey:(NSNotification *)aNotification [NSMenu setMenuBarVisible:NO]; } - /* On pre-10.6, you might have the capslock key state wrong now because we can't check here. */ - if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { - const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; - _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; - SDL_ToggleModState(KMOD_CAPS, newflags != 0); - } + const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; + _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; + SDL_ToggleModState(KMOD_CAPS, newflags != 0); } - (void)windowDidResignKey:(NSNotification *)aNotification @@ -639,7 +676,7 @@ - (void)windowWillEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = YES; @@ -664,6 +701,8 @@ - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; inFullscreenTransition = NO; @@ -671,6 +710,11 @@ - (void)windowDidEnterFullScreen:(NSNotification *)aNotification pendingWindowOperation = PENDING_OPERATION_NONE; [self setFullscreenSpace:NO]; } else { + /* Unset the resizable flag. + This is a workaround for https://bugzilla.libsdl.org/show_bug.cgi?id=3697 + */ + SetWindowStyle(window, [nswindow styleMask] & (~NSWindowStyleMaskResizable)); + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { [NSMenu setMenuBarVisible:NO]; } @@ -681,6 +725,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *)aNotification */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; } } @@ -689,13 +734,13 @@ - (void)windowWillExitFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; + isFullscreenSpace = NO; + inFullscreenTransition = YES; + /* As of OS X 10.11, the window seems to need to be resizable when exiting a Space, in order for it to resize back to its windowed-mode size. */ - SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask); - - isFullscreenSpace = NO; - inFullscreenTransition = YES; + SetWindowStyle(window, GetWindowStyle(window) | NSWindowStyleMaskResizable); } - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification @@ -706,7 +751,7 @@ - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification return; } - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = NO; @@ -742,11 +787,36 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification [NSMenu setMenuBarVisible:YES]; pendingWindowOperation = PENDING_OPERATION_NONE; + +#if 0 +/* This fixed bug 3719, which is that changing window size while fullscreen + doesn't take effect when leaving fullscreen, but introduces bug 3809, + which is that a maximized window doesn't go back to normal size when + restored, so this code is disabled until we can properly handle the + beginning and end of maximize and restore. + */ + /* Restore windowed size and position in case it changed while fullscreen */ + { + NSRect rect; + rect.origin.x = window->windowed.x; + rect.origin.y = window->windowed.y; + rect.size.width = window->windowed.w; + rect.size.height = window->windowed.h; + ConvertNSRect([nswindow screen], NO, &rect); + + s_moveHack = 0; + [nswindow setContentSize:rect.size]; + [nswindow setFrameOrigin:rect.origin]; + s_moveHack = SDL_GetTicks(); + } +#endif /* 0 */ + /* Force the size change event in case it was delivered earlier while the window was still animating into place. */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; /* FIXME: Why does the window get hidden? */ @@ -820,30 +890,25 @@ - (BOOL)processHitTest:(NSEvent *)theEvent - (void)mouseDown:(NSEvent *)theEvent { int button; + int clicks; /* Ignore events that aren't inside the client area (i.e. title bar.) */ if ([theEvent window]) { NSRect windowRect = [[[theEvent window] contentView] frame]; - - /* add one to size, since NSPointInRect is exclusive of the bottom - edges, which mean it misses the top of the window by one pixel - (as the origin is the bottom left). */ - windowRect.size.width += 1; - windowRect.size.height += 1; - - if (!NSPointInRect([theEvent locationInWindow], windowRect)) { + if (!NSMouseInRect([theEvent locationInWindow], windowRect, NO)) { return; } } if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } switch ([theEvent buttonNumber]) { case 0: - if (([theEvent modifierFlags] & NSControlKeyMask) && - GetHintCtrlClickEmulateRightClick()) { + if (([theEvent modifierFlags] & NSEventModifierFlagControl) && + GetHintCtrlClickEmulateRightClick()) { wasCtrlLeft = YES; button = SDL_BUTTON_RIGHT; } else { @@ -858,10 +923,12 @@ - (void)mouseDown:(NSEvent *)theEvent button = SDL_BUTTON_MIDDLE; break; default: - button = [theEvent buttonNumber] + 1; + button = (int) [theEvent buttonNumber] + 1; break; } - SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button); + + clicks = (int) [theEvent clickCount]; + SDL_SendMouseButtonClicks(_data->window, 0, SDL_PRESSED, button, clicks); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -877,8 +944,10 @@ - (void)otherMouseDown:(NSEvent *)theEvent - (void)mouseUp:(NSEvent *)theEvent { int button; + int clicks; if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* stopped dragging, drop event. */ } @@ -898,10 +967,12 @@ - (void)mouseUp:(NSEvent *)theEvent button = SDL_BUTTON_MIDDLE; break; default: - button = [theEvent buttonNumber] + 1; + button = (int) [theEvent buttonNumber] + 1; break; } - SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button); + + clicks = (int) [theEvent clickCount]; + SDL_SendMouseButtonClicks(_data->window, 0, SDL_RELEASED, button, clicks); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -922,6 +993,7 @@ - (void)mouseMoved:(NSEvent *)theEvent int x, y; if ([self processHitTest:theEvent]) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } @@ -956,13 +1028,8 @@ - (void)mouseMoved:(NSEvent *)theEvent cgpoint.x = window->x + x; cgpoint.y = window->y + y; - /* According to the docs, this was deprecated in 10.6, but it's still - * around. The substitute requires a CGEventSource, but I'm not entirely - * sure how we'd procure the right one for this event. - */ - CGSetLocalEventsSuppressionInterval(0.0); CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint); - CGSetLocalEventsSuppressionInterval(0.25); + CGAssociateMouseAndMouseCursorPosition(YES); Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y); #endif @@ -1075,16 +1142,41 @@ - (void)setSDLWindow:(SDL_Window*)window; - (void)rightMouseDown:(NSEvent *)theEvent; - (BOOL)mouseDownCanMoveWindow; - (void)drawRect:(NSRect)dirtyRect; +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; +- (BOOL)wantsUpdateLayer; +- (void)updateLayer; @end @implementation SDLView + - (void)setSDLWindow:(SDL_Window*)window { _sdlWindow = window; } +/* this is used on older macOS revisions. 10.8 and later use updateLayer. */ - (void)drawRect:(NSRect)dirtyRect { + /* Force the graphics context to clear to black so we don't get a flash of + white until the app is ready to draw. In practice on modern macOS, this + only gets called for window creation and other extraordinary events. */ + [[NSColor blackColor] setFill]; + NSRectFill(dirtyRect); + SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); +} + +-(BOOL) wantsUpdateLayer +{ + return YES; +} + +-(void) updateLayer +{ + /* Force the graphics context to clear to black so we don't get a flash of + white until the app is ready to draw. In practice on modern macOS, this + only gets called for window creation and other extraordinary events. */ + self.layer.backgroundColor = NSColor.blackColor.CGColor; + ScheduleContextUpdates((SDL_WindowData *) _sdlWindow->driverdata); SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); } @@ -1114,6 +1206,15 @@ - (void)resetCursorRects cursor:[NSCursor invisibleCursor]]; } } + +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent +{ + if (SDL_GetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH)) { + return SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); + } else { + return SDL_GetHintBoolean("SDL_MAC_MOUSE_FOCUS_CLICKTHROUGH", SDL_FALSE); + } +} @end static int @@ -1157,14 +1258,14 @@ - (void)resetCursorRects } { - unsigned int style = [nswindow styleMask]; + unsigned long style = [nswindow styleMask]; - if (style == NSBorderlessWindowMask) { + if (style == NSWindowStyleMaskBorderless) { window->flags |= SDL_WINDOW_BORDERLESS; } else { window->flags &= ~SDL_WINDOW_BORDERLESS; } - if (style & NSResizableWindowMask) { + if (style & NSWindowStyleMaskResizable) { window->flags |= SDL_WINDOW_RESIZABLE; } else { window->flags &= ~SDL_WINDOW_RESIZABLE; @@ -1208,7 +1309,7 @@ - (void)resetCursorRects SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); NSRect rect; SDL_Rect bounds; - unsigned int style; + NSUInteger style; NSArray *screens = [NSScreen screens]; Cocoa_GetDisplayBounds(_this, display, &bounds); @@ -1240,7 +1341,6 @@ - (void)resetCursorRects @catch (NSException *e) { return SDL_SetError("%s", [[e reason] UTF8String]); } - [nswindow setBackgroundColor:[NSColor blackColor]]; if (videodata->allow_spaces) { SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); @@ -1263,16 +1363,40 @@ - (void)resetCursorRects } } - [nswindow setContentView: contentView]; +#if SDL_VIDEO_OPENGL_ES2 +#if SDL_VIDEO_OPENGL_EGL + if ((window->flags & SDL_WINDOW_OPENGL) && + _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { + [contentView setWantsLayer:TRUE]; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_VIDEO_OPENGL_ES2 */ + [nswindow setContentView:contentView]; [contentView release]; - /* Allow files and folders to be dragged onto the window by users */ - [nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; - if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { [nswindow release]; return -1; } + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; + } + + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ +#if SDL_VIDEO_OPENGL_ES2 + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_EGL + if (Cocoa_GLES_SetupWindow(_this, window) < 0) { + Cocoa_DestroyWindow(_this, window); + return -1; + } + return 0; +#else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } +#endif /* SDL_VIDEO_OPENGL_ES2 */ return 0; }} @@ -1470,27 +1594,6 @@ - (void)resetCursorRects } }} -static NSWindow * -Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style) -{ - if (!data->created) { - /* Don't mess with other people's windows... */ - return nswindow; - } - - [data->listener close]; - data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:NO screen:[nswindow screen]]; - [data->nswindow setContentView:[nswindow contentView]]; - [data->nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; - /* See comment in SetupWindowData. */ - [data->nswindow setOneShot:NO]; - [data->listener listen:data]; - - [nswindow close]; - - return data->nswindow; -} - void Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { @autoreleasepool @@ -1502,6 +1605,20 @@ - (void)resetCursorRects } }} +void +Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) +{ @autoreleasepool +{ + /* Don't set this if we're in a space! + * The window will get permanently stuck if resizable is false. + * -flibit + */ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Cocoa_WindowListener *listener = data->listener; + if (![listener isInFullscreenSpace]) { + SetWindowStyle(window, GetWindowStyle(window)); + } +}} void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) @@ -1532,11 +1649,7 @@ - (void)resetCursorRects rect.origin.y += (screenRect.size.height - rect.size.height); } - if ([nswindow respondsToSelector: @selector(setStyleMask:)]) { - [nswindow performSelector: @selector(setStyleMask:) withObject: (id)NSBorderlessWindowMask]; - } else { - nswindow = Cocoa_RebuildWindow(data, nswindow, NSBorderlessWindowMask); - } + [nswindow setStyleMask:NSWindowStyleMaskBorderless]; } else { rect.origin.x = window->windowed.x; rect.origin.y = window->windowed.y; @@ -1544,16 +1657,12 @@ - (void)resetCursorRects rect.size.height = window->windowed.h; ConvertNSRect([nswindow screen], fullscreen, &rect); - if ([nswindow respondsToSelector: @selector(setStyleMask:)]) { - [nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)]; + [nswindow setStyleMask:GetWindowStyle(window)]; - /* Hack to restore window decorations on Mac OS X 10.10 */ - NSRect frameRect = [nswindow frame]; - [nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; - [nswindow setFrame:frameRect display:NO]; - } else { - nswindow = Cocoa_RebuildWindow(data, nswindow, GetWindowStyle(window)); - } + /* Hack to restore window decorations on Mac OS X 10.10 */ + NSRect frameRect = [nswindow frame]; + [nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; + [nswindow setFrame:frameRect display:NO]; } /* The view responder chain gets messed with during setStyleMask */ @@ -1640,8 +1749,13 @@ - (void)resetCursorRects void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { - /* Move the cursor to the nearest point in the window */ + SDL_Mouse *mouse = SDL_GetMouse(); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + /* Enable or disable the event tap as necessary */ + Cocoa_EnableMouseEventTap(mouse->driverdata, grabbed); + + /* Move the cursor to the nearest point in the window */ if (grabbed && data && ![data->listener isMoving]) { int x, y; CGPoint cgpoint; @@ -1706,7 +1820,7 @@ - (void)resetCursorRects info->info.cocoa.window = nswindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -1767,6 +1881,25 @@ take effect properly (e.g. setting the window size, etc.) return 0; /* just succeed, the real work is done elsewhere. */ } +void +Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (accept) { + [data->nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; + } else { + [data->nswindow unregisterDraggedTypes]; + } +} + +int +Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + [data->nswindow setAlphaValue:opacity]; + return 0; +} + #endif /* SDL_VIDEO_DRIVER_COCOA */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.c index 4b979f36c8..d9d0c3a036 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.h index f5f9a46fda..98d943fa33 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_WM.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_wm_h -#define _SDL_directfb_wm_h +#ifndef SDL_directfb_wm_h_ +#define SDL_directfb_wm_h_ #include "SDL_DirectFB_video.h" @@ -51,6 +51,6 @@ extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch); -#endif /* _SDL_directfb_wm_h */ +#endif /* SDL_directfb_wm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.c index 52a4b53670..12cf21af5e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.h index bd99a3faf3..1a370c6415 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_dyn.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_dyn_h -#define _SDL_DirectFB_dyn_h +#ifndef SDL_DirectFB_dyn_h_ +#define SDL_DirectFB_dyn_h_ #define DFB_SYMS \ DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \ @@ -36,4 +36,6 @@ int SDL_DirectFB_LoadLibrary(void); void SDL_DirectFB_UnLoadLibrary(void); -#endif +#endif /* SDL_DirectFB_dyn_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.c index 0bf9fdba58..27cf19f91a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -743,9 +743,6 @@ void DirectFB_QuitKeyboard(_THIS) { /* SDL_DFB_DEVICEDATA(_this); */ - - SDL_KeyboardQuit(); - } #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.h index 2931ad2a1c..ccbdb0ac96 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_events.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_events_h -#define _SDL_DirectFB_events_h +#ifndef SDL_DirectFB_events_h_ +#define SDL_DirectFB_events_h_ #include "../SDL_sysvideo.h" @@ -29,4 +29,6 @@ extern void DirectFB_InitKeyboard(_THIS); extern void DirectFB_QuitKeyboard(_THIS); extern void DirectFB_PumpEventsWindow(_THIS); -#endif +#endif /* SDL_DirectFB_events_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.c index 9d0abf5601..a3b8b45bfb 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.h index 9911eff568..75d8bbfd9f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_modes.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_modes_h -#define _SDL_directfb_modes_h +#ifndef SDL_directfb_modes_h_ +#define SDL_directfb_modes_h_ #include @@ -54,6 +54,6 @@ extern void DirectFB_QuitModes(_THIS); extern void DirectFB_SetContext(_THIS, SDL_Window *window); -#endif /* _SDL_directfb_modes_h */ +#endif /* SDL_directfb_modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.c index 0657d2f06a..a2b3e416e2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,10 +36,8 @@ static SDL_Cursor *DirectFB_CreateDefaultCursor(void); static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); static int DirectFB_ShowCursor(SDL_Cursor * cursor); -static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_FreeCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Window * window, int x, int y); -static void DirectFB_FreeMouse(SDL_Mouse * mouse); static const char *arrow[] = { /* pixels */ @@ -84,11 +82,9 @@ DirectFB_CreateDefaultCursor(void) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; - Uint32 *p; int pitch, i, j; SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor)); @@ -139,7 +135,6 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; @@ -184,7 +179,6 @@ static int DirectFB_ShowCursor(SDL_Cursor * cursor) { SDL_DFB_CURSORDATA(cursor); - DFBResult ret; SDL_Window *window; window = SDL_GetFocusWindow(); @@ -239,7 +233,6 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; - DFBResult ret; int cx, cy; SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy)); @@ -253,8 +246,10 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) #if USE_MULTI_API +static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); +static void DirectFB_FreeMouse(SDL_Mouse * mouse); static int id_mask; diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.h index 4e2f27a92e..e1236a07e0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_mouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_mouse_h -#define _SDL_DirectFB_mouse_h +#ifndef SDL_DirectFB_mouse_h_ +#define SDL_DirectFB_mouse_h_ #include @@ -39,6 +39,6 @@ struct _DFB_CursorData extern void DirectFB_InitMouse(_THIS); extern void DirectFB_QuitMouse(_THIS); -#endif /* _SDL_DirectFB_mouse_h */ +#endif /* SDL_DirectFB_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.c index 065854a08f..93d2fdeff3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,9 +117,9 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) if (path == NULL) { - path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); + path = SDL_getenv("SDL_OPENGL_LIBRARY"); if (path == NULL) { - path = "libGL.so"; + path = "libGL.so.1"; } } @@ -133,7 +133,6 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) SDL_DFB_DEBUG("Loaded library: %s\n", path); _this->gl_config.dll_handle = handle; - _this->gl_config.driver_loaded = 1; if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path)); @@ -151,16 +150,10 @@ static void DirectFB_GL_UnloadLibrary(_THIS) { #if 0 - int ret; - - if (_this->gl_config.driver_loaded) { - - ret = GL_UnloadObject(_this->gl_config.dll_handle); - if (ret) - SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); - _this->gl_config.dll_handle = NULL; - _this->gl_config.driver_loaded = 0; - } + int ret = GL_UnloadObject(_this->gl_config.dll_handle); + if (ret) + SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); + _this->gl_config.dll_handle = NULL; #endif /* Free OpenGL memory */ SDL_free(_this->gl_data); @@ -246,18 +239,12 @@ DirectFB_GL_GetSwapInterval(_THIS) return 0; } -void +int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); - DFBRegion region; DirectFB_GLContext *p; - region.x1 = 0; - region.y1 = 0; - region.x2 = window->w; - region.y2 = window->h; - #if 0 if (devdata->glFinish) devdata->glFinish(); @@ -273,9 +260,9 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) } SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC )); - return; + return 0; error: - return; + return -1; } void diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.h index 6391ee4f3d..9463e1bba5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_opengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_directfb_opengl_h -#define _SDL_directfb_opengl_h +#ifndef SDL_directfb_opengl_h_ +#define SDL_directfb_opengl_h_ #include "SDL_DirectFB_video.h" @@ -50,7 +50,7 @@ extern int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int DirectFB_GL_SetSwapInterval(_THIS, int interval); extern int DirectFB_GL_GetSwapInterval(_THIS); -extern void DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); +extern int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); extern void DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context); extern void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window); @@ -59,6 +59,6 @@ extern void DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window); #endif /* SDL_DIRECTFB_OPENGL */ -#endif /* _SDL_directfb_opengl_h */ +#endif /* SDL_directfb_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.c index 4a1bf46b8e..4054f732a7 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -217,7 +217,9 @@ static SDL_INLINE IDirectFBSurface *get_dfb_surface(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.surface; } @@ -228,7 +230,9 @@ static SDL_INLINE IDirectFBWindow *get_dfb_window(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.window; } @@ -332,7 +336,7 @@ DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -int +static int DirectFB_RenderClear(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -344,7 +348,6 @@ DirectFB_RenderClear(SDL_Renderer * renderer) destsurf->Clear(destsurf, renderer->r, renderer->g, renderer->b, renderer->a); - return 0; } @@ -357,6 +360,10 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) DirectFB_RenderData *data = NULL; DFBSurfaceCapabilities scaps; + if (!winsurf) { + return NULL; + } + SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer)); SDL_DFB_ALLOC_CLEAR(data, sizeof(*data)); @@ -530,7 +537,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* find the right pixelformat */ pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format); if (pixelformat == DSPF_UNKNOWN) { - SDL_SetError("Unknown pixel format %d\n", data->format); + SDL_SetError("Unknown pixel format %d", data->format); goto error; } @@ -1273,7 +1280,7 @@ DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -1303,7 +1310,7 @@ DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Window *window = renderer->window; SDL_DFB_WINDOWDATA(window); Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.h index be016b0844..bc3c07595c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_render.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.c index 3239e30214..36559319fe 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,25 +29,22 @@ #include "../SDL_shape_internals.h" -SDL_Window* -DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags /* | SDL_DFB_WINDOW_SHAPED */); -} - SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; + SDL_ShapeData* data; + int resized_properly; result = malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; - SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData)); + data = SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; data->surface = NULL; window->shaper = result; - int resized_properly = DirectFB_ResizeWindowShape(window); + resized_properly = DirectFB_ResizeWindowShape(window); SDL_assert(resized_properly == 0); return result; diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.h index 46be39fbf7..f0a418df50 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_shape.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_shape_h -#define _SDL_DirectFB_shape_h +#ifndef SDL_DirectFB_shape_h_ +#define SDL_DirectFB_shape_h_ #include @@ -31,9 +31,8 @@ typedef struct { IDirectFBSurface *surface; } SDL_ShapeData; -extern SDL_Window* DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window); extern int DirectFB_ResizeWindowShape(SDL_Window* window); extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_DirectFB_shape_h */ +#endif /* SDL_DirectFB_shape_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.c index 5579759eb0..8740ce111e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,14 +22,10 @@ #if SDL_VIDEO_DRIVER_DIRECTFB -#include "SDL_DirectFB_video.h" - -#include "SDL_DirectFB_events.h" /* * #include "SDL_DirectFB_keyboard.h" */ #include "SDL_DirectFB_modes.h" -#include "SDL_DirectFB_mouse.h" #include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_WM.h" @@ -107,20 +103,19 @@ DirectFB_CreateDevice(int devindex) /* Initialize all variables that we clean on shutdown */ SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice)); - /* Set the function pointers */ - /* Set the function pointers */ device->VideoInit = DirectFB_VideoInit; device->VideoQuit = DirectFB_VideoQuit; device->GetDisplayModes = DirectFB_GetDisplayModes; device->SetDisplayMode = DirectFB_SetDisplayMode; device->PumpEvents = DirectFB_PumpEventsWindow; - device->CreateWindow = DirectFB_CreateWindow; - device->CreateWindowFrom = DirectFB_CreateWindowFrom; + device->CreateSDLWindow = DirectFB_CreateWindow; + device->CreateSDLWindowFrom = DirectFB_CreateWindowFrom; device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; device->SetWindowSize = DirectFB_SetWindowSize; + device->SetWindowOpacity = DirectFB_SetWindowOpacity; device->ShowWindow = DirectFB_ShowWindow; device->HideWindow = DirectFB_HideWindow; device->RaiseWindow = DirectFB_RaiseWindow; @@ -177,7 +172,7 @@ DirectFB_DeviceInformation(IDirectFB * dfb) SDL_DFB_LOG( "Driver Version: %d.%d", desc.driver.major, desc.driver.minor); - SDL_DFB_LOG( "Video memoory: %d", desc.video_memory); + SDL_DFB_LOG( "Video memory: %d", desc.video_memory); SDL_DFB_LOG( "Blitting flags:"); for (n = 0; blitting_flags[n].flag; n++) { @@ -233,8 +228,7 @@ DirectFB_VideoInit(_THIS) DirectFBSetOption("disable-module", "x11input"); } - /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */ - devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */ + devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 1); /* default: on */ if (!devdata->use_linux_input) { @@ -330,6 +324,7 @@ static const struct { { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */ { DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */ { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */ + { DSPF_ABGR, SDL_PIXELFORMAT_ABGR8888 }, /* 32 bit ABGR (4 byte, alpha 8@24, blue 8@16, green 8@8, red 8@0) */ #if (ENABLE_LUT8) { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */ #endif @@ -376,7 +371,6 @@ static const struct { { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR24 }, { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR888 }, { DSPF_UNKNOWN, SDL_PIXELFORMAT_RGBA8888 }, - { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR8888 }, { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGRA8888 }, { DSPF_UNKNOWN, SDL_PIXELFORMAT_ARGB2101010 }, { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR4444 }, diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.h index b36ace0dd6..f019031cfd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_video.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_DirectFB_video_h -#define _SDL_DirectFB_video_h +#ifndef SDL_DirectFB_video_h_ +#define SDL_DirectFB_video_h_ #include #include @@ -167,4 +167,4 @@ DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format); void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri); -#endif /* _SDL_DirectFB_video_h */ +#endif /* SDL_DirectFB_video_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.c b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.c rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.c index 3b8b45d442..55171ed1df 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.c +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -458,9 +458,29 @@ SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) { + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(window); + /* Before 2.0.6, it was possible to build an SDL with DirectFB support + (SDL_SysWMinfo will be large enough to hold DirectFB info), but build + your app against SDL headers that didn't have DirectFB support + (SDL_SysWMinfo could be smaller than DirectFB needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and DirectFB will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use DirectFB, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } + if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_DIRECTFB; @@ -469,7 +489,7 @@ DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, info->info.dfb.surface = windata->surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -529,4 +549,17 @@ DirectFB_AdjustWindowSurface(SDL_Window * window) return; } +int +DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + const Uint8 alpha = (Uint8) ((unsigned int) (opacity * 255.0f)); + SDL_DFB_WINDOWDATA(window); + SDL_DFB_CHECKERR(windata->dfbwin->SetOpacity(windata->dfbwin, alpha)); + windata->opacity = alpha; + return 0; + +error: + return -1; +} + #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.h b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.h rename to 3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.h index 658cc8749a..f03aab2e5d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/directfb/SDL_DirectFB_window.h +++ b/3rdparty/sdl2-2.0.9/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_window_h -#define _SDL_directfb_window_h +#ifndef SDL_directfb_window_h_ +#define SDL_directfb_window_h_ #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_WM.h" @@ -75,7 +75,8 @@ extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern void DirectFB_AdjustWindowSurface(SDL_Window * window); +extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); -#endif /* _SDL_directfb_window_h */ +#endif /* SDL_directfb_window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents.c b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents.c rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents.c index a5a9443045..e9918bd8e5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents_c.h b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents_c.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents_c.h index d2f78698d5..454d39401f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_nullevents_c_h_ +#define SDL_nullevents_c_h_ + #include "../../SDL_internal.h" #include "SDL_nullvideo.h" extern void DUMMY_PumpEvents(_THIS); +#endif /* SDL_nullevents_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer.c b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer.c rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer.c index 01c8a5abb2..64c77810eb 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer.c +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer_c.h b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer_c.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer_c.h rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer_c.h index 37d198f90e..b7d0c633fc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,16 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_nullframebuffer_c_h_ +#define SDL_nullframebuffer_c_h_ + #include "../../SDL_internal.h" extern int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window * window); +#endif /* SDL_nullframebuffer_c_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.c b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.c index 96f47813ad..317faf4fd9 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,6 +84,7 @@ DUMMY_CreateDevice(int devindex) SDL_OutOfMemory(); return (0); } + device->is_dummy = SDL_TRUE; /* Set the function pointers */ device->VideoInit = DUMMY_VideoInit; diff --git a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.h b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.h index 0126ba1837..c770349351 100644 --- a/3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nullvideo_h -#define _SDL_nullvideo_h +#ifndef SDL_nullvideo_h_ +#define SDL_nullvideo_h_ #include "../SDL_sysvideo.h" -#endif /* _SDL_nullvideo_h */ +#endif /* SDL_nullvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.c b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.c similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.c rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.c index 0f915c6f37..14bc24030d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -217,16 +217,16 @@ static const SDL_Scancode emscripten_scancode_table[] = { /* 171 */ SDL_SCANCODE_UNKNOWN, /* 172 */ SDL_SCANCODE_UNKNOWN, /* 173 */ SDL_SCANCODE_MINUS, /*FX*/ - /* 174 */ SDL_SCANCODE_UNKNOWN, - /* 175 */ SDL_SCANCODE_UNKNOWN, - /* 176 */ SDL_SCANCODE_UNKNOWN, - /* 177 */ SDL_SCANCODE_UNKNOWN, + /* 174 */ SDL_SCANCODE_VOLUMEDOWN, /*IE, Chrome*/ + /* 175 */ SDL_SCANCODE_VOLUMEUP, /*IE, Chrome*/ + /* 176 */ SDL_SCANCODE_AUDIONEXT, /*IE, Chrome*/ + /* 177 */ SDL_SCANCODE_AUDIOPREV, /*IE, Chrome*/ /* 178 */ SDL_SCANCODE_UNKNOWN, - /* 179 */ SDL_SCANCODE_UNKNOWN, + /* 179 */ SDL_SCANCODE_AUDIOPLAY, /*IE, Chrome*/ /* 180 */ SDL_SCANCODE_UNKNOWN, - /* 181 */ SDL_SCANCODE_UNKNOWN, - /* 182 */ SDL_SCANCODE_UNKNOWN, - /* 183 */ SDL_SCANCODE_UNKNOWN, + /* 181 */ SDL_SCANCODE_AUDIOMUTE, /*FX*/ + /* 182 */ SDL_SCANCODE_VOLUMEDOWN, /*FX*/ + /* 183 */ SDL_SCANCODE_VOLUMEUP, /*FX*/ /* 184 */ SDL_SCANCODE_UNKNOWN, /* 185 */ SDL_SCANCODE_UNKNOWN, /* 186 */ SDL_SCANCODE_SEMICOLON, /*IE, Chrome, D3E legacy*/ @@ -270,7 +270,7 @@ static const SDL_Scancode emscripten_scancode_table[] = { /* "borrowed" from SDL_windowsevents.c */ -int +static int Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -297,37 +297,55 @@ Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) return SDL_TRUE; } -EM_BOOL -Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) +static EM_BOOL +Emscripten_HandlePointerLockChange(int eventType, const EmscriptenPointerlockChangeEvent *changeEvent, void *userData) { - SDL_WindowData *window_data = userData; - int mx = mouseEvent->canvasX, my = mouseEvent->canvasY; - EmscriptenPointerlockChangeEvent pointerlock_status; + SDL_WindowData *window_data = (SDL_WindowData *) userData; + /* keep track of lock losses, so we can regrab if/when appropriate. */ + window_data->has_pointer_lock = changeEvent->isActive; + return 0; +} - /* check for pointer lock */ - emscripten_get_pointerlock_status(&pointerlock_status); - if (pointerlock_status.isActive) { - mx = mouseEvent->movementX; - my = mouseEvent->movementY; - } +static EM_BOOL +Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) +{ + SDL_WindowData *window_data = userData; + const int isPointerLocked = window_data->has_pointer_lock; + int mx, my; + static double residualx = 0, residualy = 0; /* rescale (in case canvas is being scaled)*/ - double client_w, client_h; + double client_w, client_h, xscale, yscale; emscripten_get_element_css_size(NULL, &client_w, &client_h); + xscale = window_data->window->w / client_w; + yscale = window_data->window->h / client_h; + + if (isPointerLocked) { + residualx += mouseEvent->movementX * xscale; + residualy += mouseEvent->movementY * yscale; + /* Let slow sub-pixel motion accumulate. Don't lose it. */ + mx = residualx; + residualx -= mx; + my = residualy; + residualy -= my; + } else { + mx = mouseEvent->canvasX * xscale; + my = mouseEvent->canvasY * yscale; + } - mx = mx * (window_data->window->w / (client_w * window_data->pixel_ratio)); - my = my * (window_data->window->h / (client_h * window_data->pixel_ratio)); - - SDL_SendMouseMotion(window_data->window, 0, pointerlock_status.isActive, mx, my); + SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my); return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; - uint32_t sdl_button; + Uint8 sdl_button; + Uint8 sdl_button_state; + SDL_EventType sdl_event_type; + switch (mouseEvent->button) { case 0: sdl_button = SDL_BUTTON_LEFT; @@ -341,73 +359,139 @@ Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEve default: return 0; } - SDL_SendMouseButton(window_data->window, 0, eventType == EMSCRIPTEN_EVENT_MOUSEDOWN ? SDL_PRESSED : SDL_RELEASED, sdl_button); - return 1; + + if (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN) { + if (SDL_GetMouse()->relative_mode && !window_data->has_pointer_lock) { + emscripten_request_pointerlock(NULL, 0); /* try to regrab lost pointer lock. */ + } + sdl_button_state = SDL_PRESSED; + sdl_event_type = SDL_MOUSEBUTTONDOWN; + } else { + sdl_button_state = SDL_RELEASED; + sdl_event_type = SDL_MOUSEBUTTONUP; + } + SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button); + return SDL_GetEventState(sdl_event_type) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; - SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? SDL_WINDOWEVENT_ENTER : SDL_WINDOWEVENT_LEAVE, 0, 0); - return 1; + + int mx = mouseEvent->canvasX, my = mouseEvent->canvasY; + const int isPointerLocked = window_data->has_pointer_lock; + + if (!isPointerLocked) { + /* rescale (in case canvas is being scaled)*/ + double client_w, client_h; + emscripten_get_element_css_size(NULL, &client_w, &client_h); + + mx = mx * (window_data->window->w / client_w); + my = my * (window_data->window->h / client_h); + SDL_SendMouseMotion(window_data->window, 0, isPointerLocked, mx, my); + } + + SDL_SetMouseFocus(eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? window_data->window : NULL); + return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; - SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); - return 1; + SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); + return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; + /* If the user switches away while keys are pressed (such as + * via Alt+Tab), key release events won't be received. */ + if (eventType == EMSCRIPTEN_EVENT_BLUR) { + SDL_ResetKeyboard(); + } + + SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_FOCUS ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); - return 1; + return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData) { SDL_WindowData *window_data = userData; int i; + double client_w, client_h; + int preventDefault = 0; SDL_TouchID deviceId = 1; if (SDL_AddTouch(deviceId, "") < 0) { return 0; } + emscripten_get_element_css_size(NULL, &client_w, &client_h); + for (i = 0; i < touchEvent->numTouches; i++) { SDL_FingerID id; float x, y; + int mx, my; if (!touchEvent->touches[i].isChanged) continue; id = touchEvent->touches[i].identifier; - x = touchEvent->touches[i].canvasX / (float)window_data->windowed_width; - y = touchEvent->touches[i].canvasY / (float)window_data->windowed_height; + x = touchEvent->touches[i].canvasX / client_w; + y = touchEvent->touches[i].canvasY / client_h; + + mx = x * window_data->window->w; + my = y * window_data->window->h; + + if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) { + if (!window_data->finger_touching) { + window_data->finger_touching = SDL_TRUE; + window_data->first_finger = id; + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); + SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); + } + SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f); - if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) { + if (!preventDefault && SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) { + preventDefault = 1; + } + } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) { + if ((window_data->finger_touching) && (window_data->first_finger == id)) { + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); + } SDL_SendTouchMotion(deviceId, id, x, y, 1.0f); - } else if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) { - SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f); + + if (!preventDefault && SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { + preventDefault = 1; + } } else { + if ((window_data->finger_touching) && (window_data->first_finger == id)) { + SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); + window_data->finger_touching = SDL_FALSE; + } SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f); + + if (!preventDefault && SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { + preventDefault = 1; + } } } - - return 1; + return preventDefault; } -EM_BOOL +static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Uint32 scancode; + SDL_bool prevent_default; + SDL_bool is_nav_key; /* .keyCode is deprecated, but still the most reliable way to get keys */ if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) { @@ -431,105 +515,70 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi break; } } - SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? - SDL_PRESSED : SDL_RELEASED, scancode); + SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); } } - /* if we prevent keydown, we won't get keypress - * also we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX + prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; + + /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress + * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ - return SDL_GetEventState(SDL_TEXTINPUT) != SDL_ENABLE || eventType != EMSCRIPTEN_EVENT_KEYDOWN - || keyEvent->keyCode == 8 /* backspace */ || keyEvent->keyCode == 9 /* tab */; + is_nav_key = keyEvent->keyCode == 8 /* backspace */ || + keyEvent->keyCode == 9 /* tab */ || + keyEvent->keyCode == 37 /* left */ || + keyEvent->keyCode == 38 /* up */ || + keyEvent->keyCode == 39 /* right */ || + keyEvent->keyCode == 40 /* down */; + + if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && !is_nav_key) + prevent_default = SDL_FALSE; + + return prevent_default; } -EM_BOOL +static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { char text[5]; if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) { SDL_SendKeyboardText(text); } - return 1; + return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) { - /*make sure this is actually our element going fullscreen*/ - if(SDL_strcmp(fullscreenChangeEvent->id, "SDLFullscreenElement") != 0) - return 0; - SDL_WindowData *window_data = userData; if(fullscreenChangeEvent->isFullscreen) { - SDL_bool is_desktop_fullscreen; window_data->window->flags |= window_data->requested_fullscreen_mode; - if(!window_data->requested_fullscreen_mode) - window_data->window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; /*we didn't reqest fullscreen*/ - window_data->requested_fullscreen_mode = 0; - is_desktop_fullscreen = (window_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; - - /*update size*/ - if(window_data->window->flags & SDL_WINDOW_RESIZABLE || is_desktop_fullscreen) - { - emscripten_set_canvas_size(fullscreenChangeEvent->screenWidth, fullscreenChangeEvent->screenHeight); - SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, fullscreenChangeEvent->screenWidth, fullscreenChangeEvent->screenHeight); - } - else - { - /*preserve ratio*/ - double w = window_data->window->w; - double h = window_data->window->h; - double factor = SDL_min(fullscreenChangeEvent->screenWidth / w, fullscreenChangeEvent->screenHeight / h); - emscripten_set_element_css_size(NULL, w * factor, h * factor); - } + if(!window_data->requested_fullscreen_mode) + window_data->window->flags |= SDL_WINDOW_FULLSCREEN; /*we didn't reqest fullscreen*/ } else { - EM_ASM({ - //un-reparent canvas (similar to Module.requestFullscreen) - var canvas = Module['canvas']; - if(canvas.parentNode.id == "SDLFullscreenElement") { - var canvasContainer = canvas.parentNode; - canvasContainer.parentNode.insertBefore(canvas, canvasContainer); - canvasContainer.parentNode.removeChild(canvasContainer); - } - }); - double unscaled_w = window_data->windowed_width / window_data->pixel_ratio; - double unscaled_h = window_data->windowed_height / window_data->pixel_ratio; - emscripten_set_canvas_size(window_data->windowed_width, window_data->windowed_height); - - if (!window_data->external_size && window_data->pixel_ratio != 1.0f) { - emscripten_set_element_css_size(NULL, unscaled_w, unscaled_h); - } - - SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, unscaled_w, unscaled_h); - window_data->window->flags &= ~FULLSCREEN_MASK; } return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData) { SDL_WindowData *window_data = userData; - if(window_data->window->flags & FULLSCREEN_MASK) - { - SDL_bool is_desktop_fullscreen = (window_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; - if(window_data->window->flags & SDL_WINDOW_RESIZABLE || is_desktop_fullscreen) - { - emscripten_set_canvas_size(uiEvent->windowInnerWidth * window_data->pixel_ratio, uiEvent->windowInnerHeight * window_data->pixel_ratio); - SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, uiEvent->windowInnerWidth, uiEvent->windowInnerHeight); - } + /* update pixel ratio */ + if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); } - else + + if(!(window_data->window->flags & FULLSCREEN_MASK)) { /* this will only work if the canvas size is set through css */ if(window_data->window->flags & SDL_WINDOW_RESIZABLE) @@ -556,6 +605,22 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u } EM_BOOL +Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData) +{ + /*this is used during fullscreen changes*/ + SDL_WindowData *window_data = userData; + + if(window_data->fullscreen_resize) + { + double css_w, css_h; + emscripten_get_element_css_size(NULL, &css_w, &css_h); + SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, css_w, css_h); + } + + return 0; +} + +static EM_BOOL Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -566,27 +631,31 @@ Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChang void Emscripten_RegisterEventHandlers(SDL_WindowData *data) { + const char *keyElement; + /* There is only one window and that window is the canvas */ emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove); emscripten_set_mousedown_callback("#canvas", data, 0, Emscripten_HandleMouseButton); - emscripten_set_mouseup_callback("#canvas", data, 0, Emscripten_HandleMouseButton); + emscripten_set_mouseup_callback("#document", data, 0, Emscripten_HandleMouseButton); emscripten_set_mouseenter_callback("#canvas", data, 0, Emscripten_HandleMouseFocus); emscripten_set_mouseleave_callback("#canvas", data, 0, Emscripten_HandleMouseFocus); emscripten_set_wheel_callback("#canvas", data, 0, Emscripten_HandleWheel); - emscripten_set_focus_callback("#canvas", data, 0, Emscripten_HandleFocus); - emscripten_set_blur_callback("#canvas", data, 0, Emscripten_HandleFocus); + emscripten_set_focus_callback("#window", data, 0, Emscripten_HandleFocus); + emscripten_set_blur_callback("#window", data, 0, Emscripten_HandleFocus); emscripten_set_touchstart_callback("#canvas", data, 0, Emscripten_HandleTouch); emscripten_set_touchend_callback("#canvas", data, 0, Emscripten_HandleTouch); emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch); emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch); + emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange); + /* Keyboard events are awkward */ - const char *keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!keyElement) keyElement = "#window"; emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); @@ -603,33 +672,36 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) void Emscripten_UnregisterEventHandlers(SDL_WindowData *data) { + const char *target; + /* only works due to having one window */ emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL); emscripten_set_mousedown_callback("#canvas", NULL, 0, NULL); - emscripten_set_mouseup_callback("#canvas", NULL, 0, NULL); + emscripten_set_mouseup_callback("#document", NULL, 0, NULL); emscripten_set_mouseenter_callback("#canvas", NULL, 0, NULL); emscripten_set_mouseleave_callback("#canvas", NULL, 0, NULL); emscripten_set_wheel_callback("#canvas", NULL, 0, NULL); - emscripten_set_focus_callback("#canvas", NULL, 0, NULL); - emscripten_set_blur_callback("#canvas", NULL, 0, NULL); + emscripten_set_focus_callback("#window", NULL, 0, NULL); + emscripten_set_blur_callback("#window", NULL, 0, NULL); emscripten_set_touchstart_callback("#canvas", NULL, 0, NULL); emscripten_set_touchend_callback("#canvas", NULL, 0, NULL); emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL); emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL); - const char *target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL); + + target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!target) { target = "#window"; } emscripten_set_keydown_callback(target, NULL, 0, NULL); emscripten_set_keyup_callback(target, NULL, 0, NULL); - emscripten_set_keypress_callback(target, NULL, 0, NULL); emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL); diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.h b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.h similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.h rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.h index d5b65f8545..3a4e058327 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_emscriptenevents_h -#define _SDL_emscriptenevents_h +#ifndef SDL_emscriptenevents_h_ +#define SDL_emscriptenevents_h_ #include "SDL_emscriptenvideo.h" @@ -30,7 +30,11 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data); extern void Emscripten_UnregisterEventHandlers(SDL_WindowData *data); -#endif /* _SDL_emscriptenevents_h */ + +extern EM_BOOL +Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData); + +#endif /* SDL_emscriptenevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.c b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.c similarity index 62% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.c rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.c index a26e23ae65..bfdec3b56b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,15 +69,25 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec /* Send the data to the display */ EM_ASM_INT({ - //TODO: don't create context every update - var ctx = Module['canvas'].getContext('2d'); - - //library_sdl.js SDL_UnlockSurface - var image = ctx.createImageData($0, $1); - var data = image.data; - var src = $2 >> 2; + var w = $0; + var h = $1; + var pixels = $2; + + if (!Module['SDL2']) Module['SDL2'] = {}; + var SDL2 = Module['SDL2']; + if (SDL2.ctxCanvas !== Module['canvas']) { + SDL2.ctx = Module['createContext'](Module['canvas'], false, true); + SDL2.ctxCanvas = Module['canvas']; + } + if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) { + SDL2.image = SDL2.ctx.createImageData(w, h); + SDL2.w = w; + SDL2.h = h; + SDL2.imageCtx = SDL2.ctx; + } + var data = SDL2.image.data; + var src = pixels >> 2; var dst = 0; - var isScreen = true; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, @@ -90,26 +100,58 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec data[dst ] = val & 0xff; data[dst+1] = (val >> 8) & 0xff; data[dst+2] = (val >> 16) & 0xff; - data[dst+3] = isScreen ? 0xff : ((val >> 24) & 0xff); + data[dst+3] = 0xff; src++; dst += 4; } } else { - var data32 = new Uint32Array(data.buffer); + if (SDL2.data32Data !== data) { + SDL2.data32 = new Int32Array(data.buffer); + SDL2.data8 = new Uint8Array(data.buffer); + } + var data32 = SDL2.data32; num = data32.length; - if (isScreen) { - while (dst < num) { - // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; - data32[dst++] = HEAP32[src++] | 0xff000000; + // logically we need to do + // while (dst < num) { + // data32[dst++] = HEAP32[src++] | 0xff000000 + // } + // the following code is faster though, because + // .set() is almost free - easily 10x faster due to + // native memcpy efficiencies, and the remaining loop + // just stores, not load + store, so it is faster + data32.set(HEAP32.subarray(src, src + num)); + var data8 = SDL2.data8; + var i = 3; + var j = i + 4*num; + if (num % 8 == 0) { + // unrolling gives big speedups + while (i < j) { + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; + data8[i] = 0xff; + i = i + 4 | 0; } - } else { - while (dst < num) { - data32[dst++] = HEAP32[src++]; + } else { + while (i < j) { + data8[i] = 0xff; + i = i + 4 | 0; } } } - ctx.putImageData(image, 0, 0); + SDL2.ctx.putImageData(SDL2.image, 0, 0); return 0; }, surface->w, surface->h, surface->pixels); diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.h b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.h rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.h index b2a6d3b370..49a215a2aa 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenframebuffer_h -#define _SDL_emscriptenframebuffer_h +#ifndef SDL_emscriptenframebuffer_h_ +#define SDL_emscriptenframebuffer_h_ extern int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window * window); -#endif /* _SDL_emscriptenframebuffer_h */ +#endif /* SDL_emscriptenframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.c b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.c similarity index 65% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.c rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.c index 2a68dd95c8..e120980a3e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,9 +32,8 @@ #include "../../events/SDL_mouse_c.h" #include "SDL_assert.h" - static SDL_Cursor* -Emscripten_CreateDefaultCursor() +Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom) { SDL_Cursor* cursor; Emscripten_CursorData *curdata; @@ -48,7 +47,8 @@ Emscripten_CreateDefaultCursor() return NULL; } - curdata->system_cursor = "default"; + curdata->system_cursor = cursor_str; + curdata->is_custom = is_custom; cursor->driverdata = curdata; } else { @@ -59,16 +59,81 @@ Emscripten_CreateDefaultCursor() } static SDL_Cursor* -Emscripten_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) +Emscripten_CreateDefaultCursor() { - return Emscripten_CreateDefaultCursor(); + return Emscripten_CreateCursorFromString("default", SDL_FALSE); +} + +static SDL_Cursor* +Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) +{ + const char *cursor_url = NULL; + SDL_Surface *conv_surf; + + conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); + + if (!conv_surf) { + return NULL; + } + + cursor_url = (const char *)EM_ASM_INT({ + var w = $0; + var h = $1; + var hot_x = $2; + var hot_y = $3; + var pixels = $4; + + var canvas = document.createElement("canvas"); + canvas.width = w; + canvas.height = h; + + var ctx = canvas.getContext("2d"); + + var image = ctx.createImageData(w, h); + var data = image.data; + var src = pixels >> 2; + var dst = 0; + var num; + if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { + // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, + // not UInt8ClampedArray. These don't have buffers, so we need to revert + // to copying a byte at a time. We do the undefined check because modern + // browsers do not define CanvasPixelArray anymore. + num = data.length; + while (dst < num) { + var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data[dst ] = val & 0xff; + data[dst+1] = (val >> 8) & 0xff; + data[dst+2] = (val >> 16) & 0xff; + data[dst+3] = (val >> 24) & 0xff; + src++; + dst += 4; + } + } else { + var data32 = new Int32Array(data.buffer); + num = data32.length; + data32.set(HEAP32.subarray(src, src + num)); + } + + ctx.putImageData(image, 0, 0); + var url = hot_x === 0 && hot_y === 0 + ? "url(" + canvas.toDataURL() + "), auto" + : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto"; + + var urlBuf = _malloc(url.length + 1); + stringToUTF8(url, urlBuf, url.length + 1); + + return urlBuf; + }, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels); + + SDL_FreeSurface(conv_surf); + + return Emscripten_CreateCursorFromString(cursor_url, SDL_TRUE); } static SDL_Cursor* Emscripten_CreateSystemCursor(SDL_SystemCursor id) { - SDL_Cursor *cursor; - Emscripten_CursorData *curdata; const char *cursor_name = NULL; switch(id) { @@ -100,6 +165,7 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id) cursor_name = "ns-resize"; break; case SDL_SYSTEM_CURSOR_SIZEALL: + cursor_name = "move"; break; case SDL_SYSTEM_CURSOR_NO: cursor_name = "not-allowed"; @@ -112,22 +178,7 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (!cursor) { - SDL_OutOfMemory(); - return NULL; - } - curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata)); - if (!curdata) { - SDL_OutOfMemory(); - SDL_free(cursor); - return NULL; - } - - curdata->system_cursor = cursor_name; - cursor->driverdata = curdata; - - return cursor; + return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE); } static void @@ -138,6 +189,9 @@ Emscripten_FreeCursor(SDL_Cursor* cursor) curdata = (Emscripten_CursorData *) cursor->driverdata; if (curdata != NULL) { + if (curdata->is_custom) { + SDL_free((char *)curdata->system_cursor); + } SDL_free(cursor->driverdata); } @@ -213,17 +267,6 @@ Emscripten_InitMouse() void Emscripten_FiniMouse() { - SDL_Mouse* mouse = SDL_GetMouse(); - - Emscripten_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.h b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.h rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.h index 76ea849ede..d6cd4927e9 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenmouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,15 @@ */ -#ifndef _SDL_emscriptenmouse_h -#define _SDL_emscriptenmouse_h +#ifndef SDL_emscriptenmouse_h_ +#define SDL_emscriptenmouse_h_ + +#include "SDL_stdinc.h" typedef struct _Emscripten_CursorData { const char *system_cursor; + SDL_bool is_custom; } Emscripten_CursorData; extern void @@ -34,6 +37,6 @@ Emscripten_InitMouse(); extern void Emscripten_FiniMouse(); -#endif /* _SDL_emscriptenmouse_h */ +#endif /* SDL_emscriptenmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.c b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.c similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.c rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.c index 12a37c6048..7d8c005753 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,11 +39,15 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { if (!_this->egl_data) { return SDL_OutOfMemory(); } - + + /* Emscripten forces you to manually cast eglGetProcAddress to the real + function type; grep for "__eglMustCastToProperFunctionPointerType" in + Emscripten's egl.h for details. */ + _this->egl_data->eglGetProcAddress = (void *(EGLAPIENTRY *)(const char *)) eglGetProcAddress; + LOAD_FUNC(eglGetDisplay); LOAD_FUNC(eglInitialize); LOAD_FUNC(eglTerminate); - LOAD_FUNC(eglGetProcAddress); LOAD_FUNC(eglChooseConfig); LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); @@ -56,7 +60,9 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { LOAD_FUNC(eglWaitNative); LOAD_FUNC(eglWaitGL); LOAD_FUNC(eglBindAPI); - + LOAD_FUNC(eglQueryString); + LOAD_FUNC(eglGetError); + _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(EGL_DEFAULT_DISPLAY); if (!_this->egl_data->egl_display) { return SDL_SetError("Could not get EGL display"); @@ -66,8 +72,6 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { return SDL_SetError("Could not initialize EGL"); } - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.h b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.h index edafed8220..fbd93cbbba 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenopengles_h -#define _SDL_emscriptenopengles_h +#ifndef SDL_emscriptenopengles_h_ +#define SDL_emscriptenopengles_h_ #if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL @@ -38,12 +38,12 @@ extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_emscriptenopengles_h */ +#endif /* SDL_emscriptenopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.c b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.c similarity index 76% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.c index 302ca87930..cbb933de8c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_video.h" #include "SDL_mouse.h" +#include "SDL_hints.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../SDL_egl_c.h" @@ -47,6 +48,7 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window); static void Emscripten_DestroyWindow(_THIS, SDL_Window * window); static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); static void Emscripten_PumpEvents(_THIS); +static void Emscripten_SetWindowTitle(_THIS, SDL_Window * window); /* Emscripten driver bootstrap functions */ @@ -75,6 +77,12 @@ Emscripten_CreateDevice(int devindex) return (0); } + /* Firefox sends blur event which would otherwise prevent full screen + * when the user clicks to allow full screen. + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1144964 + */ + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); + /* Set the function pointers */ device->VideoInit = Emscripten_VideoInit; device->VideoQuit = Emscripten_VideoQuit; @@ -83,10 +91,9 @@ Emscripten_CreateDevice(int devindex) device->PumpEvents = Emscripten_PumpEvents; - device->CreateWindow = Emscripten_CreateWindow; - /*device->CreateWindowFrom = Emscripten_CreateWindowFrom; + device->CreateSDLWindow = Emscripten_CreateWindow; device->SetWindowTitle = Emscripten_SetWindowTitle; - device->SetWindowIcon = Emscripten_SetWindowIcon; + /*device->SetWindowIcon = Emscripten_SetWindowIcon; device->SetWindowPosition = Emscripten_SetWindowPosition;*/ device->SetWindowSize = Emscripten_SetWindowSize; /*device->ShowWindow = Emscripten_ShowWindow; @@ -103,6 +110,7 @@ Emscripten_CreateDevice(int devindex) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -113,6 +121,7 @@ Emscripten_CreateDevice(int devindex) device->GL_SwapWindow = Emscripten_GLES_SwapWindow; device->GL_DeleteContext = Emscripten_GLES_DeleteContext; device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize; +#endif device->free = Emscripten_DeleteDevice; @@ -129,15 +138,17 @@ int Emscripten_VideoInit(_THIS) { SDL_DisplayMode mode; - double css_w, css_h; /* Use a fake 32-bpp desktop mode */ mode.format = SDL_PIXELFORMAT_RGB888; - emscripten_get_element_css_size(NULL, &css_w, &css_h); + mode.w = EM_ASM_INT_V({ + return screen.width; + }); - mode.w = css_w; - mode.h = css_h; + mode.h = EM_ASM_INT_V({ + return screen.height; + }); mode.refresh_rate = 0; mode.driverdata = NULL; @@ -199,7 +210,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) emscripten_get_element_css_size(NULL, &css_w, &css_h); - wdata->external_size = css_w != scaled_w || css_h != scaled_h; + wdata->external_size = SDL_floor(css_w) != scaled_w || SDL_floor(css_h) != scaled_h; if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { /* external css has resized us */ @@ -218,9 +229,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } } - wdata->windowed_width = scaled_w; - wdata->windowed_height = scaled_h; - +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -233,6 +242,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } } +#endif wdata->window = window; @@ -255,6 +265,10 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window) if (window->driverdata) { data = (SDL_WindowData *) window->driverdata; + /* update pixel ratio */ + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + data->pixel_ratio = emscripten_get_device_pixel_ratio(); + } emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio); /*scale canvas down*/ @@ -273,10 +287,12 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window) data = (SDL_WindowData *) window->driverdata; Emscripten_UnregisterEventHandlers(data); +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } +#endif SDL_free(window->driverdata); window->driverdata = NULL; } @@ -290,30 +306,49 @@ Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * di data = (SDL_WindowData *) window->driverdata; if(fullscreen) { + EmscriptenFullscreenStrategy strategy; + SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; + int res; + + strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT; + + if(!is_desktop_fullscreen) { + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE; + } else if(window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF; + } else { + strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF; + } + + strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; + + strategy.canvasResizedCallback = Emscripten_HandleCanvasResize; + strategy.canvasResizedCallbackUserData = data; + data->requested_fullscreen_mode = window->flags & (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); - /*unset the fullscreen flags as we're not actually fullscreen yet*/ - window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); - - EM_ASM({ - //reparent canvas (similar to Module.requestFullscreen) - var canvas = Module['canvas']; - if(canvas.parentNode.id != "SDLFullscreenElement") { - var canvasContainer = document.createElement("div"); - canvasContainer.id = "SDLFullscreenElement"; - canvas.parentNode.insertBefore(canvasContainer, canvas); - canvasContainer.appendChild(canvas); - } - }); - - int is_fullscreen; - emscripten_get_canvas_size(&data->windowed_width, &data->windowed_height, &is_fullscreen); - emscripten_request_fullscreen("SDLFullscreenElement", 1); + data->fullscreen_resize = is_desktop_fullscreen; + + res = emscripten_request_fullscreen_strategy(NULL, 1, &strategy); + if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) { + /* unset flags, fullscreen failed */ + window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); + } } else emscripten_exit_fullscreen(); } } +static void +Emscripten_SetWindowTitle(_THIS, SDL_Window * window) { + EM_ASM_INT({ + if (typeof Module['setWindowTitle'] !== 'undefined') { + Module['setWindowTitle'](Module['Pointer_stringify']($0)); + } + return 0; + }, window->title); +} + #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.h b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.h similarity index 77% rename from 3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.h index e824de34fb..c2001b0064 100644 --- a/3rdparty/sdl2-2.0.4/src/video/emscripten/SDL_emscriptenvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,17 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenvideo_h -#define _SDL_emscriptenvideo_h +#ifndef SDL_emscriptenvideo_h_ +#define SDL_emscriptenvideo_h_ #include "../SDL_sysvideo.h" +#include "../../events/SDL_touch_c.h" #include #include +#if SDL_VIDEO_OPENGL_EGL #include +#endif typedef struct SDL_WindowData { @@ -37,16 +40,19 @@ typedef struct SDL_WindowData SDL_Window *window; SDL_Surface *surface; - int windowed_width; - int windowed_height; - float pixel_ratio; SDL_bool external_size; int requested_fullscreen_mode; + SDL_bool fullscreen_resize; + + SDL_bool finger_touching; /* for mapping touch events to mice */ + SDL_FingerID first_finger; + + SDL_bool has_pointer_lock; } SDL_WindowData; -#endif /* _SDL_emscriptenvideo_h */ +#endif /* SDL_emscriptenvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_BWin.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_BWin.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_BWin.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_BWin.h index dade664c3b..b22f74b253 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_BWin.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_BWin_h -#define _SDL_BWin_h +#ifndef SDL_BWin_h_ +#define SDL_BWin_h_ #ifdef __cplusplus extern "C" { @@ -38,9 +38,9 @@ extern "C" { #include #include #include -#include +#include #if SDL_VIDEO_OPENGL -#include +#include #endif #include "SDL_events.h" #include "../../main/haiku/SDL_BApp.h" @@ -56,6 +56,7 @@ enum WinCommands { BWIN_RESTORE_WINDOW, BWIN_SET_TITLE, BWIN_SET_BORDERED, + BWIN_SET_RESIZABLE, BWIN_FULLSCREEN }; @@ -71,6 +72,7 @@ class SDL_BWin:public BDirectWindow #if SDL_VIDEO_OPENGL _SDL_GLView = NULL; + _gl_type = 0; #endif _shown = false; _inhibit_resize = false; @@ -86,7 +88,7 @@ class SDL_BWin:public BDirectWindow _clips = NULL; #ifdef DRAWTHREAD - _draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread", + _draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread", B_NORMAL_PRIORITY, (void*) this); resume_thread(_draw_thread_id); #endif @@ -113,6 +115,8 @@ class SDL_BWin:public BDirectWindow } #endif + delete _prev_frame; + /* Clean up framebuffer stuff */ _buffer_locker->Lock(); #ifdef DRAWTHREAD @@ -132,6 +136,7 @@ class SDL_BWin:public BDirectWindow B_FOLLOW_ALL_SIDES, (B_WILL_DRAW | B_FRAME_EVENTS), gl_flags); + _gl_type = gl_flags; } AddChild(_SDL_GLView); _SDL_GLView->EnableDirectMode(true); @@ -249,6 +254,7 @@ class SDL_BWin:public BDirectWindow virtual void WindowActivated(bool active) { BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */ + msg.AddBool("focusGained", active); _PostWindowEvent(msg); } @@ -336,16 +342,30 @@ class SDL_BWin:public BDirectWindow break; case B_KEY_DOWN: + { + int32 i = 0; + int8 byte; + int8 bytes[4] = { 0, 0, 0, 0 }; + while (i < 4 && msg->FindInt8("byte", i, &byte) == B_OK) { + bytes[i] = byte; + i++; + } + if (msg->FindInt32("key", &key) == B_OK) { + _KeyEvent((SDL_Scancode)key, &bytes[0], i, SDL_PRESSED); + } + } + break; + case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */ if (msg->FindInt32("key", &key) == B_OK) { - _KeyEvent((SDL_Scancode)key, SDL_PRESSED); + _KeyEvent((SDL_Scancode)key, NULL, 0, SDL_PRESSED); } break; case B_KEY_UP: case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */ if (msg->FindInt32("key", &key) == B_OK) { - _KeyEvent(key, SDL_RELEASED); + _KeyEvent(key, NULL, 0, SDL_RELEASED); } break; @@ -378,6 +398,9 @@ class SDL_BWin:public BDirectWindow case BWIN_SET_BORDERED: _SetBordered(message); break; + case BWIN_SET_RESIZABLE: + _SetResizable(message); + break; case BWIN_SHOW_WINDOW: Show(); break; @@ -424,6 +447,7 @@ class SDL_BWin:public BDirectWindow BBitmap *GetBitmap() { return _bitmap; } #if SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; } + Uint32 GetGLType() { return _gl_type; } #endif /* Setter methods */ @@ -508,13 +532,15 @@ class SDL_BWin:public BDirectWindow _PostWindowEvent(msg); } - void _KeyEvent(int32 keyCode, int32 keyState) { + void _KeyEvent(int32 keyCode, const int8 *keyUtf8, const ssize_t & len, int32 keyState) { /* Create a message to pass along to the BeApp thread */ BMessage msg(BAPP_KEY); msg.AddInt32("key-state", keyState); msg.AddInt32("key-scancode", keyCode); + if (keyUtf8 != NULL) { + msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); + } be_app->PostMessage(&msg); - /* Apparently SDL only uses the scancode */ } void _RepaintEvent() { @@ -565,7 +591,19 @@ class SDL_BWin:public BDirectWindow if(msg->FindBool("window-border", &bEnabled) != B_OK) { return; } - SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); + SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); + } + + void _SetResizable(BMessage *msg) { + bool bEnabled; + if(msg->FindBool("window-resizable", &bEnabled) != B_OK) { + return; + } + if (bEnabled) { + SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } else { + SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } } void _Restore() { @@ -592,6 +630,7 @@ class SDL_BWin:public BDirectWindow /* Members */ #if SDL_VIDEO_OPENGL BGLView * _SDL_GLView; + Uint32 _gl_type; #endif int32 _last_buttons; @@ -635,4 +674,6 @@ class SDL_BWin:public BDirectWindow * through a draw cycle. Occurs when the previous * buffer provided by DirectConnected() is invalidated. */ -#endif +#endif /* SDL_BWin_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.cc new file mode 100644 index 0000000000..3138603d81 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.cc @@ -0,0 +1,95 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU + +/* BWindow based clipboard implementation */ + +#include +#include + +#include "SDL_BWin.h" +#include "SDL_timer.h" +#include "../SDL_sysvideo.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int HAIKU_SetClipboardText(_THIS, const char *text) { + BMessage *clip = NULL; + if(be_clipboard->Lock()) { + be_clipboard->Clear(); + if((clip = be_clipboard->Data())) { + /* Presumably the string of characters is ascii-format */ + ssize_t asciiLength = 0; + for(; text[asciiLength] != 0; ++asciiLength) {} + clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength); + be_clipboard->Commit(); + } + be_clipboard->Unlock(); + } + return 0; +} + +char *HAIKU_GetClipboardText(_THIS) { + BMessage *clip = NULL; + const char *text = NULL; + ssize_t length; + char *result; + if(be_clipboard->Lock()) { + if((clip = be_clipboard->Data())) { + /* Presumably the string of characters is ascii-format */ + clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text, + &length); + } + be_clipboard->Unlock(); + } + + if (!text) { + result = SDL_strdup(""); + } else { + /* Copy the data and pass on to SDL */ + result = (char *)SDL_malloc((length + 1) * sizeof(char)); + SDL_strlcpy(result, text, length + 1); + } + + return result; +} + +SDL_bool HAIKU_HasClipboardText(_THIS) { + SDL_bool result = SDL_FALSE; + char *text = HAIKU_GetClipboardText(_this); + if (text) { + result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE; + SDL_free(text); + } + return result; +} + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.h similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.h index dd31f19a55..de69ed39da 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bclipboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,10 @@ #ifndef SDL_BCLIPBOARD_H #define SDL_BCLIPBOARD_H -extern int BE_SetClipboardText(_THIS, const char *text); -extern char *BE_GetClipboardText(_THIS); -extern SDL_bool BE_HasClipboardText(_THIS); +extern int HAIKU_SetClipboardText(_THIS, const char *text); +extern char *HAIKU_GetClipboardText(_THIS); +extern SDL_bool HAIKU_HasClipboardText(_THIS); #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.cc similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.cc rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.cc index 36513a3b24..c918ab2439 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.cc +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,8 @@ extern "C" { #endif -void BE_PumpEvents(_THIS) { - /* Since the event thread is its own thread, this isn't really necessary */ +void HAIKU_PumpEvents(_THIS) { + /* Since the event thread is its own thread, this isn't really necessary */ } #ifdef __cplusplus @@ -37,3 +37,5 @@ void BE_PumpEvents(_THIS) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.h index cb756c9677..5c34fcf14b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,10 +28,12 @@ extern "C" { #endif -extern void BE_PumpEvents(_THIS); +extern void HAIKU_PumpEvents(_THIS); #ifdef __cplusplus } #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.cc new file mode 100644 index 0000000000..967570612b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.cc @@ -0,0 +1,259 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU + +#include "SDL_bframebuffer.h" + +#include +#include +#include "SDL_bmodes.h" +#include "SDL_BWin.h" + +#include "../../main/haiku/SDL_BApp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef DRAWTHREAD +static int32 HAIKU_UpdateOnce(SDL_Window *window); +#endif + +static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { + return ((SDL_BWin*)(window->driverdata)); +} + +static SDL_INLINE SDL_BApp *_GetBeApp() { + return ((SDL_BApp*)be_app); +} + +int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, + Uint32 * format, + void ** pixels, int *pitch) { + SDL_BWin *bwin = _ToBeWin(window); + BScreen bscreen; + if(!bscreen.IsValid()) { + return -1; + } + + while(!bwin->Connected()) { snooze(100); } + + /* Make sure we have exclusive access to frame buffer data */ + bwin->LockBuffer(); + + /* format */ + display_mode bmode; + bscreen.GetMode(&bmode); + int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space); + *format = HAIKU_BPPToSDLPxFormat(bpp); + + /* Create the new bitmap object */ + BBitmap *bitmap = bwin->GetBitmap(); + + if(bitmap) { + delete bitmap; + } + bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space, + false, /* Views not accepted */ + true); /* Contiguous memory required */ + + if(bitmap->InitCheck() != B_OK) { + delete bitmap; + return SDL_SetError("Could not initialize back buffer!"); + } + + + bwin->SetBitmap(bitmap); + + /* Set the pixel pointer */ + *pixels = bitmap->Bits(); + + /* pitch = width of window, in bytes */ + *pitch = bitmap->BytesPerRow(); + + bwin->SetBufferExists(true); + bwin->SetTrashBuffer(false); + bwin->UnlockBuffer(); + return 0; +} + + + +int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window, + const SDL_Rect * rects, int numrects) { + if(!window) + return 0; + + SDL_BWin *bwin = _ToBeWin(window); + +#ifdef DRAWTHREAD + bwin->LockBuffer(); + bwin->SetBufferDirty(true); + bwin->UnlockBuffer(); +#else + bwin->SetBufferDirty(true); + HAIKU_UpdateOnce(window); +#endif + + return 0; +} + +int32 HAIKU_DrawThread(void *data) { + SDL_BWin *bwin = (SDL_BWin*)data; + + BScreen bscreen; + if(!bscreen.IsValid()) { + return -1; + } + + while(bwin->ConnectionEnabled()) { + if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) { + bwin->LockBuffer(); + BBitmap *bitmap = NULL; + bitmap = bwin->GetBitmap(); + int32 windowPitch = bitmap->BytesPerRow(); + int32 bufferPitch = bwin->GetRowBytes(); + uint8 *windowpx; + uint8 *bufferpx; + + int32 BPP = bwin->GetBytesPerPx(); + int32 windowSub = bwin->GetFbX() * BPP + + bwin->GetFbY() * windowPitch; + clipping_rect *clips = bwin->GetClips(); + int32 numClips = bwin->GetNumClips(); + int i, y; + + /* Blit each clipping rectangle */ + bscreen.WaitForRetrace(); + for(i = 0; i < numClips; ++i) { + /* Get addresses of the start of each clipping rectangle */ + int32 width = clips[i].right - clips[i].left + 1; + int32 height = clips[i].bottom - clips[i].top + 1; + bufferpx = bwin->GetBufferPx() + + clips[i].top * bufferPitch + clips[i].left * BPP; + windowpx = (uint8*)bitmap->Bits() + + clips[i].top * windowPitch + clips[i].left * BPP - + windowSub; + + /* Copy each row of pixels from the window buffer into the frame + buffer */ + for(y = 0; y < height; ++y) + { + + if(bwin->CanTrashWindowBuffer()) { + goto escape; /* Break out before the buffer is killed */ + } + + memcpy(bufferpx, windowpx, width * BPP); + bufferpx += bufferPitch; + windowpx += windowPitch; + } + } + + bwin->SetBufferDirty(false); +escape: + bwin->UnlockBuffer(); + } else { + snooze(16000); + } + } + + return B_OK; +} + +void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { + SDL_BWin *bwin = _ToBeWin(window); + + bwin->LockBuffer(); + + /* Free and clear the window buffer */ + BBitmap *bitmap = bwin->GetBitmap(); + delete bitmap; + bwin->SetBitmap(NULL); + bwin->SetBufferExists(false); + bwin->UnlockBuffer(); +} + + +/* + * TODO: + * This was written to test if certain errors were caused by threading issues. + * The specific issues have since become rare enough that they may have been + * solved, but I doubt it- they were pretty sporadic before now. + */ +#ifndef DRAWTHREAD +static int32 HAIKU_UpdateOnce(SDL_Window *window) { + SDL_BWin *bwin = _ToBeWin(window); + BScreen bscreen; + if(!bscreen.IsValid()) { + return -1; + } + + if(bwin->ConnectionEnabled() && bwin->Connected()) { + bwin->LockBuffer(); + int32 windowPitch = window->surface->pitch; + int32 bufferPitch = bwin->GetRowBytes(); + uint8 *windowpx; + uint8 *bufferpx; + + int32 BPP = bwin->GetBytesPerPx(); + uint8 *windowBaseAddress = (uint8*)window->surface->pixels; + int32 windowSub = bwin->GetFbX() * BPP + + bwin->GetFbY() * windowPitch; + clipping_rect *clips = bwin->GetClips(); + int32 numClips = bwin->GetNumClips(); + int i, y; + + /* Blit each clipping rectangle */ + bscreen.WaitForRetrace(); + for(i = 0; i < numClips; ++i) { + /* Get addresses of the start of each clipping rectangle */ + int32 width = clips[i].right - clips[i].left + 1; + int32 height = clips[i].bottom - clips[i].top + 1; + bufferpx = bwin->GetBufferPx() + + clips[i].top * bufferPitch + clips[i].left * BPP; + windowpx = windowBaseAddress + + clips[i].top * windowPitch + clips[i].left * BPP - windowSub; + + /* Copy each row of pixels from the window buffer into the frame + buffer */ + for(y = 0; y < height; ++y) + { + memcpy(bufferpx, windowpx, width * BPP); + bufferpx += bufferPitch; + windowpx += windowPitch; + } + } + bwin->UnlockBuffer(); + } + return 0; +} +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.h similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.h index d6be21f4d0..e48156d13a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bframebuffer.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,16 +30,18 @@ extern "C" { #include "../SDL_sysvideo.h" -extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, +extern int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); -extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, +extern int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); -extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window); -extern int32 BE_DrawThread(void *data); +extern void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window); +extern int32 HAIKU_DrawThread(void *data); #ifdef __cplusplus } #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.cc new file mode 100644 index 0000000000..9a8b9a4a98 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.cc @@ -0,0 +1,190 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include "SDL_events.h" +#include "SDL_keycode.h" + +#include "SDL_bkeyboard.h" + + +#define KEYMAP_SIZE 128 + + +static SDL_Scancode keymap[KEYMAP_SIZE]; +static int8 keystate[KEYMAP_SIZE]; + +void HAIKU_InitOSKeymap(void) { + for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { + keymap[i] = SDL_SCANCODE_UNKNOWN; + } + + for( uint i = 0; i < KEYMAP_SIZE; ++i ) { + keystate[i] = SDL_RELEASED; + } + + keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE); + keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1); + keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2); + keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3); + keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4); + keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5); + keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6); + keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7); + keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8); + keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9); + keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10); + keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11); + keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12); + keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN); + keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK); + keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE); + keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE); + keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1); + keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2); + keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3); + keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4); + keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5); + keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6); + keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7); + keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8); + keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9); + keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0); + keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS); + keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS); + keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE); + keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT); + keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME); + keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP); + keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR); + keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE); + keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY); + keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS); + keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB); + keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q); + keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w); + keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e); + keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r); + keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t); + keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y); + keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u); + keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i); + keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o); + keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p); + keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET); + keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET); + keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH); + keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE); + keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END); + keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN); + keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7); + keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8); + keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9); + keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS); + keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK); + keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a); + keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s); + keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d); + keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f); + keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g); + keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h); + keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j); + keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k); + keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l); + keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON); + keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE); + keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN); + keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4); + keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5); + keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6); + keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT); + keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z); + keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x); + keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c); + keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v); + keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b); + keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n); + keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m); + keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA); + keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD); + keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH); + keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT); + keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP); + keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1); + keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2); + keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3); + keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER); + keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL); + keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT); + keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE); + keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT); + keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL); + keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT); + keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN); + keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT); + keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0); + keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD); + keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI); + keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI); + keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU); + keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */ + keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS); + keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER); +} + +SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) { + if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) { + return keymap[bkey]; + } else { + return SDL_SCANCODE_UNKNOWN; + } +} + +int8 HAIKU_GetKeyState(int32 bkey) { + if(bkey > 0 && bkey < KEYMAP_SIZE) { + return keystate[bkey]; + } else { + return SDL_RELEASED; + } +} + +void HAIKU_SetKeyState(int32 bkey, int8 state) { + if(bkey > 0 && bkey < KEYMAP_SIZE) { + keystate[bkey] = state; + } +} + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.h similarity index 78% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.h index 6327994214..0184828ae6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bkeyboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,13 +30,15 @@ extern "C" { #include "../../../include/SDL_keyboard.h" -extern void BE_InitOSKeymap(); -extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey); -extern int8 BE_GetKeyState(int32 bkey); -extern void BE_SetKeyState(int32 bkey, int8 state); +extern void HAIKU_InitOSKeymap(void); +extern SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey); +extern int8 HAIKU_GetKeyState(int32 bkey); +extern void HAIKU_SetKeyState(int32 bkey, int8 state); #ifdef __cplusplus } #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.cc new file mode 100644 index 0000000000..9d71996738 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.cc @@ -0,0 +1,333 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU + +#include +#include +#include "SDL_bmodes.h" +#include "SDL_BWin.h" + +#if SDL_VIDEO_OPENGL +#include "SDL_bopengl.h" +#endif + +#include "../../main/haiku/SDL_BApp.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */ + +#if WRAP_BMODE +/* This wrapper is here so that the driverdata can be freed without freeing + the display_mode structure */ +struct SDL_DisplayModeData { + display_mode *bmode; +}; +#endif + +static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { + return ((SDL_BWin*)(window->driverdata)); +} + +static SDL_INLINE SDL_BApp *_GetBeApp() { + return ((SDL_BApp*)be_app); +} + +static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) { +#if WRAP_BMODE + return ((SDL_DisplayModeData*)mode->driverdata)->bmode; +#else + return (display_mode*)(mode->driverdata); +#endif +} + +/* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */ +static float get_refresh_rate(display_mode &mode) { + return float(mode.timing.pixel_clock * 1000) + / float(mode.timing.h_total * mode.timing.v_total); +} + + +#if 0 +/* TODO: + * This is a useful debugging tool. Uncomment and insert into code as needed. + */ +void _SpoutModeData(display_mode *bmode) { + printf("BMode:\n"); + printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height); + printf("\th,v = (%i,%i)\n", bmode->h_display_start, + bmode->v_display_start); + if(bmode->flags) { + printf("\tFlags:\n"); + if(bmode->flags & B_SCROLL) { + printf("\t\tB_SCROLL\n"); + } + if(bmode->flags & B_8_BIT_DAC) { + printf("\t\tB_8_BIT_DAC\n"); + } + if(bmode->flags & B_HARDWARE_CURSOR) { + printf("\t\tB_HARDWARE_CURSOR\n"); + } + if(bmode->flags & B_PARALLEL_ACCESS) { + printf("\t\tB_PARALLEL_ACCESS\n"); + } + if(bmode->flags & B_DPMS) { + printf("\t\tB_DPMS\n"); + } + if(bmode->flags & B_IO_FB_NA) { + printf("\t\tB_IO_FB_NA\n"); + } + } + printf("\tTiming:\n"); + printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock); + printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n", + bmode->timing.h_display, bmode->timing.h_sync_start, + bmode->timing.h_sync_end, bmode->timing.h_total); + printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n", + bmode->timing.v_display, bmode->timing.v_sync_start, + bmode->timing.v_sync_end, bmode->timing.v_total); + if(bmode->timing.flags) { + printf("\t\tFlags:\n"); + if(bmode->timing.flags & B_BLANK_PEDESTAL) { + printf("\t\t\tB_BLANK_PEDESTAL\n"); + } + if(bmode->timing.flags & B_TIMING_INTERLACED) { + printf("\t\t\tB_TIMING_INTERLACED\n"); + } + if(bmode->timing.flags & B_POSITIVE_HSYNC) { + printf("\t\t\tB_POSITIVE_HSYNC\n"); + } + if(bmode->timing.flags & B_POSITIVE_VSYNC) { + printf("\t\t\tB_POSITIVE_VSYNC\n"); + } + if(bmode->timing.flags & B_SYNC_ON_GREEN) { + printf("\t\t\tB_SYNC_ON_GREEN\n"); + } + } +} +#endif + + + +int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace) +{ + int bitsperpixel; + + bitsperpixel = 0; + switch (colorspace) { + case B_CMAP8: + bitsperpixel = 8; + break; + case B_RGB15: + case B_RGBA15: + case B_RGB15_BIG: + case B_RGBA15_BIG: + bitsperpixel = 15; + break; + case B_RGB16: + case B_RGB16_BIG: + bitsperpixel = 16; + break; + case B_RGB32: + case B_RGBA32: + case B_RGB32_BIG: + case B_RGBA32_BIG: + bitsperpixel = 32; + break; + default: + break; + } + return(bitsperpixel); +} + +int32 HAIKU_BPPToSDLPxFormat(int32 bpp) { + /* Translation taken from SDL_windowsmodes.c */ + switch (bpp) { + case 32: + return SDL_PIXELFORMAT_RGB888; + break; + case 24: /* May not be supported by Haiku */ + return SDL_PIXELFORMAT_RGB24; + break; + case 16: + return SDL_PIXELFORMAT_RGB565; + break; + case 15: + return SDL_PIXELFORMAT_RGB555; + break; + case 8: + return SDL_PIXELFORMAT_INDEX8; + break; + case 4: /* May not be supported by Haiku */ + return SDL_PIXELFORMAT_INDEX4LSB; + break; + } + + /* May never get here, but safer and needed to shut up compiler */ + SDL_SetError("Invalid bpp value"); + return 0; +} + +static void _BDisplayModeToSdlDisplayMode(display_mode *bmode, + SDL_DisplayMode *mode) { + mode->w = bmode->virtual_width; + mode->h = bmode->virtual_height; + mode->refresh_rate = (int)get_refresh_rate(*bmode); + +#if WRAP_BMODE + SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, + sizeof(SDL_DisplayModeData)); + data->bmode = bmode; + + mode->driverdata = data; + +#else + + mode->driverdata = bmode; +#endif + + /* Set the format */ + int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space); + mode->format = HAIKU_BPPToSDLPxFormat(bpp); +} + +/* Later, there may be more than one monitor available */ +static void _AddDisplay(BScreen *screen) { + SDL_VideoDisplay display; + SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1, + sizeof(SDL_DisplayMode)); + display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode)); + screen->GetMode(bmode); + + _BDisplayModeToSdlDisplayMode(bmode, mode); + + SDL_zero(display); + display.desktop_mode = *mode; + display.current_mode = *mode; + + SDL_AddVideoDisplay(&display); +} + +/* + * Functions called by SDL + */ + +int HAIKU_InitModes(_THIS) { + BScreen screen; + + /* TODO: When Haiku supports multiple display screens, call + _AddDisplayScreen() for each of them. */ + _AddDisplay(&screen); + return 0; +} + +int HAIKU_QuitModes(_THIS) { + /* FIXME: Nothing really needs to be done here at the moment? */ + return 0; +} + + +int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) { + BScreen bscreen; + BRect rc = bscreen.Frame(); + rect->x = (int)rc.left; + rect->y = (int)rc.top; + rect->w = (int)rc.Width() + 1; + rect->h = (int)rc.Height() + 1; + return 0; +} + +void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) { + /* Get the current screen */ + BScreen bscreen; + + /* Iterate through all of the modes */ + SDL_DisplayMode mode; + display_mode this_bmode; + display_mode *bmodes; + uint32 count, i; + + /* Get graphics-hardware supported modes */ + bscreen.GetModeList(&bmodes, &count); + bscreen.GetMode(&this_bmode); + + for(i = 0; i < count; ++i) { + // FIXME: Apparently there are errors with colorspace changes + if (bmodes[i].space == this_bmode.space) { + _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode); + SDL_AddDisplayMode(display, &mode); + } + } + free(bmodes); +} + + +int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ + /* Get the current screen */ + BScreen bscreen; + if(!bscreen.IsValid()) { + printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__); + } + + /* Set the mode using the driver data */ + display_mode *bmode = _ExtractBMode(mode); + + + /* FIXME: Is the first option always going to be the right one? */ + uint32 c = 0, i; + display_mode *bmode_list; + bscreen.GetModeList(&bmode_list, &c); + for(i = 0; i < c; ++i) { + if( bmode_list[i].space == bmode->space && + bmode_list[i].virtual_width == bmode->virtual_width && + bmode_list[i].virtual_height == bmode->virtual_height ) { + bmode = &bmode_list[i]; + break; + } + } + + if(bscreen.SetMode(bmode) != B_OK) { + return SDL_SetError("Bad video mode"); + } + + free(bmode_list); + +#if SDL_VIDEO_OPENGL + /* FIXME: Is there some way to reboot the OpenGL context? This doesn't + help */ +// HAIKU_GL_RebootContexts(_this); +#endif + + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.h similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.h index c3882ba580..3abc1dce6d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bmodes.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,15 +28,15 @@ extern "C" { #include "../SDL_sysvideo.h" -extern int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace); -extern int32 BE_BPPToSDLPxFormat(int32 bpp); +extern int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace); +extern int32 HAIKU_BPPToSDLPxFormat(int32 bpp); -extern int BE_InitModes(_THIS); -extern int BE_QuitModes(_THIS); -extern int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, +extern int HAIKU_InitModes(_THIS); +extern int HAIKU_QuitModes(_THIS); +extern int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect); -extern void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display); -extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, +extern void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display); +extern int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); #ifdef __cplusplus @@ -44,3 +44,5 @@ extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.cc new file mode 100644 index 0000000000..e599062717 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.cc @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL + +#include "SDL_bopengl.h" + +#include +#include +#include +#include "SDL_BWin.h" +#include "../../main/haiku/SDL_BApp.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { + return ((SDL_BWin*)(window->driverdata)); +} + +static SDL_INLINE SDL_BApp *_GetBeApp() { + return ((SDL_BApp*)be_app); +} + +/* Passing a NULL path means load pointers from the application */ +int HAIKU_GL_LoadLibrary(_THIS, const char *path) +{ +/* FIXME: Is this working correctly? */ + image_info info; + int32 cookie = 0; + while (get_next_image_info(0, &cookie, &info) == B_OK) { + void *location = NULL; + if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, + &location) == B_OK) { + + _this->gl_config.dll_handle = (void *) (size_t) info.id; + _this->gl_config.driver_loaded = 1; + SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", + SDL_arraysize(_this->gl_config.driver_path)); + } + } + return 0; +} + +void *HAIKU_GL_GetProcAddress(_THIS, const char *proc) +{ + if (_this->gl_config.dll_handle != NULL) { + void *location = NULL; + status_t err; + if ((err = + get_image_symbol((image_id) (size_t) _this->gl_config.dll_handle, + proc, B_SYMBOL_TYPE_ANY, + &location)) == B_OK) { + return location; + } else { + SDL_SetError("Couldn't find OpenGL symbol"); + return NULL; + } + } else { + SDL_SetError("OpenGL library not loaded"); + return NULL; + } +} + + + + +int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window) { + _ToBeWin(window)->SwapBuffers(); + return 0; +} + +int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { + SDL_BWin* win = (SDL_BWin*)context; + _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL); + return 0; +} + + +SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) { + /* FIXME: Not sure what flags should be included here; may want to have + most of them */ + SDL_BWin *bwin = _ToBeWin(window); + Uint32 gl_flags = BGL_RGB; + if (_this->gl_config.alpha_size) { + gl_flags |= BGL_ALPHA; + } + if (_this->gl_config.depth_size) { + gl_flags |= BGL_DEPTH; + } + if (_this->gl_config.stencil_size) { + gl_flags |= BGL_STENCIL; + } + if (_this->gl_config.double_buffer) { + gl_flags |= BGL_DOUBLE; + } else { + gl_flags |= BGL_SINGLE; + } + if (_this->gl_config.accum_red_size || + _this->gl_config.accum_green_size || + _this->gl_config.accum_blue_size || + _this->gl_config.accum_alpha_size) { + gl_flags |= BGL_ACCUM; + } + bwin->CreateGLView(gl_flags); + return (SDL_GLContext)(bwin); +} + +void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) { + /* Currently, automatically unlocks the view */ + ((SDL_BWin*)context)->RemoveGLView(); +} + + +int HAIKU_GL_SetSwapInterval(_THIS, int interval) { + /* TODO: Implement this, if necessary? */ + return SDL_Unsupported(); +} + +int HAIKU_GL_GetSwapInterval(_THIS) { + /* TODO: Implement this, if necessary? */ + return 0; +} + + +void HAIKU_GL_UnloadLibrary(_THIS) { + /* TODO: Implement this, if necessary? */ +} + + +/* FIXME: This function is meant to clear the OpenGL context when the video + mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not + currently in use. */ +void HAIKU_GL_RebootContexts(_THIS) { + SDL_Window *window = _this->windows; + while(window) { + SDL_BWin *bwin = _ToBeWin(window); + if(bwin->GetGLView()) { + bwin->LockLooper(); + bwin->RemoveGLView(); + bwin->CreateGLView(bwin->GetGLType()); + bwin->UnlockLooper(); + } + window = window->next; + } +} + + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.h similarity index 53% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.h index e7d475dfb7..b5b0de6924 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bopengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,8 @@ #ifndef SDL_BOPENGL_H #define SDL_BOPENGL_H +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL + #ifdef __cplusplus extern "C" { #endif @@ -29,21 +31,25 @@ extern "C" { #include "../SDL_sysvideo.h" -extern int BE_GL_LoadLibrary(_THIS, const char *path); /* FIXME */ -extern void *BE_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */ -extern void BE_GL_UnloadLibrary(_THIS); /* TODO */ -extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window, +extern int HAIKU_GL_LoadLibrary(_THIS, const char *path); /* FIXME */ +extern void *HAIKU_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */ +extern void HAIKU_GL_UnloadLibrary(_THIS); /* TODO */ +extern int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern int BE_GL_SetSwapInterval(_THIS, int interval); /* TODO */ -extern int BE_GL_GetSwapInterval(_THIS); /* TODO */ -extern void BE_GL_SwapWindow(_THIS, SDL_Window * window); -extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window); -extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context); +extern int HAIKU_GL_SetSwapInterval(_THIS, int interval); /* TODO */ +extern int HAIKU_GL_GetSwapInterval(_THIS); /* TODO */ +extern int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window); +extern SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window); +extern void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context); -extern void BE_GL_RebootContexts(_THIS); +extern void HAIKU_GL_RebootContexts(_THIS); #ifdef __cplusplus } #endif +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.cc new file mode 100644 index 0000000000..e7b4b6e300 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.cc @@ -0,0 +1,177 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "SDL_bkeyboard.h" +#include "SDL_bwindow.h" +#include "SDL_bclipboard.h" +#include "SDL_bvideo.h" +#include "SDL_bopengl.h" +#include "SDL_bmodes.h" +#include "SDL_bframebuffer.h" +#include "SDL_bevents.h" + +/* FIXME: Undefined functions */ +// #define HAIKU_PumpEvents NULL + #define HAIKU_StartTextInput NULL + #define HAIKU_StopTextInput NULL + #define HAIKU_SetTextInputRect NULL + +// #define HAIKU_DeleteDevice NULL + +/* End undefined functions */ + +static SDL_VideoDevice * +HAIKU_CreateDevice(int devindex) +{ + SDL_VideoDevice *device; + /*SDL_VideoData *data;*/ + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + + device->driverdata = NULL; /* FIXME: Is this the cause of some of the + SDL_Quit() errors? */ + +/* TODO: Figure out if any initialization needs to go here */ + + /* Set the function pointers */ + device->VideoInit = HAIKU_VideoInit; + device->VideoQuit = HAIKU_VideoQuit; + device->GetDisplayBounds = HAIKU_GetDisplayBounds; + device->GetDisplayModes = HAIKU_GetDisplayModes; + device->SetDisplayMode = HAIKU_SetDisplayMode; + device->PumpEvents = HAIKU_PumpEvents; + + device->CreateSDLWindow = HAIKU_CreateWindow; + device->CreateSDLWindowFrom = HAIKU_CreateWindowFrom; + device->SetWindowTitle = HAIKU_SetWindowTitle; + device->SetWindowIcon = HAIKU_SetWindowIcon; + device->SetWindowPosition = HAIKU_SetWindowPosition; + device->SetWindowSize = HAIKU_SetWindowSize; + device->ShowWindow = HAIKU_ShowWindow; + device->HideWindow = HAIKU_HideWindow; + device->RaiseWindow = HAIKU_RaiseWindow; + device->MaximizeWindow = HAIKU_MaximizeWindow; + device->MinimizeWindow = HAIKU_MinimizeWindow; + device->RestoreWindow = HAIKU_RestoreWindow; + device->SetWindowBordered = HAIKU_SetWindowBordered; + device->SetWindowResizable = HAIKU_SetWindowResizable; + device->SetWindowFullscreen = HAIKU_SetWindowFullscreen; + device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp; + device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp; + device->SetWindowGrab = HAIKU_SetWindowGrab; + device->DestroyWindow = HAIKU_DestroyWindow; + device->GetWindowWMInfo = HAIKU_GetWindowWMInfo; + device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer; + device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer; + device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer; + + device->shape_driver.CreateShaper = NULL; + device->shape_driver.SetWindowShape = NULL; + device->shape_driver.ResizeWindowShape = NULL; + +#if SDL_VIDEO_OPENGL + device->GL_LoadLibrary = HAIKU_GL_LoadLibrary; + device->GL_GetProcAddress = HAIKU_GL_GetProcAddress; + device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary; + device->GL_CreateContext = HAIKU_GL_CreateContext; + device->GL_MakeCurrent = HAIKU_GL_MakeCurrent; + device->GL_SetSwapInterval = HAIKU_GL_SetSwapInterval; + device->GL_GetSwapInterval = HAIKU_GL_GetSwapInterval; + device->GL_SwapWindow = HAIKU_GL_SwapWindow; + device->GL_DeleteContext = HAIKU_GL_DeleteContext; +#endif + + device->StartTextInput = HAIKU_StartTextInput; + device->StopTextInput = HAIKU_StopTextInput; + device->SetTextInputRect = HAIKU_SetTextInputRect; + + device->SetClipboardText = HAIKU_SetClipboardText; + device->GetClipboardText = HAIKU_GetClipboardText; + device->HasClipboardText = HAIKU_HasClipboardText; + + device->free = HAIKU_DeleteDevice; + + return device; +} + +VideoBootStrap HAIKU_bootstrap = { + "haiku", "Haiku graphics", + HAIKU_Available, HAIKU_CreateDevice +}; + +void HAIKU_DeleteDevice(SDL_VideoDevice * device) +{ + SDL_free(device->driverdata); + SDL_free(device); +} + +int HAIKU_VideoInit(_THIS) +{ + /* Initialize the Be Application for appserver interaction */ + if (SDL_InitBeApp() < 0) { + return -1; + } + + /* Initialize video modes */ + HAIKU_InitModes(_this); + + /* Init the keymap */ + HAIKU_InitOSKeymap(); + +#if SDL_VIDEO_OPENGL + /* testgl application doesn't load library, just tries to load symbols */ + /* is it correct? if so we have to load library here */ + HAIKU_GL_LoadLibrary(_this, NULL); +#endif + + /* We're done! */ + return (0); +} + +int HAIKU_Available(void) +{ + return (1); +} + +void HAIKU_VideoQuit(_THIS) +{ + + HAIKU_QuitModes(_this); + + SDL_QuitBeApp(); +} + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.h index ef5c740320..a1d01fb257 100644 --- a/3rdparty/sdl2-2.0.4/src/video/haiku/SDL_bvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,13 +30,15 @@ extern "C" { #include "../SDL_sysvideo.h" -extern void BE_VideoQuit(_THIS); -extern int BE_VideoInit(_THIS); -extern void BE_DeleteDevice(_THIS); -extern int BE_Available(void); +extern void HAIKU_VideoQuit(_THIS); +extern int HAIKU_VideoInit(_THIS); +extern void HAIKU_DeleteDevice(_THIS); +extern int HAIKU_Available(void); #ifdef __cplusplus } #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.cc b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.cc new file mode 100644 index 0000000000..142a3fa18c --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.cc @@ -0,0 +1,233 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_HAIKU +#include "../SDL_sysvideo.h" + +#include "SDL_BWin.h" +#include + +/* Define a path to window's BWIN data */ +#ifdef __cplusplus +extern "C" { +#endif + +static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { + return ((SDL_BWin*)(window->driverdata)); +} + +static SDL_INLINE SDL_BApp *_GetBeApp() { + return ((SDL_BApp*)be_app); +} + +static int _InitWindow(_THIS, SDL_Window *window) { + uint32 flags = 0; + window_look look = B_TITLED_WINDOW_LOOK; + + BRect bounds( + window->x, + window->y, + window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing + window->y + window->h - 1 + ); + + if(window->flags & SDL_WINDOW_FULLSCREEN) { + /* TODO: Add support for this flag */ + printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__); + } + if(window->flags & SDL_WINDOW_OPENGL) { + /* TODO: Add support for this flag */ + } + if(!(window->flags & SDL_WINDOW_RESIZABLE)) { + flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE; + } + if(window->flags & SDL_WINDOW_BORDERLESS) { + look = B_NO_BORDER_WINDOW_LOOK; + } + + SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); + if(bwin == NULL) + return -1; + + window->driverdata = bwin; + int32 winID = _GetBeApp()->GetID(window); + bwin->SetID(winID); + + return 0; +} + +int HAIKU_CreateWindow(_THIS, SDL_Window *window) { + if (_InitWindow(_this, window) < 0) { + return -1; + } + + /* Start window loop */ + _ToBeWin(window)->Show(); + return 0; +} + +int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { + + SDL_BWin *otherBWin = (SDL_BWin*)data; + if(!otherBWin->LockLooper()) + return -1; + + /* Create the new window and initialize its members */ + window->x = (int)otherBWin->Frame().left; + window->y = (int)otherBWin->Frame().top; + window->w = (int)otherBWin->Frame().Width(); + window->h = (int)otherBWin->Frame().Height(); + + /* Set SDL flags */ + if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) { + window->flags |= SDL_WINDOW_RESIZABLE; + } + + /* If we are out of memory, return the error code */ + if (_InitWindow(_this, window) < 0) { + return -1; + } + + /* TODO: Add any other SDL-supported window attributes here */ + _ToBeWin(window)->SetTitle(otherBWin->Title()); + + /* Start window loop and unlock the other window */ + _ToBeWin(window)->Show(); + + otherBWin->UnlockLooper(); + return 0; +} + +void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) { + BMessage msg(BWIN_SET_TITLE); + msg.AddString("window-title", window->title); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) { + /* FIXME: Icons not supported by Haiku */ +} + +void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) { + BMessage msg(BWIN_MOVE_WINDOW); + msg.AddInt32("window-x", window->x); + msg.AddInt32("window-y", window->y); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_SetWindowSize(_THIS, SDL_Window * window) { + BMessage msg(BWIN_RESIZE_WINDOW); + msg.AddInt32("window-w", window->w - 1); + msg.AddInt32("window-h", window->h - 1); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { + BMessage msg(BWIN_SET_BORDERED); + msg.AddBool("window-border", bordered != SDL_FALSE); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { + BMessage msg(BWIN_SET_RESIZABLE); + msg.AddBool("window-resizable", resizable != SDL_FALSE); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_ShowWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_SHOW_WINDOW); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_HideWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_HIDE_WINDOW); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_RaiseWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */ + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_MAXIMIZE_WINDOW); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_MINIMIZE_WINDOW); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_RestoreWindow(_THIS, SDL_Window * window) { + BMessage msg(BWIN_RESTORE_WINDOW); + _ToBeWin(window)->PostMessage(&msg); +} + +void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window, + SDL_VideoDisplay * display, SDL_bool fullscreen) { + /* Haiku tracks all video display information */ + BMessage msg(BWIN_FULLSCREEN); + msg.AddBool("fullscreen", fullscreen); + _ToBeWin(window)->PostMessage(&msg); + +} + +int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { + /* FIXME: Not Haiku supported */ + return -1; +} + +int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) { + /* FIXME: Not Haiku supported */ + return -1; +} + + +void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { + /* TODO: Implement this! */ +} + +void HAIKU_DestroyWindow(_THIS, SDL_Window * window) { + _ToBeWin(window)->LockLooper(); /* This MUST be locked */ + _GetBeApp()->ClearID(_ToBeWin(window)); + _ToBeWin(window)->Quit(); + window->driverdata = NULL; +} + +SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info) { + /* FIXME: What is the point of this? What information should be included? */ + return SDL_FALSE; +} + + + + + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.h b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.h new file mode 100644 index 0000000000..2894f2794e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/haiku/SDL_bwindow.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_BWINDOW_H +#define SDL_BWINDOW_H + + +#include "../SDL_sysvideo.h" + + +extern int HAIKU_CreateWindow(_THIS, SDL_Window *window); +extern int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +extern void HAIKU_SetWindowTitle(_THIS, SDL_Window * window); +extern void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +extern void HAIKU_SetWindowPosition(_THIS, SDL_Window * window); +extern void HAIKU_SetWindowSize(_THIS, SDL_Window * window); +extern void HAIKU_ShowWindow(_THIS, SDL_Window * window); +extern void HAIKU_HideWindow(_THIS, SDL_Window * window); +extern void HAIKU_RaiseWindow(_THIS, SDL_Window * window); +extern void HAIKU_MaximizeWindow(_THIS, SDL_Window * window); +extern void HAIKU_MinimizeWindow(_THIS, SDL_Window * window); +extern void HAIKU_RestoreWindow(_THIS, SDL_Window * window); +extern void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); +extern void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable); +extern void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); +extern int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); +extern int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); +extern void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +extern void HAIKU_DestroyWindow(_THIS, SDL_Window * window); +extern SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + + + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/egl.h b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/egl.h new file mode 100644 index 0000000000..93a21873c0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/egl.h @@ -0,0 +1,303 @@ +#ifndef __egl_h_ +#define __egl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +/* Generated on date 20170627 */ + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_VERSION_1_0 +#define EGL_VERSION_1_0 1 +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +#include +#include +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_BLUE_SIZE 0x3022 +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_CORE_NATIVE_ENGINE 0x305B +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_DONT_CARE EGL_CAST(EGLint,-1) +#define EGL_DRAW 0x3059 +#define EGL_EXTENSIONS 0x3055 +#define EGL_FALSE 0 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_HEIGHT 0x3056 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_NONE 0x3038 +#define EGL_NON_CONFORMANT_CONFIG 0x3051 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0) +#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0) +#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_PIXMAP_BIT 0x0002 +#define EGL_READ 0x305A +#define EGL_RED_SIZE 0x3024 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SLOW_CONFIG 0x3050 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_SUCCESS 0x3000 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_TRANSPARENT_RGB 0x3052 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRUE 1 +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_WIDTH 0x3057 +#define EGL_WINDOW_BIT 0x0004 +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); +EGLAPI EGLint EGLAPIENTRY eglGetError (void); +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif /* EGL_VERSION_1_0 */ + +#ifndef EGL_VERSION_1_1 +#define EGL_VERSION_1_1 1 +#define EGL_BACK_BUFFER 0x3084 +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_CONTEXT_LOST 0x300E +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_2D 0x305F +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_TARGET 0x3081 +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif /* EGL_VERSION_1_1 */ + +#ifndef EGL_VERSION_1_2 +#define EGL_VERSION_1_2 1 +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#define EGL_ALPHA_FORMAT 0x3088 +#define EGL_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_ALPHA_FORMAT_PRE 0x308C +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_BUFFER_PRESERVED 0x3094 +#define EGL_BUFFER_DESTROYED 0x3095 +#define EGL_CLIENT_APIS 0x308D +#define EGL_COLORSPACE 0x3087 +#define EGL_COLORSPACE_sRGB 0x3089 +#define EGL_COLORSPACE_LINEAR 0x308A +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 +#define EGL_DISPLAY_SCALING 10000 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_LUMINANCE_BUFFER 0x308F +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_OPENGL_ES_BIT 0x0001 +#define EGL_OPENVG_BIT 0x0002 +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENVG_IMAGE 0x3096 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_RGB_BUFFER 0x308E +#define EGL_SINGLE_BUFFER 0x3085 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_UNKNOWN EGL_CAST(EGLint,-1) +#define EGL_VERTICAL_RESOLUTION 0x3091 +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif /* EGL_VERSION_1_2 */ + +#ifndef EGL_VERSION_1_3 +#define EGL_VERSION_1_3 1 +#define EGL_CONFORMANT 0x3042 +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 +#define EGL_OPENGL_ES2_BIT 0x0004 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_COLORSPACE_sRGB 0x3089 +#define EGL_VG_COLORSPACE_LINEAR 0x308A +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 +#endif /* EGL_VERSION_1_3 */ + +#ifndef EGL_VERSION_1_4 +#define EGL_VERSION_1_4 1 +#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0) +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B +#define EGL_OPENGL_API 0x30A2 +#define EGL_OPENGL_BIT 0x0008 +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif /* EGL_VERSION_1_4 */ + +#ifndef EGL_VERSION_1_5 +#define EGL_VERSION_1_5 1 +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 +#define EGL_CONTEXT_MINOR_VERSION 0x30FB +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD +#define EGL_NO_RESET_NOTIFICATION 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 +#define EGL_OPENGL_ES3_BIT 0x00000040 +#define EGL_CL_EVENT_HANDLE 0x309C +#define EGL_SYNC_CL_EVENT 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 +#define EGL_SYNC_TYPE 0x30F7 +#define EGL_SYNC_STATUS 0x30F1 +#define EGL_SYNC_CONDITION 0x30F8 +#define EGL_SIGNALED 0x30F2 +#define EGL_UNSIGNALED 0x30F3 +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED 0x30F5 +#define EGL_CONDITION_SATISFIED 0x30F6 +#define EGL_NO_SYNC EGL_CAST(EGLSync,0) +#define EGL_SYNC_FENCE 0x30F9 +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_SRGB 0x3089 +#define EGL_GL_COLORSPACE_LINEAR 0x308A +#define EGL_GL_RENDERBUFFER 0x30B9 +#define EGL_GL_TEXTURE_2D 0x30B1 +#define EGL_GL_TEXTURE_LEVEL 0x30BC +#define EGL_GL_TEXTURE_3D 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 +#define EGL_IMAGE_PRESERVED 0x30D2 +#define EGL_NO_IMAGE EGL_CAST(EGLImage,0) +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif /* EGL_VERSION_1_5 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglext.h b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglext.h new file mode 100644 index 0000000000..d2def032d1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglext.h @@ -0,0 +1,1241 @@ +#ifndef __eglext_h_ +#define __eglext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +#define EGL_EGLEXT_VERSION 20170627 + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: _nomatch_^ + * Default extensions included: egl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_KHR_cl_event +#define EGL_KHR_cl_event 1 +#define EGL_CL_EVENT_HANDLE_KHR 0x309C +#define EGL_SYNC_CL_EVENT_KHR 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF +#endif /* EGL_KHR_cl_event */ + +#ifndef EGL_KHR_cl_event2 +#define EGL_KHR_cl_event2 1 +typedef void *EGLSyncKHR; +typedef intptr_t EGLAttribKHR; +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#endif +#endif /* EGL_KHR_cl_event2 */ + +#ifndef EGL_KHR_client_get_all_proc_addresses +#define EGL_KHR_client_get_all_proc_addresses 1 +#endif /* EGL_KHR_client_get_all_proc_addresses */ + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 +#endif /* EGL_KHR_config_attribs */ + +#ifndef EGL_KHR_context_flush_control +#define EGL_KHR_context_flush_control 1 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 +#endif /* EGL_KHR_context_flush_control */ + +#ifndef EGL_KHR_create_context +#define EGL_KHR_create_context 1 +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif /* EGL_KHR_create_context */ + +#ifndef EGL_KHR_create_context_no_error +#define EGL_KHR_create_context_no_error 1 +#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 +#endif /* EGL_KHR_create_context_no_error */ + +#ifndef EGL_KHR_debug +#define EGL_KHR_debug 1 +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +#define EGL_OBJECT_THREAD_KHR 0x33B0 +#define EGL_OBJECT_DISPLAY_KHR 0x33B1 +#define EGL_OBJECT_CONTEXT_KHR 0x33B2 +#define EGL_OBJECT_SURFACE_KHR 0x33B3 +#define EGL_OBJECT_IMAGE_KHR 0x33B4 +#define EGL_OBJECT_SYNC_KHR 0x33B5 +#define EGL_OBJECT_STREAM_KHR 0x33B6 +#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9 +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA +#define EGL_DEBUG_MSG_WARN_KHR 0x33BB +#define EGL_DEBUG_MSG_INFO_KHR 0x33BC +#define EGL_DEBUG_CALLBACK_KHR 0x33B8 +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#endif +#endif /* EGL_KHR_debug */ + +#ifndef EGL_KHR_display_reference +#define EGL_KHR_display_reference 1 +#define EGL_TRACK_REFERENCES_KHR 0x3352 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#endif +#endif /* EGL_KHR_display_reference */ + +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_fence_sync */ + +#ifndef EGL_KHR_get_all_proc_addresses +#define EGL_KHR_get_all_proc_addresses 1 +#endif /* EGL_KHR_get_all_proc_addresses */ + +#ifndef EGL_KHR_gl_colorspace +#define EGL_KHR_gl_colorspace 1 +#define EGL_GL_COLORSPACE_KHR 0x309D +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A +#endif /* EGL_KHR_gl_colorspace */ + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 +#endif /* EGL_KHR_gl_renderbuffer_image */ + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC +#endif /* EGL_KHR_gl_texture_2D_image */ + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD +#endif /* EGL_KHR_gl_texture_3D_image */ + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 +#endif /* EGL_KHR_gl_texture_cubemap_image */ + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +typedef void *EGLImageKHR; +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0) +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif +#endif /* EGL_KHR_image */ + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#endif /* EGL_KHR_image_base */ + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +#endif /* EGL_KHR_image_pixmap */ + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 +#define EGL_MATCH_FORMAT_KHR 0x3043 +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 +#define EGL_FORMAT_RGB_565_KHR 0x30C1 +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 +#define EGL_BITMAP_POINTER_KHR 0x30C6 +#define EGL_BITMAP_PITCH_KHR 0x30C7 +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD +#define EGL_LOWER_LEFT_KHR 0x30CE +#define EGL_UPPER_LEFT_KHR 0x30CF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); +#endif +#endif /* EGL_KHR_lock_surface */ + +#ifndef EGL_KHR_lock_surface2 +#define EGL_KHR_lock_surface2 1 +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 +#endif /* EGL_KHR_lock_surface2 */ + +#ifndef EGL_KHR_lock_surface3 +#define EGL_KHR_lock_surface3 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#endif +#endif /* EGL_KHR_lock_surface3 */ + +#ifndef EGL_KHR_mutable_render_buffer +#define EGL_KHR_mutable_render_buffer 1 +#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000 +#endif /* EGL_KHR_mutable_render_buffer */ + +#ifndef EGL_KHR_no_config_context +#define EGL_KHR_no_config_context 1 +#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0) +#endif /* EGL_KHR_no_config_context */ + +#ifndef EGL_KHR_partial_update +#define EGL_KHR_partial_update 1 +#define EGL_BUFFER_AGE_KHR 0x313D +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_partial_update */ + +#ifndef EGL_KHR_platform_android +#define EGL_KHR_platform_android 1 +#define EGL_PLATFORM_ANDROID_KHR 0x3141 +#endif /* EGL_KHR_platform_android */ + +#ifndef EGL_KHR_platform_gbm +#define EGL_KHR_platform_gbm 1 +#define EGL_PLATFORM_GBM_KHR 0x31D7 +#endif /* EGL_KHR_platform_gbm */ + +#ifndef EGL_KHR_platform_wayland +#define EGL_KHR_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 +#endif /* EGL_KHR_platform_wayland */ + +#ifndef EGL_KHR_platform_x11 +#define EGL_KHR_platform_x11 1 +#define EGL_PLATFORM_X11_KHR 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 +#endif /* EGL_KHR_platform_x11 */ + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_reusable_sync */ + +#ifndef EGL_KHR_stream +#define EGL_KHR_stream 1 +typedef void *EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream */ + +#ifndef EGL_KHR_stream_attrib +#define EGL_KHR_stream_attrib 1 +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream_attrib */ + +#ifndef EGL_KHR_stream_consumer_gltexture +#define EGL_KHR_stream_consumer_gltexture 1 +#ifdef EGL_KHR_stream +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_consumer_gltexture */ + +#ifndef EGL_KHR_stream_cross_process_fd +#define EGL_KHR_stream_cross_process_fd 1 +typedef int EGLNativeFileDescriptorKHR; +#ifdef EGL_KHR_stream +#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1) +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_cross_process_fd */ + +#ifndef EGL_KHR_stream_fifo +#define EGL_KHR_stream_fifo 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_fifo */ + +#ifndef EGL_KHR_stream_producer_aldatalocator +#define EGL_KHR_stream_producer_aldatalocator 1 +#ifdef EGL_KHR_stream +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_aldatalocator */ + +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_KHR_stream_producer_eglsurface 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_BIT_KHR 0x0800 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_eglsurface */ + +#ifndef EGL_KHR_surfaceless_context +#define EGL_KHR_surfaceless_context 1 +#endif /* EGL_KHR_surfaceless_context */ + +#ifndef EGL_KHR_swap_buffers_with_damage +#define EGL_KHR_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_swap_buffers_with_damage */ + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA +#endif /* EGL_KHR_vg_parent_image */ + +#ifndef EGL_KHR_wait_sync +#define EGL_KHR_wait_sync 1 +typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#endif +#endif /* EGL_KHR_wait_sync */ + +#ifndef EGL_ANDROID_blob_cache +#define EGL_ANDROID_blob_cache 1 +typedef khronos_ssize_t EGLsizeiANDROID; +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#endif +#endif /* EGL_ANDROID_blob_cache */ + +#ifndef EGL_ANDROID_create_native_client_buffer +#define EGL_ANDROID_create_native_client_buffer 1 +#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 +#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001 +#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002 +#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004 +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list); +#endif +#endif /* EGL_ANDROID_create_native_client_buffer */ + +#ifndef EGL_ANDROID_framebuffer_target +#define EGL_ANDROID_framebuffer_target 1 +#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 +#endif /* EGL_ANDROID_framebuffer_target */ + +#ifndef EGL_ANDROID_front_buffer_auto_refresh +#define EGL_ANDROID_front_buffer_auto_refresh 1 +#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ + +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 +#endif /* EGL_ANDROID_image_native_buffer */ + +#ifndef EGL_ANDROID_native_fence_sync +#define EGL_ANDROID_native_fence_sync 1 +#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 +#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 +#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 +#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 +typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); +#endif +#endif /* EGL_ANDROID_native_fence_sync */ + +#ifndef EGL_ANDROID_presentation_time +#define EGL_ANDROID_presentation_time 1 +typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#endif +#endif /* EGL_ANDROID_presentation_time */ + +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 +#endif /* EGL_ANDROID_recordable */ + +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ + +#ifndef EGL_ANGLE_device_d3d +#define EGL_ANGLE_device_d3d 1 +#define EGL_D3D9_DEVICE_ANGLE 0x33A0 +#define EGL_D3D11_DEVICE_ANGLE 0x33A1 +#endif /* EGL_ANGLE_device_d3d */ + +#ifndef EGL_ANGLE_query_surface_pointer +#define EGL_ANGLE_query_surface_pointer 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif +#endif /* EGL_ANGLE_query_surface_pointer */ + +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ + +#ifndef EGL_ANGLE_window_fixed_size +#define EGL_ANGLE_window_fixed_size 1 +#define EGL_FIXED_SIZE_ANGLE 0x3201 +#endif /* EGL_ANGLE_window_fixed_size */ + +#ifndef EGL_ARM_implicit_external_sync +#define EGL_ARM_implicit_external_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A +#endif /* EGL_ARM_implicit_external_sync */ + +#ifndef EGL_ARM_pixmap_multisample_discard +#define EGL_ARM_pixmap_multisample_discard 1 +#define EGL_DISCARD_SAMPLES_ARM 0x3286 +#endif /* EGL_ARM_pixmap_multisample_discard */ + +#ifndef EGL_EXT_bind_to_front +#define EGL_EXT_bind_to_front 1 +#define EGL_FRONT_BUFFER_EXT 0x3464 +#endif /* EGL_EXT_bind_to_front */ + +#ifndef EGL_EXT_buffer_age +#define EGL_EXT_buffer_age 1 +#define EGL_BUFFER_AGE_EXT 0x313D +#endif /* EGL_EXT_buffer_age */ + +#ifndef EGL_EXT_client_extensions +#define EGL_EXT_client_extensions 1 +#endif /* EGL_EXT_client_extensions */ + +#ifndef EGL_EXT_compositor +#define EGL_EXT_compositor 1 +#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460 +#define EGL_EXTERNAL_REF_ID_EXT 0x3461 +#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462 +#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy); +#endif +#endif /* EGL_EXT_compositor */ + +#ifndef EGL_EXT_create_context_robustness +#define EGL_EXT_create_context_robustness 1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF +#endif /* EGL_EXT_create_context_robustness */ + +#ifndef EGL_EXT_device_base +#define EGL_EXT_device_base 1 +typedef void *EGLDeviceEXT; +#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0) +#define EGL_BAD_DEVICE_EXT 0x322B +#define EGL_DEVICE_EXT 0x322C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#endif +#endif /* EGL_EXT_device_base */ + +#ifndef EGL_EXT_device_drm +#define EGL_EXT_device_drm 1 +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#endif /* EGL_EXT_device_drm */ + +#ifndef EGL_EXT_device_enumeration +#define EGL_EXT_device_enumeration 1 +#endif /* EGL_EXT_device_enumeration */ + +#ifndef EGL_EXT_device_openwf +#define EGL_EXT_device_openwf 1 +#define EGL_OPENWF_DEVICE_ID_EXT 0x3237 +#endif /* EGL_EXT_device_openwf */ + +#ifndef EGL_EXT_device_query +#define EGL_EXT_device_query 1 +#endif /* EGL_EXT_device_query */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_linear +#define EGL_EXT_gl_colorspace_bt2020_linear 1 +#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F +#endif /* EGL_EXT_gl_colorspace_bt2020_linear */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_pq +#define EGL_EXT_gl_colorspace_bt2020_pq 1 +#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340 +#endif /* EGL_EXT_gl_colorspace_bt2020_pq */ + +#ifndef EGL_EXT_gl_colorspace_display_p3 +#define EGL_EXT_gl_colorspace_display_p3 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363 +#endif /* EGL_EXT_gl_colorspace_display_p3 */ + +#ifndef EGL_EXT_gl_colorspace_display_p3_linear +#define EGL_EXT_gl_colorspace_display_p3_linear 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ + +#ifndef EGL_EXT_gl_colorspace_scrgb +#define EGL_EXT_gl_colorspace_scrgb 1 +#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351 +#endif /* EGL_EXT_gl_colorspace_scrgb */ + +#ifndef EGL_EXT_gl_colorspace_scrgb_linear +#define EGL_EXT_gl_colorspace_scrgb_linear 1 +#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350 +#endif /* EGL_EXT_gl_colorspace_scrgb_linear */ + +#ifndef EGL_EXT_image_dma_buf_import +#define EGL_EXT_image_dma_buf_import 1 +#define EGL_LINUX_DMA_BUF_EXT 0x3270 +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 +#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 +#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 +#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B +#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E +#define EGL_ITU_REC601_EXT 0x327F +#define EGL_ITU_REC709_EXT 0x3280 +#define EGL_ITU_REC2020_EXT 0x3281 +#define EGL_YUV_FULL_RANGE_EXT 0x3282 +#define EGL_YUV_NARROW_RANGE_EXT 0x3283 +#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 +#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 +#endif /* EGL_EXT_image_dma_buf_import */ + +#ifndef EGL_EXT_image_dma_buf_import_modifiers +#define EGL_EXT_image_dma_buf_import_modifiers 1 +#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 +#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 +#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 +#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 +#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 +#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 +#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 +#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 +#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 +#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 +#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#endif +#endif /* EGL_EXT_image_dma_buf_import_modifiers */ + +#ifndef EGL_EXT_image_implicit_sync_control +#define EGL_EXT_image_implicit_sync_control 1 +#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470 +#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471 +#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472 +#endif /* EGL_EXT_image_implicit_sync_control */ + +#ifndef EGL_EXT_multiview_window +#define EGL_EXT_multiview_window 1 +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 +#endif /* EGL_EXT_multiview_window */ + +#ifndef EGL_EXT_output_base +#define EGL_EXT_output_base 1 +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0) +#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0) +#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D +#define EGL_BAD_OUTPUT_PORT_EXT 0x322E +#define EGL_SWAP_INTERVAL_EXT 0x322F +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#endif +#endif /* EGL_EXT_output_base */ + +#ifndef EGL_EXT_output_drm +#define EGL_EXT_output_drm 1 +#define EGL_DRM_CRTC_EXT 0x3234 +#define EGL_DRM_PLANE_EXT 0x3235 +#define EGL_DRM_CONNECTOR_EXT 0x3236 +#endif /* EGL_EXT_output_drm */ + +#ifndef EGL_EXT_output_openwf +#define EGL_EXT_output_openwf 1 +#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 +#define EGL_OPENWF_PORT_ID_EXT 0x3239 +#endif /* EGL_EXT_output_openwf */ + +#ifndef EGL_EXT_pixel_format_float +#define EGL_EXT_pixel_format_float 1 +#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339 +#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A +#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B +#endif /* EGL_EXT_pixel_format_float */ + +#ifndef EGL_EXT_platform_base +#define EGL_EXT_platform_base 1 +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#endif +#endif /* EGL_EXT_platform_base */ + +#ifndef EGL_EXT_platform_device +#define EGL_EXT_platform_device 1 +#define EGL_PLATFORM_DEVICE_EXT 0x313F +#endif /* EGL_EXT_platform_device */ + +#ifndef EGL_EXT_platform_wayland +#define EGL_EXT_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 +#endif /* EGL_EXT_platform_wayland */ + +#ifndef EGL_EXT_platform_x11 +#define EGL_EXT_platform_x11 1 +#define EGL_PLATFORM_X11_EXT 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 +#endif /* EGL_EXT_platform_x11 */ + +#ifndef EGL_EXT_protected_content +#define EGL_EXT_protected_content 1 +#define EGL_PROTECTED_CONTENT_EXT 0x32C0 +#endif /* EGL_EXT_protected_content */ + +#ifndef EGL_EXT_protected_surface +#define EGL_EXT_protected_surface 1 +#endif /* EGL_EXT_protected_surface */ + +#ifndef EGL_EXT_stream_consumer_egloutput +#define EGL_EXT_stream_consumer_egloutput 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#endif +#endif /* EGL_EXT_stream_consumer_egloutput */ + +#ifndef EGL_EXT_surface_CTA861_3_metadata +#define EGL_EXT_surface_CTA861_3_metadata 1 +#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360 +#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361 +#endif /* EGL_EXT_surface_CTA861_3_metadata */ + +#ifndef EGL_EXT_surface_SMPTE2086_metadata +#define EGL_EXT_surface_SMPTE2086_metadata 1 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346 +#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347 +#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348 +#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349 +#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A +#define EGL_METADATA_SCALING_EXT 50000 +#endif /* EGL_EXT_surface_SMPTE2086_metadata */ + +#ifndef EGL_EXT_swap_buffers_with_damage +#define EGL_EXT_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_EXT_swap_buffers_with_damage */ + +#ifndef EGL_EXT_yuv_surface +#define EGL_EXT_yuv_surface 1 +#define EGL_YUV_ORDER_EXT 0x3301 +#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 +#define EGL_YUV_SUBSAMPLE_EXT 0x3312 +#define EGL_YUV_DEPTH_RANGE_EXT 0x3317 +#define EGL_YUV_CSC_STANDARD_EXT 0x330A +#define EGL_YUV_PLANE_BPP_EXT 0x331A +#define EGL_YUV_BUFFER_EXT 0x3300 +#define EGL_YUV_ORDER_YUV_EXT 0x3302 +#define EGL_YUV_ORDER_YVU_EXT 0x3303 +#define EGL_YUV_ORDER_YUYV_EXT 0x3304 +#define EGL_YUV_ORDER_UYVY_EXT 0x3305 +#define EGL_YUV_ORDER_YVYU_EXT 0x3306 +#define EGL_YUV_ORDER_VYUY_EXT 0x3307 +#define EGL_YUV_ORDER_AYUV_EXT 0x3308 +#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 +#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 +#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 +#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 +#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 +#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B +#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C +#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D +#define EGL_YUV_PLANE_BPP_0_EXT 0x331B +#define EGL_YUV_PLANE_BPP_8_EXT 0x331C +#define EGL_YUV_PLANE_BPP_10_EXT 0x331D +#endif /* EGL_EXT_yuv_surface */ + +#ifndef EGL_HI_clientpixmap +#define EGL_HI_clientpixmap 1 +struct EGLClientPixmapHI { + void *pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#endif +#endif /* EGL_HI_clientpixmap */ + +#ifndef EGL_HI_colorformats +#define EGL_HI_colorformats 1 +#define EGL_COLOR_FORMAT_HI 0x8F70 +#define EGL_COLOR_RGB_HI 0x8F71 +#define EGL_COLOR_RGBA_HI 0x8F72 +#define EGL_COLOR_ARGB_HI 0x8F73 +#endif /* EGL_HI_colorformats */ + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif /* EGL_IMG_context_priority */ + +#ifndef EGL_IMG_image_plane_attribs +#define EGL_IMG_image_plane_attribs 1 +#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105 +#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106 +#endif /* EGL_IMG_image_plane_attribs */ + +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 +#define EGL_DRM_BUFFER_MESA 0x31D3 +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif +#endif /* EGL_MESA_drm_image */ + +#ifndef EGL_MESA_image_dma_buf_export +#define EGL_MESA_image_dma_buf_export 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#endif +#endif /* EGL_MESA_image_dma_buf_export */ + +#ifndef EGL_MESA_platform_gbm +#define EGL_MESA_platform_gbm 1 +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif /* EGL_MESA_platform_gbm */ + +#ifndef EGL_MESA_platform_surfaceless +#define EGL_MESA_platform_surfaceless 1 +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD +#endif /* EGL_MESA_platform_surfaceless */ + +#ifndef EGL_NOK_swap_region +#define EGL_NOK_swap_region 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region */ + +#ifndef EGL_NOK_swap_region2 +#define EGL_NOK_swap_region2 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region2 */ + +#ifndef EGL_NOK_texture_from_pixmap +#define EGL_NOK_texture_from_pixmap 1 +#define EGL_Y_INVERTED_NOK 0x307F +#endif /* EGL_NOK_texture_from_pixmap */ + +#ifndef EGL_NV_3dvision_surface +#define EGL_NV_3dvision_surface 1 +#define EGL_AUTO_STEREO_NV 0x3136 +#endif /* EGL_NV_3dvision_surface */ + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif /* EGL_NV_coverage_sample */ + +#ifndef EGL_NV_coverage_sample_resolve +#define EGL_NV_coverage_sample_resolve 1 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#endif /* EGL_NV_coverage_sample_resolve */ + +#ifndef EGL_NV_cuda_event +#define EGL_NV_cuda_event 1 +#define EGL_CUDA_EVENT_HANDLE_NV 0x323B +#define EGL_SYNC_CUDA_EVENT_NV 0x323C +#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D +#endif /* EGL_NV_cuda_event */ + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif /* EGL_NV_depth_nonlinear */ + +#ifndef EGL_NV_device_cuda +#define EGL_NV_device_cuda 1 +#define EGL_CUDA_DEVICE_NV 0x323A +#endif /* EGL_NV_device_cuda */ + +#ifndef EGL_NV_native_query +#define EGL_NV_native_query 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#endif +#endif /* EGL_NV_native_query */ + +#ifndef EGL_NV_post_convert_rounding +#define EGL_NV_post_convert_rounding 1 +#endif /* EGL_NV_post_convert_rounding */ + +#ifndef EGL_NV_post_sub_buffer +#define EGL_NV_post_sub_buffer 1 +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif +#endif /* EGL_NV_post_sub_buffer */ + +#ifndef EGL_NV_robustness_video_memory_purge +#define EGL_NV_robustness_video_memory_purge 1 +#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C +#endif /* EGL_NV_robustness_video_memory_purge */ + +#ifndef EGL_NV_stream_consumer_gltexture_yuv +#define EGL_NV_stream_consumer_gltexture_yuv 1 +#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C +#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D +#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#endif +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ + +#ifndef EGL_NV_stream_cross_display +#define EGL_NV_stream_cross_display 1 +#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E +#endif /* EGL_NV_stream_cross_display */ + +#ifndef EGL_NV_stream_cross_object +#define EGL_NV_stream_cross_object 1 +#define EGL_STREAM_CROSS_OBJECT_NV 0x334D +#endif /* EGL_NV_stream_cross_object */ + +#ifndef EGL_NV_stream_cross_partition +#define EGL_NV_stream_cross_partition 1 +#define EGL_STREAM_CROSS_PARTITION_NV 0x323F +#endif /* EGL_NV_stream_cross_partition */ + +#ifndef EGL_NV_stream_cross_process +#define EGL_NV_stream_cross_process 1 +#define EGL_STREAM_CROSS_PROCESS_NV 0x3245 +#endif /* EGL_NV_stream_cross_process */ + +#ifndef EGL_NV_stream_cross_system +#define EGL_NV_stream_cross_system 1 +#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F +#endif /* EGL_NV_stream_cross_system */ + +#ifndef EGL_NV_stream_fifo_next +#define EGL_NV_stream_fifo_next 1 +#define EGL_PENDING_FRAME_NV 0x3329 +#define EGL_STREAM_TIME_PENDING_NV 0x332A +#endif /* EGL_NV_stream_fifo_next */ + +#ifndef EGL_NV_stream_fifo_synchronous +#define EGL_NV_stream_fifo_synchronous 1 +#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336 +#endif /* EGL_NV_stream_fifo_synchronous */ + +#ifndef EGL_NV_stream_frame_limits +#define EGL_NV_stream_frame_limits 1 +#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337 +#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338 +#endif /* EGL_NV_stream_frame_limits */ + +#ifndef EGL_NV_stream_metadata +#define EGL_NV_stream_metadata 1 +#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250 +#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251 +#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252 +#define EGL_PRODUCER_METADATA_NV 0x3253 +#define EGL_CONSUMER_METADATA_NV 0x3254 +#define EGL_PENDING_METADATA_NV 0x3328 +#define EGL_METADATA0_SIZE_NV 0x3255 +#define EGL_METADATA1_SIZE_NV 0x3256 +#define EGL_METADATA2_SIZE_NV 0x3257 +#define EGL_METADATA3_SIZE_NV 0x3258 +#define EGL_METADATA0_TYPE_NV 0x3259 +#define EGL_METADATA1_TYPE_NV 0x325A +#define EGL_METADATA2_TYPE_NV 0x325B +#define EGL_METADATA3_TYPE_NV 0x325C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#endif +#endif /* EGL_NV_stream_metadata */ + +#ifndef EGL_NV_stream_remote +#define EGL_NV_stream_remote 1 +#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240 +#define EGL_STREAM_TYPE_NV 0x3241 +#define EGL_STREAM_PROTOCOL_NV 0x3242 +#define EGL_STREAM_ENDPOINT_NV 0x3243 +#define EGL_STREAM_LOCAL_NV 0x3244 +#define EGL_STREAM_PRODUCER_NV 0x3247 +#define EGL_STREAM_CONSUMER_NV 0x3248 +#define EGL_STREAM_PROTOCOL_FD_NV 0x3246 +#endif /* EGL_NV_stream_remote */ + +#ifndef EGL_NV_stream_reset +#define EGL_NV_stream_reset 1 +#define EGL_SUPPORT_RESET_NV 0x3334 +#define EGL_SUPPORT_REUSE_NV 0x3335 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_NV_stream_reset */ + +#ifndef EGL_NV_stream_socket +#define EGL_NV_stream_socket 1 +#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B +#define EGL_SOCKET_HANDLE_NV 0x324C +#define EGL_SOCKET_TYPE_NV 0x324D +#endif /* EGL_NV_stream_socket */ + +#ifndef EGL_NV_stream_socket_inet +#define EGL_NV_stream_socket_inet 1 +#define EGL_SOCKET_TYPE_INET_NV 0x324F +#endif /* EGL_NV_stream_socket_inet */ + +#ifndef EGL_NV_stream_socket_unix +#define EGL_NV_stream_socket_unix 1 +#define EGL_SOCKET_TYPE_UNIX_NV 0x324E +#endif /* EGL_NV_stream_socket_unix */ + +#ifndef EGL_NV_stream_sync +#define EGL_NV_stream_sync 1 +#define EGL_SYNC_NEW_FRAME_NV 0x321F +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#endif +#endif /* EGL_NV_stream_sync */ + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +typedef void *EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0) +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_sync */ + +#ifndef EGL_NV_system_time +#define EGL_NV_system_time 1 +typedef khronos_utime_nanoseconds_t EGLuint64NV; +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_system_time */ + +#ifndef EGL_TIZEN_image_native_buffer +#define EGL_TIZEN_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_TIZEN 0x32A0 +#endif /* EGL_TIZEN_image_native_buffer */ + +#ifndef EGL_TIZEN_image_native_surface +#define EGL_TIZEN_image_native_surface 1 +#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 +#endif /* EGL_TIZEN_image_native_surface */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglplatform.h b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglplatform.h new file mode 100644 index 0000000000..c77c3338de --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/EGL/eglplatform.h @@ -0,0 +1,132 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + * + * Khronos STRONGLY RECOMMENDS that you use the default definitions + * provided below, since these changes affect both binary and source + * portability of applications using EGL running on different EGL + * implementations. + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__ANDROID__) || defined(ANDROID) + +struct ANativeWindow; +struct egl_native_pixmap_t; + +typedef struct ANativeWindow* EGLNativeWindowType; +typedef struct egl_native_pixmap_t* EGLNativePixmapType; +typedef void* EGLNativeDisplayType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + + +/* C++ / C typecast macros for special EGL handle values */ +#if defined(__cplusplus) +#define EGL_CAST(type, value) (static_cast(value)) +#else +#define EGL_CAST(type, value) ((type) (value)) +#endif + +#endif /* __eglplatform_h */ diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2.h b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2.h new file mode 100644 index 0000000000..8ba1642296 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2.h @@ -0,0 +1,675 @@ +#ifndef __gl2_h_ +#define __gl2_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#include + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +#ifndef GL_GLES_PROTOTYPES +#define GL_GLES_PROTOTYPES 1 +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 +#include +typedef khronos_int8_t GLbyte; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef short GLshort; +typedef unsigned short GLushort; +typedef void GLvoid; +typedef struct __GLsync *GLsync; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef unsigned int GLenum; +typedef unsigned int GLuint; +typedef char GLchar; +typedef khronos_float_t GLfloat; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; +typedef unsigned int GLbitfield; +typedef int GLint; +typedef unsigned char GLboolean; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_NONE 0 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#if GL_GLES_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_ES_VERSION_2_0 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2ext.h b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2ext.h new file mode 100644 index 0000000000..4e1488c629 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2ext.h @@ -0,0 +1,3505 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: _nomatch_^ + * Default extensions included: gles2 + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_SAMPLER 0x82E6 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_VERTEX_ARRAY_KHR 0x8074 +#define GL_QUERY_KHR 0x82E3 +#define GL_PROGRAM_PIPELINE_KHR 0x82E4 +#define GL_SAMPLER_KHR 0x82E6 +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); +GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); +GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); +#endif +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_parallel_shader_compile +#define GL_KHR_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 +typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); +#endif +#endif /* GL_KHR_parallel_shader_compile */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 +#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 +#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 +#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 +#define GL_CONTEXT_LOST_KHR 0x0507 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void); +GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#endif +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +typedef void *GLeglImageOES; +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +#endif /* GL_OES_EGL_image */ + +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#endif /* GL_OES_EGL_image_external */ + +#ifndef GL_OES_EGL_image_external_essl3 +#define GL_OES_EGL_image_external_essl3 1 +#endif /* GL_OES_EGL_image_external_essl3 */ + +#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture +#define GL_OES_compressed_ETC1_RGB8_sub_texture 1 +#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */ + +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#define GL_ETC1_RGB8_OES 0x8D64 +#endif /* GL_OES_compressed_ETC1_RGB8_texture */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_copy_image +#define GL_OES_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_OES_copy_image */ + +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif /* GL_OES_depth24 */ + +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif /* GL_OES_depth32 */ + +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif /* GL_OES_depth_texture */ + +#ifndef GL_OES_draw_buffers_indexed +#define GL_OES_draw_buffers_indexed 1 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index); +#endif +#endif /* GL_OES_draw_buffers_indexed */ + +#ifndef GL_OES_draw_elements_base_vertex +#define GL_OES_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#endif +#endif /* GL_OES_draw_elements_base_vertex */ + +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif /* GL_OES_element_index_uint */ + +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif /* GL_OES_fbo_render_mipmap */ + +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif /* GL_OES_fragment_precision_high */ + +#ifndef GL_OES_geometry_point_size +#define GL_OES_geometry_point_size 1 +#endif /* GL_OES_geometry_point_size */ + +#ifndef GL_OES_geometry_shader +#define GL_OES_geometry_shader 1 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_LINES_ADJACENCY_OES 0x000A +#define GL_LINE_STRIP_ADJACENCY_OES 0x000B +#define GL_TRIANGLES_ADJACENCY_OES 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_OES_geometry_shader */ + +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif +#endif /* GL_OES_get_program_binary */ + +#ifndef GL_OES_gpu_shader5 +#define GL_OES_gpu_shader5 1 +#endif /* GL_OES_gpu_shader5 */ + +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_OES_mapbuffer */ + +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif /* GL_OES_packed_depth_stencil */ + +#ifndef GL_OES_primitive_bounding_box +#define GL_OES_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_OES_primitive_bounding_box */ + +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#define GL_ALPHA8_OES 0x803C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_LUMINANCE8_OES 0x8040 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB10_A2_EXT 0x8059 +#endif /* GL_OES_required_internalformat */ + +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif /* GL_OES_rgb8_rgba8 */ + +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 +typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); +#endif +#endif /* GL_OES_sample_shading */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 +#endif /* GL_OES_sample_variables */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 +#endif /* GL_OES_shader_image_atomic */ + +#ifndef GL_OES_shader_io_blocks +#define GL_OES_shader_io_blocks 1 +#endif /* GL_OES_shader_io_blocks */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D +#endif /* GL_OES_shader_multisample_interpolation */ + +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif /* GL_OES_standard_derivatives */ + +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif /* GL_OES_stencil1 */ + +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif /* GL_OES_stencil4 */ + +#ifndef GL_OES_surfaceless_context +#define GL_OES_surfaceless_context 1 +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#endif /* GL_OES_surfaceless_context */ + +#ifndef GL_OES_tessellation_point_size +#define GL_OES_tessellation_point_size 1 +#endif /* GL_OES_tessellation_point_size */ + +#ifndef GL_OES_tessellation_shader +#define GL_OES_tessellation_shader 1 +#define GL_PATCHES_OES 0x000E +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_QUADS_OES 0x0007 +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value); +#endif +#endif /* GL_OES_tessellation_shader */ + +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +#endif /* GL_OES_texture_3D */ + +#ifndef GL_OES_texture_border_clamp +#define GL_OES_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 +#define GL_CLAMP_TO_BORDER_OES 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_OES_texture_border_clamp */ + +#ifndef GL_OES_texture_buffer +#define GL_OES_texture_buffer 1 +#define GL_TEXTURE_BUFFER_OES 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F +#define GL_SAMPLER_BUFFER_OES 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 +#define GL_IMAGE_BUFFER_OES 0x9051 +#define GL_INT_IMAGE_BUFFER_OES 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D +#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_OES_texture_buffer */ + +#ifndef GL_OES_texture_compression_astc +#define GL_OES_texture_compression_astc 1 +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 +#endif /* GL_OES_texture_compression_astc */ + +#ifndef GL_OES_texture_cube_map_array +#define GL_OES_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A +#endif /* GL_OES_texture_cube_map_array */ + +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif /* GL_OES_texture_float */ + +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif /* GL_OES_texture_float_linear */ + +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#define GL_HALF_FLOAT_OES 0x8D61 +#endif /* GL_OES_texture_half_float */ + +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif /* GL_OES_texture_half_float_linear */ + +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif /* GL_OES_texture_npot */ + +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 +#define GL_STENCIL_INDEX_OES 0x1901 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif /* GL_OES_texture_stencil8 */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif +#endif /* GL_OES_texture_storage_multisample_2d_array */ + +#ifndef GL_OES_texture_view +#define GL_OES_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_OES_texture_view */ + +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +#endif /* GL_OES_vertex_array_object */ + +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif /* GL_OES_vertex_half_float */ + +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif /* GL_OES_vertex_type_10_10_10_2 */ + +#ifndef GL_OES_viewport_array +#define GL_OES_viewport_array 1 +#define GL_MAX_VIEWPORTS_OES 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data); +#endif +#endif /* GL_OES_viewport_array */ + +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif /* GL_AMD_compressed_3DC_texture */ + +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif /* GL_AMD_compressed_ATC_texture */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif /* GL_AMD_performance_monitor */ + +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#define GL_Z400_BINARY_AMD 0x8740 +#endif /* GL_AMD_program_binary_Z400 */ + +#ifndef GL_ANDROID_extension_pack_es31a +#define GL_ANDROID_extension_pack_es31a 1 +#endif /* GL_ANDROID_extension_pack_es31a */ + +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 +#endif /* GL_ANGLE_depth_texture */ + +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_ANGLE_framebuffer_blit */ + +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_ANGLE_framebuffer_multisample */ + +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +#endif /* GL_ANGLE_instanced_arrays */ + +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif /* GL_ANGLE_pack_reverse_row_order */ + +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif /* GL_ANGLE_program_binary */ + +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif /* GL_ANGLE_texture_compression_dxt3 */ + +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif /* GL_ANGLE_texture_compression_dxt5 */ + +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif /* GL_ANGLE_texture_usage */ + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +#endif /* GL_ANGLE_translated_shader_source */ + +#ifndef GL_APPLE_clip_distance +#define GL_APPLE_clip_distance 1 +#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 +#define GL_CLIP_DISTANCE0_APPLE 0x3000 +#define GL_CLIP_DISTANCE1_APPLE 0x3001 +#define GL_CLIP_DISTANCE2_APPLE 0x3002 +#define GL_CLIP_DISTANCE3_APPLE 0x3003 +#define GL_CLIP_DISTANCE4_APPLE 0x3004 +#define GL_CLIP_DISTANCE5_APPLE 0x3005 +#define GL_CLIP_DISTANCE6_APPLE 0x3006 +#define GL_CLIP_DISTANCE7_APPLE 0x3007 +#endif /* GL_APPLE_clip_distance */ + +#ifndef GL_APPLE_color_buffer_packed_float +#define GL_APPLE_color_buffer_packed_float 1 +#endif /* GL_APPLE_color_buffer_packed_float */ + +#ifndef GL_APPLE_copy_texture_levels +#define GL_APPLE_copy_texture_levels 1 +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif +#endif /* GL_APPLE_copy_texture_levels */ + +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif +#endif /* GL_APPLE_framebuffer_multisample */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ + +#ifndef GL_APPLE_sync +#define GL_APPLE_sync 1 +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); +GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); +GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); +GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +#endif /* GL_APPLE_sync */ + +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#define GL_BGRA_EXT 0x80E1 +#define GL_BGRA8_EXT 0x93A1 +#endif /* GL_APPLE_texture_format_BGRA8888 */ + +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif /* GL_APPLE_texture_max_level */ + +#ifndef GL_APPLE_texture_packed_float +#define GL_APPLE_texture_packed_float 1 +#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B +#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E +#define GL_R11F_G11F_B10F_APPLE 0x8C3A +#define GL_RGB9_E5_APPLE 0x8C3D +#endif /* GL_APPLE_texture_packed_float */ + +#ifndef GL_ARM_mali_program_binary +#define GL_ARM_mali_program_binary 1 +#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 +#endif /* GL_ARM_mali_program_binary */ + +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif /* GL_ARM_mali_shader_binary */ + +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif /* GL_ARM_rgba8 */ + +#ifndef GL_ARM_shader_framebuffer_fetch +#define GL_ARM_shader_framebuffer_fetch 1 +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 +#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 +#endif /* GL_ARM_shader_framebuffer_fetch */ + +#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil +#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 +#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ + +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 +#endif /* GL_DMP_program_binary */ + +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#define GL_SHADER_BINARY_DMP 0x9250 +#endif /* GL_DMP_shader_binary */ + +#ifndef GL_EXT_EGL_image_array +#define GL_EXT_EGL_image_array 1 +#endif /* GL_EXT_EGL_image_array */ + +#ifndef GL_EXT_YUV_target +#define GL_EXT_YUV_target 1 +#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 +#endif /* GL_EXT_YUV_target */ + +#ifndef GL_EXT_base_instance +#define GL_EXT_base_instance 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#endif +#endif /* GL_EXT_base_instance */ + +#ifndef GL_EXT_blend_func_extended +#define GL_EXT_blend_func_extended 1 +#define GL_SRC1_COLOR_EXT 0x88F9 +#define GL_SRC1_ALPHA_EXT 0x8589 +#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB +#define GL_SRC_ALPHA_SATURATE_EXT 0x0308 +#define GL_LOCATION_INDEX_EXT 0x930F +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name); +#endif +#endif /* GL_EXT_blend_func_extended */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_buffer_storage +#define GL_EXT_buffer_storage 1 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT_EXT 0x0040 +#define GL_MAP_COHERENT_BIT_EXT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100 +#define GL_CLIENT_STORAGE_BIT_EXT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F +#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220 +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#endif +#endif /* GL_EXT_buffer_storage */ + +#ifndef GL_EXT_clear_texture +#define GL_EXT_clear_texture 1 +typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#endif +#endif /* GL_EXT_clear_texture */ + +#ifndef GL_EXT_clip_control +#define GL_EXT_clip_control 1 +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D +typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth); +#endif +#endif /* GL_EXT_clip_control */ + +#ifndef GL_EXT_clip_cull_distance +#define GL_EXT_clip_cull_distance 1 +#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32 +#define GL_MAX_CULL_DISTANCES_EXT 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA +#define GL_CLIP_DISTANCE0_EXT 0x3000 +#define GL_CLIP_DISTANCE1_EXT 0x3001 +#define GL_CLIP_DISTANCE2_EXT 0x3002 +#define GL_CLIP_DISTANCE3_EXT 0x3003 +#define GL_CLIP_DISTANCE4_EXT 0x3004 +#define GL_CLIP_DISTANCE5_EXT 0x3005 +#define GL_CLIP_DISTANCE6_EXT 0x3006 +#define GL_CLIP_DISTANCE7_EXT 0x3007 +#endif /* GL_EXT_clip_cull_distance */ + +#ifndef GL_EXT_color_buffer_float +#define GL_EXT_color_buffer_float 1 +#endif /* GL_EXT_color_buffer_float */ + +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif /* GL_EXT_color_buffer_half_float */ + +#ifndef GL_EXT_conservative_depth +#define GL_EXT_conservative_depth 1 +#endif /* GL_EXT_conservative_depth */ + +#ifndef GL_EXT_copy_image +#define GL_EXT_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_EXT_copy_image */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +#endif /* GL_EXT_discard_framebuffer */ + +#ifndef GL_EXT_disjoint_timer_query +#define GL_EXT_disjoint_timer_query 1 +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_EXT_disjoint_timer_query */ + +#ifndef GL_EXT_draw_buffers +#define GL_EXT_draw_buffers 1 +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 +#define GL_DRAW_BUFFER0_EXT 0x8825 +#define GL_DRAW_BUFFER1_EXT 0x8826 +#define GL_DRAW_BUFFER2_EXT 0x8827 +#define GL_DRAW_BUFFER3_EXT 0x8828 +#define GL_DRAW_BUFFER4_EXT 0x8829 +#define GL_DRAW_BUFFER5_EXT 0x882A +#define GL_DRAW_BUFFER6_EXT 0x882B +#define GL_DRAW_BUFFER7_EXT 0x882C +#define GL_DRAW_BUFFER8_EXT 0x882D +#define GL_DRAW_BUFFER9_EXT 0x882E +#define GL_DRAW_BUFFER10_EXT 0x882F +#define GL_DRAW_BUFFER11_EXT 0x8830 +#define GL_DRAW_BUFFER12_EXT 0x8831 +#define GL_DRAW_BUFFER13_EXT 0x8832 +#define GL_DRAW_BUFFER14_EXT 0x8833 +#define GL_DRAW_BUFFER15_EXT 0x8834 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_EXT_draw_buffers */ + +#ifndef GL_EXT_draw_buffers_indexed +#define GL_EXT_draw_buffers_indexed 1 +typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); +#endif +#endif /* GL_EXT_draw_buffers_indexed */ + +#ifndef GL_EXT_draw_elements_base_vertex +#define GL_EXT_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#endif +#endif /* GL_EXT_draw_elements_base_vertex */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_transform_feedback +#define GL_EXT_draw_transform_feedback 1 +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id); +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id); +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount); +#endif +#endif /* GL_EXT_draw_transform_feedback */ + +#ifndef GL_EXT_external_buffer +#define GL_EXT_external_buffer 1 +typedef void *GLeglClientBufferEXT; +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#endif +#endif /* GL_EXT_external_buffer */ + +#ifndef GL_EXT_float_blend +#define GL_EXT_float_blend 1 +#endif /* GL_EXT_float_blend */ + +#ifndef GL_EXT_geometry_point_size +#define GL_EXT_geometry_point_size 1 +#endif /* GL_EXT_geometry_point_size */ + +#ifndef GL_EXT_geometry_shader +#define GL_EXT_geometry_shader 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F +#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_UNDEFINED_VERTEX_EXT 0x8260 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_EXT_geometry_shader */ + +#ifndef GL_EXT_gpu_shader5 +#define GL_EXT_gpu_shader5 1 +#endif /* GL_EXT_gpu_shader5 */ + +#ifndef GL_EXT_instanced_arrays +#define GL_EXT_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_instanced_arrays */ + +#ifndef GL_EXT_map_buffer_range +#define GL_EXT_map_buffer_range 1 +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +#endif +#endif /* GL_EXT_map_buffer_range */ + +#ifndef GL_EXT_memory_object +#define GL_EXT_memory_object 1 +#define GL_TEXTURE_TILING_EXT 0x9580 +#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581 +#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B +#define GL_NUM_TILING_TYPES_EXT 0x9582 +#define GL_TILING_TYPES_EXT 0x9583 +#define GL_OPTIMAL_TILING_EXT 0x9584 +#define GL_LINEAR_TILING_EXT 0x9585 +#define GL_NUM_DEVICE_UUIDS_EXT 0x9596 +#define GL_DEVICE_UUID_EXT 0x9597 +#define GL_DRIVER_UUID_EXT 0x9598 +#define GL_UUID_SIZE_EXT 16 +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects); +typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject); +typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects); +typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data); +GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data); +GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects); +GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject); +GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects); +GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_EXT_memory_object */ + +#ifndef GL_EXT_memory_object_fd +#define GL_EXT_memory_object_fd 1 +#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586 +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_memory_object_fd */ + +#ifndef GL_EXT_memory_object_win32 +#define GL_EXT_memory_object_win32 1 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 +#define GL_DEVICE_LUID_EXT 0x9599 +#define GL_DEVICE_NODE_MASK_EXT 0x959A +#define GL_LUID_SIZE_EXT 8 +#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 +#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A +#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B +#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_memory_object_win32 */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multi_draw_indirect +#define GL_EXT_multi_draw_indirect 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif +#endif /* GL_EXT_multi_draw_indirect */ + +#ifndef GL_EXT_multisampled_compatibility +#define GL_EXT_multisampled_compatibility 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#endif /* GL_EXT_multisampled_compatibility */ + +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_EXT_multisampled_render_to_texture */ + +#ifndef GL_EXT_multiview_draw_buffers +#define GL_EXT_multiview_draw_buffers 1 +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); +typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); +GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); +GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); +#endif +#endif /* GL_EXT_multiview_draw_buffers */ + +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#endif /* GL_EXT_occlusion_query_boolean */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_EXT_primitive_bounding_box */ + +#ifndef GL_EXT_protected_textures +#define GL_EXT_protected_textures 1 +#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010 +#define GL_TEXTURE_PROTECTED_EXT 0x8BFA +#endif /* GL_EXT_protected_textures */ + +#ifndef GL_EXT_pvrtc_sRGB +#define GL_EXT_pvrtc_sRGB 1 +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 +#endif /* GL_EXT_pvrtc_sRGB */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif /* GL_EXT_read_format_bgra */ + +#ifndef GL_EXT_render_snorm +#define GL_EXT_render_snorm 1 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM_EXT 0x8F98 +#define GL_RG16_SNORM_EXT 0x8F99 +#define GL_RGBA16_SNORM_EXT 0x8F9B +#endif /* GL_EXT_render_snorm */ + +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_EXT_robustness */ + +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif /* GL_EXT_sRGB */ + +#ifndef GL_EXT_sRGB_write_control +#define GL_EXT_sRGB_write_control 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif /* GL_EXT_sRGB_write_control */ + +#ifndef GL_EXT_semaphore +#define GL_EXT_semaphore 1 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 +typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores); +typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores); +GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore); +GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#endif +#endif /* GL_EXT_semaphore */ + +#ifndef GL_EXT_semaphore_fd +#define GL_EXT_semaphore_fd 1 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_semaphore_fd */ + +#ifndef GL_EXT_semaphore_win32 +#define GL_EXT_semaphore_win32 1 +#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 +#define GL_D3D12_FENCE_VALUE_EXT 0x9595 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_semaphore_win32 */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_EXT_separate_shader_objects */ + +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_EXT_shader_framebuffer_fetch 1 +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif /* GL_EXT_shader_framebuffer_fetch */ + +#ifndef GL_EXT_shader_group_vote +#define GL_EXT_shader_group_vote 1 +#endif /* GL_EXT_shader_group_vote */ + +#ifndef GL_EXT_shader_implicit_conversions +#define GL_EXT_shader_implicit_conversions 1 +#endif /* GL_EXT_shader_implicit_conversions */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shader_io_blocks +#define GL_EXT_shader_io_blocks 1 +#endif /* GL_EXT_shader_io_blocks */ + +#ifndef GL_EXT_shader_non_constant_global_initializers +#define GL_EXT_shader_non_constant_global_initializers 1 +#endif /* GL_EXT_shader_non_constant_global_initializers */ + +#ifndef GL_EXT_shader_pixel_local_storage +#define GL_EXT_shader_pixel_local_storage 1 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 +#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 +#endif /* GL_EXT_shader_pixel_local_storage */ + +#ifndef GL_EXT_shader_pixel_local_storage2 +#define GL_EXT_shader_pixel_local_storage2 1 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651 +#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size); +typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target); +typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size); +GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target); +GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values); +#endif +#endif /* GL_EXT_shader_pixel_local_storage2 */ + +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif /* GL_EXT_shader_texture_lod */ + +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif /* GL_EXT_shadow_samplers */ + +#ifndef GL_EXT_sparse_texture +#define GL_EXT_sparse_texture 1 +#define GL_TEXTURE_SPARSE_EXT 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7 +#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_3D 0x806F +#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9 +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_EXT_sparse_texture */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 +#endif /* GL_EXT_tessellation_point_size */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 +#define GL_PATCHES_EXT 0x000E +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_QUADS_EXT 0x0007 +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); +#endif +#endif /* GL_EXT_tessellation_shader */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_EXT_texture_border_clamp */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_EXT_texture_buffer */ + +#ifndef GL_EXT_texture_compression_astc_decode_mode +#define GL_EXT_texture_compression_astc_decode_mode 1 +#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69 +#endif /* GL_EXT_texture_compression_astc_decode_mode */ + +#ifndef GL_EXT_texture_compression_bptc +#define GL_EXT_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F +#endif /* GL_EXT_texture_compression_bptc */ + +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif /* GL_EXT_texture_compression_dxt1 */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_compression_s3tc_srgb +#define GL_EXT_texture_compression_s3tc_srgb 1 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_compression_s3tc_srgb */ + +#ifndef GL_EXT_texture_cube_map_array +#define GL_EXT_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#endif /* GL_EXT_texture_cube_map_array */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif /* GL_EXT_texture_format_BGRA8888 */ + +#ifndef GL_EXT_texture_norm16 +#define GL_EXT_texture_norm16 1 +#define GL_R16_EXT 0x822A +#define GL_RG16_EXT 0x822C +#define GL_RGBA16_EXT 0x805B +#define GL_RGB16_EXT 0x8054 +#define GL_RGB16_SNORM_EXT 0x8F9A +#endif /* GL_EXT_texture_norm16 */ + +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif /* GL_EXT_texture_rg */ + +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_EXT_texture_sRGB_R8 1 +#define GL_SR8_EXT 0x8FBD +#endif /* GL_EXT_texture_sRGB_R8 */ + +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif /* GL_EXT_texture_type_2_10_10_10_REV */ + +#ifndef GL_EXT_texture_view +#define GL_EXT_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_EXT_texture_view */ + +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 +#endif /* GL_EXT_unpack_subimage */ + +#ifndef GL_EXT_win32_keyed_mutex +#define GL_EXT_win32_keyed_mutex 1 +typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout); +typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout); +GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key); +#endif +#endif /* GL_EXT_win32_keyed_mutex */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 +typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); +#endif +#endif /* GL_EXT_window_rectangles */ + +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#endif /* GL_FJ_shader_binary_GCCSO */ + +#ifndef GL_IMG_bindless_texture +#define GL_IMG_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#endif +#endif /* GL_IMG_bindless_texture */ + +#ifndef GL_IMG_framebuffer_downsample +#define GL_IMG_framebuffer_downsample 1 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C +#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D +#define GL_DOWNSAMPLE_SCALES_IMG 0x913E +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#endif +#endif /* GL_IMG_framebuffer_downsample */ + +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_IMG_multisampled_render_to_texture */ + +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif /* GL_IMG_program_binary */ + +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif /* GL_IMG_read_format */ + +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#define GL_SGX_BINARY_IMG 0x8C0A +#endif /* GL_IMG_shader_binary */ + +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif /* GL_IMG_texture_compression_pvrtc */ + +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif /* GL_IMG_texture_compression_pvrtc2 */ + +#ifndef GL_IMG_texture_filter_cubic +#define GL_IMG_texture_filter_cubic 1 +#define GL_CUBIC_IMG 0x9139 +#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A +#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B +#endif /* GL_IMG_texture_filter_cubic */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE +#endif /* GL_INTEL_conservative_rasterization */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 +#endif /* GL_MESA_shader_integer_functions */ + +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_minmax_factor +#define GL_NV_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_NV_blend_minmax_factor */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F +typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); +#endif +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + +#ifndef GL_NV_copy_buffer +#define GL_NV_copy_buffer 1 +#define GL_COPY_READ_BUFFER_NV 0x8F36 +#define GL_COPY_WRITE_BUFFER_NV 0x8F37 +typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GL_NV_copy_buffer */ + +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +#endif /* GL_NV_coverage_sample */ + +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif /* GL_NV_depth_nonlinear */ + +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_NV_draw_buffers */ + +#ifndef GL_NV_draw_instanced +#define GL_NV_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_NV_draw_instanced */ + +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 +typedef void (GL_APIENTRY *GLVULKANPROCNV)(void); +typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name); +typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name); +GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence); +#endif +#endif /* GL_NV_draw_vulkan_image */ + +#ifndef GL_NV_explicit_attrib_location +#define GL_NV_explicit_attrib_location 1 +#endif /* GL_NV_explicit_attrib_location */ + +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +#endif /* GL_NV_fbo_color_attachments */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +#endif /* GL_NV_fence */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_blit +#define GL_NV_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_NV_framebuffer_blit */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + +#ifndef GL_NV_framebuffer_multisample +#define GL_NV_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_NV_framebuffer_multisample */ + +#ifndef GL_NV_generate_mipmap_sRGB +#define GL_NV_generate_mipmap_sRGB 1 +#endif /* GL_NV_generate_mipmap_sRGB */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +#define GL_PATCHES 0x000E +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_image_formats +#define GL_NV_image_formats 1 +#endif /* GL_NV_image_formats */ + +#ifndef GL_NV_instanced_arrays +#define GL_NV_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); +#endif +#endif /* GL_NV_instanced_arrays */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + +#ifndef GL_NV_non_square_matrices +#define GL_NV_non_square_matrices 1 +#define GL_FLOAT_MAT2x3_NV 0x8B65 +#define GL_FLOAT_MAT2x4_NV 0x8B66 +#define GL_FLOAT_MAT3x2_NV 0x8B67 +#define GL_FLOAT_MAT3x4_NV 0x8B68 +#define GL_FLOAT_MAT4x2_NV 0x8B69 +#define GL_FLOAT_MAT4x3_NV 0x8B6A +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_NV_non_square_matrices */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D +typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range); +GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path); +GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func); +GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + +#ifndef GL_NV_pixel_buffer_object +#define GL_NV_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_NV 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF +#endif /* GL_NV_pixel_buffer_object */ + +#ifndef GL_NV_polygon_mode +#define GL_NV_polygon_mode 1 +#define GL_POLYGON_MODE_NV 0x0B40 +#define GL_POLYGON_OFFSET_POINT_NV 0x2A01 +#define GL_POLYGON_OFFSET_LINE_NV 0x2A02 +#define GL_POINT_NV 0x1B00 +#define GL_LINE_NV 0x1B01 +#define GL_FILL_NV 0x1B02 +typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode); +#endif +#endif /* GL_NV_polygon_mode */ + +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#define GL_READ_BUFFER_NV 0x0C02 +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +#endif /* GL_NV_read_buffer */ + +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif /* GL_NV_read_buffer_front */ + +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif /* GL_NV_read_depth */ + +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif /* GL_NV_read_depth_stencil */ + +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif /* GL_NV_read_stencil */ + +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif /* GL_NV_sRGB_formats */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_noperspective_interpolation +#define GL_NV_shader_noperspective_interpolation 1 +#endif /* GL_NV_shader_noperspective_interpolation */ + +#ifndef GL_NV_shadow_samplers_array +#define GL_NV_shadow_samplers_array 1 +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif /* GL_NV_shadow_samplers_array */ + +#ifndef GL_NV_shadow_samplers_cube +#define GL_NV_shadow_samplers_cube 1 +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif /* GL_NV_shadow_samplers_cube */ + +#ifndef GL_NV_texture_border_clamp +#define GL_NV_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif /* GL_NV_texture_border_clamp */ + +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif /* GL_NV_texture_compression_s3tc_update */ + +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif /* GL_NV_texture_npot_2D_mipmap */ + +#ifndef GL_NV_viewport_array +#define GL_NV_viewport_array 1 +#define GL_MAX_VIEWPORTS_NV 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data); +GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index); +#endif +#endif /* GL_NV_viewport_array */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B +typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#endif +#endif /* GL_NV_viewport_swizzle */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + +#ifndef GL_OVR_multiview_multisampled_render_to_texture +#define GL_OVR_multiview_multisampled_render_to_texture 1 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview_multisampled_render_to_texture */ + +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +#endif /* GL_QCOM_alpha_test */ + +#ifndef GL_QCOM_binning_control +#define GL_QCOM_binning_control 1 +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#endif /* GL_QCOM_binning_control */ + +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +#endif /* GL_QCOM_driver_control */ + +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params); +#endif +#endif /* GL_QCOM_extended_get */ + +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +#endif /* GL_QCOM_extended_get2 */ + +#ifndef GL_QCOM_framebuffer_foveated +#define GL_QCOM_framebuffer_foveated 1 +#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001 +#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#endif +#endif /* GL_QCOM_framebuffer_foveated */ + +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif /* GL_QCOM_perfmon_global_mode */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent +#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1 +#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void); +#endif +#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */ + +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +#endif /* GL_QCOM_tiled_rendering */ + +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif /* GL_QCOM_writeonly_rendering */ + +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif /* GL_VIV_shader_binary */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2platform.h b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2platform.h new file mode 100644 index 0000000000..eb318dc3a3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/GLES2/gl2platform.h @@ -0,0 +1,38 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* +** Copyright (c) 2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * Please contribute modifications back to Khronos as pull requests on the + * public github repository: + * https://github.com/KhronosGroup/OpenGL-Registry + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/KHR/khrplatform.h b/3rdparty/sdl2-2.0.9/src/video/khronos/KHR/khrplatform.h new file mode 100644 index 0000000000..1ad3554a76 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/KHR/khrplatform.h @@ -0,0 +1,284 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vk_platform.h b/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vk_platform.h new file mode 100644 index 0000000000..72f80493ca --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vk_platform.h @@ -0,0 +1,120 @@ +// +// File: vk_platform.h +// +/* +** Copyright (c) 2014-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + + +#ifndef VK_PLATFORM_H_ +#define VK_PLATFORM_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/* +*************************************************************************************************** +* Platform-specific directives and type declarations +*************************************************************************************************** +*/ + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ +#if defined(_WIN32) + // On Windows, Vulkan commands use the stdcall convention + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error "Vulkan isn't supported for the 'armeabi' NDK ABI" +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) + // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" + // calling convention, i.e. float parameters are passed in registers. This + // is true even if the rest of the application passes floats on the stack, + // as it does by default when compiling for the armeabi-v7a NDK ABI. + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR +#else + // On other platforms, use the default calling convention + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR +#endif + +#include + +#if !defined(VK_NO_STDINT_H) + #if defined(_MSC_VER) && (_MSC_VER < 1600) + typedef signed __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef signed __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef signed __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include + #endif +#endif // !defined(VK_NO_STDINT_H) + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +// Platform-specific headers required by platform window system extensions. +// These are enabled prior to #including "vulkan.h". The same enable then +// controls inclusion of the extension interfaces in vulkan.h. + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_MIR_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XCB_KHR +#include +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vulkan.h b/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vulkan.h new file mode 100644 index 0000000000..04495fa0cd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/khronos/vulkan/vulkan.h @@ -0,0 +1,6458 @@ +#ifndef VULKAN_H_ +#define VULKAN_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#define VK_VERSION_1_0 1 +#include "./vk_platform.h" + +#define VK_MAKE_VERSION(major, minor, patch) \ + (((major) << 22) | ((minor) << 12) | (patch)) + +// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. +//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 + +// Vulkan 1.0 version number +#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0 + +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) +// Version of this file +#define VK_HEADER_VERSION 59 + + +#define VK_NULL_HANDLE 0 + + + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + + +#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE) +#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif +#endif + + + +typedef uint32_t VkFlags; +typedef uint32_t VkBool32; +typedef uint64_t VkDeviceSize; +typedef uint32_t VkSampleMask; + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_HANDLE(VkPhysicalDevice) +VK_DEFINE_HANDLE(VkDevice) +VK_DEFINE_HANDLE(VkQueue) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) +VK_DEFINE_HANDLE(VkCommandBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) + +#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_REMAINING_MIP_LEVELS (~0U) +#define VK_REMAINING_ARRAY_LAYERS (~0U) +#define VK_WHOLE_SIZE (~0ULL) +#define VK_ATTACHMENT_UNUSED (~0U) +#define VK_TRUE 1 +#define VK_FALSE 0 +#define VK_QUEUE_FAMILY_IGNORED (~0U) +#define VK_SUBPASS_EXTERNAL (~0U) +#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 +#define VK_UUID_SIZE 16 +#define VK_MAX_MEMORY_TYPES 32 +#define VK_MAX_MEMORY_HEAPS 16 +#define VK_MAX_EXTENSION_NAME_SIZE 256 +#define VK_MAX_DESCRIPTION_SIZE 256 + + +typedef enum VkPipelineCacheHeaderVersion { + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1), + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheHeaderVersion; + +typedef enum VkResult { + VK_SUCCESS = 0, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, + VK_ERROR_OUT_OF_HOST_MEMORY = -1, + VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, + VK_ERROR_INITIALIZATION_FAILED = -3, + VK_ERROR_DEVICE_LOST = -4, + VK_ERROR_MEMORY_MAP_FAILED = -5, + VK_ERROR_LAYER_NOT_PRESENT = -6, + VK_ERROR_EXTENSION_NOT_PRESENT = -7, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_ERROR_FRAGMENTED_POOL = -12, + VK_ERROR_SURFACE_LOST_KHR = -1000000000, + VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, + VK_SUBOPTIMAL_KHR = 1000001003, + VK_ERROR_OUT_OF_DATE_KHR = -1000001004, + VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_ERROR_INVALID_SHADER_NV = -1000012000, + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000, + VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003, + VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL, + VK_RESULT_END_RANGE = VK_INCOMPLETE, + VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1), + VK_RESULT_MAX_ENUM = 0x7FFFFFFF +} VkResult; + +typedef enum VkStructureType { + VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, + VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, + VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, + VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, + VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, + VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, + VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, + VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, + VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, + VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, + VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, + VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, + VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, + VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, + VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX = 1000053000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX = 1000053001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX = 1000053002, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001, + VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004, + VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX = 1000060000, + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX = 1000060001, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX = 1000060002, + VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX = 1000060003, + VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX = 1000060004, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX = 1000060005, + VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX = 1000060006, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX = 1000060007, + VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX = 1000060008, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX = 1000060009, + VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX = 1000060011, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX = 1000060012, + VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, + VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX = 1000070000, + VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX = 1000070001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000, + VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002, + VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, + VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, + VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, + VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, + VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000, + VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, + VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, + VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, + VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000, + VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, + VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001, + VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002, + VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, + VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, + VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, + VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, + VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, + VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, + VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, + VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000, + VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001, + VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000, + VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, + VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, + VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, + VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, + VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, + VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, + VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, + VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001, + VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002, + VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, + VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, + VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, + VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkStructureType; + +typedef enum VkSystemAllocationScope { + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, + VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND, + VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE, + VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1), + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF +} VkSystemAllocationScope; + +typedef enum VkInternalAllocationType { + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1), + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkInternalAllocationType; + +typedef enum VkFormat { + VK_FORMAT_UNDEFINED = 0, + VK_FORMAT_R4G4_UNORM_PACK8 = 1, + VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, + VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, + VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, + VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, + VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, + VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, + VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, + VK_FORMAT_R8_UNORM = 9, + VK_FORMAT_R8_SNORM = 10, + VK_FORMAT_R8_USCALED = 11, + VK_FORMAT_R8_SSCALED = 12, + VK_FORMAT_R8_UINT = 13, + VK_FORMAT_R8_SINT = 14, + VK_FORMAT_R8_SRGB = 15, + VK_FORMAT_R8G8_UNORM = 16, + VK_FORMAT_R8G8_SNORM = 17, + VK_FORMAT_R8G8_USCALED = 18, + VK_FORMAT_R8G8_SSCALED = 19, + VK_FORMAT_R8G8_UINT = 20, + VK_FORMAT_R8G8_SINT = 21, + VK_FORMAT_R8G8_SRGB = 22, + VK_FORMAT_R8G8B8_UNORM = 23, + VK_FORMAT_R8G8B8_SNORM = 24, + VK_FORMAT_R8G8B8_USCALED = 25, + VK_FORMAT_R8G8B8_SSCALED = 26, + VK_FORMAT_R8G8B8_UINT = 27, + VK_FORMAT_R8G8B8_SINT = 28, + VK_FORMAT_R8G8B8_SRGB = 29, + VK_FORMAT_B8G8R8_UNORM = 30, + VK_FORMAT_B8G8R8_SNORM = 31, + VK_FORMAT_B8G8R8_USCALED = 32, + VK_FORMAT_B8G8R8_SSCALED = 33, + VK_FORMAT_B8G8R8_UINT = 34, + VK_FORMAT_B8G8R8_SINT = 35, + VK_FORMAT_B8G8R8_SRGB = 36, + VK_FORMAT_R8G8B8A8_UNORM = 37, + VK_FORMAT_R8G8B8A8_SNORM = 38, + VK_FORMAT_R8G8B8A8_USCALED = 39, + VK_FORMAT_R8G8B8A8_SSCALED = 40, + VK_FORMAT_R8G8B8A8_UINT = 41, + VK_FORMAT_R8G8B8A8_SINT = 42, + VK_FORMAT_R8G8B8A8_SRGB = 43, + VK_FORMAT_B8G8R8A8_UNORM = 44, + VK_FORMAT_B8G8R8A8_SNORM = 45, + VK_FORMAT_B8G8R8A8_USCALED = 46, + VK_FORMAT_B8G8R8A8_SSCALED = 47, + VK_FORMAT_B8G8R8A8_UINT = 48, + VK_FORMAT_B8G8R8A8_SINT = 49, + VK_FORMAT_B8G8R8A8_SRGB = 50, + VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, + VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, + VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, + VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, + VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, + VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, + VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, + VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, + VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, + VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, + VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, + VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, + VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, + VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, + VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, + VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, + VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, + VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, + VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, + VK_FORMAT_R16_UNORM = 70, + VK_FORMAT_R16_SNORM = 71, + VK_FORMAT_R16_USCALED = 72, + VK_FORMAT_R16_SSCALED = 73, + VK_FORMAT_R16_UINT = 74, + VK_FORMAT_R16_SINT = 75, + VK_FORMAT_R16_SFLOAT = 76, + VK_FORMAT_R16G16_UNORM = 77, + VK_FORMAT_R16G16_SNORM = 78, + VK_FORMAT_R16G16_USCALED = 79, + VK_FORMAT_R16G16_SSCALED = 80, + VK_FORMAT_R16G16_UINT = 81, + VK_FORMAT_R16G16_SINT = 82, + VK_FORMAT_R16G16_SFLOAT = 83, + VK_FORMAT_R16G16B16_UNORM = 84, + VK_FORMAT_R16G16B16_SNORM = 85, + VK_FORMAT_R16G16B16_USCALED = 86, + VK_FORMAT_R16G16B16_SSCALED = 87, + VK_FORMAT_R16G16B16_UINT = 88, + VK_FORMAT_R16G16B16_SINT = 89, + VK_FORMAT_R16G16B16_SFLOAT = 90, + VK_FORMAT_R16G16B16A16_UNORM = 91, + VK_FORMAT_R16G16B16A16_SNORM = 92, + VK_FORMAT_R16G16B16A16_USCALED = 93, + VK_FORMAT_R16G16B16A16_SSCALED = 94, + VK_FORMAT_R16G16B16A16_UINT = 95, + VK_FORMAT_R16G16B16A16_SINT = 96, + VK_FORMAT_R16G16B16A16_SFLOAT = 97, + VK_FORMAT_R32_UINT = 98, + VK_FORMAT_R32_SINT = 99, + VK_FORMAT_R32_SFLOAT = 100, + VK_FORMAT_R32G32_UINT = 101, + VK_FORMAT_R32G32_SINT = 102, + VK_FORMAT_R32G32_SFLOAT = 103, + VK_FORMAT_R32G32B32_UINT = 104, + VK_FORMAT_R32G32B32_SINT = 105, + VK_FORMAT_R32G32B32_SFLOAT = 106, + VK_FORMAT_R32G32B32A32_UINT = 107, + VK_FORMAT_R32G32B32A32_SINT = 108, + VK_FORMAT_R32G32B32A32_SFLOAT = 109, + VK_FORMAT_R64_UINT = 110, + VK_FORMAT_R64_SINT = 111, + VK_FORMAT_R64_SFLOAT = 112, + VK_FORMAT_R64G64_UINT = 113, + VK_FORMAT_R64G64_SINT = 114, + VK_FORMAT_R64G64_SFLOAT = 115, + VK_FORMAT_R64G64B64_UINT = 116, + VK_FORMAT_R64G64B64_SINT = 117, + VK_FORMAT_R64G64B64_SFLOAT = 118, + VK_FORMAT_R64G64B64A64_UINT = 119, + VK_FORMAT_R64G64B64A64_SINT = 120, + VK_FORMAT_R64G64B64A64_SFLOAT = 121, + VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, + VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, + VK_FORMAT_D16_UNORM = 124, + VK_FORMAT_X8_D24_UNORM_PACK32 = 125, + VK_FORMAT_D32_SFLOAT = 126, + VK_FORMAT_S8_UINT = 127, + VK_FORMAT_D16_UNORM_S8_UINT = 128, + VK_FORMAT_D24_UNORM_S8_UINT = 129, + VK_FORMAT_D32_SFLOAT_S8_UINT = 130, + VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, + VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, + VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, + VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, + VK_FORMAT_BC2_UNORM_BLOCK = 135, + VK_FORMAT_BC2_SRGB_BLOCK = 136, + VK_FORMAT_BC3_UNORM_BLOCK = 137, + VK_FORMAT_BC3_SRGB_BLOCK = 138, + VK_FORMAT_BC4_UNORM_BLOCK = 139, + VK_FORMAT_BC4_SNORM_BLOCK = 140, + VK_FORMAT_BC5_UNORM_BLOCK = 141, + VK_FORMAT_BC5_SNORM_BLOCK = 142, + VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, + VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, + VK_FORMAT_BC7_UNORM_BLOCK = 145, + VK_FORMAT_BC7_SRGB_BLOCK = 146, + VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, + VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, + VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, + VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, + VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, + VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, + VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, + VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, + VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, + VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, + VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, + VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, + VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, + VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, + VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, + VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, + VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, + VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, + VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, + VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, + VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, + VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, + VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, + VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, + VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, + VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, + VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, + VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, + VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, + VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, + VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, + VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, + VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, + VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, + VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, + VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, + VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, + VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, + VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, + VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, + VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, + VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, + VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, + VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, + VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, + VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED, + VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, + VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1), + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF +} VkFormat; + +typedef enum VkImageType { + VK_IMAGE_TYPE_1D = 0, + VK_IMAGE_TYPE_2D = 1, + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D, + VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D, + VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1), + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageType; + +typedef enum VkImageTiling { + VK_IMAGE_TILING_OPTIMAL = 0, + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR, + VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1), + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF +} VkImageTiling; + +typedef enum VkPhysicalDeviceType { + VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, + VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, + VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, + VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER, + VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU, + VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1), + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkPhysicalDeviceType; + +typedef enum VkQueryType { + VK_QUERY_TYPE_OCCLUSION = 0, + VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, + VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP, + VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1), + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkQueryType; + +typedef enum VkSharingMode { + VK_SHARING_MODE_EXCLUSIVE = 0, + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE, + VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT, + VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1), + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSharingMode; + +typedef enum VkImageLayout { + VK_IMAGE_LAYOUT_UNDEFINED = 0, + VK_IMAGE_LAYOUT_GENERAL = 1, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, + VK_IMAGE_LAYOUT_PREINITIALIZED = 8, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, + VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED, + VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1), + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF +} VkImageLayout; + +typedef enum VkImageViewType { + VK_IMAGE_VIEW_TYPE_1D = 0, + VK_IMAGE_VIEW_TYPE_2D = 1, + VK_IMAGE_VIEW_TYPE_3D = 2, + VK_IMAGE_VIEW_TYPE_CUBE = 3, + VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, + VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D, + VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, + VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1), + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageViewType; + +typedef enum VkComponentSwizzle { + VK_COMPONENT_SWIZZLE_IDENTITY = 0, + VK_COMPONENT_SWIZZLE_ZERO = 1, + VK_COMPONENT_SWIZZLE_ONE = 2, + VK_COMPONENT_SWIZZLE_R = 3, + VK_COMPONENT_SWIZZLE_G = 4, + VK_COMPONENT_SWIZZLE_B = 5, + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A, + VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1), + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF +} VkComponentSwizzle; + +typedef enum VkVertexInputRate { + VK_VERTEX_INPUT_RATE_VERTEX = 0, + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX, + VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE, + VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1), + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF +} VkVertexInputRate; + +typedef enum VkPrimitiveTopology { + VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, + VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, + VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1), + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF +} VkPrimitiveTopology; + +typedef enum VkPolygonMode { + VK_POLYGON_MODE_FILL = 0, + VK_POLYGON_MODE_LINE = 1, + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, + VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL, + VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT, + VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1), + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF +} VkPolygonMode; + +typedef enum VkFrontFace { + VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE, + VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE, + VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1), + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF +} VkFrontFace; + +typedef enum VkCompareOp { + VK_COMPARE_OP_NEVER = 0, + VK_COMPARE_OP_LESS = 1, + VK_COMPARE_OP_EQUAL = 2, + VK_COMPARE_OP_LESS_OR_EQUAL = 3, + VK_COMPARE_OP_GREATER = 4, + VK_COMPARE_OP_NOT_EQUAL = 5, + VK_COMPARE_OP_GREATER_OR_EQUAL = 6, + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER, + VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS, + VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1), + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF +} VkCompareOp; + +typedef enum VkStencilOp { + VK_STENCIL_OP_KEEP = 0, + VK_STENCIL_OP_ZERO = 1, + VK_STENCIL_OP_REPLACE = 2, + VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, + VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, + VK_STENCIL_OP_INVERT = 5, + VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP, + VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP, + VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1), + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF +} VkStencilOp; + +typedef enum VkLogicOp { + VK_LOGIC_OP_CLEAR = 0, + VK_LOGIC_OP_AND = 1, + VK_LOGIC_OP_AND_REVERSE = 2, + VK_LOGIC_OP_COPY = 3, + VK_LOGIC_OP_AND_INVERTED = 4, + VK_LOGIC_OP_NO_OP = 5, + VK_LOGIC_OP_XOR = 6, + VK_LOGIC_OP_OR = 7, + VK_LOGIC_OP_NOR = 8, + VK_LOGIC_OP_EQUIVALENT = 9, + VK_LOGIC_OP_INVERT = 10, + VK_LOGIC_OP_OR_REVERSE = 11, + VK_LOGIC_OP_COPY_INVERTED = 12, + VK_LOGIC_OP_OR_INVERTED = 13, + VK_LOGIC_OP_NAND = 14, + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR, + VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET, + VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1), + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF +} VkLogicOp; + +typedef enum VkBlendFactor { + VK_BLEND_FACTOR_ZERO = 0, + VK_BLEND_FACTOR_ONE = 1, + VK_BLEND_FACTOR_SRC_COLOR = 2, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, + VK_BLEND_FACTOR_DST_COLOR = 4, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, + VK_BLEND_FACTOR_SRC_ALPHA = 6, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, + VK_BLEND_FACTOR_DST_ALPHA = 8, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, + VK_BLEND_FACTOR_CONSTANT_COLOR = 10, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, + VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, + VK_BLEND_FACTOR_SRC1_COLOR = 15, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, + VK_BLEND_FACTOR_SRC1_ALPHA = 17, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO, + VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, + VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1), + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF +} VkBlendFactor; + +typedef enum VkBlendOp { + VK_BLEND_OP_ADD = 0, + VK_BLEND_OP_SUBTRACT = 1, + VK_BLEND_OP_REVERSE_SUBTRACT = 2, + VK_BLEND_OP_MIN = 3, + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_ZERO_EXT = 1000148000, + VK_BLEND_OP_SRC_EXT = 1000148001, + VK_BLEND_OP_DST_EXT = 1000148002, + VK_BLEND_OP_SRC_OVER_EXT = 1000148003, + VK_BLEND_OP_DST_OVER_EXT = 1000148004, + VK_BLEND_OP_SRC_IN_EXT = 1000148005, + VK_BLEND_OP_DST_IN_EXT = 1000148006, + VK_BLEND_OP_SRC_OUT_EXT = 1000148007, + VK_BLEND_OP_DST_OUT_EXT = 1000148008, + VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, + VK_BLEND_OP_DST_ATOP_EXT = 1000148010, + VK_BLEND_OP_XOR_EXT = 1000148011, + VK_BLEND_OP_MULTIPLY_EXT = 1000148012, + VK_BLEND_OP_SCREEN_EXT = 1000148013, + VK_BLEND_OP_OVERLAY_EXT = 1000148014, + VK_BLEND_OP_DARKEN_EXT = 1000148015, + VK_BLEND_OP_LIGHTEN_EXT = 1000148016, + VK_BLEND_OP_COLORDODGE_EXT = 1000148017, + VK_BLEND_OP_COLORBURN_EXT = 1000148018, + VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, + VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, + VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, + VK_BLEND_OP_EXCLUSION_EXT = 1000148022, + VK_BLEND_OP_INVERT_EXT = 1000148023, + VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, + VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, + VK_BLEND_OP_LINEARBURN_EXT = 1000148026, + VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, + VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, + VK_BLEND_OP_PINLIGHT_EXT = 1000148029, + VK_BLEND_OP_HARDMIX_EXT = 1000148030, + VK_BLEND_OP_HSL_HUE_EXT = 1000148031, + VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, + VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, + VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, + VK_BLEND_OP_PLUS_EXT = 1000148035, + VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, + VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, + VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, + VK_BLEND_OP_MINUS_EXT = 1000148039, + VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, + VK_BLEND_OP_CONTRAST_EXT = 1000148041, + VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, + VK_BLEND_OP_RED_EXT = 1000148043, + VK_BLEND_OP_GREEN_EXT = 1000148044, + VK_BLEND_OP_BLUE_EXT = 1000148045, + VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD, + VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX, + VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1), + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF +} VkBlendOp; + +typedef enum VkDynamicState { + VK_DYNAMIC_STATE_VIEWPORT = 0, + VK_DYNAMIC_STATE_SCISSOR = 1, + VK_DYNAMIC_STATE_LINE_WIDTH = 2, + VK_DYNAMIC_STATE_DEPTH_BIAS = 3, + VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, + VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, + VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, + VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, + VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF +} VkDynamicState; + +typedef enum VkFilter { + VK_FILTER_NEAREST = 0, + VK_FILTER_LINEAR = 1, + VK_FILTER_CUBIC_IMG = 1000015000, + VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, + VK_FILTER_END_RANGE = VK_FILTER_LINEAR, + VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), + VK_FILTER_MAX_ENUM = 0x7FFFFFFF +} VkFilter; + +typedef enum VkSamplerMipmapMode { + VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST, + VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR, + VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1), + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerMipmapMode; + +typedef enum VkSamplerAddressMode { + VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, + VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerAddressMode; + +typedef enum VkBorderColor { + VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, + VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, + VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, + VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, + VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, + VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE, + VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1), + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF +} VkBorderColor; + +typedef enum VkDescriptorType { + VK_DESCRIPTOR_TYPE_SAMPLER = 0, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, + VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER, + VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1), + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorType; + +typedef enum VkAttachmentLoadOp { + VK_ATTACHMENT_LOAD_OP_LOAD = 0, + VK_ATTACHMENT_LOAD_OP_CLEAR = 1, + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD, + VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1), + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentLoadOp; + +typedef enum VkAttachmentStoreOp { + VK_ATTACHMENT_STORE_OP_STORE = 0, + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE, + VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1), + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentStoreOp; + +typedef enum VkPipelineBindPoint { + VK_PIPELINE_BIND_POINT_GRAPHICS = 0, + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS, + VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE, + VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1), + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF +} VkPipelineBindPoint; + +typedef enum VkCommandBufferLevel { + VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY, + VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY, + VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1), + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferLevel; + +typedef enum VkIndexType { + VK_INDEX_TYPE_UINT16 = 0, + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16, + VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32, + VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1), + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkIndexType; + +typedef enum VkSubpassContents { + VK_SUBPASS_CONTENTS_INLINE = 0, + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE, + VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS, + VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1), + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassContents; + +typedef enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, + VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN, + VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL, + VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1), + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkObjectType; + +typedef VkFlags VkInstanceCreateFlags; + +typedef enum VkFormatFeatureFlagBits { + VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, + VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, + VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, + VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, + VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, + VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, + VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, + VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000, + VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFormatFeatureFlagBits; +typedef VkFlags VkFormatFeatureFlags; + +typedef enum VkImageUsageFlagBits { + VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, + VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, + VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, + VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageUsageFlagBits; +typedef VkFlags VkImageUsageFlags; + +typedef enum VkImageCreateFlagBits { + VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, + VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, + VK_IMAGE_CREATE_BIND_SFR_BIT_KHX = 0x00000040, + VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020, + VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageCreateFlagBits; +typedef VkFlags VkImageCreateFlags; + +typedef enum VkSampleCountFlagBits { + VK_SAMPLE_COUNT_1_BIT = 0x00000001, + VK_SAMPLE_COUNT_2_BIT = 0x00000002, + VK_SAMPLE_COUNT_4_BIT = 0x00000004, + VK_SAMPLE_COUNT_8_BIT = 0x00000008, + VK_SAMPLE_COUNT_16_BIT = 0x00000010, + VK_SAMPLE_COUNT_32_BIT = 0x00000020, + VK_SAMPLE_COUNT_64_BIT = 0x00000040, + VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSampleCountFlagBits; +typedef VkFlags VkSampleCountFlags; + +typedef enum VkQueueFlagBits { + VK_QUEUE_GRAPHICS_BIT = 0x00000001, + VK_QUEUE_COMPUTE_BIT = 0x00000002, + VK_QUEUE_TRANSFER_BIT = 0x00000004, + VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, + VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueueFlagBits; +typedef VkFlags VkQueueFlags; + +typedef enum VkMemoryPropertyFlagBits { + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, + VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, + VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, + VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryPropertyFlagBits; +typedef VkFlags VkMemoryPropertyFlags; + +typedef enum VkMemoryHeapFlagBits { + VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHX = 0x00000002, + VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryHeapFlagBits; +typedef VkFlags VkMemoryHeapFlags; +typedef VkFlags VkDeviceCreateFlags; +typedef VkFlags VkDeviceQueueCreateFlags; + +typedef enum VkPipelineStageFlagBits { + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, + VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, + VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, + VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, + VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, + VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, + VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, + VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, + VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, + VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, + VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, + VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, + VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 0x00020000, + VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineStageFlagBits; +typedef VkFlags VkPipelineStageFlags; +typedef VkFlags VkMemoryMapFlags; + +typedef enum VkImageAspectFlagBits { + VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, + VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, + VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, + VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, + VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageAspectFlagBits; +typedef VkFlags VkImageAspectFlags; + +typedef enum VkSparseImageFormatFlagBits { + VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, + VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, + VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseImageFormatFlagBits; +typedef VkFlags VkSparseImageFormatFlags; + +typedef enum VkSparseMemoryBindFlagBits { + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, + VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseMemoryBindFlagBits; +typedef VkFlags VkSparseMemoryBindFlags; + +typedef enum VkFenceCreateFlagBits { + VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, + VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFenceCreateFlagBits; +typedef VkFlags VkFenceCreateFlags; +typedef VkFlags VkSemaphoreCreateFlags; +typedef VkFlags VkEventCreateFlags; +typedef VkFlags VkQueryPoolCreateFlags; + +typedef enum VkQueryPipelineStatisticFlagBits { + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, + VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, + VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, + VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryPipelineStatisticFlagBits; +typedef VkFlags VkQueryPipelineStatisticFlags; + +typedef enum VkQueryResultFlagBits { + VK_QUERY_RESULT_64_BIT = 0x00000001, + VK_QUERY_RESULT_WAIT_BIT = 0x00000002, + VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, + VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, + VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryResultFlagBits; +typedef VkFlags VkQueryResultFlags; + +typedef enum VkBufferCreateFlagBits { + VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferCreateFlagBits; +typedef VkFlags VkBufferCreateFlags; + +typedef enum VkBufferUsageFlagBits { + VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, + VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, + VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferUsageFlagBits; +typedef VkFlags VkBufferUsageFlags; +typedef VkFlags VkBufferViewCreateFlags; +typedef VkFlags VkImageViewCreateFlags; +typedef VkFlags VkShaderModuleCreateFlags; +typedef VkFlags VkPipelineCacheCreateFlags; + +typedef enum VkPipelineCreateFlagBits { + VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, + VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, + VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, + VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHX = 0x00000008, + VK_PIPELINE_CREATE_DISPATCH_BASE_KHX = 0x00000010, + VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCreateFlagBits; +typedef VkFlags VkPipelineCreateFlags; +typedef VkFlags VkPipelineShaderStageCreateFlags; + +typedef enum VkShaderStageFlagBits { + VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, + VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, + VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, + VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, + VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, + VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, + VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkShaderStageFlagBits; +typedef VkFlags VkPipelineVertexInputStateCreateFlags; +typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; +typedef VkFlags VkPipelineTessellationStateCreateFlags; +typedef VkFlags VkPipelineViewportStateCreateFlags; +typedef VkFlags VkPipelineRasterizationStateCreateFlags; + +typedef enum VkCullModeFlagBits { + VK_CULL_MODE_NONE = 0, + VK_CULL_MODE_FRONT_BIT = 0x00000001, + VK_CULL_MODE_BACK_BIT = 0x00000002, + VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, + VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCullModeFlagBits; +typedef VkFlags VkCullModeFlags; +typedef VkFlags VkPipelineMultisampleStateCreateFlags; +typedef VkFlags VkPipelineDepthStencilStateCreateFlags; +typedef VkFlags VkPipelineColorBlendStateCreateFlags; + +typedef enum VkColorComponentFlagBits { + VK_COLOR_COMPONENT_R_BIT = 0x00000001, + VK_COLOR_COMPONENT_G_BIT = 0x00000002, + VK_COLOR_COMPONENT_B_BIT = 0x00000004, + VK_COLOR_COMPONENT_A_BIT = 0x00000008, + VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkColorComponentFlagBits; +typedef VkFlags VkColorComponentFlags; +typedef VkFlags VkPipelineDynamicStateCreateFlags; +typedef VkFlags VkPipelineLayoutCreateFlags; +typedef VkFlags VkShaderStageFlags; +typedef VkFlags VkSamplerCreateFlags; + +typedef enum VkDescriptorSetLayoutCreateFlagBits { + VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorSetLayoutCreateFlagBits; +typedef VkFlags VkDescriptorSetLayoutCreateFlags; + +typedef enum VkDescriptorPoolCreateFlagBits { + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, + VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorPoolCreateFlagBits; +typedef VkFlags VkDescriptorPoolCreateFlags; +typedef VkFlags VkDescriptorPoolResetFlags; +typedef VkFlags VkFramebufferCreateFlags; +typedef VkFlags VkRenderPassCreateFlags; + +typedef enum VkAttachmentDescriptionFlagBits { + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, + VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentDescriptionFlagBits; +typedef VkFlags VkAttachmentDescriptionFlags; + +typedef enum VkSubpassDescriptionFlagBits { + VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 0x00000001, + VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 0x00000002, + VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassDescriptionFlagBits; +typedef VkFlags VkSubpassDescriptionFlags; + +typedef enum VkAccessFlagBits { + VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, + VK_ACCESS_INDEX_READ_BIT = 0x00000002, + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, + VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, + VK_ACCESS_SHADER_READ_BIT = 0x00000020, + VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, + VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, + VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, + VK_ACCESS_HOST_READ_BIT = 0x00002000, + VK_ACCESS_HOST_WRITE_BIT = 0x00004000, + VK_ACCESS_MEMORY_READ_BIT = 0x00008000, + VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, + VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000, + VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000, + VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, + VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAccessFlagBits; +typedef VkFlags VkAccessFlags; + +typedef enum VkDependencyFlagBits { + VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, + VK_DEPENDENCY_VIEW_LOCAL_BIT_KHX = 0x00000002, + VK_DEPENDENCY_DEVICE_GROUP_BIT_KHX = 0x00000004, + VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDependencyFlagBits; +typedef VkFlags VkDependencyFlags; + +typedef enum VkCommandPoolCreateFlagBits { + VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, + VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolCreateFlagBits; +typedef VkFlags VkCommandPoolCreateFlags; + +typedef enum VkCommandPoolResetFlagBits { + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolResetFlagBits; +typedef VkFlags VkCommandPoolResetFlags; + +typedef enum VkCommandBufferUsageFlagBits { + VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, + VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, + VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferUsageFlagBits; +typedef VkFlags VkCommandBufferUsageFlags; + +typedef enum VkQueryControlFlagBits { + VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, + VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryControlFlagBits; +typedef VkFlags VkQueryControlFlags; + +typedef enum VkCommandBufferResetFlagBits { + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferResetFlagBits; +typedef VkFlags VkCommandBufferResetFlags; + +typedef enum VkStencilFaceFlagBits { + VK_STENCIL_FACE_FRONT_BIT = 0x00000001, + VK_STENCIL_FACE_BACK_BIT = 0x00000002, + VK_STENCIL_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkStencilFaceFlagBits; +typedef VkFlags VkStencilFaceFlags; + +typedef struct VkApplicationInfo { + VkStructureType sType; + const void* pNext; + const char* pApplicationName; + uint32_t applicationVersion; + const char* pEngineName; + uint32_t engineVersion; + uint32_t apiVersion; +} VkApplicationInfo; + +typedef struct VkInstanceCreateInfo { + VkStructureType sType; + const void* pNext; + VkInstanceCreateFlags flags; + const VkApplicationInfo* pApplicationInfo; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; +} VkInstanceCreateInfo; + +typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( + void* pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( + void* pUserData, + void* pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkFreeFunction)( + void* pUserData, + void* pMemory); + +typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef struct VkAllocationCallbacks { + void* pUserData; + PFN_vkAllocationFunction pfnAllocation; + PFN_vkReallocationFunction pfnReallocation; + PFN_vkFreeFunction pfnFree; + PFN_vkInternalAllocationNotification pfnInternalAllocation; + PFN_vkInternalFreeNotification pfnInternalFree; +} VkAllocationCallbacks; + +typedef struct VkPhysicalDeviceFeatures { + VkBool32 robustBufferAccess; + VkBool32 fullDrawIndexUint32; + VkBool32 imageCubeArray; + VkBool32 independentBlend; + VkBool32 geometryShader; + VkBool32 tessellationShader; + VkBool32 sampleRateShading; + VkBool32 dualSrcBlend; + VkBool32 logicOp; + VkBool32 multiDrawIndirect; + VkBool32 drawIndirectFirstInstance; + VkBool32 depthClamp; + VkBool32 depthBiasClamp; + VkBool32 fillModeNonSolid; + VkBool32 depthBounds; + VkBool32 wideLines; + VkBool32 largePoints; + VkBool32 alphaToOne; + VkBool32 multiViewport; + VkBool32 samplerAnisotropy; + VkBool32 textureCompressionETC2; + VkBool32 textureCompressionASTC_LDR; + VkBool32 textureCompressionBC; + VkBool32 occlusionQueryPrecise; + VkBool32 pipelineStatisticsQuery; + VkBool32 vertexPipelineStoresAndAtomics; + VkBool32 fragmentStoresAndAtomics; + VkBool32 shaderTessellationAndGeometryPointSize; + VkBool32 shaderImageGatherExtended; + VkBool32 shaderStorageImageExtendedFormats; + VkBool32 shaderStorageImageMultisample; + VkBool32 shaderStorageImageReadWithoutFormat; + VkBool32 shaderStorageImageWriteWithoutFormat; + VkBool32 shaderUniformBufferArrayDynamicIndexing; + VkBool32 shaderSampledImageArrayDynamicIndexing; + VkBool32 shaderStorageBufferArrayDynamicIndexing; + VkBool32 shaderStorageImageArrayDynamicIndexing; + VkBool32 shaderClipDistance; + VkBool32 shaderCullDistance; + VkBool32 shaderFloat64; + VkBool32 shaderInt64; + VkBool32 shaderInt16; + VkBool32 shaderResourceResidency; + VkBool32 shaderResourceMinLod; + VkBool32 sparseBinding; + VkBool32 sparseResidencyBuffer; + VkBool32 sparseResidencyImage2D; + VkBool32 sparseResidencyImage3D; + VkBool32 sparseResidency2Samples; + VkBool32 sparseResidency4Samples; + VkBool32 sparseResidency8Samples; + VkBool32 sparseResidency16Samples; + VkBool32 sparseResidencyAliased; + VkBool32 variableMultisampleRate; + VkBool32 inheritedQueries; +} VkPhysicalDeviceFeatures; + +typedef struct VkFormatProperties { + VkFormatFeatureFlags linearTilingFeatures; + VkFormatFeatureFlags optimalTilingFeatures; + VkFormatFeatureFlags bufferFeatures; +} VkFormatProperties; + +typedef struct VkExtent3D { + uint32_t width; + uint32_t height; + uint32_t depth; +} VkExtent3D; + +typedef struct VkImageFormatProperties { + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArrayLayers; + VkSampleCountFlags sampleCounts; + VkDeviceSize maxResourceSize; +} VkImageFormatProperties; + +typedef struct VkPhysicalDeviceLimits { + uint32_t maxImageDimension1D; + uint32_t maxImageDimension2D; + uint32_t maxImageDimension3D; + uint32_t maxImageDimensionCube; + uint32_t maxImageArrayLayers; + uint32_t maxTexelBufferElements; + uint32_t maxUniformBufferRange; + uint32_t maxStorageBufferRange; + uint32_t maxPushConstantsSize; + uint32_t maxMemoryAllocationCount; + uint32_t maxSamplerAllocationCount; + VkDeviceSize bufferImageGranularity; + VkDeviceSize sparseAddressSpaceSize; + uint32_t maxBoundDescriptorSets; + uint32_t maxPerStageDescriptorSamplers; + uint32_t maxPerStageDescriptorUniformBuffers; + uint32_t maxPerStageDescriptorStorageBuffers; + uint32_t maxPerStageDescriptorSampledImages; + uint32_t maxPerStageDescriptorStorageImages; + uint32_t maxPerStageDescriptorInputAttachments; + uint32_t maxPerStageResources; + uint32_t maxDescriptorSetSamplers; + uint32_t maxDescriptorSetUniformBuffers; + uint32_t maxDescriptorSetUniformBuffersDynamic; + uint32_t maxDescriptorSetStorageBuffers; + uint32_t maxDescriptorSetStorageBuffersDynamic; + uint32_t maxDescriptorSetSampledImages; + uint32_t maxDescriptorSetStorageImages; + uint32_t maxDescriptorSetInputAttachments; + uint32_t maxVertexInputAttributes; + uint32_t maxVertexInputBindings; + uint32_t maxVertexInputAttributeOffset; + uint32_t maxVertexInputBindingStride; + uint32_t maxVertexOutputComponents; + uint32_t maxTessellationGenerationLevel; + uint32_t maxTessellationPatchSize; + uint32_t maxTessellationControlPerVertexInputComponents; + uint32_t maxTessellationControlPerVertexOutputComponents; + uint32_t maxTessellationControlPerPatchOutputComponents; + uint32_t maxTessellationControlTotalOutputComponents; + uint32_t maxTessellationEvaluationInputComponents; + uint32_t maxTessellationEvaluationOutputComponents; + uint32_t maxGeometryShaderInvocations; + uint32_t maxGeometryInputComponents; + uint32_t maxGeometryOutputComponents; + uint32_t maxGeometryOutputVertices; + uint32_t maxGeometryTotalOutputComponents; + uint32_t maxFragmentInputComponents; + uint32_t maxFragmentOutputAttachments; + uint32_t maxFragmentDualSrcAttachments; + uint32_t maxFragmentCombinedOutputResources; + uint32_t maxComputeSharedMemorySize; + uint32_t maxComputeWorkGroupCount[3]; + uint32_t maxComputeWorkGroupInvocations; + uint32_t maxComputeWorkGroupSize[3]; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; + uint32_t maxDrawIndexedIndexValue; + uint32_t maxDrawIndirectCount; + float maxSamplerLodBias; + float maxSamplerAnisotropy; + uint32_t maxViewports; + uint32_t maxViewportDimensions[2]; + float viewportBoundsRange[2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; + int32_t minTexelOffset; + uint32_t maxTexelOffset; + int32_t minTexelGatherOffset; + uint32_t maxTexelGatherOffset; + float minInterpolationOffset; + float maxInterpolationOffset; + uint32_t subPixelInterpolationOffsetBits; + uint32_t maxFramebufferWidth; + uint32_t maxFramebufferHeight; + uint32_t maxFramebufferLayers; + VkSampleCountFlags framebufferColorSampleCounts; + VkSampleCountFlags framebufferDepthSampleCounts; + VkSampleCountFlags framebufferStencilSampleCounts; + VkSampleCountFlags framebufferNoAttachmentsSampleCounts; + uint32_t maxColorAttachments; + VkSampleCountFlags sampledImageColorSampleCounts; + VkSampleCountFlags sampledImageIntegerSampleCounts; + VkSampleCountFlags sampledImageDepthSampleCounts; + VkSampleCountFlags sampledImageStencilSampleCounts; + VkSampleCountFlags storageImageSampleCounts; + uint32_t maxSampleMaskWords; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; + uint32_t maxClipDistances; + uint32_t maxCullDistances; + uint32_t maxCombinedClipAndCullDistances; + uint32_t discreteQueuePriorities; + float pointSizeRange[2]; + float lineWidthRange[2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; +} VkPhysicalDeviceLimits; + +typedef struct VkPhysicalDeviceSparseProperties { + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; +} VkPhysicalDeviceSparseProperties; + +typedef struct VkPhysicalDeviceProperties { + uint32_t apiVersion; + uint32_t driverVersion; + uint32_t vendorID; + uint32_t deviceID; + VkPhysicalDeviceType deviceType; + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; + uint8_t pipelineCacheUUID[VK_UUID_SIZE]; + VkPhysicalDeviceLimits limits; + VkPhysicalDeviceSparseProperties sparseProperties; +} VkPhysicalDeviceProperties; + +typedef struct VkQueueFamilyProperties { + VkQueueFlags queueFlags; + uint32_t queueCount; + uint32_t timestampValidBits; + VkExtent3D minImageTransferGranularity; +} VkQueueFamilyProperties; + +typedef struct VkMemoryType { + VkMemoryPropertyFlags propertyFlags; + uint32_t heapIndex; +} VkMemoryType; + +typedef struct VkMemoryHeap { + VkDeviceSize size; + VkMemoryHeapFlags flags; +} VkMemoryHeap; + +typedef struct VkPhysicalDeviceMemoryProperties { + uint32_t memoryTypeCount; + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; + uint32_t memoryHeapCount; + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; +} VkPhysicalDeviceMemoryProperties; + +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); +typedef struct VkDeviceQueueCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceQueueCreateFlags flags; + uint32_t queueFamilyIndex; + uint32_t queueCount; + const float* pQueuePriorities; +} VkDeviceQueueCreateInfo; + +typedef struct VkDeviceCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceCreateFlags flags; + uint32_t queueCreateInfoCount; + const VkDeviceQueueCreateInfo* pQueueCreateInfos; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; + const VkPhysicalDeviceFeatures* pEnabledFeatures; +} VkDeviceCreateInfo; + +typedef struct VkExtensionProperties { + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; +} VkExtensionProperties; + +typedef struct VkLayerProperties { + char layerName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; + uint32_t implementationVersion; + char description[VK_MAX_DESCRIPTION_SIZE]; +} VkLayerProperties; + +typedef struct VkSubmitInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + const VkPipelineStageFlags* pWaitDstStageMask; + uint32_t commandBufferCount; + const VkCommandBuffer* pCommandBuffers; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkSubmitInfo; + +typedef struct VkMemoryAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeIndex; +} VkMemoryAllocateInfo; + +typedef struct VkMappedMemoryRange { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMappedMemoryRange; + +typedef struct VkMemoryRequirements { + VkDeviceSize size; + VkDeviceSize alignment; + uint32_t memoryTypeBits; +} VkMemoryRequirements; + +typedef struct VkSparseImageFormatProperties { + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; + VkSparseImageFormatFlags flags; +} VkSparseImageFormatProperties; + +typedef struct VkSparseImageMemoryRequirements { + VkSparseImageFormatProperties formatProperties; + uint32_t imageMipTailFirstLod; + VkDeviceSize imageMipTailSize; + VkDeviceSize imageMipTailOffset; + VkDeviceSize imageMipTailStride; +} VkSparseImageMemoryRequirements; + +typedef struct VkSparseMemoryBind { + VkDeviceSize resourceOffset; + VkDeviceSize size; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseMemoryBind; + +typedef struct VkSparseBufferMemoryBindInfo { + VkBuffer buffer; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseBufferMemoryBindInfo; + +typedef struct VkSparseImageOpaqueMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseImageOpaqueMemoryBindInfo; + +typedef struct VkImageSubresource { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t arrayLayer; +} VkImageSubresource; + +typedef struct VkOffset3D { + int32_t x; + int32_t y; + int32_t z; +} VkOffset3D; + +typedef struct VkSparseImageMemoryBind { + VkImageSubresource subresource; + VkOffset3D offset; + VkExtent3D extent; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseImageMemoryBind; + +typedef struct VkSparseImageMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseImageMemoryBind* pBinds; +} VkSparseImageMemoryBindInfo; + +typedef struct VkBindSparseInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t bufferBindCount; + const VkSparseBufferMemoryBindInfo* pBufferBinds; + uint32_t imageOpaqueBindCount; + const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; + uint32_t imageBindCount; + const VkSparseImageMemoryBindInfo* pImageBinds; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkBindSparseInfo; + +typedef struct VkFenceCreateInfo { + VkStructureType sType; + const void* pNext; + VkFenceCreateFlags flags; +} VkFenceCreateInfo; + +typedef struct VkSemaphoreCreateInfo { + VkStructureType sType; + const void* pNext; + VkSemaphoreCreateFlags flags; +} VkSemaphoreCreateInfo; + +typedef struct VkEventCreateInfo { + VkStructureType sType; + const void* pNext; + VkEventCreateFlags flags; +} VkEventCreateInfo; + +typedef struct VkQueryPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkQueryPoolCreateFlags flags; + VkQueryType queryType; + uint32_t queryCount; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkQueryPoolCreateInfo; + +typedef struct VkBufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkDeviceSize size; + VkBufferUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; +} VkBufferCreateInfo; + +typedef struct VkBufferViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferViewCreateFlags flags; + VkBuffer buffer; + VkFormat format; + VkDeviceSize offset; + VkDeviceSize range; +} VkBufferViewCreateInfo; + +typedef struct VkImageCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageCreateFlags flags; + VkImageType imageType; + VkFormat format; + VkExtent3D extent; + uint32_t mipLevels; + uint32_t arrayLayers; + VkSampleCountFlagBits samples; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkImageLayout initialLayout; +} VkImageCreateInfo; + +typedef struct VkSubresourceLayout { + VkDeviceSize offset; + VkDeviceSize size; + VkDeviceSize rowPitch; + VkDeviceSize arrayPitch; + VkDeviceSize depthPitch; +} VkSubresourceLayout; + +typedef struct VkComponentMapping { + VkComponentSwizzle r; + VkComponentSwizzle g; + VkComponentSwizzle b; + VkComponentSwizzle a; +} VkComponentMapping; + +typedef struct VkImageSubresourceRange { + VkImageAspectFlags aspectMask; + uint32_t baseMipLevel; + uint32_t levelCount; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceRange; + +typedef struct VkImageViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageViewCreateFlags flags; + VkImage image; + VkImageViewType viewType; + VkFormat format; + VkComponentMapping components; + VkImageSubresourceRange subresourceRange; +} VkImageViewCreateInfo; + +typedef struct VkShaderModuleCreateInfo { + VkStructureType sType; + const void* pNext; + VkShaderModuleCreateFlags flags; + size_t codeSize; + const uint32_t* pCode; +} VkShaderModuleCreateInfo; + +typedef struct VkPipelineCacheCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCacheCreateFlags flags; + size_t initialDataSize; + const void* pInitialData; +} VkPipelineCacheCreateInfo; + +typedef struct VkSpecializationMapEntry { + uint32_t constantID; + uint32_t offset; + size_t size; +} VkSpecializationMapEntry; + +typedef struct VkSpecializationInfo { + uint32_t mapEntryCount; + const VkSpecializationMapEntry* pMapEntries; + size_t dataSize; + const void* pData; +} VkSpecializationInfo; + +typedef struct VkPipelineShaderStageCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineShaderStageCreateFlags flags; + VkShaderStageFlagBits stage; + VkShaderModule module; + const char* pName; + const VkSpecializationInfo* pSpecializationInfo; +} VkPipelineShaderStageCreateInfo; + +typedef struct VkVertexInputBindingDescription { + uint32_t binding; + uint32_t stride; + VkVertexInputRate inputRate; +} VkVertexInputBindingDescription; + +typedef struct VkVertexInputAttributeDescription { + uint32_t location; + uint32_t binding; + VkFormat format; + uint32_t offset; +} VkVertexInputAttributeDescription; + +typedef struct VkPipelineVertexInputStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineVertexInputStateCreateFlags flags; + uint32_t vertexBindingDescriptionCount; + const VkVertexInputBindingDescription* pVertexBindingDescriptions; + uint32_t vertexAttributeDescriptionCount; + const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; +} VkPipelineVertexInputStateCreateInfo; + +typedef struct VkPipelineInputAssemblyStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineInputAssemblyStateCreateFlags flags; + VkPrimitiveTopology topology; + VkBool32 primitiveRestartEnable; +} VkPipelineInputAssemblyStateCreateInfo; + +typedef struct VkPipelineTessellationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineTessellationStateCreateFlags flags; + uint32_t patchControlPoints; +} VkPipelineTessellationStateCreateInfo; + +typedef struct VkViewport { + float x; + float y; + float width; + float height; + float minDepth; + float maxDepth; +} VkViewport; + +typedef struct VkOffset2D { + int32_t x; + int32_t y; +} VkOffset2D; + +typedef struct VkExtent2D { + uint32_t width; + uint32_t height; +} VkExtent2D; + +typedef struct VkRect2D { + VkOffset2D offset; + VkExtent2D extent; +} VkRect2D; + +typedef struct VkPipelineViewportStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineViewportStateCreateFlags flags; + uint32_t viewportCount; + const VkViewport* pViewports; + uint32_t scissorCount; + const VkRect2D* pScissors; +} VkPipelineViewportStateCreateInfo; + +typedef struct VkPipelineRasterizationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineRasterizationStateCreateFlags flags; + VkBool32 depthClampEnable; + VkBool32 rasterizerDiscardEnable; + VkPolygonMode polygonMode; + VkCullModeFlags cullMode; + VkFrontFace frontFace; + VkBool32 depthBiasEnable; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; + float lineWidth; +} VkPipelineRasterizationStateCreateInfo; + +typedef struct VkPipelineMultisampleStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineMultisampleStateCreateFlags flags; + VkSampleCountFlagBits rasterizationSamples; + VkBool32 sampleShadingEnable; + float minSampleShading; + const VkSampleMask* pSampleMask; + VkBool32 alphaToCoverageEnable; + VkBool32 alphaToOneEnable; +} VkPipelineMultisampleStateCreateInfo; + +typedef struct VkStencilOpState { + VkStencilOp failOp; + VkStencilOp passOp; + VkStencilOp depthFailOp; + VkCompareOp compareOp; + uint32_t compareMask; + uint32_t writeMask; + uint32_t reference; +} VkStencilOpState; + +typedef struct VkPipelineDepthStencilStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDepthStencilStateCreateFlags flags; + VkBool32 depthTestEnable; + VkBool32 depthWriteEnable; + VkCompareOp depthCompareOp; + VkBool32 depthBoundsTestEnable; + VkBool32 stencilTestEnable; + VkStencilOpState front; + VkStencilOpState back; + float minDepthBounds; + float maxDepthBounds; +} VkPipelineDepthStencilStateCreateInfo; + +typedef struct VkPipelineColorBlendAttachmentState { + VkBool32 blendEnable; + VkBlendFactor srcColorBlendFactor; + VkBlendFactor dstColorBlendFactor; + VkBlendOp colorBlendOp; + VkBlendFactor srcAlphaBlendFactor; + VkBlendFactor dstAlphaBlendFactor; + VkBlendOp alphaBlendOp; + VkColorComponentFlags colorWriteMask; +} VkPipelineColorBlendAttachmentState; + +typedef struct VkPipelineColorBlendStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineColorBlendStateCreateFlags flags; + VkBool32 logicOpEnable; + VkLogicOp logicOp; + uint32_t attachmentCount; + const VkPipelineColorBlendAttachmentState* pAttachments; + float blendConstants[4]; +} VkPipelineColorBlendStateCreateInfo; + +typedef struct VkPipelineDynamicStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDynamicStateCreateFlags flags; + uint32_t dynamicStateCount; + const VkDynamicState* pDynamicStates; +} VkPipelineDynamicStateCreateInfo; + +typedef struct VkGraphicsPipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo* pTessellationState; + const VkPipelineViewportStateCreateInfo* pViewportState; + const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + const VkPipelineDynamicStateCreateInfo* pDynamicState; + VkPipelineLayout layout; + VkRenderPass renderPass; + uint32_t subpass; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkGraphicsPipelineCreateInfo; + +typedef struct VkComputePipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + VkPipelineShaderStageCreateInfo stage; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkComputePipelineCreateInfo; + +typedef struct VkPushConstantRange { + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; +} VkPushConstantRange; + +typedef struct VkPipelineLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineLayoutCreateFlags flags; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; +} VkPipelineLayoutCreateInfo; + +typedef struct VkSamplerCreateInfo { + VkStructureType sType; + const void* pNext; + VkSamplerCreateFlags flags; + VkFilter magFilter; + VkFilter minFilter; + VkSamplerMipmapMode mipmapMode; + VkSamplerAddressMode addressModeU; + VkSamplerAddressMode addressModeV; + VkSamplerAddressMode addressModeW; + float mipLodBias; + VkBool32 anisotropyEnable; + float maxAnisotropy; + VkBool32 compareEnable; + VkCompareOp compareOp; + float minLod; + float maxLod; + VkBorderColor borderColor; + VkBool32 unnormalizedCoordinates; +} VkSamplerCreateInfo; + +typedef struct VkDescriptorSetLayoutBinding { + uint32_t binding; + VkDescriptorType descriptorType; + uint32_t descriptorCount; + VkShaderStageFlags stageFlags; + const VkSampler* pImmutableSamplers; +} VkDescriptorSetLayoutBinding; + +typedef struct VkDescriptorSetLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorSetLayoutCreateFlags flags; + uint32_t bindingCount; + const VkDescriptorSetLayoutBinding* pBindings; +} VkDescriptorSetLayoutCreateInfo; + +typedef struct VkDescriptorPoolSize { + VkDescriptorType type; + uint32_t descriptorCount; +} VkDescriptorPoolSize; + +typedef struct VkDescriptorPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPoolCreateFlags flags; + uint32_t maxSets; + uint32_t poolSizeCount; + const VkDescriptorPoolSize* pPoolSizes; +} VkDescriptorPoolCreateInfo; + +typedef struct VkDescriptorSetAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPool descriptorPool; + uint32_t descriptorSetCount; + const VkDescriptorSetLayout* pSetLayouts; +} VkDescriptorSetAllocateInfo; + +typedef struct VkDescriptorImageInfo { + VkSampler sampler; + VkImageView imageView; + VkImageLayout imageLayout; +} VkDescriptorImageInfo; + +typedef struct VkDescriptorBufferInfo { + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize range; +} VkDescriptorBufferInfo; + +typedef struct VkWriteDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + const VkDescriptorImageInfo* pImageInfo; + const VkDescriptorBufferInfo* pBufferInfo; + const VkBufferView* pTexelBufferView; +} VkWriteDescriptorSet; + +typedef struct VkCopyDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet srcSet; + uint32_t srcBinding; + uint32_t srcArrayElement; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; +} VkCopyDescriptorSet; + +typedef struct VkFramebufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkFramebufferCreateFlags flags; + VkRenderPass renderPass; + uint32_t attachmentCount; + const VkImageView* pAttachments; + uint32_t width; + uint32_t height; + uint32_t layers; +} VkFramebufferCreateInfo; + +typedef struct VkAttachmentDescription { + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription; + +typedef struct VkAttachmentReference { + uint32_t attachment; + VkImageLayout layout; +} VkAttachmentReference; + +typedef struct VkSubpassDescription { + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t inputAttachmentCount; + const VkAttachmentReference* pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference* pColorAttachments; + const VkAttachmentReference* pResolveAttachments; + const VkAttachmentReference* pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t* pPreserveAttachments; +} VkSubpassDescription; + +typedef struct VkSubpassDependency { + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; +} VkSubpassDependency; + +typedef struct VkRenderPassCreateInfo { + VkStructureType sType; + const void* pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription* pAttachments; + uint32_t subpassCount; + const VkSubpassDescription* pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency* pDependencies; +} VkRenderPassCreateInfo; + +typedef struct VkCommandPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPoolCreateFlags flags; + uint32_t queueFamilyIndex; +} VkCommandPoolCreateInfo; + +typedef struct VkCommandBufferAllocateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPool commandPool; + VkCommandBufferLevel level; + uint32_t commandBufferCount; +} VkCommandBufferAllocateInfo; + +typedef struct VkCommandBufferInheritanceInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + uint32_t subpass; + VkFramebuffer framebuffer; + VkBool32 occlusionQueryEnable; + VkQueryControlFlags queryFlags; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkCommandBufferInheritanceInfo; + +typedef struct VkCommandBufferBeginInfo { + VkStructureType sType; + const void* pNext; + VkCommandBufferUsageFlags flags; + const VkCommandBufferInheritanceInfo* pInheritanceInfo; +} VkCommandBufferBeginInfo; + +typedef struct VkBufferCopy { + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy; + +typedef struct VkImageSubresourceLayers { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceLayers; + +typedef struct VkImageCopy { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy; + +typedef struct VkImageBlit { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets[2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets[2]; +} VkImageBlit; + +typedef struct VkBufferImageCopy { + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy; + +typedef union VkClearColorValue { + float float32[4]; + int32_t int32[4]; + uint32_t uint32[4]; +} VkClearColorValue; + +typedef struct VkClearDepthStencilValue { + float depth; + uint32_t stencil; +} VkClearDepthStencilValue; + +typedef union VkClearValue { + VkClearColorValue color; + VkClearDepthStencilValue depthStencil; +} VkClearValue; + +typedef struct VkClearAttachment { + VkImageAspectFlags aspectMask; + uint32_t colorAttachment; + VkClearValue clearValue; +} VkClearAttachment; + +typedef struct VkClearRect { + VkRect2D rect; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkClearRect; + +typedef struct VkImageResolve { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve; + +typedef struct VkMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; +} VkMemoryBarrier; + +typedef struct VkBufferMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier; + +typedef struct VkImageMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier; + +typedef struct VkRenderPassBeginInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + VkFramebuffer framebuffer; + VkRect2D renderArea; + uint32_t clearValueCount; + const VkClearValue* pClearValues; +} VkRenderPassBeginInfo; + +typedef struct VkDispatchIndirectCommand { + uint32_t x; + uint32_t y; + uint32_t z; +} VkDispatchIndirectCommand; + +typedef struct VkDrawIndexedIndirectCommand { + uint32_t indexCount; + uint32_t instanceCount; + uint32_t firstIndex; + int32_t vertexOffset; + uint32_t firstInstance; +} VkDrawIndexedIndirectCommand; + +typedef struct VkDrawIndirectCommand { + uint32_t vertexCount; + uint32_t instanceCount; + uint32_t firstVertex; + uint32_t firstInstance; +} VkDrawIndirectCommand; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); +typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); +typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); +typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); +typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData); +typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); +typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore); +typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent); +typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool); +typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage); +typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches); +typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler); +typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets); +typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); +typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); +typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers); +typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); +typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo); +typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports); +typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); +typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects); +typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues); +typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( + const VkInstanceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance); + +VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( + VkInstance instance, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices( + VkInstance instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties* pMemoryProperties); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr( + VkInstance instance, + const char* pName); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr( + VkDevice device, + const char* pName); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( + VkPhysicalDevice physicalDevice, + const VkDeviceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDevice* pDevice); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDevice( + VkDevice device, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties( + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( + VkDevice device, + uint32_t queueFamilyIndex, + uint32_t queueIndex, + VkQueue* pQueue); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( + VkQueue queue, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( + VkQueue queue); + +VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle( + VkDevice device); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory( + VkDevice device, + const VkMemoryAllocateInfo* pAllocateInfo, + const VkAllocationCallbacks* pAllocator, + VkDeviceMemory* pMemory); + +VKAPI_ATTR void VKAPI_CALL vkFreeMemory( + VkDevice device, + VkDeviceMemory memory, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize offset, + VkDeviceSize size, + VkMemoryMapFlags flags, + void** ppData); + +VKAPI_ATTR void VKAPI_CALL vkUnmapMemory( + VkDevice device, + VkDeviceMemory memory); + +VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory( + VkDevice device, + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements( + VkDevice device, + VkBuffer buffer, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements( + VkDevice device, + VkImage image, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( + VkDevice device, + VkImage image, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements* pSparseMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkSampleCountFlagBits samples, + VkImageUsageFlags usage, + VkImageTiling tiling, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse( + VkQueue queue, + uint32_t bindInfoCount, + const VkBindSparseInfo* pBindInfo, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence( + VkDevice device, + const VkFenceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFence( + VkDevice device, + VkFence fence, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus( + VkDevice device, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences, + VkBool32 waitAll, + uint64_t timeout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore( + VkDevice device, + const VkSemaphoreCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSemaphore* pSemaphore); + +VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore( + VkDevice device, + VkSemaphore semaphore, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent( + VkDevice device, + const VkEventCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkEvent* pEvent); + +VKAPI_ATTR void VKAPI_CALL vkDestroyEvent( + VkDevice device, + VkEvent event, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool( + VkDevice device, + const VkQueryPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkQueryPool* pQueryPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool( + VkDevice device, + VkQueryPool queryPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( + VkDevice device, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + size_t dataSize, + void* pData, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer( + VkDevice device, + const VkBufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBuffer* pBuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer( + VkDevice device, + VkBuffer buffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView( + VkDevice device, + const VkBufferViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBufferView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView( + VkDevice device, + VkBufferView bufferView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage( + VkDevice device, + const VkImageCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImage* pImage); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImage( + VkDevice device, + VkImage image, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout( + VkDevice device, + VkImage image, + const VkImageSubresource* pSubresource, + VkSubresourceLayout* pLayout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView( + VkDevice device, + const VkImageViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImageView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImageView( + VkDevice device, + VkImageView imageView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule( + VkDevice device, + const VkShaderModuleCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkShaderModule* pShaderModule); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule( + VkDevice device, + VkShaderModule shaderModule, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache( + VkDevice device, + const VkPipelineCacheCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineCache* pPipelineCache); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache( + VkDevice device, + VkPipelineCache pipelineCache, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData( + VkDevice device, + VkPipelineCache pipelineCache, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches( + VkDevice device, + VkPipelineCache dstCache, + uint32_t srcCacheCount, + const VkPipelineCache* pSrcCaches); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkComputePipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline( + VkDevice device, + VkPipeline pipeline, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout( + VkDevice device, + const VkPipelineLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineLayout* pPipelineLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout( + VkDevice device, + VkPipelineLayout pipelineLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler( + VkDevice device, + const VkSamplerCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSampler* pSampler); + +VKAPI_ATTR void VKAPI_CALL vkDestroySampler( + VkDevice device, + VkSampler sampler, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout( + VkDevice device, + const VkDescriptorSetLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorSetLayout* pSetLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout( + VkDevice device, + VkDescriptorSetLayout descriptorSetLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool( + VkDevice device, + const VkDescriptorPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorPool* pDescriptorPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + VkDescriptorPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets( + VkDevice device, + const VkDescriptorSetAllocateInfo* pAllocateInfo, + VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets( + VkDevice device, + VkDescriptorPool descriptorPool, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( + VkDevice device, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites, + uint32_t descriptorCopyCount, + const VkCopyDescriptorSet* pDescriptorCopies); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer( + VkDevice device, + const VkFramebufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFramebuffer* pFramebuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer( + VkDevice device, + VkFramebuffer framebuffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass( + VkDevice device, + const VkRenderPassCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkRenderPass* pRenderPass); + +VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass( + VkDevice device, + VkRenderPass renderPass, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity( + VkDevice device, + VkRenderPass renderPass, + VkExtent2D* pGranularity); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool( + VkDevice device, + const VkCommandPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCommandPool* pCommandPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool( + VkDevice device, + VkCommandPool commandPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers( + VkDevice device, + const VkCommandBufferAllocateInfo* pAllocateInfo, + VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers( + VkDevice device, + VkCommandPool commandPool, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer( + VkCommandBuffer commandBuffer, + const VkCommandBufferBeginInfo* pBeginInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer( + VkCommandBuffer commandBuffer, + VkCommandBufferResetFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewport* pViewports); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor( + VkCommandBuffer commandBuffer, + uint32_t firstScissor, + uint32_t scissorCount, + const VkRect2D* pScissors); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth( + VkCommandBuffer commandBuffer, + float lineWidth); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias( + VkCommandBuffer commandBuffer, + float depthBiasConstantFactor, + float depthBiasClamp, + float depthBiasSlopeFactor); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants( + VkCommandBuffer commandBuffer, + const float blendConstants[4]); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds( + VkCommandBuffer commandBuffer, + float minDepthBounds, + float maxDepthBounds); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t compareMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t writeMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t reference); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets, + uint32_t dynamicOffsetCount, + const uint32_t* pDynamicOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers( + VkCommandBuffer commandBuffer, + uint32_t firstBinding, + uint32_t bindingCount, + const VkBuffer* pBuffers, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdDraw( + VkCommandBuffer commandBuffer, + uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed( + VkCommandBuffer commandBuffer, + uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t vertexOffset, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatch( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageBlit* pRegions, + VkFilter filter); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize dataSize, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize size, + uint32_t data); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearColorValue* pColor, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearDepthStencilValue* pDepthStencil, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( + VkCommandBuffer commandBuffer, + uint32_t attachmentCount, + const VkClearAttachment* pAttachments, + uint32_t rectCount, + const VkClearRect* pRects); + +VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageResolve* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + VkDependencyFlags dependencyFlags, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query, + VkQueryControlFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount); + +VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp( + VkCommandBuffer commandBuffer, + VkPipelineStageFlagBits pipelineStage, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants( + VkCommandBuffer commandBuffer, + VkPipelineLayout layout, + VkShaderStageFlags stageFlags, + uint32_t offset, + uint32_t size, + const void* pValues); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass( + VkCommandBuffer commandBuffer, + const VkRenderPassBeginInfo* pRenderPassBegin, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass( + VkCommandBuffer commandBuffer, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( + VkCommandBuffer commandBuffer, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); +#endif + +#define VK_KHR_surface 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#define VK_KHR_SURFACE_SPEC_VERSION 25 +#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" +#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + + +typedef enum VkColorSpaceKHR { + VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, + VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, + VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, + VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104003, + VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, + VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, + VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, + VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, + VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, + VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, + VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, + VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, + VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, + VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, + VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, + VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1), + VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkColorSpaceKHR; + +typedef enum VkPresentModeKHR { + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, + VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, + VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR, + VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR, + VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPresentModeKHR; + + +typedef enum VkSurfaceTransformFlagBitsKHR { + VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, + VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, + VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSurfaceTransformFlagBitsKHR; +typedef VkFlags VkSurfaceTransformFlagsKHR; + +typedef enum VkCompositeAlphaFlagBitsKHR { + VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, + VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, + VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkCompositeAlphaFlagBitsKHR; +typedef VkFlags VkCompositeAlphaFlagsKHR; + +typedef struct VkSurfaceCapabilitiesKHR { + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; +} VkSurfaceCapabilitiesKHR; + +typedef struct VkSurfaceFormatKHR { + VkFormat format; + VkColorSpaceKHR colorSpace; +} VkSurfaceFormatKHR; + + +typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( + VkInstance instance, + VkSurfaceKHR surface, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + VkSurfaceKHR surface, + VkBool32* pSupported); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormatKHR* pSurfaceFormats); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pPresentModeCount, + VkPresentModeKHR* pPresentModes); +#endif + +#define VK_KHR_swapchain 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) + +#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68 +#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" + + +typedef enum VkSwapchainCreateFlagBitsKHR { + VK_SWAPCHAIN_CREATE_BIND_SFR_BIT_KHX = 0x00000001, + VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSwapchainCreateFlagBitsKHR; +typedef VkFlags VkSwapchainCreateFlagsKHR; + +typedef struct VkSwapchainCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkSwapchainCreateFlagsKHR flags; + VkSurfaceKHR surface; + uint32_t minImageCount; + VkFormat imageFormat; + VkColorSpaceKHR imageColorSpace; + VkExtent2D imageExtent; + uint32_t imageArrayLayers; + VkImageUsageFlags imageUsage; + VkSharingMode imageSharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkSurfaceTransformFlagBitsKHR preTransform; + VkCompositeAlphaFlagBitsKHR compositeAlpha; + VkPresentModeKHR presentMode; + VkBool32 clipped; + VkSwapchainKHR oldSwapchain; +} VkSwapchainCreateInfoKHR; + +typedef struct VkPresentInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t swapchainCount; + const VkSwapchainKHR* pSwapchains; + const uint32_t* pImageIndices; + VkResult* pResults; +} VkPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain); +typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex); +typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( + VkDevice device, + const VkSwapchainCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchain); + +VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( + VkDevice device, + VkSwapchainKHR swapchain, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pSwapchainImageCount, + VkImage* pSwapchainImages); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint64_t timeout, + VkSemaphore semaphore, + VkFence fence, + uint32_t* pImageIndex); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( + VkQueue queue, + const VkPresentInfoKHR* pPresentInfo); +#endif + +#define VK_KHR_display 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) + +#define VK_KHR_DISPLAY_SPEC_VERSION 21 +#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" + + +typedef enum VkDisplayPlaneAlphaFlagBitsKHR { + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, + VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDisplayPlaneAlphaFlagBitsKHR; +typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; +typedef VkFlags VkDisplayModeCreateFlagsKHR; +typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; + +typedef struct VkDisplayPropertiesKHR { + VkDisplayKHR display; + const char* displayName; + VkExtent2D physicalDimensions; + VkExtent2D physicalResolution; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkBool32 planeReorderPossible; + VkBool32 persistentContent; +} VkDisplayPropertiesKHR; + +typedef struct VkDisplayModeParametersKHR { + VkExtent2D visibleRegion; + uint32_t refreshRate; +} VkDisplayModeParametersKHR; + +typedef struct VkDisplayModePropertiesKHR { + VkDisplayModeKHR displayMode; + VkDisplayModeParametersKHR parameters; +} VkDisplayModePropertiesKHR; + +typedef struct VkDisplayModeCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplayModeCreateFlagsKHR flags; + VkDisplayModeParametersKHR parameters; +} VkDisplayModeCreateInfoKHR; + +typedef struct VkDisplayPlaneCapabilitiesKHR { + VkDisplayPlaneAlphaFlagsKHR supportedAlpha; + VkOffset2D minSrcPosition; + VkOffset2D maxSrcPosition; + VkExtent2D minSrcExtent; + VkExtent2D maxSrcExtent; + VkOffset2D minDstPosition; + VkOffset2D maxDstPosition; + VkExtent2D minDstExtent; + VkExtent2D maxDstExtent; +} VkDisplayPlaneCapabilitiesKHR; + +typedef struct VkDisplayPlanePropertiesKHR { + VkDisplayKHR currentDisplay; + uint32_t currentStackIndex; +} VkDisplayPlanePropertiesKHR; + +typedef struct VkDisplaySurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplaySurfaceCreateFlagsKHR flags; + VkDisplayModeKHR displayMode; + uint32_t planeIndex; + uint32_t planeStackIndex; + VkSurfaceTransformFlagBitsKHR transform; + float globalAlpha; + VkDisplayPlaneAlphaFlagBitsKHR alphaMode; + VkExtent2D imageExtent; +} VkDisplaySurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPlanePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR( + VkPhysicalDevice physicalDevice, + uint32_t planeIndex, + uint32_t* pDisplayCount, + VkDisplayKHR* pDisplays); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + uint32_t* pPropertyCount, + VkDisplayModePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDisplayModeKHR* pMode); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR* pCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( + VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + +#define VK_KHR_display_swapchain 1 +#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 +#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" + +typedef struct VkDisplayPresentInfoKHR { + VkStructureType sType; + const void* pNext; + VkRect2D srcRect; + VkRect2D dstRect; + VkBool32 persistent; +} VkDisplayPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchains); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#define VK_KHR_xlib_surface 1 +#include + +#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" + +typedef VkFlags VkXlibSurfaceCreateFlagsKHR; + +typedef struct VkXlibSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXlibSurfaceCreateFlagsKHR flags; + Display* dpy; + Window window; +} VkXlibSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( + VkInstance instance, + const VkXlibSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + Display* dpy, + VisualID visualID); +#endif +#endif /* VK_USE_PLATFORM_XLIB_KHR */ + +#ifdef VK_USE_PLATFORM_XCB_KHR +#define VK_KHR_xcb_surface 1 +#include + +#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" + +typedef VkFlags VkXcbSurfaceCreateFlagsKHR; + +typedef struct VkXcbSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXcbSurfaceCreateFlagsKHR flags; + xcb_connection_t* connection; + xcb_window_t window; +} VkXcbSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( + VkInstance instance, + const VkXcbSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t* connection, + xcb_visualid_t visual_id); +#endif +#endif /* VK_USE_PLATFORM_XCB_KHR */ + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#define VK_KHR_wayland_surface 1 +#include + +#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" + +typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; + +typedef struct VkWaylandSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWaylandSurfaceCreateFlagsKHR flags; + struct wl_display* display; + struct wl_surface* surface; +} VkWaylandSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( + VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display* display); +#endif +#endif /* VK_USE_PLATFORM_WAYLAND_KHR */ + +#ifdef VK_USE_PLATFORM_MIR_KHR +#define VK_KHR_mir_surface 1 +#include + +#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4 +#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface" + +typedef VkFlags VkMirSurfaceCreateFlagsKHR; + +typedef struct VkMirSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkMirSurfaceCreateFlagsKHR flags; + MirConnection* connection; + MirSurface* mirSurface; +} VkMirSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( + VkInstance instance, + const VkMirSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection* connection); +#endif +#endif /* VK_USE_PLATFORM_MIR_KHR */ + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#define VK_KHR_android_surface 1 +#include + +#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 +#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" + +typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; + +typedef struct VkAndroidSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkAndroidSurfaceCreateFlagsKHR flags; + ANativeWindow* window; +} VkAndroidSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( + VkInstance instance, + const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_surface 1 +#include + +#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" + +typedef VkFlags VkWin32SurfaceCreateFlagsKHR; + +typedef struct VkWin32SurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWin32SurfaceCreateFlagsKHR flags; + HINSTANCE hinstance; + HWND hwnd; +} VkWin32SurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( + VkInstance instance, + const VkWin32SurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_sampler_mirror_clamp_to_edge 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" + + +#define VK_KHR_get_physical_device_properties2 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" + +typedef struct VkPhysicalDeviceFeatures2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceFeatures features; +} VkPhysicalDeviceFeatures2KHR; + +typedef struct VkPhysicalDeviceProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceProperties properties; +} VkPhysicalDeviceProperties2KHR; + +typedef struct VkFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkFormatProperties formatProperties; +} VkFormatProperties2KHR; + +typedef struct VkImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkImageFormatProperties imageFormatProperties; +} VkImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkImageCreateFlags flags; +} VkPhysicalDeviceImageFormatInfo2KHR; + +typedef struct VkQueueFamilyProperties2KHR { + VkStructureType sType; + void* pNext; + VkQueueFamilyProperties queueFamilyProperties; +} VkQueueFamilyProperties2KHR; + +typedef struct VkPhysicalDeviceMemoryProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceMemoryProperties memoryProperties; +} VkPhysicalDeviceMemoryProperties2KHR; + +typedef struct VkSparseImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageFormatProperties properties; +} VkSparseImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceSparseImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkSampleCountFlagBits samples; + VkImageUsageFlags usage; + VkImageTiling tiling; +} VkPhysicalDeviceSparseImageFormatInfo2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, VkImageFormatProperties2KHR* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2KHR* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties2KHR* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, + VkImageFormatProperties2KHR* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties2KHR* pProperties); +#endif + +#define VK_KHR_shader_draw_parameters 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" + + +#define VK_KHR_maintenance1 1 +#define VK_KHR_MAINTENANCE1_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1" + +typedef VkFlags VkCommandPoolTrimFlagsKHR; + +typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolTrimFlagsKHR flags); +#endif + +#define VK_KHR_external_memory_capabilities 1 +#define VK_LUID_SIZE_KHR 8 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsKHR { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR; + +typedef enum VkExternalMemoryFeatureFlagBitsKHR { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsKHR; +typedef VkFlags VkExternalMemoryFeatureFlagsKHR; + +typedef struct VkExternalMemoryPropertiesKHR { + VkExternalMemoryFeatureFlagsKHR externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsKHR compatibleHandleTypes; +} VkExternalMemoryPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalImageFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalImageFormatInfoKHR; + +typedef struct VkExternalImageFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalImageFormatPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalBufferInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkBufferUsageFlags usage; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalBufferInfoKHR; + +typedef struct VkExternalBufferPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalBufferPropertiesKHR; + +typedef struct VkPhysicalDeviceIDPropertiesKHR { + VkStructureType sType; + void* pNext; + uint8_t deviceUUID[VK_UUID_SIZE]; + uint8_t driverUUID[VK_UUID_SIZE]; + uint8_t deviceLUID[VK_LUID_SIZE_KHR]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; +} VkPhysicalDeviceIDPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, VkExternalBufferPropertiesKHR* pExternalBufferProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, + VkExternalBufferPropertiesKHR* pExternalBufferProperties); +#endif + +#define VK_KHR_external_memory 1 +#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" +#define VK_QUEUE_FAMILY_EXTERNAL_KHR (~0U-1) + +typedef struct VkExternalMemoryImageCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryImageCreateInfoKHR; + +typedef struct VkExternalMemoryBufferCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryBufferCreateInfoKHR; + +typedef struct VkExportMemoryAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExportMemoryAllocateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_memory_win32 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportMemoryWin32HandleInfoKHR; + +typedef struct VkExportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportMemoryWin32HandleInfoKHR; + +typedef struct VkMemoryWin32HandlePropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryWin32HandlePropertiesKHR; + +typedef struct VkMemoryGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( + VkDevice device, + const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + HANDLE handle, + VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_memory_fd 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" + +typedef struct VkImportMemoryFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportMemoryFdInfoKHR; + +typedef struct VkMemoryFdPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryFdPropertiesKHR; + +typedef struct VkMemoryGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR( + VkDevice device, + const VkMemoryGetFdInfoKHR* pGetFdInfo, + int* pFd); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + int fd, + VkMemoryFdPropertiesKHR* pMemoryFdProperties); +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_keyed_mutex 1 +#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeouts; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoKHR; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_capabilities 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" + + +typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR; + +typedef enum VkExternalSemaphoreFeatureFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreFeatureFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalSemaphoreInfoKHR; + +typedef struct VkExternalSemaphorePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalSemaphoreHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalSemaphoreFeatureFlagsKHR externalSemaphoreFeatures; +} VkExternalSemaphorePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, + VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); +#endif + +#define VK_KHR_external_semaphore 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" + + +typedef enum VkSemaphoreImportFlagBitsKHR { + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSemaphoreImportFlagBitsKHR; +typedef VkFlags VkSemaphoreImportFlagsKHR; + +typedef struct VkExportSemaphoreCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR handleTypes; +} VkExportSemaphoreCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_semaphore_win32 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" + +typedef struct VkImportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportSemaphoreWin32HandleInfoKHR; + +typedef struct VkExportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportSemaphoreWin32HandleInfoKHR; + +typedef struct VkD3D12FenceSubmitInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreValuesCount; + const uint64_t* pWaitSemaphoreValues; + uint32_t signalSemaphoreValuesCount; + const uint64_t* pSignalSemaphoreValues; +} VkD3D12FenceSubmitInfoKHR; + +typedef struct VkSemaphoreGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( + VkDevice device, + const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( + VkDevice device, + const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_fd 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" + +typedef struct VkImportSemaphoreFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportSemaphoreFdInfoKHR; + +typedef struct VkSemaphoreGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR( + VkDevice device, + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( + VkDevice device, + const VkSemaphoreGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_push_descriptor 1 +#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 1 +#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" + +typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t maxPushDescriptors; +} VkPhysicalDevicePushDescriptorPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites); +#endif + +#define VK_KHR_16bit_storage 1 +#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 +#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" + +typedef struct VkPhysicalDevice16BitStorageFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; +} VkPhysicalDevice16BitStorageFeaturesKHR; + + + +#define VK_KHR_incremental_present 1 +#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1 +#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" + +typedef struct VkRectLayerKHR { + VkOffset2D offset; + VkExtent2D extent; + uint32_t layer; +} VkRectLayerKHR; + +typedef struct VkPresentRegionKHR { + uint32_t rectangleCount; + const VkRectLayerKHR* pRectangles; +} VkPresentRegionKHR; + +typedef struct VkPresentRegionsKHR { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentRegionKHR* pRegions; +} VkPresentRegionsKHR; + + + +#define VK_KHR_descriptor_update_template 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplateKHR) + +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1 +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template" + + +typedef enum VkDescriptorUpdateTemplateTypeKHR { + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = 0, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE_KHR = (VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR + 1), + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDescriptorUpdateTemplateTypeKHR; + +typedef VkFlags VkDescriptorUpdateTemplateCreateFlagsKHR; + +typedef struct VkDescriptorUpdateTemplateEntryKHR { + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + size_t offset; + size_t stride; +} VkDescriptorUpdateTemplateEntryKHR; + +typedef struct VkDescriptorUpdateTemplateCreateInfoKHR { + VkStructureType sType; + void* pNext; + VkDescriptorUpdateTemplateCreateFlagsKHR flags; + uint32_t descriptorUpdateEntryCount; + const VkDescriptorUpdateTemplateEntryKHR* pDescriptorUpdateEntries; + VkDescriptorUpdateTemplateTypeKHR templateType; + VkDescriptorSetLayout descriptorSetLayout; + VkPipelineBindPoint pipelineBindPoint; + VkPipelineLayout pipelineLayout; + uint32_t set; +} VkDescriptorUpdateTemplateCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR( + VkDevice device, + const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR( + VkDevice device, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( + VkDevice device, + VkDescriptorSet descriptorSet, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( + VkCommandBuffer commandBuffer, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + VkPipelineLayout layout, + uint32_t set, + const void* pData); +#endif + +#define VK_KHR_shared_presentable_image 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" + +typedef struct VkSharedPresentSurfaceCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkImageUsageFlags sharedPresentSupportedUsageFlags; +} VkSharedPresentSurfaceCapabilitiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain); +#endif + +#define VK_KHR_external_fence_capabilities 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" + + +typedef enum VkExternalFenceHandleTypeFlagBitsKHR { + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000008, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalFenceHandleTypeFlagsKHR; + +typedef enum VkExternalFenceFeatureFlagBitsKHR { + VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceFeatureFlagBitsKHR; +typedef VkFlags VkExternalFenceFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalFenceInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalFenceInfoKHR; + +typedef struct VkExternalFencePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalFenceHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalFenceHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalFenceFeatureFlagsKHR externalFenceFeatures; +} VkExternalFencePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, VkExternalFencePropertiesKHR* pExternalFenceProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, + VkExternalFencePropertiesKHR* pExternalFenceProperties); +#endif + +#define VK_KHR_external_fence 1 +#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" + + +typedef enum VkFenceImportFlagBitsKHR { + VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkFenceImportFlagBitsKHR; +typedef VkFlags VkFenceImportFlagsKHR; + +typedef struct VkExportFenceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagsKHR handleTypes; +} VkExportFenceCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_fence_win32 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" + +typedef struct VkImportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportFenceWin32HandleInfoKHR; + +typedef struct VkExportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportFenceWin32HandleInfoKHR; + +typedef struct VkFenceGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( + VkDevice device, + const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( + VkDevice device, + const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_fence_fd 1 +#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" + +typedef struct VkImportFenceFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportFenceFdInfoKHR; + +typedef struct VkFenceGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR( + VkDevice device, + const VkImportFenceFdInfoKHR* pImportFenceFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( + VkDevice device, + const VkFenceGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_get_surface_capabilities2 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" + +typedef struct VkPhysicalDeviceSurfaceInfo2KHR { + VkStructureType sType; + const void* pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + +typedef struct VkSurfaceCapabilities2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + +typedef struct VkSurfaceFormat2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + VkSurfaceCapabilities2KHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormat2KHR* pSurfaceFormats); +#endif + +#define VK_KHR_variable_pointers 1 +#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 +#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" + +typedef struct VkPhysicalDeviceVariablePointerFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; +} VkPhysicalDeviceVariablePointerFeaturesKHR; + + + +#define VK_KHR_dedicated_allocation 1 +#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 +#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" + +typedef struct VkMemoryDedicatedRequirementsKHR { + VkStructureType sType; + void* pNext; + VkBool32 prefersDedicatedAllocation; + VkBool32 requiresDedicatedAllocation; +} VkMemoryDedicatedRequirementsKHR; + +typedef struct VkMemoryDedicatedAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkMemoryDedicatedAllocateInfoKHR; + + + +#define VK_KHR_storage_buffer_storage_class 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" + + +#define VK_KHR_relaxed_block_layout 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" + + +#define VK_KHR_get_memory_requirements2 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" + +typedef struct VkBufferMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferMemoryRequirementsInfo2KHR; + +typedef struct VkImageMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageMemoryRequirementsInfo2KHR; + +typedef struct VkImageSparseMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageSparseMemoryRequirementsInfo2KHR; + +typedef struct VkMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkMemoryRequirements memoryRequirements; +} VkMemoryRequirements2KHR; + +typedef struct VkSparseImageMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageMemoryRequirements memoryRequirements; +} VkSparseImageMemoryRequirements2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR( + VkDevice device, + const VkImageMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR( + VkDevice device, + const VkBufferMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( + VkDevice device, + const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); +#endif + +#define VK_EXT_debug_report 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) + +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 8 +#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" +#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT +#define VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT + + +typedef enum VkDebugReportObjectTypeEXT { + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, + VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, + VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, + VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, + VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, + VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, + VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, + VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, + VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, + VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, + VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, + VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1), + VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportObjectTypeEXT; + + +typedef enum VkDebugReportFlagBitsEXT { + VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, + VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, + VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, + VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, + VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportFlagBitsEXT; +typedef VkFlags VkDebugReportFlagsEXT; + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData); + +typedef struct VkDebugReportCallbackCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportFlagsEXT flags; + PFN_vkDebugReportCallbackEXT pfnCallback; + void* pUserData; +} VkDebugReportCallbackCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); +typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT( + VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDebugReportCallbackEXT* pCallback); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT( + VkInstance instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( + VkInstance instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage); +#endif + +#define VK_NV_glsl_shader 1 +#define VK_NV_GLSL_SHADER_SPEC_VERSION 1 +#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" + + +#define VK_EXT_depth_range_unrestricted 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" + + +#define VK_IMG_filter_cubic 1 +#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 +#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" + + +#define VK_AMD_rasterization_order 1 +#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 +#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" + + +typedef enum VkRasterizationOrderAMD { + VK_RASTERIZATION_ORDER_STRICT_AMD = 0, + VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, + VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD, + VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD, + VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1), + VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF +} VkRasterizationOrderAMD; + +typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { + VkStructureType sType; + const void* pNext; + VkRasterizationOrderAMD rasterizationOrder; +} VkPipelineRasterizationStateRasterizationOrderAMD; + + + +#define VK_AMD_shader_trinary_minmax 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" + + +#define VK_AMD_shader_explicit_vertex_parameter 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" + + +#define VK_EXT_debug_marker 1 +#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 +#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" + +typedef struct VkDebugMarkerObjectNameInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + const char* pObjectName; +} VkDebugMarkerObjectNameInfoEXT; + +typedef struct VkDebugMarkerObjectTagInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + uint64_t tagName; + size_t tagSize; + const void* pTag; +} VkDebugMarkerObjectTagInfoEXT; + +typedef struct VkDebugMarkerMarkerInfoEXT { + VkStructureType sType; + const void* pNext; + const char* pMarkerName; + float color[4]; +} VkDebugMarkerMarkerInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo); +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( + VkDevice device, + const VkDebugMarkerObjectTagInfoEXT* pTagInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( + VkDevice device, + const VkDebugMarkerObjectNameInfoEXT* pNameInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +#endif + +#define VK_AMD_gcn_shader 1 +#define VK_AMD_GCN_SHADER_SPEC_VERSION 1 +#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" + + +#define VK_NV_dedicated_allocation 1 +#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 +#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" + +typedef struct VkDedicatedAllocationImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationImageCreateInfoNV; + +typedef struct VkDedicatedAllocationBufferCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationBufferCreateInfoNV; + +typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkDedicatedAllocationMemoryAllocateInfoNV; + + + +#define VK_AMD_draw_indirect_count 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" + +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); +#endif + +#define VK_AMD_negative_viewport_height 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" + + +#define VK_AMD_gpu_shader_half_float 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" + + +#define VK_AMD_shader_ballot 1 +#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 +#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" + + +#define VK_AMD_texture_gather_bias_lod 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" + +typedef struct VkTextureLODGatherFormatPropertiesAMD { + VkStructureType sType; + void* pNext; + VkBool32 supportsTextureGatherLODBiasAMD; +} VkTextureLODGatherFormatPropertiesAMD; + + + +#define VK_KHX_multiview 1 +#define VK_KHX_MULTIVIEW_SPEC_VERSION 1 +#define VK_KHX_MULTIVIEW_EXTENSION_NAME "VK_KHX_multiview" + +typedef struct VkRenderPassMultiviewCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t subpassCount; + const uint32_t* pViewMasks; + uint32_t dependencyCount; + const int32_t* pViewOffsets; + uint32_t correlationMaskCount; + const uint32_t* pCorrelationMasks; +} VkRenderPassMultiviewCreateInfoKHX; + +typedef struct VkPhysicalDeviceMultiviewFeaturesKHX { + VkStructureType sType; + void* pNext; + VkBool32 multiview; + VkBool32 multiviewGeometryShader; + VkBool32 multiviewTessellationShader; +} VkPhysicalDeviceMultiviewFeaturesKHX; + +typedef struct VkPhysicalDeviceMultiviewPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t maxMultiviewViewCount; + uint32_t maxMultiviewInstanceIndex; +} VkPhysicalDeviceMultiviewPropertiesKHX; + + + +#define VK_IMG_format_pvrtc 1 +#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 +#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" + + +#define VK_NV_external_memory_capabilities 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsNV { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsNV; +typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; + +typedef enum VkExternalMemoryFeatureFlagBitsNV { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsNV; +typedef VkFlags VkExternalMemoryFeatureFlagsNV; + +typedef struct VkExternalImageFormatPropertiesNV { + VkImageFormatProperties imageFormatProperties; + VkExternalMemoryFeatureFlagsNV externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes; +} VkExternalImageFormatPropertiesNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkExternalMemoryHandleTypeFlagsNV externalHandleType, + VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); +#endif + +#define VK_NV_external_memory 1 +#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" + +typedef struct VkExternalMemoryImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExternalMemoryImageCreateInfoNV; + +typedef struct VkExportMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExportMemoryAllocateInfoNV; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_external_memory_win32 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleType; + HANDLE handle; +} VkImportMemoryWin32HandleInfoNV; + +typedef struct VkExportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; +} VkExportMemoryWin32HandleInfoNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( + VkDevice device, + VkDeviceMemory memory, + VkExternalMemoryHandleTypeFlagsNV handleType, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_win32_keyed_mutex 1 +#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeoutMilliseconds; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoNV; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHX_device_group 1 +#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32 +#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_EXTENSION_NAME "VK_KHX_device_group" + + +typedef enum VkPeerMemoryFeatureFlagBitsKHX { + VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHX = 0x00000001, + VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHX = 0x00000002, + VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHX = 0x00000004, + VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHX = 0x00000008, + VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkPeerMemoryFeatureFlagBitsKHX; +typedef VkFlags VkPeerMemoryFeatureFlagsKHX; + +typedef enum VkMemoryAllocateFlagBitsKHX { + VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHX = 0x00000001, + VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkMemoryAllocateFlagBitsKHX; +typedef VkFlags VkMemoryAllocateFlagsKHX; + +typedef enum VkDeviceGroupPresentModeFlagBitsKHX { + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHX = 0x00000001, + VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHX = 0x00000002, + VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHX = 0x00000004, + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHX = 0x00000008, + VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkDeviceGroupPresentModeFlagBitsKHX; +typedef VkFlags VkDeviceGroupPresentModeFlagsKHX; + +typedef struct VkMemoryAllocateFlagsInfoKHX { + VkStructureType sType; + const void* pNext; + VkMemoryAllocateFlagsKHX flags; + uint32_t deviceMask; +} VkMemoryAllocateFlagsInfoKHX; + +typedef struct VkBindBufferMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; +} VkBindBufferMemoryInfoKHX; + +typedef struct VkBindImageMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkImage image; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; + uint32_t SFRRectCount; + const VkRect2D* pSFRRects; +} VkBindImageMemoryInfoKHX; + +typedef struct VkDeviceGroupRenderPassBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; + uint32_t deviceRenderAreaCount; + const VkRect2D* pDeviceRenderAreas; +} VkDeviceGroupRenderPassBeginInfoKHX; + +typedef struct VkDeviceGroupCommandBufferBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; +} VkDeviceGroupCommandBufferBeginInfoKHX; + +typedef struct VkDeviceGroupSubmitInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const uint32_t* pWaitSemaphoreDeviceIndices; + uint32_t commandBufferCount; + const uint32_t* pCommandBufferDeviceMasks; + uint32_t signalSemaphoreCount; + const uint32_t* pSignalSemaphoreDeviceIndices; +} VkDeviceGroupSubmitInfoKHX; + +typedef struct VkDeviceGroupBindSparseInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t resourceDeviceIndex; + uint32_t memoryDeviceIndex; +} VkDeviceGroupBindSparseInfoKHX; + +typedef struct VkDeviceGroupPresentCapabilitiesKHX { + VkStructureType sType; + const void* pNext; + uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupPresentCapabilitiesKHX; + +typedef struct VkImageSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; +} VkImageSwapchainCreateInfoKHX; + +typedef struct VkBindImageMemorySwapchainInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint32_t imageIndex; +} VkBindImageMemorySwapchainInfoKHX; + +typedef struct VkAcquireNextImageInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint64_t timeout; + VkSemaphore semaphore; + VkFence fence; + uint32_t deviceMask; +} VkAcquireNextImageInfoKHX; + +typedef struct VkDeviceGroupPresentInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const uint32_t* pDeviceMasks; + VkDeviceGroupPresentModeFlagBitsKHX mode; +} VkDeviceGroupPresentInfoKHX; + +typedef struct VkDeviceGroupSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupSwapchainCreateInfoKHX; + + +typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHX* pBindInfos); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHX* pBindInfos); +typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHX)(VkCommandBuffer commandBuffer, uint32_t deviceMask); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHX)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHX)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHX* pModes); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHX)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX( + VkDevice device, + uint32_t heapIndex, + uint32_t localDeviceIndex, + uint32_t remoteDeviceIndex, + VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindBufferMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindImageMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHX( + VkCommandBuffer commandBuffer, + uint32_t deviceMask); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX( + VkDevice device, + VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX( + VkDevice device, + VkSurfaceKHR surface, + VkDeviceGroupPresentModeFlagsKHX* pModes); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX( + VkDevice device, + const VkAcquireNextImageInfoKHX* pAcquireInfo, + uint32_t* pImageIndex); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX( + VkCommandBuffer commandBuffer, + uint32_t baseGroupX, + uint32_t baseGroupY, + uint32_t baseGroupZ, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pRectCount, + VkRect2D* pRects); +#endif + +#define VK_EXT_validation_flags 1 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" + + +typedef enum VkValidationCheckEXT { + VK_VALIDATION_CHECK_ALL_EXT = 0, + VK_VALIDATION_CHECK_SHADERS_EXT = 1, + VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT, + VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_SHADERS_EXT, + VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_SHADERS_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1), + VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF +} VkValidationCheckEXT; + +typedef struct VkValidationFlagsEXT { + VkStructureType sType; + const void* pNext; + uint32_t disabledValidationCheckCount; + VkValidationCheckEXT* pDisabledValidationChecks; +} VkValidationFlagsEXT; + + + +#ifdef VK_USE_PLATFORM_VI_NN +#define VK_NN_vi_surface 1 +#define VK_NN_VI_SURFACE_SPEC_VERSION 1 +#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" + +typedef VkFlags VkViSurfaceCreateFlagsNN; + +typedef struct VkViSurfaceCreateInfoNN { + VkStructureType sType; + const void* pNext; + VkViSurfaceCreateFlagsNN flags; + void* window; +} VkViSurfaceCreateInfoNN; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( + VkInstance instance, + const VkViSurfaceCreateInfoNN* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_VI_NN */ + +#define VK_EXT_shader_subgroup_ballot 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" + + +#define VK_EXT_shader_subgroup_vote 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" + + +#define VK_KHX_device_group_creation 1 +#define VK_KHX_DEVICE_GROUP_CREATION_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHX_device_group_creation" + +typedef struct VkPhysicalDeviceGroupPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t physicalDeviceCount; + VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkBool32 subsetAllocation; +} VkPhysicalDeviceGroupPropertiesKHX; + +typedef struct VkDeviceGroupDeviceCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t physicalDeviceCount; + const VkPhysicalDevice* pPhysicalDevices; +} VkDeviceGroupDeviceCreateInfoKHX; + + +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHX)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHX( + VkInstance instance, + uint32_t* pPhysicalDeviceGroupCount, + VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); +#endif + +#define VK_NVX_device_generated_commands 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkObjectTableNVX) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNVX) + +#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 +#define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands" + + +typedef enum VkIndirectCommandsTokenTypeNVX { + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX + 1), + VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsTokenTypeNVX; + +typedef enum VkObjectEntryTypeNVX { + VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0, + VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1, + VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2, + VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3, + VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4, + VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX, + VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX, + VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX + 1), + VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryTypeNVX; + + +typedef enum VkIndirectCommandsLayoutUsageFlagBitsNVX { + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsLayoutUsageFlagBitsNVX; +typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNVX; + +typedef enum VkObjectEntryUsageFlagBitsNVX { + VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001, + VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002, + VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryUsageFlagBitsNVX; +typedef VkFlags VkObjectEntryUsageFlagsNVX; + +typedef struct VkDeviceGeneratedCommandsFeaturesNVX { + VkStructureType sType; + const void* pNext; + VkBool32 computeBindingPointSupport; +} VkDeviceGeneratedCommandsFeaturesNVX; + +typedef struct VkDeviceGeneratedCommandsLimitsNVX { + VkStructureType sType; + const void* pNext; + uint32_t maxIndirectCommandsLayoutTokenCount; + uint32_t maxObjectEntryCounts; + uint32_t minSequenceCountBufferOffsetAlignment; + uint32_t minSequenceIndexBufferOffsetAlignment; + uint32_t minCommandsTokenBufferOffsetAlignment; +} VkDeviceGeneratedCommandsLimitsNVX; + +typedef struct VkIndirectCommandsTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + VkBuffer buffer; + VkDeviceSize offset; +} VkIndirectCommandsTokenNVX; + +typedef struct VkIndirectCommandsLayoutTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + uint32_t bindingUnit; + uint32_t dynamicCount; + uint32_t divisor; +} VkIndirectCommandsLayoutTokenNVX; + +typedef struct VkIndirectCommandsLayoutCreateInfoNVX { + VkStructureType sType; + const void* pNext; + VkPipelineBindPoint pipelineBindPoint; + VkIndirectCommandsLayoutUsageFlagsNVX flags; + uint32_t tokenCount; + const VkIndirectCommandsLayoutTokenNVX* pTokens; +} VkIndirectCommandsLayoutCreateInfoNVX; + +typedef struct VkCmdProcessCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t indirectCommandsTokenCount; + const VkIndirectCommandsTokenNVX* pIndirectCommandsTokens; + uint32_t maxSequencesCount; + VkCommandBuffer targetCommandBuffer; + VkBuffer sequencesCountBuffer; + VkDeviceSize sequencesCountOffset; + VkBuffer sequencesIndexBuffer; + VkDeviceSize sequencesIndexOffset; +} VkCmdProcessCommandsInfoNVX; + +typedef struct VkCmdReserveSpaceForCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t maxSequencesCount; +} VkCmdReserveSpaceForCommandsInfoNVX; + +typedef struct VkObjectTableCreateInfoNVX { + VkStructureType sType; + const void* pNext; + uint32_t objectCount; + const VkObjectEntryTypeNVX* pObjectEntryTypes; + const uint32_t* pObjectEntryCounts; + const VkObjectEntryUsageFlagsNVX* pObjectEntryUsageFlags; + uint32_t maxUniformBuffersPerDescriptor; + uint32_t maxStorageBuffersPerDescriptor; + uint32_t maxStorageImagesPerDescriptor; + uint32_t maxSampledImagesPerDescriptor; + uint32_t maxPipelineLayouts; +} VkObjectTableCreateInfoNVX; + +typedef struct VkObjectTableEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; +} VkObjectTableEntryNVX; + +typedef struct VkObjectTablePipelineEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipeline pipeline; +} VkObjectTablePipelineEntryNVX; + +typedef struct VkObjectTableDescriptorSetEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkDescriptorSet descriptorSet; +} VkObjectTableDescriptorSetEntryNVX; + +typedef struct VkObjectTableVertexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; +} VkObjectTableVertexBufferEntryNVX; + +typedef struct VkObjectTableIndexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; + VkIndexType indexType; +} VkObjectTableIndexBufferEntryNVX; + +typedef struct VkObjectTablePushConstantEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkShaderStageFlags stageFlags; +} VkObjectTablePushConstantEntryNVX; + + +typedef void (VKAPI_PTR *PFN_vkCmdProcessCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdReserveSpaceForCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNVX)(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNVX)(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateObjectTableNVX)(VkDevice device, const VkObjectTableCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkObjectTableNVX* pObjectTable); +typedef void (VKAPI_PTR *PFN_vkDestroyObjectTableNVX)(VkDevice device, VkObjectTableNVX objectTable, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectTableEntryNVX* const* ppObjectTableEntries, const uint32_t* pObjectIndices); +typedef VkResult (VKAPI_PTR *PFN_vkUnregisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectEntryTypeNVX* pObjectEntryTypes, const uint32_t* pObjectIndices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)(VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, VkDeviceGeneratedCommandsLimitsNVX* pLimits); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX( + VkDevice device, + const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX( + VkDevice device, + VkIndirectCommandsLayoutNVX indirectCommandsLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX( + VkDevice device, + const VkObjectTableCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkObjectTableNVX* pObjectTable); + +VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX( + VkDevice device, + VkObjectTableNVX objectTable, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectTableEntryNVX* const* ppObjectTableEntries, + const uint32_t* pObjectIndices); + +VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectEntryTypeNVX* pObjectEntryTypes, + const uint32_t* pObjectIndices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX( + VkPhysicalDevice physicalDevice, + VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, + VkDeviceGeneratedCommandsLimitsNVX* pLimits); +#endif + +#define VK_NV_clip_space_w_scaling 1 +#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 +#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" + +typedef struct VkViewportWScalingNV { + float xcoeff; + float ycoeff; +} VkViewportWScalingNV; + +typedef struct VkPipelineViewportWScalingStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 viewportWScalingEnable; + uint32_t viewportCount; + const VkViewportWScalingNV* pViewportWScalings; +} VkPipelineViewportWScalingStateCreateInfoNV; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewportWScalingNV* pViewportWScalings); +#endif + +#define VK_EXT_direct_mode_display 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" + +typedef VkResult (VKAPI_PTR *PFN_vkReleaseDisplayEXT)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_EXT_acquire_xlib_display 1 +#include + +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" + +typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); +typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + VkDisplayKHR display); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + RROutput rrOutput, + VkDisplayKHR* pDisplay); +#endif +#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ + +#define VK_EXT_display_surface_counter 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" +#define VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT + + +typedef enum VkSurfaceCounterFlagBitsEXT { + VK_SURFACE_COUNTER_VBLANK_EXT = 0x00000001, + VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSurfaceCounterFlagBitsEXT; +typedef VkFlags VkSurfaceCounterFlagsEXT; + +typedef struct VkSurfaceCapabilities2EXT { + VkStructureType sType; + void* pNext; + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; + VkSurfaceCounterFlagsEXT supportedSurfaceCounters; +} VkSurfaceCapabilities2EXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilities2EXT* pSurfaceCapabilities); +#endif + +#define VK_EXT_display_control 1 +#define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" + + +typedef enum VkDisplayPowerStateEXT { + VK_DISPLAY_POWER_STATE_OFF_EXT = 0, + VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, + VK_DISPLAY_POWER_STATE_ON_EXT = 2, + VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = VK_DISPLAY_POWER_STATE_OFF_EXT, + VK_DISPLAY_POWER_STATE_END_RANGE_EXT = VK_DISPLAY_POWER_STATE_ON_EXT, + VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = (VK_DISPLAY_POWER_STATE_ON_EXT - VK_DISPLAY_POWER_STATE_OFF_EXT + 1), + VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayPowerStateEXT; + +typedef enum VkDeviceEventTypeEXT { + VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, + VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT - VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT + 1), + VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceEventTypeEXT; + +typedef enum VkDisplayEventTypeEXT { + VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, + VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT - VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT + 1), + VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayEventTypeEXT; + +typedef struct VkDisplayPowerInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayPowerStateEXT powerState; +} VkDisplayPowerInfoEXT; + +typedef struct VkDeviceEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDeviceEventTypeEXT deviceEvent; +} VkDeviceEventInfoEXT; + +typedef struct VkDisplayEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayEventTypeEXT displayEvent; +} VkDisplayEventInfoEXT; + +typedef struct VkSwapchainCounterCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSurfaceCounterFlagsEXT surfaceCounters; +} VkSwapchainCounterCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDisplayPowerControlEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDeviceEventEXT)(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDisplayEventEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainCounterEXT)(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayPowerInfoEXT* pDisplayPowerInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT( + VkDevice device, + const VkDeviceEventInfoEXT* pDeviceEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayEventInfoEXT* pDisplayEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( + VkDevice device, + VkSwapchainKHR swapchain, + VkSurfaceCounterFlagBitsEXT counter, + uint64_t* pCounterValue); +#endif + +#define VK_GOOGLE_display_timing 1 +#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 +#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" + +typedef struct VkRefreshCycleDurationGOOGLE { + uint64_t refreshDuration; +} VkRefreshCycleDurationGOOGLE; + +typedef struct VkPastPresentationTimingGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; + uint64_t actualPresentTime; + uint64_t earliestPresentTime; + uint64_t presentMargin; +} VkPastPresentationTimingGOOGLE; + +typedef struct VkPresentTimeGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; +} VkPresentTimeGOOGLE; + +typedef struct VkPresentTimesInfoGOOGLE { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentTimeGOOGLE* pTimes; +} VkPresentTimesInfoGOOGLE; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pPresentationTimingCount, + VkPastPresentationTimingGOOGLE* pPresentationTimings); +#endif + +#define VK_NV_sample_mask_override_coverage 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" + + +#define VK_NV_geometry_shader_passthrough 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" + + +#define VK_NV_viewport_array2 1 +#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME "VK_NV_viewport_array2" + + +#define VK_NVX_multiview_per_view_attributes 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" + +typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { + VkStructureType sType; + void* pNext; + VkBool32 perViewPositionAllComponents; +} VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; + + + +#define VK_NV_viewport_swizzle 1 +#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" + + +typedef enum VkViewportCoordinateSwizzleNV { + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, + VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = (VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV + 1), + VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 0x7FFFFFFF +} VkViewportCoordinateSwizzleNV; + +typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; + +typedef struct VkViewportSwizzleNV { + VkViewportCoordinateSwizzleNV x; + VkViewportCoordinateSwizzleNV y; + VkViewportCoordinateSwizzleNV z; + VkViewportCoordinateSwizzleNV w; +} VkViewportSwizzleNV; + +typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineViewportSwizzleStateCreateFlagsNV flags; + uint32_t viewportCount; + const VkViewportSwizzleNV* pViewportSwizzles; +} VkPipelineViewportSwizzleStateCreateInfoNV; + + + +#define VK_EXT_discard_rectangles 1 +#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 +#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" + + +typedef enum VkDiscardRectangleModeEXT { + VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, + VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, + VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = (VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT + 1), + VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDiscardRectangleModeEXT; + +typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; + +typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t maxDiscardRectangles; +} VkPhysicalDeviceDiscardRectanglePropertiesEXT; + +typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPipelineDiscardRectangleStateCreateFlagsEXT flags; + VkDiscardRectangleModeEXT discardRectangleMode; + uint32_t discardRectangleCount; + const VkRect2D* pDiscardRectangles; +} VkPipelineDiscardRectangleStateCreateInfoEXT; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( + VkCommandBuffer commandBuffer, + uint32_t firstDiscardRectangle, + uint32_t discardRectangleCount, + const VkRect2D* pDiscardRectangles); +#endif + +#define VK_EXT_swapchain_colorspace 1 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" + + +#define VK_EXT_hdr_metadata 1 +#define VK_EXT_HDR_METADATA_SPEC_VERSION 1 +#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" + +typedef struct VkXYColorEXT { + float x; + float y; +} VkXYColorEXT; + +typedef struct VkHdrMetadataEXT { + VkStructureType sType; + const void* pNext; + VkXYColorEXT displayPrimaryRed; + VkXYColorEXT displayPrimaryGreen; + VkXYColorEXT displayPrimaryBlue; + VkXYColorEXT whitePoint; + float maxLuminance; + float minLuminance; + float maxContentLightLevel; + float maxFrameAverageLightLevel; +} VkHdrMetadataEXT; + + +typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainKHR* pSwapchains, + const VkHdrMetadataEXT* pMetadata); +#endif + +#ifdef VK_USE_PLATFORM_IOS_MVK +#define VK_MVK_ios_surface 1 +#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" + +typedef VkFlags VkIOSSurfaceCreateFlagsMVK; + +typedef struct VkIOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkIOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkIOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( + VkInstance instance, + const VkIOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_IOS_MVK */ + +#ifdef VK_USE_PLATFORM_MACOS_MVK +#define VK_MVK_macos_surface 1 +#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" + +typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; + +typedef struct VkMacOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkMacOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkMacOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( + VkInstance instance, + const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_MACOS_MVK */ + +#define VK_EXT_sampler_filter_minmax 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" + + +typedef enum VkSamplerReductionModeEXT { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0, + VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1, + VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2, + VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, + VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_MAX_EXT, + VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = (VK_SAMPLER_REDUCTION_MODE_MAX_EXT - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT + 1), + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSamplerReductionModeEXT; + +typedef struct VkSamplerReductionModeCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSamplerReductionModeEXT reductionMode; +} VkSamplerReductionModeCreateInfoEXT; + +typedef struct VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; + + + +#define VK_AMD_gpu_shader_int16 1 +#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" + + +#define VK_AMD_mixed_attachment_samples 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" + + +#define VK_EXT_shader_stencil_export 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" + + +#define VK_EXT_blend_operation_advanced 1 +#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 +#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" + + +typedef enum VkBlendOverlapEXT { + VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, + VK_BLEND_OVERLAP_DISJOINT_EXT = 1, + VK_BLEND_OVERLAP_CONJOINT_EXT = 2, + VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = VK_BLEND_OVERLAP_UNCORRELATED_EXT, + VK_BLEND_OVERLAP_END_RANGE_EXT = VK_BLEND_OVERLAP_CONJOINT_EXT, + VK_BLEND_OVERLAP_RANGE_SIZE_EXT = (VK_BLEND_OVERLAP_CONJOINT_EXT - VK_BLEND_OVERLAP_UNCORRELATED_EXT + 1), + VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBlendOverlapEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 advancedBlendCoherentOperations; +} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t advancedBlendMaxColorAttachments; + VkBool32 advancedBlendIndependentBlend; + VkBool32 advancedBlendNonPremultipliedSrcColor; + VkBool32 advancedBlendNonPremultipliedDstColor; + VkBool32 advancedBlendCorrelatedOverlap; + VkBool32 advancedBlendAllOperations; +} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; + +typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 srcPremultiplied; + VkBool32 dstPremultiplied; + VkBlendOverlapEXT blendOverlap; +} VkPipelineColorBlendAdvancedStateCreateInfoEXT; + + + +#define VK_NV_fragment_coverage_to_color 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" + +typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; + +typedef struct VkPipelineCoverageToColorStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageToColorStateCreateFlagsNV flags; + VkBool32 coverageToColorEnable; + uint32_t coverageToColorLocation; +} VkPipelineCoverageToColorStateCreateInfoNV; + + + +#define VK_NV_framebuffer_mixed_samples 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" + + +typedef enum VkCoverageModulationModeNV { + VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, + VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, + VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, + VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, + VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = VK_COVERAGE_MODULATION_MODE_NONE_NV, + VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = VK_COVERAGE_MODULATION_MODE_RGBA_NV, + VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = (VK_COVERAGE_MODULATION_MODE_RGBA_NV - VK_COVERAGE_MODULATION_MODE_NONE_NV + 1), + VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkCoverageModulationModeNV; + +typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; + +typedef struct VkPipelineCoverageModulationStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageModulationStateCreateFlagsNV flags; + VkCoverageModulationModeNV coverageModulationMode; + VkBool32 coverageModulationTableEnable; + uint32_t coverageModulationTableCount; + const float* pCoverageModulationTable; +} VkPipelineCoverageModulationStateCreateInfoNV; + + + +#define VK_NV_fill_rectangle 1 +#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 +#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" + + +#define VK_EXT_post_depth_coverage 1 +#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 +#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" + + +#define VK_EXT_shader_viewport_index_layer 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.c b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.c new file mode 100644 index 0000000000..c79f372bf9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -0,0 +1,171 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#define DEBUG_DYNAMIC_KMSDRM 0 + +#include "SDL_kmsdrmdyn.h" + +#if DEBUG_DYNAMIC_KMSDRM +#include "SDL_log.h" +#endif + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + +#include "SDL_name.h" +#include "SDL_loadso.h" + +typedef struct +{ + void *lib; + const char *libname; +} kmsdrmdynlib; + +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC NULL +#endif +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM NULL +#endif + +static kmsdrmdynlib kmsdrmlibs[] = { + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC}, + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM} +}; + +static void * +KMSDRM_GetSym(const char *fnname, int *pHasModule) +{ + int i; + void *fn = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname); + if (fn != NULL) + break; + } + } + +#if DEBUG_DYNAMIC_KMSDRM + if (fn != NULL) + SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); + else + SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); +#endif + + if (fn == NULL) + *pHasModule = 0; /* kill this module. */ + + return fn; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ + +/* Define all the function pointers and wrappers... */ +#define SDL_KMSDRM_MODULE(modname) int SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) SDL_DYNKMSDRMFN_##fn KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) SDL_DYNKMSDRMCONST_##name KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + +static int kmsdrm_load_refcount = 0; + +void +SDL_KMSDRM_UnloadSymbols(void) +{ + /* Don't actually unload if more than one module is using the libs... */ + if (kmsdrm_load_refcount > 0) { + if (--kmsdrm_load_refcount == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; +#endif + + /* set all the function pointers to NULL. */ +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + SDL_UnloadObject(kmsdrmlibs[i].lib); + kmsdrmlibs[i].lib = NULL; + } + } +#endif + } + } +} + +/* returns non-zero if all needed symbols were loaded. */ +int +SDL_KMSDRM_LoadSymbols(void) +{ + int rc = 1; /* always succeed if not using Dynamic KMSDRM stuff. */ + + /* deal with multiple modules needing these symbols... */ + if (kmsdrm_load_refcount++ == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; + int *thismod = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].libname != NULL) { + kmsdrmlibs[i].lib = SDL_LoadObject(kmsdrmlibs[i].libname); + } + } + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#include "SDL_kmsdrmsym.h" + +#define SDL_KMSDRM_MODULE(modname) thismod = &SDL_KMSDRM_HAVE_##modname; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = (SDL_DYNKMSDRMFN_##fn) KMSDRM_GetSym(#fn,thismod); +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = *(SDL_DYNKMSDRMCONST_##name*) KMSDRM_GetSym(#name,thismod); +#include "SDL_kmsdrmsym.h" + + if ((SDL_KMSDRM_HAVE_LIBDRM) && (SDL_KMSDRM_HAVE_GBM)) { + /* all required symbols loaded. */ + SDL_ClearError(); + } else { + /* in case something got loaded... */ + SDL_KMSDRM_UnloadSymbols(); + rc = 0; + } + +#else /* no dynamic KMSDRM */ + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = fn; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = name; +#include "SDL_kmsdrmsym.h" + +#endif + } + + return rc; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.h similarity index 57% rename from 3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.h rename to 3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.h index 989ced8581..578b088d8d 100644 --- a/3rdparty/sdl2-2.0.4/src/core/linux/SDL_evdev.h +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,41 +19,35 @@ 3. This notice may not be removed or altered from any source distribution. */ -#include "../../SDL_internal.h" - -#ifndef _SDL_evdev_h -#define _SDL_evdev_h +#ifndef SDL_kmsdrmdyn_h_ +#define SDL_kmsdrmdyn_h_ -#ifdef SDL_INPUT_LINUXEV - -#include "SDL_events.h" -#include +#include "../../SDL_internal.h" -typedef struct SDL_evdevlist_item -{ - char *path; - int fd; - struct SDL_evdevlist_item *next; -} SDL_evdevlist_item; +#include +#include +#include -typedef struct SDL_EVDEV_PrivateData -{ - SDL_evdevlist_item *first; - SDL_evdevlist_item *last; - int numdevices; - int ref_count; - int console_fd; - int kb_mode; - int tty; -} SDL_EVDEV_PrivateData; +#ifdef __cplusplus +extern "C" { +#endif -extern int SDL_EVDEV_Init(void); -extern void SDL_EVDEV_Quit(void); -extern void SDL_EVDEV_Poll(void); +int SDL_KMSDRM_LoadSymbols(void); +void SDL_KMSDRM_UnloadSymbols(void); +/* Declare all the function pointers and wrappers... */ +#define SDL_KMSDRM_SYM(rc,fn,params) \ + typedef rc (*SDL_DYNKMSDRMFN_##fn) params; \ + extern SDL_DYNKMSDRMFN_##fn KMSDRM_##fn; +#define SDL_KMSDRM_SYM_CONST(type, name) \ + typedef type SDL_DYNKMSDRMCONST_##name; \ + extern SDL_DYNKMSDRMCONST_##name KMSDRM_##name; +#include "SDL_kmsdrmsym.h" -#endif /* SDL_INPUT_LINUXEV */ +#ifdef __cplusplus +} +#endif -#endif /* _SDL_evdev_h */ +#endif /* SDL_kmsdrmdyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.c b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.c new file mode 100644 index 0000000000..5a611f6977 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -0,0 +1,42 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +void KMSDRM_PumpEvents(_THIS) +{ +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Poll(); +#endif + +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.h new file mode 100644 index 0000000000..3b88c281dc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmevents.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmevents_h_ +#define SDL_kmsdrmevents_h_ + +extern void KMSDRM_PumpEvents(_THIS); +extern void KMSDRM_EventInit(_THIS); +extern void KMSDRM_EventQuit(_THIS); + +#endif /* SDL_kmsdrmevents_h_ */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.c b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.c new file mode 100644 index 0000000000..04740899fd --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -0,0 +1,501 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" + +#include "../../events/SDL_mouse_c.h" +#include "../../events/default_cursor.h" + +static SDL_Cursor *KMSDRM_CreateDefaultCursor(void); +static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); +static int KMSDRM_ShowCursor(SDL_Cursor * cursor); +static void KMSDRM_MoveCursor(SDL_Cursor * cursor); +static void KMSDRM_FreeCursor(SDL_Cursor * cursor); +static void KMSDRM_WarpMouse(SDL_Window * window, int x, int y); +static int KMSDRM_WarpMouseGlobal(int x, int y); + +static SDL_Cursor * +KMSDRM_CreateDefaultCursor(void) +{ + return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY); +} + +/* Evaluate if a given cursor size is supported or not. Notably, current Intel gfx only support 64x64 and up. */ +static SDL_bool +KMSDRM_IsCursorSizeSupported (int w, int h, uint32_t bo_format) { + + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + int ret; + uint32_t bo_handle; + struct gbm_bo *bo = KMSDRM_gbm_bo_create(vdata->gbm, w, h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (bo == NULL) { + SDL_SetError("Could not create GBM cursor BO width size %dx%d for size testing", w, h); + goto cleanup; + } + + bo_handle = KMSDRM_gbm_bo_get_handle(bo).u32; + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, vdata->crtc_id, bo_handle, w, h); + + if (ret) { + goto cleanup; + } + else { + KMSDRM_gbm_bo_destroy(bo); + return SDL_TRUE; + } + +cleanup: + if (bo != NULL) { + KMSDRM_gbm_bo_destroy(bo); + } + return SDL_FALSE; +} + +/* Create a cursor from a surface */ +static SDL_Cursor * +KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_PixelFormat *pixlfmt = surface->format; + KMSDRM_CursorData *curdata; + SDL_Cursor *cursor; + SDL_bool cursor_supported = SDL_FALSE; + int i, ret, usable_cursor_w, usable_cursor_h; + uint32_t bo_format, bo_stride; + char *buffer = NULL; + size_t bufsize; + + switch(pixlfmt->format) { + case SDL_PIXELFORMAT_RGB332: + bo_format = GBM_FORMAT_RGB332; + break; + case SDL_PIXELFORMAT_ARGB4444: + bo_format = GBM_FORMAT_ARGB4444; + break; + case SDL_PIXELFORMAT_RGBA4444: + bo_format = GBM_FORMAT_RGBA4444; + break; + case SDL_PIXELFORMAT_ABGR4444: + bo_format = GBM_FORMAT_ABGR4444; + break; + case SDL_PIXELFORMAT_BGRA4444: + bo_format = GBM_FORMAT_BGRA4444; + break; + case SDL_PIXELFORMAT_ARGB1555: + bo_format = GBM_FORMAT_ARGB1555; + break; + case SDL_PIXELFORMAT_RGBA5551: + bo_format = GBM_FORMAT_RGBA5551; + break; + case SDL_PIXELFORMAT_ABGR1555: + bo_format = GBM_FORMAT_ABGR1555; + break; + case SDL_PIXELFORMAT_BGRA5551: + bo_format = GBM_FORMAT_BGRA5551; + break; + case SDL_PIXELFORMAT_RGB565: + bo_format = GBM_FORMAT_RGB565; + break; + case SDL_PIXELFORMAT_BGR565: + bo_format = GBM_FORMAT_BGR565; + break; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_RGB24: + bo_format = GBM_FORMAT_RGB888; + break; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_BGR24: + bo_format = GBM_FORMAT_BGR888; + break; + case SDL_PIXELFORMAT_RGBX8888: + bo_format = GBM_FORMAT_RGBX8888; + break; + case SDL_PIXELFORMAT_BGRX8888: + bo_format = GBM_FORMAT_BGRX8888; + break; + case SDL_PIXELFORMAT_ARGB8888: + bo_format = GBM_FORMAT_ARGB8888; + break; + case SDL_PIXELFORMAT_RGBA8888: + bo_format = GBM_FORMAT_RGBA8888; + break; + case SDL_PIXELFORMAT_ABGR8888: + bo_format = GBM_FORMAT_ABGR8888; + break; + case SDL_PIXELFORMAT_BGRA8888: + bo_format = GBM_FORMAT_BGRA8888; + break; + case SDL_PIXELFORMAT_ARGB2101010: + bo_format = GBM_FORMAT_ARGB2101010; + break; + default: + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, bo_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) { + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); + if (cursor == NULL) { + SDL_OutOfMemory(); + return NULL; + } + curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata)); + if (curdata == NULL) { + SDL_OutOfMemory(); + SDL_free(cursor); + return NULL; + } + + /* We have to know beforehand if a cursor with the same size as the surface is supported. + * If it's not, we have to find an usable cursor size and use an intermediate and clean buffer. + * If we can't find a cursor size supported by the hardware, we won't go on trying to + * call SDL_SetCursor() later. */ + + usable_cursor_w = surface->w; + usable_cursor_h = surface->h; + + while (usable_cursor_w <= MAX_CURSOR_W && usable_cursor_h <= MAX_CURSOR_H) { + if (KMSDRM_IsCursorSizeSupported(usable_cursor_w, usable_cursor_h, bo_format)) { + cursor_supported = SDL_TRUE; + break; + } + usable_cursor_w += usable_cursor_w; + usable_cursor_h += usable_cursor_h; + } + + if (!cursor_supported) { + SDL_SetError("Could not find a cursor size supported by the kernel driver"); + goto cleanup; + } + + curdata->hot_x = hot_x; + curdata->hot_y = hot_y; + curdata->w = usable_cursor_w; + curdata->h = usable_cursor_h; + + curdata->bo = KMSDRM_gbm_bo_create(vdata->gbm, usable_cursor_w, usable_cursor_h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (curdata->bo == NULL) { + SDL_SetError("Could not create GBM cursor BO"); + goto cleanup; + } + + bo_stride = KMSDRM_gbm_bo_get_stride(curdata->bo); + bufsize = bo_stride * curdata->h; + + if (surface->pitch != bo_stride) { + /* pitch doesn't match stride, must be copied to temp buffer */ + buffer = SDL_malloc(bufsize); + if (buffer == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + /* Clean the whole temporary buffer */ + SDL_memset(buffer, 0x00, bo_stride * curdata->h); + + /* Copy to temporary buffer */ + for (i = 0; i < surface->h; i++) { + SDL_memcpy(buffer + (i * bo_stride), + ((char *)surface->pixels) + (i * surface->pitch), + surface->w * pixlfmt->BytesPerPixel); + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (KMSDRM_gbm_bo_write(curdata->bo, buffer, bufsize)) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + + /* Free temporary buffer */ + SDL_free(buffer); + buffer = NULL; + } else { + /* surface matches BO format */ + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + ret = KMSDRM_gbm_bo_write(curdata->bo, surface->pixels, bufsize); + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (ret) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + } + + cursor->driverdata = curdata; + + return cursor; + +cleanup: + if (buffer != NULL) { + SDL_free(buffer); + } + if (cursor != NULL) { + SDL_free(cursor); + } + if (curdata != NULL) { + if (curdata->bo != NULL) { + KMSDRM_gbm_bo_destroy(curdata->bo); + } + SDL_free(curdata); + } + return NULL; +} + +/* Show the specified cursor, or hide if cursor is NULL */ +static int +KMSDRM_ShowCursor(SDL_Cursor * cursor) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_Mouse *mouse; + KMSDRM_CursorData *curdata; + SDL_VideoDisplay *display = NULL; + SDL_DisplayData *ddata = NULL; + int ret; + uint32_t bo_handle; + + mouse = SDL_GetMouse(); + if (mouse == NULL) { + return SDL_SetError("No mouse."); + } + + if (mouse->focus != NULL) { + display = SDL_GetDisplayForWindow(mouse->focus); + if (display != NULL) { + ddata = (SDL_DisplayData*) display->driverdata; + } + } + + if (cursor == NULL) { + /* Hide current cursor */ + if ( mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + + if (curdata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, curdata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide current cursor with drmModeSetCursor()."); + return ret; + } + /* Mark previous cursor as not-displayed */ + curdata->crtc_id = 0; + + return 0; + } + } + /* otherwise if possible, hide global cursor */ + if (ddata != NULL && ddata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide display's cursor with drmModeSetCursor()."); + return ret; + } + return 0; + } + + return SDL_SetError("Couldn't find cursor to hide."); + } + /* If cursor != NULL, show new cursor on display */ + if (display == NULL) { + return SDL_SetError("Could not get display for mouse."); + } + if (ddata == NULL) { + return SDL_SetError("Could not get display driverdata."); + } + + curdata = (KMSDRM_CursorData *) cursor->driverdata; + if (curdata == NULL || curdata->bo == NULL) { + return SDL_SetError("Cursor not initialized properly."); + } + + bo_handle = KMSDRM_gbm_bo_get_handle(curdata->bo).u32; + if (curdata->hot_x == 0 && curdata->hot_y == 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h); + } else { + ret = KMSDRM_drmModeSetCursor2(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h, + curdata->hot_x, curdata->hot_y); + } + if (ret) { + SDL_SetError("drmModeSetCursor failed."); + return ret; + } + + curdata->crtc_id = ddata->crtc_id; + + return 0; +} + +/* Free a window manager cursor */ +static void +KMSDRM_FreeCursor(SDL_Cursor * cursor) +{ + KMSDRM_CursorData *curdata; + int drm_fd; + + if (cursor != NULL) { + curdata = (KMSDRM_CursorData *) cursor->driverdata; + + if (curdata != NULL) { + if (curdata->bo != NULL) { + if (curdata->crtc_id != 0) { + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + /* Hide the cursor if previously shown on a CRTC */ + KMSDRM_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0); + curdata->crtc_id = 0; + } + KMSDRM_gbm_bo_destroy(curdata->bo); + curdata->bo = NULL; + } + SDL_free(cursor->driverdata); + } + SDL_free(cursor); + } +} + +/* Warp the mouse to (x,y) */ +static void +KMSDRM_WarpMouse(SDL_Window * window, int x, int y) +{ + /* Only one global/fullscreen window is supported */ + KMSDRM_WarpMouseGlobal(x, y); +} + +/* Warp the mouse to (x,y) */ +static int +KMSDRM_WarpMouseGlobal(int x, int y) +{ + KMSDRM_CursorData *curdata; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + /* And now update the cursor graphic position on screen. */ + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->bo != NULL) { + + if (curdata->crtc_id != 0) { + int ret, drm_fd; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + + return ret; + } else { + return SDL_SetError("Cursor is not currently shown."); + } + } else { + return SDL_SetError("Cursor not initialized properly."); + } + } else { + return SDL_SetError("No mouse or current cursor."); + } +} + +void +KMSDRM_InitMouse(_THIS) +{ + /* FIXME: Using UDEV it should be possible to scan all mice + * but there's no point in doing so as there's no multimice support...yet! + */ + SDL_Mouse *mouse = SDL_GetMouse(); + + mouse->CreateCursor = KMSDRM_CreateCursor; + mouse->ShowCursor = KMSDRM_ShowCursor; + mouse->MoveCursor = KMSDRM_MoveCursor; + mouse->FreeCursor = KMSDRM_FreeCursor; + mouse->WarpMouse = KMSDRM_WarpMouse; + mouse->WarpMouseGlobal = KMSDRM_WarpMouseGlobal; + + SDL_SetDefaultCursor(KMSDRM_CreateDefaultCursor()); +} + +void +KMSDRM_QuitMouse(_THIS) +{ + /* TODO: ? */ +} + +/* This is called when a mouse motion event occurs */ +static void +KMSDRM_MoveCursor(SDL_Cursor * cursor) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + KMSDRM_CursorData *curdata; + int drm_fd, ret; + + /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity! + That's why we move the cursor graphic ONLY. */ + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.h new file mode 100644 index 0000000000..754417de5f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_KMSDRM_mouse_h_ +#define SDL_KMSDRM_mouse_h_ + +#include + +#define MAX_CURSOR_W 512 +#define MAX_CURSOR_H 512 + +typedef struct _KMSDRM_CursorData +{ + struct gbm_bo *bo; + uint32_t crtc_id; + int hot_x, hot_y; + int w, h; +} KMSDRM_CursorData; + +extern void KMSDRM_InitMouse(_THIS); +extern void KMSDRM_QuitMouse(_THIS); + +#endif /* SDL_KMSDRM_mouse_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.c b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.c new file mode 100644 index 0000000000..fc6304d5f4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -0,0 +1,189 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "SDL_log.h" + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmdyn.h" + +#ifndef EGL_PLATFORM_GBM_MESA +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif + +/* EGL implementation of SDL OpenGL support */ + +int +KMSDRM_GLES_LoadLibrary(_THIS, const char *path) { + return SDL_EGL_LoadLibrary(_this, path, ((SDL_VideoData *)_this->driverdata)->gbm, EGL_PLATFORM_GBM_MESA); +} + +SDL_EGL_CreateContext_impl(KMSDRM) + +SDL_bool +KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup"); + return SDL_FALSE; + } + + wdata->crtc_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->crtc_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup"); + return SDL_FALSE; + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->crtc_bo); + if (fb_info == NULL) { + return SDL_FALSE; + } + + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer"); + return SDL_FALSE; + + } + + wdata->crtc_ready = SDL_TRUE; + return SDL_TRUE; +} + +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) { + if (!_this->egl_data) { + return SDL_SetError("EGL not initialized"); + } + + if (interval == 0 || interval == 1) { + _this->egl_data->egl_swapinterval = interval; + } else { + return SDL_SetError("Only swap intervals of 0 or 1 are supported"); + } + + return 0; +} + +int +KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + int ret; + + /* Do we still need to wait for a flip? */ + int timeout = 0; + if (_this->egl_data->egl_swapinterval == 1) { + timeout = -1; + } + if (!KMSDRM_WaitPageFlip(_this, wdata, timeout)) { + return 0; + } + + /* Release previously displayed buffer (which is now the backbuffer) and lock a new one */ + if (wdata->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(wdata->gs, wdata->current_bo); + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Released GBM surface %p", (void *)wdata->next_bo); */ + + wdata->current_bo = wdata->next_bo; + wdata->next_bo = NULL; + } + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + if (wdata->current_bo == NULL) { + wdata->current_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->current_bo == NULL) { + return 0; + } + } + + wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->next_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer"); + return 0; + /* } else { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Locked GBM surface %p", (void *)wdata->next_bo); */ + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); + if (fb_info == NULL) { + return 0; + } + if (_this->egl_data->egl_swapinterval == 0) { + /* Swap buffers instantly, possible tearing */ + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModeSetCrtc(%d, %u, %u, 0, 0, &%u, 1, &%ux%u@%u)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, vdata->saved_conn_id, + displaydata->cur_mode.hdisplay, displaydata->cur_mode.vdisplay, displaydata->cur_mode.vrefresh); */ + ret = KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode); + if(ret != 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not pageflip with drmModeSetCrtc: %d", ret); + } + } else { + /* Queue page flip at vsync */ + + /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not, + or FlipPage won't work in some cases. */ + if (!wdata->crtc_ready) { + if(!KMSDRM_GLES_SetupCrtc(_this, window)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips"); + return 0; + } + } + + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */ + ret = KMSDRM_drmModePageFlip(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip); + if (ret == 0) { + wdata->waiting_for_flip = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not queue pageflip: %d", ret); + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + KMSDRM_WaitPageFlip(_this, wdata, -1); + } + } + + return 0; +} + +SDL_EGL_MakeCurrent_impl(KMSDRM) + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.h new file mode 100644 index 0000000000..d0a7bfaf81 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmopengles_h_ +#define SDL_kmsdrmopengles_h_ + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define KMSDRM_GLES_GetAttribute SDL_EGL_GetAttribute +#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define KMSDRM_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define KMSDRM_GLES_DeleteContext SDL_EGL_DeleteContext +#define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval + +extern int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +extern int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_kmsdrmopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmsym.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmsym.h new file mode 100644 index 0000000000..3ab231896a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -0,0 +1,99 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* *INDENT-OFF* */ + +#ifndef SDL_KMSDRM_MODULE +#define SDL_KMSDRM_MODULE(modname) +#endif + +#ifndef SDL_KMSDRM_SYM +#define SDL_KMSDRM_SYM(rc,fn,params) +#endif + +#ifndef SDL_KMSDRM_SYM_CONST +#define SDL_KMSDRM_SYM_CONST(type, name) +#endif + + +SDL_KMSDRM_MODULE(LIBDRM) +SDL_KMSDRM_SYM(void,drmModeFreeResources,(drmModeResPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeFB,(drmModeFBPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeCrtc,(drmModeCrtcPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeConnector,(drmModeConnectorPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeEncoder,(drmModeEncoderPtr ptr)) +SDL_KMSDRM_SYM(drmModeResPtr,drmModeGetResources,(int fd)) +SDL_KMSDRM_SYM(int,drmModeAddFB,(int fd, uint32_t width, uint32_t height, uint8_t depth, + uint8_t bpp, uint32_t pitch, uint32_t bo_handle, + uint32_t *buf_id)) +SDL_KMSDRM_SYM(int,drmModeRmFB,(int fd, uint32_t bufferId)) +SDL_KMSDRM_SYM(drmModeFBPtr,drmModeGetFB,(int fd, uint32_t buf)) +SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId)) +SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId, + uint32_t x, uint32_t y, uint32_t *connectors, int count, + drmModeModeInfoPtr mode)) +SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height)) +SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height, + int32_t hot_x, int32_t hot_y)) +SDL_KMSDRM_SYM(int,drmModeMoveCursor,(int fd, uint32_t crtcId, int x, int y)) +SDL_KMSDRM_SYM(drmModeEncoderPtr,drmModeGetEncoder,(int fd, uint32_t encoder_id)) +SDL_KMSDRM_SYM(drmModeConnectorPtr,drmModeGetConnector,(int fd, uint32_t connector_id)) +SDL_KMSDRM_SYM(int,drmHandleEvent,(int fd,drmEventContextPtr evctx)) +SDL_KMSDRM_SYM(int,drmModePageFlip,(int fd, uint32_t crtc_id, uint32_t fb_id, + uint32_t flags, void *user_data)) + + +SDL_KMSDRM_MODULE(GBM) +SDL_KMSDRM_SYM(int,gbm_device_get_fd,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(int,gbm_device_is_format_supported,(struct gbm_device *gbm, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(void,gbm_device_destroy,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_create_device,(int fd)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_width,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_height,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(int,gbm_bo_write,(struct gbm_bo *bo, const void *buf, size_t count)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_bo_get_device,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_set_user_data,(struct gbm_bo *bo, void *data, + void (*destroy_user_data)(struct gbm_bo *, void *))) +SDL_KMSDRM_SYM(void *,gbm_bo_get_user_data,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_destroy,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_bo_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(struct gbm_surface *,gbm_surface_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t flags)) +SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo)) + + +#undef SDL_KMSDRM_MODULE +#undef SDL_KMSDRM_SYM +#undef SDL_KMSDRM_SYM_CONST + +/* *INDENT-ON* */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.c b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.c new file mode 100644 index 0000000000..bacbe0c1e0 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -0,0 +1,739 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +/* SDL internals */ +#include "../SDL_sysvideo.h" +#include "SDL_syswm.h" +#include "SDL_log.h" +#include "SDL_hints.h" +#include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_keyboard_c.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +/* KMS/DRM declarations */ +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" +#include +#include +#include + +#define KMSDRM_DRI_PATH "/dev/dri/" + +static int +check_modestting(int devindex) +{ + SDL_bool available = SDL_FALSE; + char device[512]; + int drm_fd; + + SDL_snprintf(device, sizeof (device), "%scard%d", KMSDRM_DRI_PATH, devindex); + + drm_fd = open(device, O_RDWR | O_CLOEXEC); + if (drm_fd >= 0) { + if (SDL_KMSDRM_LoadSymbols()) { + drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd); + if (resources != NULL) { + available = SDL_TRUE; + KMSDRM_drmModeFreeResources(resources); + } + SDL_KMSDRM_UnloadSymbols(); + } + close(drm_fd); + } + + return available; +} + +static int get_dricount(void) +{ + int devcount = 0; + struct dirent *res; + struct stat sb; + DIR *folder; + + if (!(stat(KMSDRM_DRI_PATH, &sb) == 0 + && S_ISDIR(sb.st_mode))) { + printf("The path %s cannot be opened or is not available\n", + KMSDRM_DRI_PATH); + return 0; + } + + if (access(KMSDRM_DRI_PATH, F_OK) == -1) { + printf("The path %s cannot be opened\n", + KMSDRM_DRI_PATH); + return 0; + } + + folder = opendir(KMSDRM_DRI_PATH); + if (folder) { + while ((res = readdir(folder))) { + if (res->d_type == DT_CHR) { + devcount++; + } + } + closedir(folder); + } + + return devcount; +} + +static int +get_driindex(void) +{ + const int devcount = get_dricount(); + int i; + + for (i = 0; i < devcount; i++) { + if (check_modestting(i)) { + return i; + } + } + + return -ENOENT; +} + +static int +KMSDRM_Available(void) +{ + int ret = -ENOENT; + + ret = get_driindex(); + if (ret >= 0) + return 1; + + return ret; +} + +static void +KMSDRM_Destroy(SDL_VideoDevice * device) +{ + if (device->driverdata != NULL) { + SDL_free(device->driverdata); + device->driverdata = NULL; + } + + SDL_free(device); + SDL_KMSDRM_UnloadSymbols(); +} + +static SDL_VideoDevice * +KMSDRM_Create(int devindex) +{ + SDL_VideoDevice *device; + SDL_VideoData *vdata; + + if (!devindex || (devindex > 99)) { + devindex = get_driindex(); + } + + if (devindex < 0) { + SDL_SetError("devindex (%d) must be between 0 and 99.\n", devindex); + return NULL; + } + + if (!SDL_KMSDRM_LoadSymbols()) { + return NULL; + } + + /* Initialize SDL_VideoDevice structure */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + /* Initialize internal data */ + vdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (vdata == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + vdata->devindex = devindex; + vdata->drm_fd = -1; + + device->driverdata = vdata; + + /* Setup amount of available displays and current display */ + device->num_displays = 0; + + /* Set device free function */ + device->free = KMSDRM_Destroy; + + /* Setup all functions which we can handle */ + device->VideoInit = KMSDRM_VideoInit; + device->VideoQuit = KMSDRM_VideoQuit; + device->GetDisplayModes = KMSDRM_GetDisplayModes; + device->SetDisplayMode = KMSDRM_SetDisplayMode; + device->CreateSDLWindow = KMSDRM_CreateWindow; + device->CreateSDLWindowFrom = KMSDRM_CreateWindowFrom; + device->SetWindowTitle = KMSDRM_SetWindowTitle; + device->SetWindowIcon = KMSDRM_SetWindowIcon; + device->SetWindowPosition = KMSDRM_SetWindowPosition; + device->SetWindowSize = KMSDRM_SetWindowSize; + device->ShowWindow = KMSDRM_ShowWindow; + device->HideWindow = KMSDRM_HideWindow; + device->RaiseWindow = KMSDRM_RaiseWindow; + device->MaximizeWindow = KMSDRM_MaximizeWindow; + device->MinimizeWindow = KMSDRM_MinimizeWindow; + device->RestoreWindow = KMSDRM_RestoreWindow; + device->SetWindowGrab = KMSDRM_SetWindowGrab; + device->DestroyWindow = KMSDRM_DestroyWindow; + device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary; + device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress; + device->GL_UnloadLibrary = KMSDRM_GLES_UnloadLibrary; + device->GL_CreateContext = KMSDRM_GLES_CreateContext; + device->GL_MakeCurrent = KMSDRM_GLES_MakeCurrent; + device->GL_SetSwapInterval = KMSDRM_GLES_SetSwapInterval; + device->GL_GetSwapInterval = KMSDRM_GLES_GetSwapInterval; + device->GL_SwapWindow = KMSDRM_GLES_SwapWindow; + device->GL_DeleteContext = KMSDRM_GLES_DeleteContext; +#endif + + device->PumpEvents = KMSDRM_PumpEvents; + + return device; + +cleanup: + if (device != NULL) + SDL_free(device); + if (vdata != NULL) + SDL_free(vdata); + return NULL; +} + +VideoBootStrap KMSDRM_bootstrap = { + "KMSDRM", + "KMS/DRM Video Driver", + KMSDRM_Available, + KMSDRM_Create +}; + + +static void +KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) +{ + KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; + + if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { + KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); + } + + free(fb_info); +} + +KMSDRM_FBInfo * +KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) +{ + uint32_t w, h, stride, handle; + int ret; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo); + if (fb_info != NULL) { + /* Have a previously used framebuffer, return it */ + return fb_info; + } + + /* Here a new DRM FB must be created */ + fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo)); + if (fb_info == NULL) { + SDL_OutOfMemory(); + return NULL; + } + fb_info->drm_fd = vdata->drm_fd; + + w = KMSDRM_gbm_bo_get_width(bo); + h = KMSDRM_gbm_bo_get_height(bo); + stride = KMSDRM_gbm_bo_get_stride(bo); + handle = KMSDRM_gbm_bo_get_handle(bo).u32; + + ret = KMSDRM_drmModeAddFB(vdata->drm_fd, w, h, 24, 32, stride, handle, &fb_info->fb_id); + if (ret < 0) { + free(fb_info); + return NULL; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", fb_info->fb_id, w, h, stride, (void *)bo); + + /* Associate our DRM framebuffer with this buffer object */ + KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback); + return fb_info; +} + +SDL_bool +KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout) { + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + while (wdata->waiting_for_flip) { + vdata->drm_pollfd.revents = 0; + if (poll(&vdata->drm_pollfd, 1, timeout) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & (POLLHUP | POLLERR)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll hup or error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & POLLIN) { + /* Page flip? If so, drmHandleEvent will unset wdata->waiting_for_flip */ + KMSDRM_drmHandleEvent(vdata->drm_fd, &vdata->drm_evctx); + } else { + /* Timed out and page flip didn't happen */ + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Dropping frame while waiting_for_flip"); + return SDL_FALSE; + } + } + return SDL_TRUE; +} + +static void +KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) +{ + *((SDL_bool *) data) = SDL_FALSE; +} + + +/*****************************************************************************/ +/* SDL Video and Display initialization/handling functions */ +/* _this is a SDL_VideoDevice * */ +/*****************************************************************************/ +int +KMSDRM_VideoInit(_THIS) +{ + int i; + int ret = 0; + char *devname; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + drmModeRes *resources = NULL; + drmModeConnector *connector = NULL; + drmModeEncoder *encoder = NULL; + SDL_DisplayMode current_mode; + SDL_VideoDisplay display; + + /* Allocate display internal data */ + SDL_DisplayData *data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); + if (data == NULL) { + return SDL_OutOfMemory(); + } + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()"); + + /* Open /dev/dri/cardNN */ + devname = (char *) SDL_calloc(1, 16); + if (devname == NULL) { + ret = SDL_OutOfMemory(); + goto cleanup; + } + SDL_snprintf(devname, 16, "/dev/dri/card%d", vdata->devindex); + vdata->drm_fd = open(devname, O_RDWR | O_CLOEXEC); + SDL_free(devname); + + if (vdata->drm_fd < 0) { + ret = SDL_SetError("Could not open /dev/dri/card%d.", vdata->devindex); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opened DRM FD (%d)", vdata->drm_fd); + + vdata->gbm = KMSDRM_gbm_create_device(vdata->drm_fd); + if (vdata->gbm == NULL) { + ret = SDL_SetError("Couldn't create gbm device."); + goto cleanup; + } + + /* Find the first available connector with modes */ + resources = KMSDRM_drmModeGetResources(vdata->drm_fd); + if (!resources) { + ret = SDL_SetError("drmModeGetResources(%d) failed", vdata->drm_fd); + goto cleanup; + } + + for (i = 0; i < resources->count_connectors; i++) { + connector = KMSDRM_drmModeGetConnector(vdata->drm_fd, resources->connectors[i]); + if (connector == NULL) + continue; + + if (connector->connection == DRM_MODE_CONNECTED && + connector->count_modes > 0) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found connector %d with %d modes.", + connector->connector_id, connector->count_modes); + vdata->saved_conn_id = connector->connector_id; + break; + } + + KMSDRM_drmModeFreeConnector(connector); + connector = NULL; + } + + if (i == resources->count_connectors) { + ret = SDL_SetError("No currently active connector found."); + goto cleanup; + } + + for (i = 0; i < resources->count_encoders; i++) { + encoder = KMSDRM_drmModeGetEncoder(vdata->drm_fd, resources->encoders[i]); + + if (encoder == NULL) + continue; + + if (encoder->encoder_id == connector->encoder_id) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found encoder %d.", encoder->encoder_id); + data->encoder_id = encoder->encoder_id; + break; + } + + KMSDRM_drmModeFreeEncoder(encoder); + encoder = NULL; + } + + if (i == resources->count_encoders) { + ret = SDL_SetError("No connected encoder found."); + goto cleanup; + } + + vdata->saved_crtc = KMSDRM_drmModeGetCrtc(vdata->drm_fd, encoder->crtc_id); + if (vdata->saved_crtc == NULL) { + ret = SDL_SetError("No CRTC found."); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Saved crtc_id %u, fb_id %u, (%u,%u), %ux%u", + vdata->saved_crtc->crtc_id, vdata->saved_crtc->buffer_id, vdata->saved_crtc->x, + vdata->saved_crtc->y, vdata->saved_crtc->width, vdata->saved_crtc->height); + data->crtc_id = encoder->crtc_id; + data->cur_mode = vdata->saved_crtc->mode; + vdata->crtc_id = encoder->crtc_id; + + SDL_zero(current_mode); + + current_mode.w = vdata->saved_crtc->mode.hdisplay; + current_mode.h = vdata->saved_crtc->mode.vdisplay; + current_mode.refresh_rate = vdata->saved_crtc->mode.vrefresh; + + /* FIXME ? + drmModeFB *fb = drmModeGetFB(vdata->drm_fd, vdata->saved_crtc->buffer_id); + current_mode.format = drmToSDLPixelFormat(fb->bpp, fb->depth); + drmModeFreeFB(fb); + */ + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + + current_mode.driverdata = NULL; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + + display.driverdata = data; + /* SDL_VideoQuit will later SDL_free(display.driverdata) */ + SDL_AddVideoDisplay(&display); + + /* Setup page flip handler */ + vdata->drm_pollfd.fd = vdata->drm_fd; + vdata->drm_pollfd.events = POLLIN; + vdata->drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + vdata->drm_evctx.page_flip_handler = KMSDRM_FlipHandler; + +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Init(); +#endif + + KMSDRM_InitMouse(_this); + +cleanup: + if (encoder != NULL) + KMSDRM_drmModeFreeEncoder(encoder); + if (connector != NULL) + KMSDRM_drmModeFreeConnector(connector); + if (resources != NULL) + KMSDRM_drmModeFreeResources(resources); + + if (ret != 0) { + /* Error (complete) cleanup */ + SDL_free(data); + if(vdata->saved_crtc != NULL) { + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + vdata->drm_fd = -1; + } + } + return ret; +} + +void +KMSDRM_VideoQuit(_THIS) +{ + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoQuit()"); + + if (_this->gl_config.driver_loaded) { + SDL_GL_UnloadLibrary(); + } + + if(vdata->saved_crtc != NULL) { + if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { + /* Restore saved CRTC settings */ + drmModeCrtc *crtc = vdata->saved_crtc; + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id, + crtc->x, crtc->y, &vdata->saved_conn_id, 1, + &crtc->mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not restore original CRTC mode"); + } + } + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Closed DRM FD %d", vdata->drm_fd); + vdata->drm_fd = -1; + } +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Quit(); +#endif +} + +void +KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + /* Only one display mode available, the current one */ + SDL_AddDisplayMode(display, &display->current_mode); +} + +int +KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +int +KMSDRM_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wdata; + SDL_VideoDisplay *display; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + Uint32 surface_fmt, surface_flags; + + /* Allocate window internal data */ + wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (wdata == NULL) { + SDL_OutOfMemory(); + goto error; + } + + wdata->waiting_for_flip = SDL_FALSE; + display = SDL_GetDisplayForWindow(window); + + /* Windows have one size for now */ + window->w = display->desktop_mode.w; + window->h = display->desktop_mode.h; + + /* Maybe you didn't ask for a fullscreen OpenGL window, but that's what you get */ + window->flags |= (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL); + + surface_fmt = GBM_FORMAT_XRGB8888; + surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, surface_fmt, surface_flags)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway."); + } + wdata->gs = KMSDRM_gbm_surface_create(vdata->gbm, window->w, window->h, surface_fmt, surface_flags); + +#if SDL_VIDEO_OPENGL_EGL + if (!_this->egl_data) { + if (SDL_GL_LoadLibrary(NULL) < 0) { + goto error; + } + } + wdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wdata->gs); + + if (wdata->egl_surface == EGL_NO_SURFACE) { + SDL_SetError("Could not create EGL window surface"); + goto error; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + + /* In case we want low-latency, double-buffer video, we take note here */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->double_buffer = SDL_TRUE; + } + + /* Window is created, but we have yet to set up CRTC to one of the GBM buffers if we want + drmModePageFlip to work, and we can't do it until EGL is completely setup, because we + need to do eglSwapBuffers so we can get a valid GBM buffer object to call + drmModeSetCrtc on it. */ + wdata->crtc_ready = SDL_FALSE; + + /* Setup driver data for this window */ + window->driverdata = wdata; + + /* One window, it always has focus */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + + /* Window has been successfully created */ + return 0; + +error: + if (wdata != NULL) { +#if SDL_VIDEO_OPENGL_EGL + if (wdata->egl_surface != EGL_NO_SURFACE) + SDL_EGL_DestroySurface(_this, wdata->egl_surface); +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (wdata->gs != NULL) + KMSDRM_gbm_surface_destroy(wdata->gs); + SDL_free(wdata); + } + return -1; +} + +void +KMSDRM_DestroyWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if(data) { + /* Wait for any pending page flips and unlock buffer */ + KMSDRM_WaitPageFlip(_this, data, -1); + if (data->crtc_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->crtc_bo); + data->crtc_bo = NULL; + } + if (data->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo); + data->next_bo = NULL; + } + if (data->current_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->current_bo); + data->current_bo = NULL; + } +#if SDL_VIDEO_OPENGL_EGL + SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (data->egl_surface != EGL_NO_SURFACE) { + SDL_EGL_DestroySurface(_this, data->egl_surface); + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (data->gs != NULL) { + KMSDRM_gbm_surface_destroy(data->gs); + data->gs = NULL; + } + SDL_free(data); + window->driverdata = NULL; + } +} + +int +KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + return -1; +} + +void +KMSDRM_SetWindowTitle(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ +} +void +KMSDRM_SetWindowPosition(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowSize(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_ShowWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_HideWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RaiseWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MaximizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MinimizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RestoreWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ + +} + +/*****************************************************************************/ +/* SDL Window Manager function */ +/*****************************************************************************/ +SDL_bool +KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) +{ + if (info->version.major <= SDL_MAJOR_VERSION) { + return SDL_TRUE; + } else { + SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + return SDL_FALSE; + } + + /* Failed to get window manager information */ + return SDL_FALSE; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.h b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.h new file mode 100644 index 0000000000..34f0b105a9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -0,0 +1,125 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef __SDL_KMSDRMVIDEO_H__ +#define __SDL_KMSDRMVIDEO_H__ + +#include "../SDL_sysvideo.h" + +#include +#include +#include +#include +#include +#include +#if SDL_VIDEO_OPENGL_EGL +#include +#endif + +typedef struct SDL_VideoData +{ + int devindex; /* device index that was passed on creation */ + int drm_fd; /* DRM file desc */ + struct gbm_device *gbm; + drmEventContext drm_evctx; /* DRM event context */ + struct pollfd drm_pollfd; /* pollfd containing DRM file desc */ + drmModeCrtc *saved_crtc; /* Saved CRTC to restore on quit */ + uint32_t saved_conn_id; /* Saved DRM connector ID */ + uint32_t crtc_id; /* CRTC in use */ +} SDL_VideoData; + + +typedef struct SDL_DisplayData +{ + uint32_t encoder_id; + uint32_t crtc_id; + drmModeModeInfo cur_mode; +} SDL_DisplayData; + + +typedef struct SDL_WindowData +{ + struct gbm_surface *gs; + struct gbm_bo *current_bo; + struct gbm_bo *next_bo; + struct gbm_bo *crtc_bo; + SDL_bool waiting_for_flip; + SDL_bool crtc_ready; + SDL_bool double_buffer; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif +} SDL_WindowData; + +typedef struct KMSDRM_FBInfo +{ + int drm_fd; /* DRM file desc */ + uint32_t fb_id; /* DRM framebuffer ID */ +} KMSDRM_FBInfo; + +/* Helper functions */ +KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo); +SDL_bool KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout); + +/****************************************************************************/ +/* SDL_VideoDevice functions declaration */ +/****************************************************************************/ + +/* Display and window functions */ +int KMSDRM_VideoInit(_THIS); +void KMSDRM_VideoQuit(_THIS); +void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +int KMSDRM_CreateWindow(_THIS, SDL_Window * window); +int KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +void KMSDRM_SetWindowTitle(_THIS, SDL_Window * window); +void KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +void KMSDRM_SetWindowPosition(_THIS, SDL_Window * window); +void KMSDRM_SetWindowSize(_THIS, SDL_Window * window); +void KMSDRM_ShowWindow(_THIS, SDL_Window * window); +void KMSDRM_HideWindow(_THIS, SDL_Window * window); +void KMSDRM_RaiseWindow(_THIS, SDL_Window * window); +void KMSDRM_MaximizeWindow(_THIS, SDL_Window * window); +void KMSDRM_MinimizeWindow(_THIS, SDL_Window * window); +void KMSDRM_RestoreWindow(_THIS, SDL_Window * window); +void KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +void KMSDRM_DestroyWindow(_THIS, SDL_Window * window); + +/* Window manager function */ +SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + +/* OpenGL/OpenGL ES functions */ +int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +void *KMSDRM_GLES_GetProcAddress(_THIS, const char *proc); +void KMSDRM_GLES_UnloadLibrary(_THIS); +SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +int KMSDRM_GLES_GetSwapInterval(_THIS); +int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context); + +#endif /* __SDL_KMSDRMVIDEO_H__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.c rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.c index f9dfc03955..71dc73c8b4 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.c +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,9 +84,8 @@ MIR_GetSym(const char *fnname, int *pHasModule) /* Define all the function pointers and wrappers... */ #define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0; #define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL; +#define SDL_MIR_SYM_CONST(type,name) SDL_DYMMIRCONST_##name MIR_##name = NULL; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM static int mir_load_refcount = 0; @@ -103,9 +102,8 @@ SDL_MIR_UnloadSymbols(void) /* set all the function pointers to NULL. */ #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0; #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL; +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = NULL; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC @@ -138,16 +136,12 @@ SDL_MIR_LoadSymbols(void) } #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */ -#define SDL_MIR_SYM(rc,fn,params) #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname; #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod); +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod); #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) { /* all required symbols loaded. */ @@ -162,9 +156,8 @@ SDL_MIR_LoadSymbols(void) #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */ #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn; +#define SDL_MIR_SYM_CONST(type,name) MIR_##name = name; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #endif } diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.h index 48bf489c63..32364aaf0e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirdyn.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mirdyn_h -#define _SDL_mirdyn_h +#ifndef SDL_mirdyn_h_ +#define SDL_mirdyn_h_ #include "../../SDL_internal.h" @@ -36,18 +36,18 @@ int SDL_MIR_LoadSymbols(void); void SDL_MIR_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ -#define SDL_MIR_MODULE(modname) #define SDL_MIR_SYM(rc,fn,params) \ typedef rc (*SDL_DYNMIRFN_##fn) params; \ extern SDL_DYNMIRFN_##fn MIR_##fn; +#define SDL_MIR_SYM_CONST(type, name) \ + typedef type SDL_DYMMIRCONST_##name; \ + extern SDL_DYMMIRCONST_##name MIR_##name; #include "SDL_mirsym.h" -#undef SDL_MIR_MODULE -#undef SDL_MIR_SYM #ifdef __cplusplus } #endif -#endif /* !defined _SDL_mirdyn_h */ +#endif /* !defined SDL_mirdyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.c new file mode 100644 index 0000000000..df92799f33 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.c @@ -0,0 +1,321 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Contributed by Brandon Schaefer, +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MIR + +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/SDL_touch_c.h" +#include "../../events/scancodes_xfree86.h" + +#include "SDL_mirevents.h" +#include "SDL_mirwindow.h" + +#include + +#include "SDL_mirdyn.h" + +static void +HandleKeyText(int32_t key_code) +{ + char text[8]; + int size = 0; + + size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text); + + if (size > 0) { + text[size] = '\0'; + SDL_SendKeyboardText(text); + } +} + +/* FIXME + Mir still needs to implement its IM API, for now we assume + a single key press produces a character. +*/ +static void +HandleKeyEvent(MirKeyboardEvent const* key_event, SDL_Window* window) +{ + xkb_keysym_t key_code; + Uint8 key_state; + int event_scancode; + uint32_t sdl_scancode = SDL_SCANCODE_UNKNOWN; + + MirKeyboardAction action = MIR_mir_keyboard_event_action(key_event); + + key_state = SDL_PRESSED; + key_code = MIR_mir_keyboard_event_key_code(key_event); + event_scancode = MIR_mir_keyboard_event_scan_code(key_event); + + if (action == mir_keyboard_action_up) + key_state = SDL_RELEASED; + + if (event_scancode < SDL_arraysize(xfree86_scancode_table2)) + sdl_scancode = xfree86_scancode_table2[event_scancode]; + + if (sdl_scancode != SDL_SCANCODE_UNKNOWN) + SDL_SendKeyboardKey(key_state, sdl_scancode); + + if (key_state == SDL_PRESSED) + HandleKeyText(key_code); +} + +static void +HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirPointerEvent const* pointer) +{ + uint32_t sdl_button = SDL_BUTTON_LEFT; + MirPointerButton button_state = mir_pointer_button_primary; + + static uint32_t old_button_states = 0; + uint32_t new_button_states = MIR_mir_pointer_event_buttons(pointer); + + // XOR on our old button states vs our new states to get the newley pressed/released button + button_state = new_button_states ^ old_button_states; + + switch (button_state) { + case mir_pointer_button_primary: + sdl_button = SDL_BUTTON_LEFT; + break; + case mir_pointer_button_secondary: + sdl_button = SDL_BUTTON_RIGHT; + break; + case mir_pointer_button_tertiary: + sdl_button = SDL_BUTTON_MIDDLE; + break; + case mir_pointer_button_forward: + sdl_button = SDL_BUTTON_X1; + break; + case mir_pointer_button_back: + sdl_button = SDL_BUTTON_X2; + break; + default: + break; + } + + old_button_states = new_button_states; + + SDL_SendMouseButton(sdl_window, 0, state, sdl_button); +} + +static void +HandleMouseMotion(SDL_Window* sdl_window, int x, int y) +{ + SDL_Mouse* mouse = SDL_GetMouse(); + SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y); +} + +static void +HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure) +{ + SDL_SendTouch(device_id, source_id, down, x, y, pressure); +} + +static void +HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure) +{ + SDL_SendTouchMotion(device_id, source_id, x, y, pressure); +} + +static void +HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll) +{ + SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL); +} + +static void +AddTouchDevice(int device_id) +{ + if (SDL_AddTouch(device_id, "") < 0) + SDL_SetError("Error: can't add touch %s, %d", __FILE__, __LINE__); +} + +static void +HandleTouchEvent(MirTouchEvent const* touch, int device_id, SDL_Window* sdl_window) +{ + int i, point_count; + point_count = MIR_mir_touch_event_point_count(touch); + + AddTouchDevice(device_id); + + for (i = 0; i < point_count; i++) { + int id = MIR_mir_touch_event_id(touch, i); + + int width = sdl_window->w; + int height = sdl_window->h; + + float x = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_x); + float y = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_y); + + float n_x = x / width; + float n_y = y / height; + + float pressure = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_pressure); + + switch (MIR_mir_touch_event_action(touch, i)) { + case mir_touch_action_up: + HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure); + break; + case mir_touch_action_down: + HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure); + break; + case mir_touch_action_change: + HandleTouchMotion(device_id, id, n_x, n_y, pressure); + break; + case mir_touch_actions: + break; + } + } +} + +static void +HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) +{ + SDL_SetMouseFocus(sdl_window); + + switch (MIR_mir_pointer_event_action(pointer)) { + case mir_pointer_action_button_down: + HandleMouseButton(sdl_window, SDL_PRESSED, pointer); + break; + case mir_pointer_action_button_up: + HandleMouseButton(sdl_window, SDL_RELEASED, pointer); + break; + case mir_pointer_action_motion: { + int x, y; + float hscroll, vscroll; + SDL_Mouse* mouse = SDL_GetMouse(); + x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x); + y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y); + + if (mouse) { + if (mouse->relative_mode) { + int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x); + int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y); + HandleMouseMotion(sdl_window, relative_x, relative_y); + } + else if (mouse->x != x || mouse->y != y) { + HandleMouseMotion(sdl_window, x, y); + } + } + + hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll); + vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll); + if (vscroll != 0 || hscroll != 0) + HandleMouseScroll(sdl_window, hscroll, vscroll); + } + break; + case mir_pointer_action_leave: + SDL_SetMouseFocus(NULL); + break; + case mir_pointer_action_enter: + default: + break; + } +} + +static void +HandleInput(MirInputEvent const* input_event, SDL_Window* window) +{ + switch (MIR_mir_input_event_get_type(input_event)) { + case (mir_input_event_type_key): + HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window); + break; + case (mir_input_event_type_pointer): + HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window); + break; + case (mir_input_event_type_touch): + HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event), + MIR_mir_input_event_get_device_id(input_event), + window); + break; + default: + break; + } +} + +static void +HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) +{ + int new_w = MIR_mir_resize_event_get_width (resize_event); + int new_h = MIR_mir_resize_event_get_height(resize_event); + + int old_w = window->w; + int old_h = window->h; + + if (new_w != old_w || new_h != old_h) + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); +} + +static void +HandleWindow(MirWindowEvent const* event, SDL_Window* window) +{ + MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event); + int value = MIR_mir_window_event_get_attribute_value(event); + + if (attrib == mir_window_attrib_focus) { + if (value == mir_window_focus_state_focused) { + SDL_SetKeyboardFocus(window); + } + else if (value == mir_window_focus_state_unfocused) { + SDL_SetKeyboardFocus(NULL); + } + } +} + +static void +MIR_HandleClose(SDL_Window* window) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +void +MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context) +{ + MirEventType event_type = MIR_mir_event_get_type(ev); + SDL_Window* window = (SDL_Window*)context; + + if (window) { + switch (event_type) { + case (mir_event_type_input): + HandleInput(MIR_mir_event_get_input_event(ev), window); + break; + case (mir_event_type_resize): + HandleResize(MIR_mir_event_get_resize_event(ev), window); + break; + case (mir_event_type_window): + HandleWindow(MIR_mir_event_get_window_event(ev), window); + break; + case (mir_event_type_close_window): + MIR_HandleClose(window); + break; + default: + break; + } + } +} + +#endif /* SDL_VIDEO_DRIVER_MIR */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.h index 3e0d96625f..4b0f209cdd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,15 +23,15 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirevents_h -#define _SDL_mirevents_h +#ifndef SDL_mirevents_h_ +#define SDL_mirevents_h_ #include extern void -MIR_HandleInput(MirSurface* surface, MirEvent const* ev, void* context); +MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context); -#endif /* _SDL_mirevents_h */ +#endif /* SDL_mirevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.c similarity index 69% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.c rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.c index 53e6056ff7..d678fff1fd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.c +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,39 +33,18 @@ #include "SDL_mirdyn.h" -static const Uint32 mir_pixel_format_to_sdl_format[] = { - SDL_PIXELFORMAT_UNKNOWN, /* mir_pixel_format_invalid */ - SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */ - SDL_PIXELFORMAT_BGR888, /* mir_pixel_format_xbgr_8888 */ - SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */ - SDL_PIXELFORMAT_RGB888, /* mir_pixel_format_xrgb_8888 */ - SDL_PIXELFORMAT_BGR24 /* mir_pixel_format_bgr_888 */ -}; - -Uint32 -MIR_GetSDLPixelFormat(MirPixelFormat format) -{ - return mir_pixel_format_to_sdl_format[format]; -} - int MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, void** pixels, int* pitch) { MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window; - MirSurfaceParameters surfaceparm; mir_data->software = SDL_TRUE; if (MIR_CreateWindow(_this, window) < 0) - return SDL_SetError("Failed to created a mir window."); - - mir_window = window->driverdata; + return SDL_SetError("Failed to create a mir window."); - MIR_mir_surface_get_parameters(mir_window->surface, &surfaceparm); - - *format = MIR_GetSDLPixelFormat(surfaceparm.pixel_format); + *format = MIR_GetSDLPixelFormat(mir_data->pixel_format); if (*format == SDL_PIXELFORMAT_UNKNOWN) return SDL_SetError("Unknown pixel format"); @@ -75,12 +54,6 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, if (*pixels == NULL) return SDL_OutOfMemory(); - mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm); - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); - } - return 0; } @@ -91,12 +64,14 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, MIR_Window* mir_window = window->driverdata; MirGraphicsRegion region; + MirBufferStream* bs; int i, j, x, y, w, h, start; int bytes_per_pixel, bytes_per_row, s_stride, d_stride; char* s_dest; char* pixels; - MIR_mir_surface_get_graphics_region(mir_window->surface, ®ion); + bs = MIR_mir_window_get_buffer_stream(mir_window->window); + MIR_mir_buffer_stream_get_graphics_region(bs, ®ion); s_dest = region.vaddr; pixels = (char*)window->surface->pixels; @@ -138,13 +113,13 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, bytes_per_row = bytes_per_pixel * w; for (j = 0; j < h; j++) { - memcpy(s_dest, pixels, bytes_per_row); + SDL_memcpy(s_dest, pixels, bytes_per_row); pixels += s_stride; s_dest += d_stride; } } - MIR_mir_surface_swap_buffers_sync(mir_window->surface); + MIR_mir_buffer_stream_swap_buffers_sync(bs); return 0; } diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.h index 22a579c03c..502337c32f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirframebuffer.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirframebuffer_h -#define _SDL_mirframebuffer_h +#ifndef SDL_mirframebuffer_h_ +#define SDL_mirframebuffer_h_ #include "../SDL_sysvideo.h" @@ -41,7 +41,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window, extern void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window); -#endif /* _SDL_mirframebuffer_h */ +#endif /* SDL_mirframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.c new file mode 100644 index 0000000000..5f6e38c9d4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.c @@ -0,0 +1,292 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Contributed by Brandon Schaefer, +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MIR + +#include "../../events/SDL_mouse_c.h" +#include "../SDL_sysvideo.h" +#include "SDL_assert.h" + +#include "SDL_mirdyn.h" + +#include "SDL_mirvideo.h" +#include "SDL_mirmouse.h" +#include "SDL_mirwindow.h" + +typedef struct +{ + MirCursorConfiguration* conf; + MirBufferStream* stream; + char const* name; +} MIR_Cursor; + +static SDL_Cursor* +MIR_CreateDefaultCursor() +{ + SDL_Cursor* cursor; + + cursor = SDL_calloc(1, sizeof(SDL_Cursor)); + if (cursor) { + + MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor)); + if (mir_cursor) { + mir_cursor->conf = NULL; + mir_cursor->stream = NULL; + mir_cursor->name = NULL; + cursor->driverdata = mir_cursor; + } + else { + SDL_OutOfMemory(); + SDL_free(cursor); + cursor = NULL; + } + } + else { + SDL_OutOfMemory(); + } + + return cursor; +} + +static void +CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream) +{ + char* dest, *pixels; + int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row; + + MirGraphicsRegion region; + MIR_mir_buffer_stream_get_graphics_region(stream, ®ion); + + s_w = surface->w; + s_h = surface->h; + + bytes_per_pixel = surface->format->BytesPerPixel; + bytes_per_row = bytes_per_pixel * s_w; + + dest = region.vaddr; + pixels = (char*)surface->pixels; + + r_stride = region.stride; + p_stride = surface->pitch; + + for (i = 0; i < s_h; i++) + { + SDL_memcpy(dest, pixels, bytes_per_row); + dest += r_stride; + pixels += p_stride; + } +} + +static SDL_Cursor* +MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) +{ + MirCursorConfiguration* conf; + MirBufferStream* stream; + + int s_w = surface->w; + int s_h = surface->h; + + MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata; + SDL_Cursor* cursor = MIR_CreateDefaultCursor(); + MIR_Cursor* mir_cursor; + + if (!cursor) { + return NULL; + } + + mir_cursor = (MIR_Cursor*)cursor->driverdata; + + stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection, + s_w, s_h, mir_data->pixel_format, + mir_buffer_usage_software); + + conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y); + + CopySurfacePixelsToMirStream(surface, stream); + MIR_mir_buffer_stream_swap_buffers_sync(stream); + + mir_cursor->conf = conf; + mir_cursor->stream = stream; + + return cursor; +} + +static SDL_Cursor* +MIR_CreateSystemCursor(SDL_SystemCursor id) +{ + char const* cursor_name = NULL; + SDL_Cursor* cursor; + MIR_Cursor* mir_cursor; + + switch(id) { + case SDL_SYSTEM_CURSOR_ARROW: + cursor_name = MIR_mir_arrow_cursor_name; + break; + case SDL_SYSTEM_CURSOR_IBEAM: + cursor_name = MIR_mir_caret_cursor_name; + break; + case SDL_SYSTEM_CURSOR_WAIT: + cursor_name = MIR_mir_busy_cursor_name; + break; + case SDL_SYSTEM_CURSOR_CROSSHAIR: + /* Unsupported */ + cursor_name = MIR_mir_arrow_cursor_name; + break; + case SDL_SYSTEM_CURSOR_WAITARROW: + cursor_name = MIR_mir_busy_cursor_name; + break; + case SDL_SYSTEM_CURSOR_SIZENWSE: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; + break; + case SDL_SYSTEM_CURSOR_SIZENESW: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; + break; + case SDL_SYSTEM_CURSOR_SIZEWE: + cursor_name = MIR_mir_horizontal_resize_cursor_name; + break; + case SDL_SYSTEM_CURSOR_SIZENS: + cursor_name = MIR_mir_vertical_resize_cursor_name; + break; + case SDL_SYSTEM_CURSOR_SIZEALL: + cursor_name = MIR_mir_omnidirectional_resize_cursor_name; + break; + case SDL_SYSTEM_CURSOR_NO: + /* Unsupported */ + cursor_name = MIR_mir_closed_hand_cursor_name; + break; + case SDL_SYSTEM_CURSOR_HAND: + cursor_name = MIR_mir_open_hand_cursor_name; + break; + default: + SDL_assert(0); + return NULL; + } + + cursor = MIR_CreateDefaultCursor(); + if (!cursor) { + return NULL; + } + + mir_cursor = (MIR_Cursor*)cursor->driverdata; + mir_cursor->name = cursor_name; + + return cursor; +} + +static void +MIR_FreeCursor(SDL_Cursor* cursor) +{ + if (cursor) { + + if (cursor->driverdata) { + MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + + if (mir_cursor->conf) + MIR_mir_cursor_configuration_destroy(mir_cursor->conf); + if (mir_cursor->stream) + MIR_mir_buffer_stream_release_sync(mir_cursor->stream); + + SDL_free(mir_cursor); + } + + SDL_free(cursor); + } +} + +static int +MIR_ShowCursor(SDL_Cursor* cursor) +{ + MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata; + MIR_Window* mir_window = mir_data->current_window; + + if (cursor && cursor->driverdata) { + if (mir_window && MIR_mir_window_is_valid(mir_window->window)) { + MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + + if (mir_cursor->name != NULL) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } + + if (mir_cursor->conf) { + MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf); + } + } + } + else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) { + MIR_mir_window_configure_cursor(mir_window->window, NULL); + } + + return 0; +} + +static void +MIR_WarpMouse(SDL_Window* window, int x, int y) +{ + SDL_Unsupported(); +} + +static int +MIR_WarpMouseGlobal(int x, int y) +{ + return SDL_Unsupported(); +} + +static int +MIR_SetRelativeMouseMode(SDL_bool enabled) +{ + return 0; +} + +/* TODO Actually implement the cursor, need to wait for mir support */ +void +MIR_InitMouse() +{ + SDL_Mouse* mouse = SDL_GetMouse(); + + mouse->CreateCursor = MIR_CreateCursor; + mouse->ShowCursor = MIR_ShowCursor; + mouse->FreeCursor = MIR_FreeCursor; + mouse->WarpMouse = MIR_WarpMouse; + mouse->WarpMouseGlobal = MIR_WarpMouseGlobal; + mouse->CreateSystemCursor = MIR_CreateSystemCursor; + mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode; + + SDL_SetDefaultCursor(MIR_CreateDefaultCursor()); +} + +void +MIR_FiniMouse() +{ +} + +#endif /* SDL_VIDEO_DRIVER_MIR */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.h index 94dd085615..de3261087e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirmouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirmouse_h -#define _SDL_mirmouse_h +#ifndef SDL_mirmouse_h_ +#define SDL_mirmouse_h_ extern void MIR_InitMouse(); @@ -32,6 +32,6 @@ MIR_InitMouse(); extern void MIR_FiniMouse(); -#endif /* _SDL_mirmouse_h */ +#endif /* SDL_mirmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.c similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.c rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.c index 23fabb2672..7795f97a64 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.c +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,12 @@ #include "SDL_mirdyn.h" -void +int MIR_GL_SwapWindow(_THIS, SDL_Window* window) { MIR_Window* mir_wind = window->driverdata; - SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); + return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); } int @@ -66,31 +66,13 @@ MIR_GL_LoadLibrary(_THIS, const char* path) { MIR_Data* mir_data = _this->driverdata; - SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection)); + SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0); SDL_EGL_ChooseConfig(_this); return 0; } -void -MIR_GL_UnloadLibrary(_THIS) -{ - SDL_EGL_UnloadLibrary(_this); -} - -void* -MIR_GL_GetProcAddress(_THIS, const char* proc) -{ - void* proc_addr = SDL_EGL_GetProcAddress(_this, proc); - - if (!proc_addr) { - SDL_SetError("Failed to find proc address!"); - } - - return proc_addr; -} - #endif /* SDL_VIDEO_DRIVER_MIR */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.h index 96bb40a6d8..2168f966c2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_miropengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_miropengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_miropengl_h -#define _SDL_miropengl_h +#ifndef SDL_miropengl_h_ +#define SDL_miropengl_h_ #include "SDL_mirwindow.h" @@ -33,8 +33,10 @@ #define MIR_GL_DeleteContext SDL_EGL_DeleteContext #define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval #define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval +#define MIR_GL_UnloadLibrary SDL_EGL_UnloadLibrary +#define MIR_GL_GetProcAddress SDL_EGL_GetProcAddress -extern void +extern int MIR_GL_SwapWindow(_THIS, SDL_Window* window); extern int @@ -46,13 +48,6 @@ MIR_GL_CreateContext(_THIS, SDL_Window* window); extern int MIR_GL_LoadLibrary(_THIS, const char* path); -extern void -MIR_GL_UnloadLibrary(_THIS); - -extern void* -MIR_GL_GetProcAddress(_THIS, const char* proc); - -#endif /* _SDL_miropengl_h */ +#endif /* SDL_miropengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirsym.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirsym.h new file mode 100644 index 0000000000..6e18b535bf --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirsym.h @@ -0,0 +1,143 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* *INDENT-OFF* */ + +#ifndef SDL_MIR_MODULE +#define SDL_MIR_MODULE(modname) +#endif + +#ifndef SDL_MIR_SYM +#define SDL_MIR_SYM(rc,fn,params) +#endif + +#ifndef SDL_MIR_SYM_CONST +#define SDL_MIR_SYM_CONST(type, name) +#endif + +SDL_MIR_MODULE(MIR_CLIENT) +SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec)) +SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface)) +SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) +SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream)) +SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection)) +SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage)) +SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name)) +SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec)) +SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width)) +SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height)) +SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width)) +SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height)) +SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width)) +SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height)) +SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type)) +SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format)) +SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name)) +SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec)) +SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params)) +SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window)) +SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y)) +SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage)) +SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(int,mir_keyboard_event_scan_code,(MirKeyboardEvent const *event)) +SDL_MIR_SYM(bool,mir_pointer_event_button_state,(MirPointerEvent const *event, MirPointerButton button)) +SDL_MIR_SYM(MirPointerButtons,mir_pointer_event_buttons,(MirPointerEvent const *event)) +SDL_MIR_SYM(MirInputDeviceId,mir_input_event_get_device_id,(MirInputEvent const* ev)) +SDL_MIR_SYM(MirTouchId,mir_touch_event_id,(MirTouchEvent const *event, size_t touch_index)) +SDL_MIR_SYM(float,mir_touch_event_axis_value,(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis)) +SDL_MIR_SYM(MirTouchAction,mir_touch_event_action,(MirTouchEvent const *event, size_t touch_index)) +SDL_MIR_SYM(MirPointerAction,mir_pointer_event_action,(MirPointerEvent const *event)) +SDL_MIR_SYM(float,mir_pointer_event_axis_value,(MirPointerEvent const *event, MirPointerAxis)) +SDL_MIR_SYM(MirEventType,mir_event_get_type,(MirEvent const *event)) +SDL_MIR_SYM(MirInputEventType,mir_input_event_get_type,(MirInputEvent const *event)) +SDL_MIR_SYM(MirInputEvent const*,mir_event_get_input_event,(MirEvent const *event)) +SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *event)) +SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event)) +SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event)) +SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event)) +SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event)) +SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event)) +SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats)) +SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection)) +SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection)) +SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection)) +SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig)) +SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name)) +SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window)) +SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window)) +SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window)) +SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream)) +SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf)) +SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf)) +SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event)) +SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event)) +SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection)) +SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event)) +SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event)) +SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection)) +SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config)) +SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config)) +SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index)) +SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output)) +SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output)) +SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output)) +SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output)) +SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output)) +SDL_MIR_SYM(bool,mir_output_is_enabled,(MirOutput const* output)) +SDL_MIR_SYM(MirOutputConnectionState,mir_output_get_connection_state,(MirOutput const* output)) +SDL_MIR_SYM(size_t,mir_output_get_preferred_mode_index,(MirOutput const* output)) +SDL_MIR_SYM(MirOutputType,mir_output_get_type,(MirOutput const* output)) +SDL_MIR_SYM(char const*,mir_output_type_name,(MirOutputType type)) +SDL_MIR_SYM(void,mir_output_set_current_mode,(MirOutput* output, MirOutputMode const* mode)) +SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, size_t index)) +SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode)) +SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode)) +SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode)) +SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output)) +SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output)) +SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size)) +SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size)) + +SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_arrow_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_caret_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_vertical_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_horizontal_resize_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_open_hand_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_closed_hand_cursor_name) +SDL_MIR_SYM_CONST(char const*,mir_disabled_cursor_name) + +SDL_MIR_MODULE(XKBCOMMON) +SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size)) + +#undef SDL_MIR_MODULE +#undef SDL_MIR_SYM +#undef SDL_MIR_SYM_CONST + +/* *INDENT-ON* */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.c new file mode 100644 index 0000000000..8f3a368cfc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.c @@ -0,0 +1,423 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Contributed by Brandon Schaefer, +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MIR + +#include "SDL_assert.h" +#include "SDL_log.h" + +#include "SDL_mirwindow.h" +#include "SDL_video.h" + +#include "SDL_mirframebuffer.h" +#include "SDL_mirmouse.h" +#include "SDL_miropengl.h" +#include "SDL_mirvideo.h" +#include "SDL_mirvulkan.h" + +#include "SDL_mirdyn.h" + +#define MIR_DRIVER_NAME "mir" + +static const Uint32 mir_pixel_format_to_sdl_format[] = { + SDL_PIXELFORMAT_UNKNOWN, /* mir_pixel_format_invalid */ + SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */ + SDL_PIXELFORMAT_BGR888, /* mir_pixel_format_xbgr_8888 */ + SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */ + SDL_PIXELFORMAT_RGB888, /* mir_pixel_format_xrgb_8888 */ + SDL_PIXELFORMAT_BGR24, /* mir_pixel_format_bgr_888 */ + SDL_PIXELFORMAT_RGB24, /* mir_pixel_format_rgb_888 */ + SDL_PIXELFORMAT_RGB565, /* mir_pixel_format_rgb_565 */ + SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */ + SDL_PIXELFORMAT_RGBA4444 /* mir_pixel_format_rgba_4444 */ +}; + +Uint32 +MIR_GetSDLPixelFormat(MirPixelFormat format) +{ + return mir_pixel_format_to_sdl_format[format]; +} + +static int +MIR_VideoInit(_THIS); + +static void +MIR_VideoQuit(_THIS); + +static int +MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect); + +static void +MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display); + +static int +MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode); + +static SDL_WindowShaper* +MIR_CreateShaper(SDL_Window* window) +{ + /* FIXME Im not sure if mir support this atm, will have to come back to this */ + return NULL; +} + +static int +MIR_SetWindowShape(SDL_WindowShaper* shaper, SDL_Surface* shape, SDL_WindowShapeMode* shape_mode) +{ + return SDL_Unsupported(); +} + +static int +MIR_ResizeWindowShape(SDL_Window* window) +{ + return SDL_Unsupported(); +} + +static int +MIR_Available() +{ + int available = 0; + + if (SDL_MIR_LoadSymbols()) { + + /* Lets ensure we can connect to the mir server */ + MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); + + if (!MIR_mir_connection_is_valid(connection)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s", + MIR_mir_connection_get_error_message(connection)); + + return available; + } + + MIR_mir_connection_release(connection); + + available = 1; + SDL_MIR_UnloadSymbols(); + } + + return available; +} + +static void +MIR_DeleteDevice(SDL_VideoDevice* device) +{ + SDL_free(device); + SDL_MIR_UnloadSymbols(); +} + +static void +MIR_PumpEvents(_THIS) +{ +} + +static SDL_VideoDevice* +MIR_CreateDevice(int device_index) +{ + MIR_Data* mir_data; + SDL_VideoDevice* device = NULL; + + if (!SDL_MIR_LoadSymbols()) { + return NULL; + } + + device = SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (!device) { + SDL_MIR_UnloadSymbols(); + SDL_OutOfMemory(); + return NULL; + } + + mir_data = SDL_calloc(1, sizeof(MIR_Data)); + if (!mir_data) { + SDL_free(device); + SDL_MIR_UnloadSymbols(); + SDL_OutOfMemory(); + return NULL; + } + + device->driverdata = mir_data; + + /* mirvideo */ + device->VideoInit = MIR_VideoInit; + device->VideoQuit = MIR_VideoQuit; + device->GetDisplayBounds = MIR_GetDisplayBounds; + device->GetDisplayModes = MIR_GetDisplayModes; + device->SetDisplayMode = MIR_SetDisplayMode; + device->free = MIR_DeleteDevice; + + /* miropengles */ + device->GL_SwapWindow = MIR_GL_SwapWindow; + device->GL_MakeCurrent = MIR_GL_MakeCurrent; + device->GL_CreateContext = MIR_GL_CreateContext; + device->GL_DeleteContext = MIR_GL_DeleteContext; + device->GL_LoadLibrary = MIR_GL_LoadLibrary; + device->GL_UnloadLibrary = MIR_GL_UnloadLibrary; + device->GL_GetSwapInterval = MIR_GL_GetSwapInterval; + device->GL_SetSwapInterval = MIR_GL_SetSwapInterval; + device->GL_GetProcAddress = MIR_GL_GetProcAddress; + + /* mirwindow */ + device->CreateSDLWindow = MIR_CreateWindow; + device->DestroyWindow = MIR_DestroyWindow; + device->GetWindowWMInfo = MIR_GetWindowWMInfo; + device->SetWindowFullscreen = MIR_SetWindowFullscreen; + device->MaximizeWindow = MIR_MaximizeWindow; + device->MinimizeWindow = MIR_MinimizeWindow; + device->RestoreWindow = MIR_RestoreWindow; + device->ShowWindow = MIR_RestoreWindow; + device->HideWindow = MIR_HideWindow; + device->SetWindowSize = MIR_SetWindowSize; + device->SetWindowMinimumSize = MIR_SetWindowMinimumSize; + device->SetWindowMaximumSize = MIR_SetWindowMaximumSize; + device->SetWindowTitle = MIR_SetWindowTitle; + device->SetWindowGrab = MIR_SetWindowGrab; + device->SetWindowGammaRamp = MIR_SetWindowGammaRamp; + device->GetWindowGammaRamp = MIR_GetWindowGammaRamp; + + device->CreateSDLWindowFrom = NULL; + device->SetWindowIcon = NULL; + device->RaiseWindow = NULL; + device->SetWindowBordered = NULL; + device->SetWindowResizable = NULL; + device->OnWindowEnter = NULL; + device->SetWindowPosition = NULL; + + /* mirframebuffer */ + device->CreateWindowFramebuffer = MIR_CreateWindowFramebuffer; + device->UpdateWindowFramebuffer = MIR_UpdateWindowFramebuffer; + device->DestroyWindowFramebuffer = MIR_DestroyWindowFramebuffer; + + device->shape_driver.CreateShaper = MIR_CreateShaper; + device->shape_driver.SetWindowShape = MIR_SetWindowShape; + device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape; + + device->PumpEvents = MIR_PumpEvents; + + device->SuspendScreenSaver = NULL; + + device->StartTextInput = NULL; + device->StopTextInput = NULL; + device->SetTextInputRect = NULL; + + device->HasScreenKeyboardSupport = NULL; + device->ShowScreenKeyboard = NULL; + device->HideScreenKeyboard = NULL; + device->IsScreenKeyboardShown = NULL; + + device->SetClipboardText = NULL; + device->GetClipboardText = NULL; + device->HasClipboardText = NULL; + + device->ShowMessageBox = NULL; + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface; +#endif + + return device; +} + +VideoBootStrap MIR_bootstrap = { + MIR_DRIVER_NAME, "SDL Mir video driver", + MIR_Available, MIR_CreateDevice +}; + +static SDL_DisplayMode +MIR_ConvertModeToSDLMode(MirOutputMode const* mode, MirPixelFormat format) +{ + SDL_DisplayMode sdl_mode = { + .format = MIR_GetSDLPixelFormat(format), + .w = MIR_mir_output_mode_get_width(mode), + .h = MIR_mir_output_mode_get_height(mode), + .refresh_rate = MIR_mir_output_mode_get_refresh_rate(mode), + .driverdata = NULL + }; + + return sdl_mode; +} + +static void +MIR_AddModeToDisplay(SDL_VideoDisplay* display, MirOutputMode const* mode, MirPixelFormat format) +{ + SDL_DisplayMode sdl_mode = MIR_ConvertModeToSDLMode(mode, format); + SDL_AddDisplayMode(display, &sdl_mode); +} + +static void +MIR_InitDisplayFromOutput(_THIS, MirOutput* output) +{ + SDL_VideoDisplay display; + int m; + + MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output); + int num_modes = MIR_mir_output_get_num_modes(output); + SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format); + + SDL_zero(display); + + // Unfortunate cast, but SDL_AddVideoDisplay will strdup this pointer so its read-only in this case. + display.name = (char*)MIR_mir_output_type_name(MIR_mir_output_get_type(output)); + + for (m = 0; m < num_modes; m++) { + MirOutputMode const* mode = MIR_mir_output_get_mode(output, m); + MIR_AddModeToDisplay(&display, mode, format); + } + + display.desktop_mode = current_mode; + display.current_mode = current_mode; + + display.driverdata = output; + SDL_AddVideoDisplay(&display); +} + +static void +MIR_InitDisplays(_THIS) +{ + MIR_Data* mir_data = _this->driverdata; + int num_outputs = MIR_mir_display_config_get_num_outputs(mir_data->display_config); + int d; + + for (d = 0; d < num_outputs; d++) { + MirOutput* output = MIR_mir_display_config_get_mutable_output(mir_data->display_config, d); + SDL_bool enabled = MIR_mir_output_is_enabled(output); + MirOutputConnectionState state = MIR_mir_output_get_connection_state(output); + + if (enabled && state == mir_output_connection_state_connected) { + MIR_InitDisplayFromOutput(_this, output); + } + } +} + +static int +MIR_VideoInit(_THIS) +{ + MIR_Data* mir_data = _this->driverdata; + + mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); + mir_data->current_window = NULL; + mir_data->software = SDL_FALSE; + mir_data->pixel_format = mir_pixel_format_invalid; + + if (!MIR_mir_connection_is_valid(mir_data->connection)) { + return SDL_SetError("Failed to connect to the mir server: %s", + MIR_mir_connection_get_error_message(mir_data->connection)); + } + + mir_data->display_config = MIR_mir_connection_create_display_configuration(mir_data->connection); + + MIR_InitDisplays(_this); + MIR_InitMouse(); + + return 0; +} + +static void +MIR_CleanUpDisplayConfig(_THIS) +{ + MIR_Data* mir_data = _this->driverdata; + int i; + + // SDL_VideoQuit frees the display driverdata, we own it not them + for (i = 0; i < _this->num_displays; ++i) { + _this->displays[i].driverdata = NULL; + } + + MIR_mir_display_config_release(mir_data->display_config); +} + +static void +MIR_VideoQuit(_THIS) +{ + MIR_Data* mir_data = _this->driverdata; + + MIR_CleanUpDisplayConfig(_this); + + MIR_FiniMouse(); + + MIR_GL_DeleteContext(_this, NULL); + MIR_GL_UnloadLibrary(_this); + + MIR_mir_connection_release(mir_data->connection); + + SDL_free(mir_data); + _this->driverdata = NULL; +} + +static int +MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect) +{ + MirOutput const* output = display->driverdata; + + rect->x = MIR_mir_output_get_position_x(output); + rect->y = MIR_mir_output_get_position_y(output); + rect->w = display->current_mode.w; + rect->h = display->current_mode.h; + + return 0; +} + +static void +MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* display) +{ +} + +static int +MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* display, SDL_DisplayMode* mode) +{ + int m; + MirOutput* output = display->driverdata; + int num_modes = MIR_mir_output_get_num_modes(output); + Uint32 sdl_format = MIR_GetSDLPixelFormat( + MIR_mir_output_get_current_pixel_format(output)); + + for (m = 0; m < num_modes; m++) { + MirOutputMode const* mir_mode = MIR_mir_output_get_mode(output, m); + int width = MIR_mir_output_mode_get_width(mir_mode); + int height = MIR_mir_output_mode_get_height(mir_mode); + double refresh_rate = MIR_mir_output_mode_get_refresh_rate(mir_mode); + + if (mode->format == sdl_format && + mode->w == width && + mode->h == height && + mode->refresh_rate == refresh_rate) { + + // FIXME Currently wont actually *set* anything. Need to wait for applying display changes + MIR_mir_output_set_current_mode(output, mir_mode); + return 0; + } + } + + return -1; +} + +#endif /* SDL_VIDEO_DRIVER_MIR */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.h index c5ef4758db..6850bac527 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,19 +23,27 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirvideo_h_ -#define _SDL_mirvideo_h_ +#ifndef SDL_mirvideo_h__ +#define SDL_mirvideo_h__ #include #include +#include "SDL_stdinc.h" + +typedef struct MIR_Window MIR_Window; typedef struct { - MirConnection* connection; - SDL_bool software; - + MirConnection* connection; + MirDisplayConfig* display_config; + MIR_Window* current_window; + SDL_bool software; + MirPixelFormat pixel_format; } MIR_Data; -#endif /* _SDL_mirvideo_h_ */ +extern Uint32 +MIR_GetSDLPixelFormat(MirPixelFormat format); + +#endif /* SDL_mirvideo_h__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.c new file mode 100644 index 0000000000..6ba3fa3cd5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +#include "SDL_mirvideo.h" +#include "SDL_mirwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_mirvulkan.h" +#include "SDL_syswm.h" + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMIRSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(Uint32 i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasMIRSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasMIRSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void MIR_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForMir[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForMir), + extensionsForMir); +} + +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + MIR_Window *windowData = (MIR_Window *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR = + (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMirSurfaceKHR"); + VkMirSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateMirSurfaceKHR) + { + SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.connection = windowData->mir_data->connection; + createInfo.mirSurface = windowData->window; + result = vkCreateMirSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateMirSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.h new file mode 100644 index 0000000000..6f40d5b508 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_mirvulkan_h_ +#define SDL_mirvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path); +void MIR_Vulkan_UnloadLibrary(_THIS); +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_mirvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.c b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.c new file mode 100644 index 0000000000..80877eef48 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.c @@ -0,0 +1,374 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + Contributed by Brandon Schaefer, +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_MIR + +#include "../SDL_egl_c.h" +#include "../SDL_sysvideo.h" +#include "../../events/SDL_keyboard_c.h" + +#include "SDL_mirevents.h" +#include "SDL_mirwindow.h" + +#include "SDL_mirdyn.h" + +static int +IsMirWindowValid(MIR_Window* mir_window) +{ + if (!MIR_mir_window_is_valid(mir_window->window)) { + const char* error = MIR_mir_window_get_error_message(mir_window->window); + return SDL_SetError("Failed to create a mir surface: %s", error); + } + + return 1; +} + +static MirPixelFormat +FindValidPixelFormat(MIR_Data* mir_data) +{ + unsigned int pf_size = 32; + unsigned int valid_formats; + unsigned int f; + + MirPixelFormat formats[pf_size]; + MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats, + pf_size, &valid_formats); + + for (f = 0; f < valid_formats; f++) { + MirPixelFormat cur_pf = formats[f]; + + if (cur_pf == mir_pixel_format_abgr_8888 || + cur_pf == mir_pixel_format_xbgr_8888 || + cur_pf == mir_pixel_format_argb_8888 || + cur_pf == mir_pixel_format_xrgb_8888) { + + return cur_pf; + } + } + + return mir_pixel_format_invalid; +} + +int +MIR_CreateWindow(_THIS, SDL_Window* window) +{ + MIR_Window* mir_window; + MIR_Data* mir_data; + MirPixelFormat pixel_format; + MirBufferUsage buffer_usage; + + MirWindowSpec* spec; + + mir_window = SDL_calloc(1, sizeof(MIR_Window)); + if (!mir_window) + return SDL_OutOfMemory(); + + mir_data = _this->driverdata; + window->driverdata = mir_window; + + if (window->x == SDL_WINDOWPOS_UNDEFINED) + window->x = 0; + + if (window->y == SDL_WINDOWPOS_UNDEFINED) + window->y = 0; + + mir_window->mir_data = mir_data; + mir_window->sdl_window = window; + + if (window->flags & SDL_WINDOW_OPENGL) { + pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection, + _this->egl_data->egl_display, + _this->egl_data->egl_config); + } + else { + pixel_format = FindValidPixelFormat(mir_data); + } + + mir_data->pixel_format = pixel_format; + if (pixel_format == mir_pixel_format_invalid) { + return SDL_SetError("Failed to find a valid pixel format."); + } + + buffer_usage = mir_buffer_usage_hardware; + if (mir_data->software) + buffer_usage = mir_buffer_usage_software; + + spec = MIR_mir_create_normal_window_spec(mir_data->connection, + window->w, + window->h); + + MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage); + MIR_mir_window_spec_set_name(spec, "Mir surface"); + MIR_mir_window_spec_set_pixel_format(spec, pixel_format); + + if (window->flags & SDL_WINDOW_INPUT_FOCUS) + SDL_SetKeyboardFocus(window); + + mir_window->window = MIR_mir_create_window_sync(spec); + MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window); + + MIR_mir_window_spec_release(spec); + + if (!MIR_mir_window_is_valid(mir_window->window)) { + return SDL_SetError("Failed to create a mir surface: %s", + MIR_mir_window_get_error_message(mir_window->window)); + } + + if (window->flags & SDL_WINDOW_OPENGL) { + EGLNativeWindowType egl_native_window = + (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window( + MIR_mir_window_get_buffer_stream(mir_window->window)); + + mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window); + + if (mir_window->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("Failed to create a window surface %p", + _this->egl_data->egl_display); + } + } + else { + mir_window->egl_surface = EGL_NO_SURFACE; + } + + mir_data->current_window = mir_window; + + return 0; +} + +void +MIR_DestroyWindow(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + + if (mir_data) { + SDL_EGL_DestroySurface(_this, mir_window->egl_surface); + MIR_mir_window_release_sync(mir_window->window); + + mir_data->current_window = NULL; + + SDL_free(mir_window); + } + window->driverdata = NULL; +} + +SDL_bool +MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) +{ + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { + MIR_Window* mir_window = window->driverdata; + + info->subsystem = SDL_SYSWM_MIR; + info->info.mir.connection = mir_window->mir_data->connection; + // Cannot change this to window due to it being in the public API + info->info.mir.surface = mir_window->window; + + return SDL_TRUE; + } + + return SDL_FALSE; +} + +static void +UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state) +{ + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_state(spec, window_state); + + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } +} + +void +MIR_SetWindowFullscreen(_THIS, SDL_Window* window, + SDL_VideoDisplay* display, + SDL_bool fullscreen) +{ + if (IsMirWindowValid(window->driverdata)) { + MirWindowState state; + + if (fullscreen) { + state = mir_window_state_fullscreen; + } + else { + state = mir_window_state_restored; + } + + UpdateMirWindowState(_this->driverdata, window->driverdata, state); + } +} + +void +MIR_MaximizeWindow(_THIS, SDL_Window* window) +{ + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized); +} + +void +MIR_MinimizeWindow(_THIS, SDL_Window* window) +{ + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized); +} + +void +MIR_RestoreWindow(_THIS, SDL_Window * window) +{ + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored); +} + +void +MIR_HideWindow(_THIS, SDL_Window* window) +{ + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden); +} + +void +MIR_SetWindowSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_width (spec, window->w); + MIR_mir_window_spec_set_height(spec, window->h); + + MIR_mir_window_apply_spec(mir_window->window, spec); + } +} + +void +MIR_SetWindowMinimumSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_min_width (spec, window->min_w); + MIR_mir_window_spec_set_min_height(spec, window->min_h); + + MIR_mir_window_apply_spec(mir_window->window, spec); + } +} + +void +MIR_SetWindowMaximumSize(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_max_width (spec, window->max_w); + MIR_mir_window_spec_set_max_height(spec, window->max_h); + + MIR_mir_window_apply_spec(mir_window->window, spec); + } +} + +void +MIR_SetWindowTitle(_THIS, SDL_Window* window) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + char const* title = window->title ? window->title : ""; + MirWindowSpec* spec; + + if (IsMirWindowValid(mir_window) < 0) + return; + + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_name(spec, title); + + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); +} + +void +MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed) +{ + MIR_Data* mir_data = _this->driverdata; + MIR_Window* mir_window = window->driverdata; + MirPointerConfinementState confined = mir_pointer_unconfined; + MirWindowSpec* spec; + + if (grabbed) + confined = mir_pointer_confined_to_window; + + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_pointer_confinement(spec, confined); + + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); +} + +int +MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp) +{ + MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata; + Uint32 ramp_size = 256; + + // FIXME Need to apply the changes to the output, once that public API function is around + if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) { + MIR_mir_output_set_gamma(output, + ramp + ramp_size * 0, + ramp + ramp_size * 1, + ramp + ramp_size * 2, + ramp_size); + return 0; + } + + return -1; +} + +int +MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp) +{ + MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata; + Uint32 ramp_size = 256; + + if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) { + if (MIR_mir_output_get_gamma_size(output) == ramp_size) { + MIR_mir_output_get_gamma(output, + ramp + ramp_size * 0, + ramp + ramp_size * 1, + ramp + ramp_size * 2, + ramp_size); + return 0; + } + } + + return -1; +} + +#endif /* SDL_VIDEO_DRIVER_MIR */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.h b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.h similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.h rename to 3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.h index c21fc92921..af618f50c7 100644 --- a/3rdparty/sdl2-2.0.4/src/video/mir/SDL_mirwindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/mir/SDL_mirwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,21 +23,21 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirwindow_h -#define _SDL_mirwindow_h +#ifndef SDL_mirwindow_h_ +#define SDL_mirwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" #include "SDL_mirvideo.h" -typedef struct { +struct MIR_Window { SDL_Window* sdl_window; - MIR_Data* mir_data; + MIR_Data* mir_data; - MirSurface* surface; - EGLSurface egl_surface; -} MIR_Window; + MirWindow* window; + EGLSurface egl_surface; +}; extern int @@ -60,10 +60,34 @@ MIR_MinimizeWindow(_THIS, SDL_Window* window); extern void MIR_RestoreWindow(_THIS, SDL_Window* window); +extern void +MIR_HideWindow(_THIS, SDL_Window* window); + extern SDL_bool MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info); -#endif /* _SDL_mirwindow_h */ +extern void +MIR_SetWindowSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowMinimumSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowMaximumSize(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowTitle(_THIS, SDL_Window* window); + +extern void +MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed); + +extern int +MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp); + +extern int +MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp); + +#endif /* SDL_mirwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents.c b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents.c rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents.c index d6ebbdf870..812df2bf2f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -298,7 +298,7 @@ static Uint8 SDL_NACL_translate_mouse_button(int32_t button) { return SDL_BUTTON_MIDDLE; case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: return SDL_BUTTON_RIGHT; - + case PP_INPUTEVENT_MOUSEBUTTON_NONE: default: return 0; @@ -314,14 +314,14 @@ SDL_NACL_translate_keycode(int keycode) scancode = NACL_Keycodes[keycode]; } if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list NACL KeyCode %d \n", keycode); + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list NACL KeyCode %d", keycode); } return scancode; } void NACL_PumpEvents(_THIS) { PSEvent* ps_event; - PP_Resource event; + PP_Resource event; PP_InputEvent_Type type; PP_InputEvent_Modifier modifiers; struct PP_Rect rect; @@ -329,11 +329,11 @@ void NACL_PumpEvents(_THIS) { struct PP_Point location; struct PP_Var var; const char *str; - char text[64]; + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; Uint32 str_len; SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; SDL_Mouse *mouse = SDL_GetMouse(); - + if (driverdata->window) { while ((ps_event = PSEventTryAcquire()) != NULL) { event = ps_event->as_resource; @@ -344,9 +344,9 @@ void NACL_PumpEvents(_THIS) { NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN); // FIXME: Rebuild context? See life.c UpdateContext break; - + /* From HandleInputEvent, contains an input resource. */ - case PSE_INSTANCE_HANDLEINPUT: + case PSE_INSTANCE_HANDLEINPUT: type = driverdata->ppb_input_event->GetType(event); modifiers = driverdata->ppb_input_event->GetModifiers(event); switch(type) { @@ -359,35 +359,35 @@ void NACL_PumpEvents(_THIS) { case PP_INPUTEVENT_TYPE_WHEEL: /* FIXME: GetTicks provides high resolution scroll events */ fp = driverdata->ppb_wheel_input_event->GetDelta(event); - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, (int) fp.x, (int) fp.y, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL); break; - + case PP_INPUTEVENT_TYPE_MOUSEENTER: case PP_INPUTEVENT_TYPE_MOUSELEAVE: /* FIXME: Mouse Focus */ break; - - - case PP_INPUTEVENT_TYPE_MOUSEMOVE: + + + case PP_INPUTEVENT_TYPE_MOUSEMOVE: location = driverdata->ppb_mouse_input_event->GetPosition(event); SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y); break; - + case PP_INPUTEVENT_TYPE_TOUCHSTART: case PP_INPUTEVENT_TYPE_TOUCHMOVE: case PP_INPUTEVENT_TYPE_TOUCHEND: case PP_INPUTEVENT_TYPE_TOUCHCANCEL: /* FIXME: Touch events */ break; - + case PP_INPUTEVENT_TYPE_KEYDOWN: SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_KEYUP: SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_CHAR: var = driverdata->ppb_keyboard_input_event->GetCharacterText(event); str = driverdata->ppb_var->VarToUtf8(var, &str_len); @@ -397,17 +397,17 @@ void NACL_PumpEvents(_THIS) { } SDL_strlcpy(text, str, str_len ); text[str_len] = '\0'; - + SDL_SendKeyboardText(text); /* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/ break; - + default: break; } break; - - + + /* From HandleMessage, contains a PP_Var. */ case PSE_INSTANCE_HANDLEMESSAGE: break; @@ -419,7 +419,7 @@ void NACL_PumpEvents(_THIS) { /* When the 3D context is lost, no resource. */ case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST: break; - + /* When the mouse lock is lost. */ case PSE_MOUSELOCK_MOUSELOCKLOST: break; @@ -427,7 +427,7 @@ void NACL_PumpEvents(_THIS) { default: break; } - + PSEventRelease(ps_event); } } diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents_c.h b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents_c.h similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents_c.h index 3255578c32..8059ea557a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclevents_c_h -#define _SDL_naclevents_c_h +#ifndef SDL_naclevents_c_h_ +#define SDL_naclevents_c_h_ #include "SDL_naclvideo.h" extern void NACL_PumpEvents(_THIS); -#endif /* _SDL_naclevents_c_h */ +#endif /* SDL_naclevents_c_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclglue.c b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclglue.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclglue.c rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclglue.c index 79f5b0f90b..544cc6fd50 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclglue.c +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.c b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.c rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.c index e11245135c..98b9ad3f60 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,7 +141,7 @@ int NACL_GLES_SetSwapInterval(_THIS, int interval) { /* STUB */ - return 0; + return SDL_Unsupported(); } int @@ -151,12 +151,15 @@ NACL_GLES_GetSwapInterval(_THIS) return 0; } -void +int NACL_GLES_SwapWindow(_THIS, SDL_Window * window) { SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; struct PP_CompletionCallback callback = { NULL, 0, PP_COMPLETIONCALLBACK_FLAG_NONE }; - driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ); + if (driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ) != 0) { + return SDL_SetError("SwapBuffers failed"); + } + return 0; } void diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.h b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.h index 1845e81915..744c0e5331 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclgl_h -#define _SDL_naclgl_h +#ifndef SDL_naclopengles_h_ +#define SDL_naclopengles_h_ extern int NACL_GLES_LoadLibrary(_THIS, const char *path); extern void *NACL_GLES_GetProcAddress(_THIS, const char *proc); @@ -30,9 +30,9 @@ extern SDL_GLContext NACL_GLES_CreateContext(_THIS, SDL_Window * window); extern int NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int NACL_GLES_SetSwapInterval(_THIS, int interval); extern int NACL_GLES_GetSwapInterval(_THIS); -extern void NACL_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int NACL_GLES_SwapWindow(_THIS, SDL_Window * window); extern void NACL_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_naclgl_h */ +#endif /* SDL_naclopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.c b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.c index 467155c67a..24dda2c15d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,7 +81,7 @@ static int NACL_Available(void) { static void NACL_DeleteDevice(SDL_VideoDevice *device) { SDL_VideoData *driverdata = (SDL_VideoData*) device->driverdata; driverdata->ppb_core->ReleaseResource((PP_Resource) driverdata->ppb_message_loop); - SDL_free(device->driverdata); + /* device->driverdata is not freed because it points to static memory */ SDL_free(device); } @@ -107,7 +107,7 @@ static SDL_VideoDevice *NACL_CreateDevice(int devindex) { device->VideoQuit = NACL_VideoQuit; device->PumpEvents = NACL_PumpEvents; - device->CreateWindow = NACL_CreateWindow; + device->CreateSDLWindow = NACL_CreateWindow; device->SetWindowTitle = NACL_SetWindowTitle; device->DestroyWindow = NACL_DestroyWindow; diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.h b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.h index 174a6e77ce..6986aa83ca 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclvideo_h -#define _SDL_naclvideo_h +#ifndef SDL_naclvideo_h_ +#define SDL_naclvideo_h_ #include "../SDL_sysvideo.h" #include "ppapi_simple/ps_interface.h" @@ -64,4 +64,4 @@ typedef struct SDL_VideoData { extern void NACL_SetScreenResolution(int width, int height, Uint32 format); -#endif /* _SDL_naclvideo_h */ +#endif /* SDL_naclvideo_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.c b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.c rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.c index 32d1e6d7e8..71933313cc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.c +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.h b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.h rename to 3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.h index 617bfc3abb..412b15f2e3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/nacl/SDL_naclwindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclwindow_h -#define _SDL_naclwindow_h +#ifndef SDL_naclwindow_h_ +#define SDL_naclwindow_h_ extern int NACL_CreateWindow(_THIS, SDL_Window * window); extern void NACL_SetWindowTitle(_THIS, SDL_Window * window); extern void NACL_DestroyWindow(_THIS, SDL_Window * window); -#endif /* _SDL_naclwindow_h */ +#endif /* SDL_naclwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.c b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.c rename to 3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.c index d1c35a7056..b319b164c8 100644 --- a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.c +++ b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,8 +41,6 @@ static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */ #endif -static SDL_bool PND_initialized = SDL_FALSE; - static int PND_available(void) { @@ -52,11 +50,11 @@ PND_available(void) static void PND_destroy(SDL_VideoDevice * device) { - SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; - if (device->driverdata != NULL) { + SDL_free(device->driverdata); device->driverdata = NULL; } + SDL_free(device); } static SDL_VideoDevice * @@ -93,9 +91,8 @@ PND_create() phdata->egl_initialized = SDL_TRUE; - /* Setup amount of available displays and current display */ + /* Setup amount of available displays */ device->num_displays = 0; - device->current_display = 0; /* Set device free function */ device->free = PND_destroy; @@ -105,8 +102,8 @@ PND_create() device->VideoQuit = PND_videoquit; device->GetDisplayModes = PND_getdisplaymodes; device->SetDisplayMode = PND_setdisplaymode; - device->CreateWindow = PND_createwindow; - device->CreateWindowFrom = PND_createwindowfrom; + device->CreateSDLWindow = PND_createwindow; + device->CreateSDLWindowFrom = PND_createwindowfrom; device->SetWindowTitle = PND_setwindowtitle; device->SetWindowIcon = PND_setwindowicon; device->SetWindowPosition = PND_setwindowposition; @@ -119,7 +116,9 @@ PND_create() device->RestoreWindow = PND_restorewindow; device->SetWindowGrab = PND_setwindowgrab; device->DestroyWindow = PND_destroywindow; +#if 0 device->GetWindowWMInfo = PND_getwindowwminfo; +#endif device->GL_LoadLibrary = PND_gl_loadlibrary; device->GL_GetProcAddress = PND_gl_getprocaddres; device->GL_UnloadLibrary = PND_gl_unloadlibrary; @@ -204,10 +203,6 @@ PND_createwindow(_THIS, SDL_Window * window) SDL_WindowData *wdata; - uint32_t winargc = 0; - int32_t status; - - /* Allocate window internal data */ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); if (wdata == NULL) { @@ -292,7 +287,7 @@ PND_restorewindow(_THIS, SDL_Window * window) { } void -PND_setwindowgrab(_THIS, SDL_Window * window) +PND_setwindowgrab(_THIS, SDL_Window * window, SDL_bool grabbed) { } void @@ -305,13 +300,14 @@ PND_destroywindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -319,6 +315,7 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /*****************************************************************************/ /* SDL OpenGL/OpenGL ES functions */ @@ -326,8 +323,6 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) int PND_gl_loadlibrary(_THIS, const char *path) { - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; - /* Check if OpenGL ES library is specified for GF driver */ if (path == NULL) { path = SDL_getenv("SDL_OPENGL_LIBRARY"); @@ -365,7 +360,6 @@ PND_gl_loadlibrary(_THIS, const char *path) void * PND_gl_getprocaddres(_THIS, const char *proc) { - SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; void *function_address; /* Try to get function address through the egl interface */ @@ -409,10 +403,7 @@ PND_gl_createcontext(_THIS, SDL_Window * window) { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; - SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; EGLBoolean status; - int32_t gfstatus; EGLint configs; uint32_t attr_pos; EGLint attr_value; @@ -629,12 +620,12 @@ PND_gl_createcontext(_THIS, SDL_Window * window) hNativeWnd = (NativeWindowType)malloc(16*1024); if(!hNativeWnd) - printf( "Error : Wiz framebuffer allocatation failed\n" ); + printf( "Error: Wiz framebuffer allocatation failed\n" ); else - printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd ); + printf( "SDL: Wiz framebuffer allocated: %X\n", hNativeWnd ); } else { - printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd ); + printf( "SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd ); } wdata->gles_surface = @@ -650,7 +641,7 @@ PND_gl_createcontext(_THIS, SDL_Window * window) if (wdata->gles_surface == 0) { - SDL_SetError("Error : eglCreateWindowSurface failed;\n"); + SDL_SetError("Error : eglCreateWindowSurface failed;"); return NULL; } @@ -787,18 +778,14 @@ PND_gl_getswapinterval(_THIS) return ((SDL_VideoData *) _this->driverdata)->swapinterval; } -void +int PND_gl_swapwindow(_THIS, SDL_Window * window) { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; - SDL_DisplayData *didata = - (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; - if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); - return; + return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); } /* Many applications do not uses glFinish(), so we call it for them */ @@ -808,6 +795,7 @@ PND_gl_swapwindow(_THIS, SDL_Window * window) eglWaitGL(); eglSwapBuffers(phdata->egl_display, wdata->gles_surface); + return 0; } void @@ -838,7 +826,7 @@ PND_gl_deletecontext(_THIS, SDL_GLContext context) { free(hNativeWnd); hNativeWnd = 0; - printf( "SDL13: Wiz framebuffer released\n" ); + printf( "SDL: Wiz framebuffer released\n" ); } #endif diff --git a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.h b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.h rename to 3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.h index b95cd10b16..9e460e7644 100644 --- a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora.h +++ b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,7 +77,7 @@ void PND_raisewindow(_THIS, SDL_Window * window); void PND_maximizewindow(_THIS, SDL_Window * window); void PND_minimizewindow(_THIS, SDL_Window * window); void PND_restorewindow(_THIS, SDL_Window * window); -void PND_setwindowgrab(_THIS, SDL_Window * window); +void PND_setwindowgrab(_THIS, SDL_Window * window, SDL_bool grabbed); void PND_destroywindow(_THIS, SDL_Window * window); /* Window manager function */ @@ -92,7 +92,7 @@ SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window); int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PND_gl_setswapinterval(_THIS, int interval); int PND_gl_getswapinterval(_THIS); -void PND_gl_swapwindow(_THIS, SDL_Window * window); +int PND_gl_swapwindow(_THIS, SDL_Window * window); void PND_gl_deletecontext(_THIS, SDL_GLContext context); diff --git a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.c b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.c rename to 3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.c index d22d0c759b..bff7a36b4c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.c +++ b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.h b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.h rename to 3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.h index e9f8d7cfa4..f714384cd0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/pandora/SDL_pandora_events.h +++ b/3rdparty/sdl2-2.0.9/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents.c b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents.c rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents.c index c1a095dbb6..14277b3bf1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,8 +31,8 @@ #include "../../events/SDL_keyboard_c.h" #include "SDL_pspvideo.h" #include "SDL_pspevents_c.h" -#include "SDL_thread.h" #include "SDL_keyboard.h" +#include "../../thread/SDL_systhread.h" #include #ifdef PSPIRKEYB @@ -260,12 +260,12 @@ void PSP_EventInit(_THIS) #endif /* Start thread to read data */ if((event_sem = SDL_CreateSemaphore(1)) == NULL) { - SDL_SetError("Can't create input semaphore\n"); + SDL_SetError("Can't create input semaphore"); return; } running = 1; - if((thread = SDL_CreateThread(EventUpdate, "PSPInputThread",NULL)) == NULL) { - SDL_SetError("Can't create input thread\n"); + if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) { + SDL_SetError("Can't create input thread"); return; } } diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents_c.h b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents_c.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents_c.h index e1929d2374..e98beb4a43 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl.c b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl.c rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl.c index e4f81e9ee4..644fb34e6c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl.c +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,10 +47,6 @@ int PSP_GL_LoadLibrary(_THIS, const char *path) { - if (!_this->gl_config.driver_loaded) { - _this->gl_config.driver_loaded = 1; - } - return 0; } @@ -174,10 +170,13 @@ PSP_GL_GetSwapInterval(_THIS) return _this->gl_data->swapinterval; } -void +int PSP_GL_SwapWindow(_THIS, SDL_Window * window) { - eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface); + if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) { + return SDL_SetError("eglSwapBuffers() failed"); + } + return 0; } void diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl_c.h b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl_c.h rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl_c.h index 308b027290..49300fb389 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspgl_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspgl_c_h -#define _SDL_pspgl_c_h +#ifndef SDL_pspgl_c_h_ +#define SDL_pspgl_c_h_ #include @@ -40,7 +40,7 @@ extern void * PSP_GL_GetProcAddress(_THIS, const char *proc); extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); extern void PSP_GL_SwapBuffers(_THIS); -extern void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); extern int PSP_GL_LoadLibrary(_THIS, const char *path); @@ -49,4 +49,6 @@ extern int PSP_GL_SetSwapInterval(_THIS, int interval); extern int PSP_GL_GetSwapInterval(_THIS); -#endif /* _SDL_pspgl_c_h */ +#endif /* SDL_pspgl_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse.c b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse.c rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse.c index b7c3d2b998..bd34dfaec5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse_c.h b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse_c.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse_c.h rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse_c.h index 2a3df68efb..2d2640eb09 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspmouse_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.c b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.c index 955666877e..82317793f2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,6 +92,7 @@ PSP_Create() if (gldata == NULL) { SDL_OutOfMemory(); SDL_free(device); + SDL_free(phdata); return NULL; } device->gl_data = gldata; @@ -101,7 +102,7 @@ PSP_Create() phdata->egl_initialized = SDL_TRUE; - /* Setup amount of available displays and current display */ + /* Setup amount of available displays */ device->num_displays = 0; /* Set device free function */ @@ -112,8 +113,8 @@ PSP_Create() device->VideoQuit = PSP_VideoQuit; device->GetDisplayModes = PSP_GetDisplayModes; device->SetDisplayMode = PSP_SetDisplayMode; - device->CreateWindow = PSP_CreateWindow; - device->CreateWindowFrom = PSP_CreateWindowFrom; + device->CreateSDLWindow = PSP_CreateWindow; + device->CreateSDLWindowFrom = PSP_CreateWindowFrom; device->SetWindowTitle = PSP_SetWindowTitle; device->SetWindowIcon = PSP_SetWindowIcon; device->SetWindowPosition = PSP_SetWindowPosition; @@ -126,7 +127,9 @@ PSP_Create() device->RestoreWindow = PSP_RestoreWindow; device->SetWindowGrab = PSP_SetWindowGrab; device->DestroyWindow = PSP_DestroyWindow; +#if 0 device->GetWindowWMInfo = PSP_GetWindowWMInfo; +#endif device->GL_LoadLibrary = PSP_GL_LoadLibrary; device->GL_GetProcAddress = PSP_GL_GetProcAddress; device->GL_UnloadLibrary = PSP_GL_UnloadLibrary; @@ -234,7 +237,7 @@ PSP_CreateWindow(_THIS, SDL_Window * window) int PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { - return -1; + return SDL_Unsupported(); } void @@ -290,13 +293,14 @@ PSP_DestroyWindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -304,6 +308,7 @@ PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /* TO Write Me */ diff --git a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.h b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.h index f5705a9446..741bad1edd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/psp/SDL_pspvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspvideo_h -#define _SDL_pspvideo_h +#ifndef SDL_pspvideo_h_ +#define SDL_pspvideo_h_ #include @@ -88,7 +88,7 @@ SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PSP_GL_SetSwapInterval(_THIS, int interval); int PSP_GL_GetSwapInterval(_THIS); -void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +int PSP_GL_SwapWindow(_THIS, SDL_Window * window); void PSP_GL_DeleteContext(_THIS, SDL_GLContext context); /* PSP on screen keyboard */ @@ -97,6 +97,6 @@ void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window); void PSP_HideScreenKeyboard(_THIS, SDL_Window *window); SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window); -#endif /* _SDL_pspvideo_h */ +#endif /* SDL_pspvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/qnx/gl.c b/3rdparty/sdl2-2.0.9/src/video/qnx/gl.c new file mode 100644 index 0000000000..19e1bd4f71 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/qnx/gl.c @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "sdl_qnx.h" + +static EGLDisplay egl_disp; + +/** + * Detertmines the pixel format to use based on the current display and EGL + * configuration. + * @param egl_conf EGL configuration to use + * @return A SCREEN_FORMAT* constant for the pixel format to use + */ +static int +chooseFormat(EGLConfig egl_conf) +{ + EGLint buffer_bit_depth; + EGLint alpha_bit_depth; + + eglGetConfigAttrib(egl_disp, egl_conf, EGL_BUFFER_SIZE, &buffer_bit_depth); + eglGetConfigAttrib(egl_disp, egl_conf, EGL_ALPHA_SIZE, &alpha_bit_depth); + + switch (buffer_bit_depth) { + case 32: + return SCREEN_FORMAT_RGBX8888; + case 24: + return SCREEN_FORMAT_RGB888; + case 16: + switch (alpha_bit_depth) { + case 4: + return SCREEN_FORMAT_RGBX4444; + case 1: + return SCREEN_FORMAT_RGBA5551; + default: + return SCREEN_FORMAT_RGB565; + } + default: + return 0; + } +} + +/** + * Enumerates the supported EGL configurations and chooses a suitable one. + * @param[out] pconf The chosen configuration + * @param[out] pformat The chosen pixel format + * @return 0 if successful, -1 on error + */ +int +glGetConfig(EGLConfig *pconf, int *pformat) +{ + EGLConfig egl_conf = (EGLConfig)0; + EGLConfig *egl_configs; + EGLint egl_num_configs; + EGLint val; + EGLBoolean rc; + EGLint i; + + // Determine the numbfer of configurations. + rc = eglGetConfigs(egl_disp, NULL, 0, &egl_num_configs); + if (rc != EGL_TRUE) { + return -1; + } + + if (egl_num_configs == 0) { + return -1; + } + + // Allocate enough memory for all configurations. + egl_configs = malloc(egl_num_configs * sizeof(*egl_configs)); + if (egl_configs == NULL) { + return -1; + } + + // Get the list of configurations. + rc = eglGetConfigs(egl_disp, egl_configs, egl_num_configs, + &egl_num_configs); + if (rc != EGL_TRUE) { + free(egl_configs); + return -1; + } + + // Find a good configuration. + for (i = 0; i < egl_num_configs; i++) { + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_SURFACE_TYPE, &val); + if (!(val & EGL_WINDOW_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_RENDERABLE_TYPE, &val); + if (!(val & EGL_OPENGL_ES2_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_DEPTH_SIZE, &val); + if (val == 0) { + continue; + } + + egl_conf = egl_configs[i]; + break; + } + + free(egl_configs); + *pconf = egl_conf; + *pformat = chooseFormat(egl_conf); + + return 0; +} + +/** + * Initializes the EGL library. + * @param _THIS + * @param name unused + * @return 0 if successful, -1 on error + */ +int +glLoadLibrary(_THIS, const char *name) +{ + EGLNativeDisplayType disp_id = EGL_DEFAULT_DISPLAY; + + egl_disp = eglGetDisplay(disp_id); + if (egl_disp == EGL_NO_DISPLAY) { + return -1; + } + + if (eglInitialize(egl_disp, NULL, NULL) == EGL_FALSE) { + return -1; + } + + return 0; +} + +/** + * Finds the address of an EGL extension function. + * @param proc Function name + * @return Function address + */ +void * +glGetProcAddress(_THIS, const char *proc) +{ + return eglGetProcAddress(proc); +} + +/** + * Associates the given window with the necessary EGL structures for drawing and + * displaying content. + * @param _THIS + * @param window The SDL window to create the context for + * @return A pointer to the created context, if successful, NULL on error + */ +SDL_GLContext +glCreateContext(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + EGLContext context; + EGLSurface surface; + + struct { + EGLint client_version[2]; + EGLint none; + } egl_ctx_attr = { + .client_version = { EGL_CONTEXT_CLIENT_VERSION, 2 }, + .none = EGL_NONE + }; + + struct { + EGLint render_buffer[2]; + EGLint none; + } egl_surf_attr = { + .render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER }, + .none = EGL_NONE + }; + + context = eglCreateContext(egl_disp, impl->conf, EGL_NO_CONTEXT, + (EGLint *)&egl_ctx_attr); + if (context == EGL_NO_CONTEXT) { + return NULL; + } + + surface = eglCreateWindowSurface(egl_disp, impl->conf, impl->window, + (EGLint *)&egl_surf_attr); + if (surface == EGL_NO_SURFACE) { + return NULL; + } + + eglMakeCurrent(egl_disp, surface, surface, context); + + impl->surface = surface; + return context; +} + +/** + * Sets a new value for the number of frames to display before swapping buffers. + * @param _THIS + * @param interval New interval value + * @return 0 if successful, -1 on error + */ +int +glSetSwapInterval(_THIS, int interval) +{ + if (eglSwapInterval(egl_disp, interval) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Swaps the EGL buffers associated with the given window + * @param _THIS + * @param window Window to swap buffers for + * @return 0 if successful, -1 on error + */ +int +glSwapWindow(_THIS, SDL_Window *window) +{ + /* !!! FIXME: should we migrate this all over to use SDL_egl.c? */ + window_impl_t *impl = (window_impl_t *)window->driverdata; + return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1; +} + +/** + * Makes the given context the current one for drawing operations. + * @param _THIS + * @param window SDL window associated with the context (maybe NULL) + * @param context The context to activate + * @return 0 if successful, -1 on error + */ +int +glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context) +{ + window_impl_t *impl; + EGLSurface surface = NULL; + + if (window) { + impl = (window_impl_t *)window->driverdata; + surface = impl->surface; + } + + if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Destroys a context. + * @param _THIS + * @param context The context to destroy + */ +void +glDeleteContext(_THIS, SDL_GLContext context) +{ + eglDestroyContext(egl_disp, context); +} + +/** + * Terminates access to the EGL library. + * @param _THIS + */ +void +glUnloadLibrary(_THIS) +{ + eglTerminate(egl_disp); +} diff --git a/3rdparty/sdl2-2.0.9/src/video/qnx/keyboard.c b/3rdparty/sdl2-2.0.9/src/video/qnx/keyboard.c new file mode 100644 index 0000000000..86c6395baf --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/qnx/keyboard.c @@ -0,0 +1,133 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_scancode.h" +#include "SDL_events.h" +#include "sdl_qnx.h" +#include + +/** + * A map thta translates Screen key names to SDL scan codes. + * This map is incomplete, but should include most major keys. + */ +static int key_to_sdl[] = { + [KEYCODE_SPACE] = SDL_SCANCODE_SPACE, + [KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE, + [KEYCODE_COMMA] = SDL_SCANCODE_COMMA, + [KEYCODE_MINUS] = SDL_SCANCODE_MINUS, + [KEYCODE_PERIOD] = SDL_SCANCODE_PERIOD, + [KEYCODE_SLASH] = SDL_SCANCODE_SLASH, + [KEYCODE_ZERO] = SDL_SCANCODE_0, + [KEYCODE_ONE] = SDL_SCANCODE_1, + [KEYCODE_TWO] = SDL_SCANCODE_2, + [KEYCODE_THREE] = SDL_SCANCODE_3, + [KEYCODE_FOUR] = SDL_SCANCODE_4, + [KEYCODE_FIVE] = SDL_SCANCODE_5, + [KEYCODE_SIX] = SDL_SCANCODE_6, + [KEYCODE_SEVEN] = SDL_SCANCODE_7, + [KEYCODE_EIGHT] = SDL_SCANCODE_8, + [KEYCODE_NINE] = SDL_SCANCODE_9, + [KEYCODE_SEMICOLON] = SDL_SCANCODE_SEMICOLON, + [KEYCODE_EQUAL] = SDL_SCANCODE_EQUALS, + [KEYCODE_LEFT_BRACKET] = SDL_SCANCODE_LEFTBRACKET, + [KEYCODE_BACK_SLASH] = SDL_SCANCODE_BACKSLASH, + [KEYCODE_RIGHT_BRACKET] = SDL_SCANCODE_RIGHTBRACKET, + [KEYCODE_GRAVE] = SDL_SCANCODE_GRAVE, + [KEYCODE_A] = SDL_SCANCODE_A, + [KEYCODE_B] = SDL_SCANCODE_B, + [KEYCODE_C] = SDL_SCANCODE_C, + [KEYCODE_D] = SDL_SCANCODE_D, + [KEYCODE_E] = SDL_SCANCODE_E, + [KEYCODE_F] = SDL_SCANCODE_F, + [KEYCODE_G] = SDL_SCANCODE_G, + [KEYCODE_H] = SDL_SCANCODE_H, + [KEYCODE_I] = SDL_SCANCODE_I, + [KEYCODE_J] = SDL_SCANCODE_J, + [KEYCODE_K] = SDL_SCANCODE_K, + [KEYCODE_L] = SDL_SCANCODE_L, + [KEYCODE_M] = SDL_SCANCODE_M, + [KEYCODE_N] = SDL_SCANCODE_N, + [KEYCODE_O] = SDL_SCANCODE_O, + [KEYCODE_P] = SDL_SCANCODE_P, + [KEYCODE_Q] = SDL_SCANCODE_Q, + [KEYCODE_R] = SDL_SCANCODE_R, + [KEYCODE_S] = SDL_SCANCODE_S, + [KEYCODE_T] = SDL_SCANCODE_T, + [KEYCODE_U] = SDL_SCANCODE_U, + [KEYCODE_V] = SDL_SCANCODE_V, + [KEYCODE_W] = SDL_SCANCODE_W, + [KEYCODE_X] = SDL_SCANCODE_X, + [KEYCODE_Y] = SDL_SCANCODE_Y, + [KEYCODE_Z] = SDL_SCANCODE_Z, + [KEYCODE_UP] = SDL_SCANCODE_UP, + [KEYCODE_DOWN] = SDL_SCANCODE_DOWN, + [KEYCODE_LEFT] = SDL_SCANCODE_LEFT, + [KEYCODE_PG_UP] = SDL_SCANCODE_PAGEUP, + [KEYCODE_PG_DOWN] = SDL_SCANCODE_PAGEDOWN, + [KEYCODE_RIGHT] = SDL_SCANCODE_RIGHT, + [KEYCODE_RETURN] = SDL_SCANCODE_RETURN, + [KEYCODE_TAB] = SDL_SCANCODE_TAB, + [KEYCODE_ESCAPE] = SDL_SCANCODE_ESCAPE, +}; + +/** + * Called from the event dispatcher when a keyboard event is encountered. + * Translates the event such that it can be handled by SDL. + * @param event Screen keyboard event + */ +void +handleKeyboardEvent(screen_event_t event) +{ + int val; + SDL_Scancode scancode; + + // Get the key value. + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &val) < 0) { + return; + } + + // Skip unrecognized keys. + if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) { + return; + } + + // Translate to an SDL scan code. + scancode = key_to_sdl[val]; + if (scancode == 0) { + return; + } + + // Get event flags (key state). + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &val) < 0) { + return; + } + + // Propagate the event to SDL. + // FIXME: + // Need to handle more key states (such as key combinations). + if (val & KEY_DOWN) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } +} diff --git a/3rdparty/sdl2-2.0.9/src/video/qnx/sdl_qnx.h b/3rdparty/sdl2-2.0.9/src/video/qnx/sdl_qnx.h new file mode 100644 index 0000000000..65e07988e9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/qnx/sdl_qnx.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef __SDL_QNX_H__ +#define __SDL_QNX_H__ + +#include "../SDL_sysvideo.h" +#include +#include + +typedef struct +{ + screen_window_t window; + EGLSurface surface; + EGLConfig conf; +} window_impl_t; + +extern void handleKeyboardEvent(screen_event_t event); + +extern int glGetConfig(EGLConfig *pconf, int *pformat); +extern int glLoadLibrary(_THIS, const char *name); +void *glGetProcAddress(_THIS, const char *proc); +extern SDL_GLContext glCreateContext(_THIS, SDL_Window *window); +extern int glSetSwapInterval(_THIS, int interval); +extern int glSwapWindow(_THIS, SDL_Window *window); +extern int glMakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void glDeleteContext(_THIS, SDL_GLContext context); +extern void glUnloadLibrary(_THIS); + +#endif diff --git a/3rdparty/sdl2-2.0.9/src/video/qnx/video.c b/3rdparty/sdl2-2.0.9/src/video/qnx/video.c new file mode 100644 index 0000000000..ff8223c77a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/qnx/video.c @@ -0,0 +1,364 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" +#include "../SDL_sysvideo.h" +#include "sdl_qnx.h" + +static screen_context_t context; +static screen_event_t event; + +/** + * Initializes the QNX video plugin. + * Creates the Screen context and event handles used for all window operations + * by the plugin. + * @param _THIS + * @return 0 if successful, -1 on error + */ +static int +videoInit(_THIS) +{ + SDL_VideoDisplay display; + + if (screen_create_context(&context, 0) < 0) { + return -1; + } + + if (screen_create_event(&event) < 0) { + return -1; + } + + SDL_zero(display); + + if (SDL_AddVideoDisplay(&display) < 0) { + return -1; + } + + _this->num_displays = 1; + return 0; +} + +static void +videoQuit(_THIS) +{ +} + +/** + * Creates a new native Screen window and associates it with the given SDL + * window. + * @param _THIS + * @param window SDL window to initialize + * @return 0 if successful, -1 on error + */ +static int +createWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl; + int size[2]; + int numbufs; + int format; + int usage; + + impl = SDL_calloc(1, sizeof(*impl)); + if (impl == NULL) { + return -1; + } + + // Create a native window. + if (screen_create_window(&impl->window, context) < 0) { + goto fail; + } + + // Set the native window's size to match the SDL window. + size[0] = window->w; + size[1] = window->h; + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, + size) < 0) { + goto fail; + } + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size) < 0) { + goto fail; + } + + // Create window buffer(s). + if (window->flags & SDL_WINDOW_OPENGL) { + if (glGetConfig(&impl->conf, &format) < 0) { + goto fail; + } + numbufs = 2; + + usage = SCREEN_USAGE_OPENGL_ES2; + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_USAGE, + &usage) < 0) { + return -1; + } + } else { + format = SCREEN_FORMAT_RGBX8888; + numbufs = 1; + } + + // Set pixel format. + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_FORMAT, + &format) < 0) { + goto fail; + } + + // Create buffer(s). + if (screen_create_window_buffers(impl->window, numbufs) < 0) { + goto fail; + } + + window->driverdata = impl; + return 0; + +fail: + if (impl->window) { + screen_destroy_window(impl->window); + } + + SDL_free(impl); + return -1; +} + +/** + * Gets a pointer to the Screen buffer associated with the given window. Note + * that the buffer is actually created in createWindow(). + * @param _THIS + * @param window SDL window to get the buffer for + * @param[out] pixles Holds a pointer to the window's buffer + * @param[out] format Holds the pixel format for the buffer + * @param[out] pitch Holds the number of bytes per line + * @return 0 if successful, -1 on error + */ +static int +createWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, + void ** pixels, int *pitch) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + // Get a pointer to the buffer's memory. + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + if (screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, + pixels) < 0) { + return -1; + } + + // Set format and pitch. + if (screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, + pitch) < 0) { + return -1; + } + + *format = SDL_PIXELFORMAT_RGB888; + return 0; +} + +/** + * Informs the window manager that the window needs to be updated. + * @param _THIS + * @param window The window to update + * @param rects An array of reectangular areas to update + * @param numrects Rect array length + * @return 0 if successful, -1 on error + */ +static int +updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, + int numrects) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + screen_post_window(impl->window, buffer, numrects, (int *)rects, 0); + screen_flush_context(context, 0); + return 0; +} + +/** + * Runs the main event loop. + * @param _THIS + */ +static void +pumpEvents(_THIS) +{ + int type; + + for (;;) { + if (screen_get_event(context, event, 0) < 0) { + break; + } + + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type) + < 0) { + break; + } + + if (type == SCREEN_EVENT_NONE) { + break; + } + + switch (type) { + case SCREEN_EVENT_KEYBOARD: + handleKeyboardEvent(event); + break; + + default: + break; + } + } +} + +/** + * Updates the size of the native window using the geometry of the SDL window. + * @param _THIS + * @param window SDL window to update + */ +static void +setWindowSize(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + int size[2]; + + size[0] = window->w; + size[1] = window->h; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, size); + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size); +} + +/** + * Makes the native window associated with the given SDL window visible. + * @param _THIS + * @param window SDL window to update + */ +static void +showWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 1; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Makes the native window associated with the given SDL window invisible. + * @param _THIS + * @param window SDL window to update + */ +static void +hideWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 0; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Destroys the native window associated with the given SDL window. + * @param _THIS + * @param window SDL window that is being destroyed + */ +static void +destroyWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + + if (impl) { + screen_destroy_window(impl->window); + window->driverdata = NULL; + } +} + +/** + * Frees the plugin object created by createDevice(). + * @param device Plugin object to free + */ +static void +deleteDevice(SDL_VideoDevice *device) +{ + SDL_free(device); +} + +/** + * Creates the QNX video plugin used by SDL. + * @param devindex Unused + * @return Initialized device if successful, NULL otherwise + */ +static SDL_VideoDevice * +createDevice(int devindex) +{ + SDL_VideoDevice *device; + + device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + return NULL; + } + + device->driverdata = NULL; + device->VideoInit = videoInit; + device->VideoQuit = videoQuit; + device->CreateSDLWindow = createWindow; + device->CreateWindowFramebuffer = createWindowFramebuffer; + device->UpdateWindowFramebuffer = updateWindowFramebuffer; + device->SetWindowSize = setWindowSize; + device->ShowWindow = showWindow; + device->HideWindow = hideWindow; + device->PumpEvents = pumpEvents; + device->DestroyWindow = destroyWindow; + + device->GL_LoadLibrary = glLoadLibrary; + device->GL_GetProcAddress = glGetProcAddress; + device->GL_CreateContext = glCreateContext; + device->GL_SetSwapInterval = glSetSwapInterval; + device->GL_SwapWindow = glSwapWindow; + device->GL_MakeCurrent = glMakeCurrent; + device->GL_DeleteContext = glDeleteContext; + device->GL_UnloadLibrary = glUnloadLibrary; + + device->free = deleteDevice; + return device; +} + +static int +available() +{ + return 1; +} + +VideoBootStrap QNX_bootstrap = { + "qnx", "QNX Screen", + available, createDevice +}; diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents.c b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents.c rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents.c index 4104568ccf..406435511e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents.c +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents_c.h b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents_c.h index 54fc196e42..8b1737f132 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpievents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_rpievents_c_h -#define _SDL_rpievents_c_h +#ifndef SDL_rpievents_c_h_ +#define SDL_rpievents_c_h_ #include "SDL_rpivideo.h" @@ -28,4 +28,4 @@ void RPI_PumpEvents(_THIS); void RPI_EventInit(_THIS); void RPI_EventQuit(_THIS); -#endif /* _SDL_rpievents_c_h */ +#endif /* SDL_rpievents_c_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.c b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.c similarity index 56% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.c rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.c index 0d1482c044..4ea976b3be 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_assert.h" #include "SDL_surface.h" +#include "SDL_hints.h" #include "SDL_rpivideo.h" #include "SDL_rpimouse.h" @@ -70,7 +71,16 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) SDL_assert(surface->pitch == surface->w * 4); cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); + if (cursor == NULL) { + SDL_OutOfMemory(); + return NULL; + } curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata)); + if (curdata == NULL) { + SDL_OutOfMemory(); + SDL_free(cursor); + return NULL; + } curdata->hot_x = hot_x; curdata->hot_y = hot_y; @@ -78,17 +88,17 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) curdata->h = surface->h; /* This usage is inspired by Wayland/Weston RPI code, how they figured this out is anyone's guess */ - curdata->resource = vc_dispmanx_resource_create( VC_IMAGE_ARGB8888, surface->w | (surface->pitch << 16), surface->h | (surface->h << 16), &dummy ); + curdata->resource = vc_dispmanx_resource_create(VC_IMAGE_ARGB8888, surface->w | (surface->pitch << 16), surface->h | (surface->h << 16), &dummy); SDL_assert(curdata->resource); - vc_dispmanx_rect_set( &dst_rect, 0, 0, curdata->w, curdata->h); + vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h); /* A note from Weston: * vc_dispmanx_resource_write_data() ignores ifmt, * rect.x, rect.width, and uses stride only for computing * the size of the transfer as rect.height * stride. * Therefore we can only write rows starting at x=0. */ - ret = vc_dispmanx_resource_write_data( curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect ); - SDL_assert ( ret == DISPMANX_SUCCESS ); + ret = vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect); + SDL_assert (ret == DISPMANX_SUCCESS); cursor->driverdata = curdata; @@ -108,7 +118,9 @@ RPI_ShowCursor(SDL_Cursor * cursor) SDL_VideoDisplay *display; SDL_DisplayData *data; VC_DISPMANX_ALPHA_T alpha = { DISPMANX_FLAGS_ALPHA_FROM_SOURCE /* flags */ , 255 /*opacity 0->255*/, 0 /* mask */ }; - + uint32_t layer = SDL_RPI_MOUSELAYER; + const char *env; + mouse = SDL_GetMouse(); if (mouse == NULL) { return -1; @@ -117,15 +129,15 @@ RPI_ShowCursor(SDL_Cursor * cursor) if (cursor == NULL) { /* FIXME: We hide the current mouse's cursor, what we actually need is *_HideCursor */ - if ( mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + if (mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; if (curdata->element > DISPMANX_NO_HANDLE) { - update = vc_dispmanx_update_start( 10 ); - SDL_assert( update ); - ret = vc_dispmanx_element_remove( update, curdata->element ); - SDL_assert( ret == DISPMANX_SUCCESS ); - ret = vc_dispmanx_update_submit_sync( update ); - SDL_assert( ret == DISPMANX_SUCCESS ); + update = vc_dispmanx_update_start(10); + SDL_assert(update); + ret = vc_dispmanx_element_remove(update, curdata->element); + SDL_assert(ret == DISPMANX_SUCCESS); + ret = vc_dispmanx_update_submit_sync(update); + SDL_assert(ret == DISPMANX_SUCCESS); curdata->element = DISPMANX_NO_HANDLE; } } @@ -152,25 +164,30 @@ RPI_ShowCursor(SDL_Cursor * cursor) } if (curdata->element == DISPMANX_NO_HANDLE) { - vc_dispmanx_rect_set( &src_rect, 0, 0, curdata->w << 16, curdata->h << 16 ); - vc_dispmanx_rect_set( &dst_rect, 0, 0, curdata->w, curdata->h); + vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16); + vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h); - update = vc_dispmanx_update_start( 10 ); - SDL_assert( update ); + update = vc_dispmanx_update_start(10); + SDL_assert(update); - curdata->element = vc_dispmanx_element_add( update, + env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER); + if (env) { + layer = SDL_atoi(env) + 1; + } + + curdata->element = vc_dispmanx_element_add(update, data->dispman_display, - SDL_RPI_MOUSELAYER, // layer + layer, &dst_rect, curdata->resource, &src_rect, DISPMANX_PROTECTION_NONE, &alpha, DISPMANX_NO_HANDLE, // clamp - VC_IMAGE_ROT0 ); - SDL_assert( curdata->element > DISPMANX_NO_HANDLE); - ret = vc_dispmanx_update_submit_sync( update ); - SDL_assert( ret == DISPMANX_SUCCESS ); + VC_IMAGE_ROT0); + SDL_assert(curdata->element > DISPMANX_NO_HANDLE); + ret = vc_dispmanx_update_submit_sync(update); + SDL_assert(ret == DISPMANX_SUCCESS); } return 0; @@ -189,17 +206,17 @@ RPI_FreeCursor(SDL_Cursor * cursor) if (curdata != NULL) { if (curdata->element != DISPMANX_NO_HANDLE) { - update = vc_dispmanx_update_start( 10 ); - SDL_assert( update ); - ret = vc_dispmanx_element_remove( update, curdata->element ); - SDL_assert( ret == DISPMANX_SUCCESS ); - ret = vc_dispmanx_update_submit_sync( update ); - SDL_assert( ret == DISPMANX_SUCCESS ); + update = vc_dispmanx_update_start(10); + SDL_assert(update); + ret = vc_dispmanx_element_remove(update, curdata->element); + SDL_assert(ret == DISPMANX_SUCCESS); + ret = vc_dispmanx_update_submit_sync(update); + SDL_assert(ret == DISPMANX_SUCCESS); } if (curdata->resource != DISPMANX_NO_HANDLE) { - ret = vc_dispmanx_resource_delete( curdata->resource ); - SDL_assert( ret == DISPMANX_SUCCESS ); + ret = vc_dispmanx_resource_delete(curdata->resource); + SDL_assert(ret == DISPMANX_SUCCESS); } SDL_free(cursor->driverdata); @@ -221,35 +238,113 @@ RPI_WarpMouseGlobal(int x, int y) { RPI_CursorData *curdata; DISPMANX_UPDATE_HANDLE_T update; + int ret; VC_RECT_T dst_rect; + VC_RECT_T src_rect; SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { - curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; - if (curdata->element != DISPMANX_NO_HANDLE) { - int ret; - update = vc_dispmanx_update_start( 10 ); - SDL_assert( update ); - vc_dispmanx_rect_set( &dst_rect, x, y, curdata->w, curdata->h); - ret = vc_dispmanx_element_change_attributes( - update, - curdata->element, - ELEMENT_CHANGE_DEST_RECT, - 0, - 0, - &dst_rect, - NULL, - DISPMANX_NO_HANDLE, - DISPMANX_NO_ROTATE); - SDL_assert( ret == DISPMANX_SUCCESS ); - /* Submit asynchronously, otherwise the peformance suffers a lot */ - ret = vc_dispmanx_update_submit( update, 0, NULL ); - SDL_assert( ret == DISPMANX_SUCCESS ); - return (ret == DISPMANX_SUCCESS) ? 0 : -1; - } - } + if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + return 0; + } + + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->element == DISPMANX_NO_HANDLE) { + return 0; + } + + update = vc_dispmanx_update_start(10); + if (!update) { + return 0; + } + + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = curdata->w << 16; + src_rect.height = curdata->h << 16; + dst_rect.x = x; + dst_rect.y = y; + dst_rect.width = curdata->w; + dst_rect.height = curdata->h; + + ret = vc_dispmanx_element_change_attributes( + update, + curdata->element, + 0, + 0, + 0, + &dst_rect, + &src_rect, + DISPMANX_NO_HANDLE, + DISPMANX_NO_ROTATE); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_element_change_attributes() failed"); + } + + /* Submit asynchronously, otherwise the peformance suffers a lot */ + ret = vc_dispmanx_update_submit(update, 0, NULL); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_update_submit() failed"); + } + return 0; +} + +/* Warp the mouse to (x,y) */ +static int +RPI_WarpMouseGlobalGraphicOnly(int x, int y) +{ + RPI_CursorData *curdata; + DISPMANX_UPDATE_HANDLE_T update; + int ret; + VC_RECT_T dst_rect; + VC_RECT_T src_rect; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + return 0; + } - return -1; /* !!! FIXME: this should SDL_SetError() somewhere. */ + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->element == DISPMANX_NO_HANDLE) { + return 0; + } + + update = vc_dispmanx_update_start(10); + if (!update) { + return 0; + } + + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = curdata->w << 16; + src_rect.height = curdata->h << 16; + dst_rect.x = x; + dst_rect.y = y; + dst_rect.width = curdata->w; + dst_rect.height = curdata->h; + + ret = vc_dispmanx_element_change_attributes( + update, + curdata->element, + 0, + 0, + 0, + &dst_rect, + &src_rect, + DISPMANX_NO_HANDLE, + DISPMANX_NO_ROTATE); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_element_change_attributes() failed"); + } + + /* Submit asynchronously, otherwise the peformance suffers a lot */ + ret = vc_dispmanx_update_submit(update, 0, NULL); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_update_submit() failed"); + } + return 0; } void @@ -281,7 +376,9 @@ static void RPI_MoveCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); - RPI_WarpMouse(mouse->focus, mouse->x, mouse->y); + /* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity, + * so we create a version of WarpMouseGlobal without it. */ + RPI_WarpMouseGlobalGraphicOnly(mouse->x, mouse->y); } #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.h b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.h rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.h index 6a4e70511f..919f8115b8 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpimouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_RPI_mouse_h -#define _SDL_RPI_mouse_h +#ifndef SDL_RPI_mouse_h_ +#define SDL_RPI_mouse_h_ #include "../SDL_sysvideo.h" @@ -38,6 +38,6 @@ struct _RPI_CursorData extern void RPI_InitMouse(_THIS); extern void RPI_QuitMouse(_THIS); -#endif /* _SDL_RPI_mouse_h */ +#endif /* SDL_RPI_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.c b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.c new file mode 100644 index 0000000000..b7630075bc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.c @@ -0,0 +1,71 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" +#include "SDL_hints.h" +#include "SDL_log.h" + +#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL + +#include "SDL_rpivideo.h" +#include "SDL_rpiopengles.h" + +/* EGL implementation of SDL OpenGL support */ + +void +RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor) +{ + *mask = SDL_GL_CONTEXT_PROFILE_ES; + *major = 2; + *minor = 0; +} + +int +RPI_GLES_LoadLibrary(_THIS, const char *path) { + return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0); +} + +int +RPI_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + * Run your SDL2 program with "SDL_RPI_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondWait(wdata->vsync_cond, wdata->vsync_cond_mutex); + SDL_UnlockMutex(wdata->vsync_cond_mutex); + } + + return 0; +} + +SDL_EGL_CreateContext_impl(RPI) +SDL_EGL_MakeCurrent_impl(RPI) + +#endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.h b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.h index 83c8000674..9724a5f73e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpiopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_rpiopengles_h -#define _SDL_rpiopengles_h +#ifndef SDL_rpiopengles_h_ +#define SDL_rpiopengles_h_ #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,12 @@ extern int RPI_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); -extern void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); extern int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor); #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_rpiopengles_h */ +#endif /* SDL_rpiopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.c b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.c similarity index 72% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.c rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.c index 539c88c9bb..c4f4a6069b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ #include "SDL_events.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_keyboard_c.h" +#include "SDL_hints.h" #ifdef SDL_INPUT_LINUXEV #include "../../core/linux/SDL_evdev.h" @@ -58,11 +59,25 @@ RPI_Available(void) static void RPI_Destroy(SDL_VideoDevice * device) { - /* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */ + SDL_free(device->driverdata); + SDL_free(device); +} - if (device->driverdata != NULL) { - device->driverdata = NULL; - } +static int +RPI_GetRefreshRate() +{ + TV_DISPLAY_STATE_T tvstate; + if (vc_tv_get_display_state( &tvstate ) == 0) { + //The width/height parameters are in the same position in the union + //for HDMI and SDTV + HDMI_PROPERTY_PARAM_T property; + property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; + vc_tv_hdmi_get_property(&property); + return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? + tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) : + tvstate.display.hdmi.frame_rate; + } + return 60; /* Failed to get display state, default to 60 */ } static SDL_VideoDevice * @@ -88,7 +103,7 @@ RPI_Create() device->driverdata = phdata; - /* Setup amount of available displays and current display */ + /* Setup amount of available displays */ device->num_displays = 0; /* Set device free function */ @@ -99,8 +114,8 @@ RPI_Create() device->VideoQuit = RPI_VideoQuit; device->GetDisplayModes = RPI_GetDisplayModes; device->SetDisplayMode = RPI_SetDisplayMode; - device->CreateWindow = RPI_CreateWindow; - device->CreateWindowFrom = RPI_CreateWindowFrom; + device->CreateSDLWindow = RPI_CreateWindow; + device->CreateSDLWindowFrom = RPI_CreateWindowFrom; device->SetWindowTitle = RPI_SetWindowTitle; device->SetWindowIcon = RPI_SetWindowIcon; device->SetWindowPosition = RPI_SetWindowPosition; @@ -113,7 +128,9 @@ RPI_Create() device->RestoreWindow = RPI_RestoreWindow; device->SetWindowGrab = RPI_SetWindowGrab; device->DestroyWindow = RPI_DestroyWindow; +#if 0 device->GetWindowWMInfo = RPI_GetWindowWMInfo; +#endif device->GL_LoadLibrary = RPI_GLES_LoadLibrary; device->GL_GetProcAddress = RPI_GLES_GetProcAddress; device->GL_UnloadLibrary = RPI_GLES_UnloadLibrary; @@ -123,6 +140,7 @@ RPI_Create() device->GL_GetSwapInterval = RPI_GLES_GetSwapInterval; device->GL_SwapWindow = RPI_GLES_SwapWindow; device->GL_DeleteContext = RPI_GLES_DeleteContext; + device->GL_DefaultProfileConfig = RPI_GLES_DefaultProfileConfig; device->PumpEvents = RPI_PumpEvents; @@ -158,8 +176,7 @@ RPI_VideoInit(_THIS) current_mode.w = w; current_mode.h = h; - /* FIXME: Is there a way to tell the actual refresh rate? */ - current_mode.refresh_rate = 60; + current_mode.refresh_rate = RPI_GetRefreshRate(); /* 32 bpp for default */ current_mode.format = SDL_PIXELFORMAT_ABGR8888; @@ -182,7 +199,9 @@ RPI_VideoInit(_THIS) SDL_AddVideoDisplay(&display); #ifdef SDL_INPUT_LINUXEV - SDL_EVDEV_Init(); + if (SDL_EVDEV_Init() < 0) { + return -1; + } #endif RPI_InitMouse(_this); @@ -211,6 +230,16 @@ RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return 0; } +static void +RPI_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data) +{ + SDL_WindowData *wdata = ((SDL_WindowData *) data); + + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondSignal(wdata->vsync_cond); + SDL_UnlockMutex(wdata->vsync_cond_mutex); +} + int RPI_CreateWindow(_THIS, SDL_Window * window) { @@ -221,6 +250,8 @@ RPI_CreateWindow(_THIS, SDL_Window * window) VC_RECT_T src_rect; VC_DISPMANX_ALPHA_T dispman_alpha; DISPMANX_UPDATE_HANDLE_T dispman_update; + uint32_t layer = SDL_RPI_VIDEOLAYER; + const char *env; /* Disable alpha, otherwise the app looks composed with whatever dispman is showing (X11, console,etc) */ dispman_alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS; @@ -253,11 +284,25 @@ RPI_CreateWindow(_THIS, SDL_Window * window) src_rect.width = window->w << 16; src_rect.height = window->h << 16; + env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER); + if (env) { + layer = SDL_atoi(env); + } + dispman_update = vc_dispmanx_update_start( 0 ); - wdata->dispman_window.element = vc_dispmanx_element_add ( dispman_update, displaydata->dispman_display, SDL_RPI_VIDEOLAYER /* layer */, &dst_rect, 0/*src*/, &src_rect, DISPMANX_PROTECTION_NONE, &dispman_alpha /*alpha*/, 0/*clamp*/, 0/*transform*/); + wdata->dispman_window.element = vc_dispmanx_element_add (dispman_update, + displaydata->dispman_display, + layer /* layer */, + &dst_rect, + 0 /*src*/, + &src_rect, + DISPMANX_PROTECTION_NONE, + &dispman_alpha /*alpha*/, + 0 /*clamp*/, + 0 /*transform*/); wdata->dispman_window.width = window->w; wdata->dispman_window.height = window->h; - vc_dispmanx_update_submit_sync( dispman_update ); + vc_dispmanx_update_submit_sync(dispman_update); if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -270,9 +315,18 @@ RPI_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } + /* Start generating vsync callbacks if necesary */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->vsync_cond = SDL_CreateCond(); + wdata->vsync_cond_mutex = SDL_CreateMutex(); + wdata->double_buffer = SDL_TRUE; + vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata); + } + /* Setup driver data for this window */ window->driverdata = wdata; - + /* One window, it always has focus */ SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); @@ -285,7 +339,22 @@ void RPI_DestroyWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + if(data) { + if (data->double_buffer) { + /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */ + SDL_LockMutex(data->vsync_cond_mutex); + SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex); + SDL_UnlockMutex(data->vsync_cond_mutex); + + vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL); + + SDL_DestroyCond(data->vsync_cond); + SDL_DestroyMutex(data->vsync_cond_mutex); + } + #if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); @@ -351,13 +420,14 @@ RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -365,6 +435,7 @@ RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.h b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.h rename to 3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.h index 74dcf94146..b2eb670ae0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/raspberry/SDL_rpivideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" -#include "bcm_host.h" +#include #include "GLES/gl.h" #include "EGL/egl.h" #include "EGL/eglext.h" @@ -48,6 +48,12 @@ typedef struct SDL_WindowData #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif + + /* Vsync callback cond and mutex */ + SDL_cond *vsync_cond; + SDL_mutex *vsync_cond_mutex; + SDL_bool double_buffer; + } SDL_WindowData; #define SDL_RPI_VIDEOLAYER 10000 /* High enough so to occlude everything */ @@ -90,7 +96,7 @@ SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int RPI_GLES_SetSwapInterval(_THIS, int interval); int RPI_GLES_GetSwapInterval(_THIS); -void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context); #endif /* __SDL_RPIVIDEO_H__ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/sdlgenblit.pl b/3rdparty/sdl2-2.0.9/src/video/sdlgenblit.pl similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/sdlgenblit.pl rename to 3rdparty/sdl2-2.0.9/src/video/sdlgenblit.pl index 9ebffafc49..d89ae2a8c4 100755 --- a/3rdparty/sdl2-2.0.4/src/video/sdlgenblit.pl +++ b/3rdparty/sdl2-2.0.9/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.h index 1879f0b3ad..34b01384d3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ @interface SDLLaunchScreenController : UIViewController - (instancetype)init; +- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil; - (void)loadView; -- (NSUInteger)supportedInterfaceOrientations; @end @@ -36,6 +36,12 @@ - (void)hideLaunchScreen; +/* This property is marked as optional, and is only intended to be used when + * the app's UI is storyboard-based. SDL is not storyboard-based, however + * several major third-party ad APIs (e.g. Google admob) incorrectly assume this + * property always exists, and will crash if it doesn't. */ +@property (nonatomic) UIWindow *window; + @end /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.m similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.m index 971b438b01..15762d2bf4 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitappdelegate.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,13 +69,14 @@ int main(int argc, char **argv) return exit_status; } -static void +static void SDLCALL SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { BOOL disable = (hint && *hint != '0'); [UIApplication sharedApplication].idleTimerDisabled = disable; } +#if !TARGET_OS_TV /* Load a launch image using the old UILaunchImageFile-era naming rules. */ static UIImage * SDL_LoadLaunchImageNamed(NSString *name, int screenh) @@ -114,17 +115,31 @@ int main(int argc, char **argv) return image; } +#endif /* !TARGET_OS_TV */ + +@interface SDLLaunchScreenController () + +#if !TARGET_OS_TV +- (NSUInteger)supportedInterfaceOrientations; +#endif + +@end @implementation SDLLaunchScreenController - (instancetype)init +{ + return [self initWithNibName:nil bundle:[NSBundle mainBundle]]; +} + +- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (!(self = [super initWithNibName:nil bundle:nil])) { return nil; } - NSBundle *bundle = [NSBundle mainBundle]; - NSString *screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"]; + NSString *screenname = nibNameOrNil; + NSBundle *bundle = nibBundleOrNil; BOOL atleastiOS8 = UIKit_IsSystemVersionAtLeast(8.0); /* Launch screens were added in iOS 8. Otherwise we use launch images. */ @@ -141,27 +156,28 @@ - (instancetype)init if (!self.view) { NSArray *launchimages = [bundle objectForInfoDictionaryKey:@"UILaunchImages"]; - UIInterfaceOrientation curorient = [UIApplication sharedApplication].statusBarOrientation; NSString *imagename = nil; UIImage *image = nil; int screenw = (int)([UIScreen mainScreen].bounds.size.width + 0.5); int screenh = (int)([UIScreen mainScreen].bounds.size.height + 0.5); +#if !TARGET_OS_TV + UIInterfaceOrientation curorient = [UIApplication sharedApplication].statusBarOrientation; + /* We always want portrait-oriented size, to match UILaunchImageSize. */ if (screenw > screenh) { int width = screenw; screenw = screenh; screenh = width; } +#endif /* Xcode 5 introduced a dictionary of launch images in Info.plist. */ if (launchimages) { for (NSDictionary *dict in launchimages) { - UIInterfaceOrientationMask orientmask = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; - NSString *minversion = dict[@"UILaunchImageMinimumOSVersion"]; - NSString *sizestring = dict[@"UILaunchImageSize"]; - NSString *orientstring = dict[@"UILaunchImageOrientation"]; + NSString *minversion = dict[@"UILaunchImageMinimumOSVersion"]; + NSString *sizestring = dict[@"UILaunchImageSize"]; /* Ignore this image if the current version is too low. */ if (minversion && !UIKit_IsSystemVersionAtLeast(minversion.doubleValue)) { @@ -176,6 +192,10 @@ - (instancetype)init } } +#if !TARGET_OS_TV + UIInterfaceOrientationMask orientmask = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; + NSString *orientstring = dict[@"UILaunchImageOrientation"]; + if (orientstring) { if ([orientstring isEqualToString:@"PortraitUpsideDown"]) { orientmask = UIInterfaceOrientationMaskPortraitUpsideDown; @@ -192,6 +212,7 @@ - (instancetype)init if ((orientmask & (1 << curorient)) == 0) { continue; } +#endif imagename = dict[@"UILaunchImageName"]; } @@ -199,7 +220,9 @@ - (instancetype)init if (imagename) { image = [UIImage imageNamed:imagename]; } - } else { + } +#if !TARGET_OS_TV + else { imagename = [bundle objectForInfoDictionaryKey:@"UILaunchImageFile"]; if (imagename) { @@ -210,11 +233,13 @@ - (instancetype)init image = SDL_LoadLaunchImageNamed(@"Default", screenh); } } +#endif if (image) { UIImageView *view = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIImageOrientation imageorient = UIImageOrientationUp; +#if !TARGET_OS_TV /* Bugs observed / workaround tested in iOS 8.3, 7.1, and 6.1. */ if (UIInterfaceOrientationIsLandscape(curorient)) { if (atleastiOS8 && image.size.width < image.size.height) { @@ -238,6 +263,7 @@ - (instancetype)init } } } +#endif /* Create the properly oriented image. */ view.image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:imageorient]; @@ -254,6 +280,7 @@ - (void)loadView /* Do nothing. */ } +#if !TARGET_OS_TV - (BOOL)shouldAutorotate { /* If YES, the launch image will be incorrectly rotated in some cases. */ @@ -267,6 +294,7 @@ - (NSUInteger)supportedInterfaceOrientations * the ones set here (it will cause an exception in that case.) */ return UIInterfaceOrientationMaskAll; } +#endif /* !TARGET_OS_TV */ @end @@ -333,7 +361,6 @@ - (void)postFinishLaunch - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSBundle *bundle = [NSBundle mainBundle]; - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; #if SDL_IPHONE_LAUNCHSCREEN /* The normal launch screen is displayed until didFinishLaunching returns, @@ -342,9 +369,32 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( * displayed (e.g. if resources are loaded before SDL_GL_SwapWindow is * called), so we show the launch screen programmatically until the first * time events are pumped. */ - UIViewController *viewcontroller = [[SDLLaunchScreenController alloc] init]; + UIViewController *vc = nil; + NSString *screenname = nil; + + /* tvOS only uses a plain launch image. */ +#if !TARGET_OS_TV + screenname = [bundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"]; + + if (screenname && UIKit_IsSystemVersionAtLeast(8.0)) { + @try { + /* The launch storyboard is actually a nib in some older versions of + * Xcode. We'll try to load it as a storyboard first, as it's more + * modern. */ + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:screenname bundle:bundle]; + vc = [storyboard instantiateInitialViewController]; + } + @catch (NSException *exception) { + /* Do nothing (there's more code to execute below). */ + } + } +#endif + + if (vc == nil) { + vc = [[SDLLaunchScreenController alloc] initWithNibName:screenname bundle:bundle]; + } - if (viewcontroller.view) { + if (vc.view) { launchWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; /* We don't want the launch window immediately hidden when a real SDL @@ -355,7 +405,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( * other windows when possible. */ launchWindow.hidden = NO; - launchWindow.rootViewController = viewcontroller; + launchWindow.rootViewController = vc; } #endif @@ -372,92 +422,93 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( return YES; } -- (void)applicationWillTerminate:(UIApplication *)application +- (UIWindow *)window { - SDL_SendAppEvent(SDL_APP_TERMINATING); + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (_this) { + SDL_Window *window = NULL; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + if (data != nil) { + return data.uiwindow; + } + } + } + return nil; } -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +- (void)setWindow:(UIWindow *)window { - SDL_SendAppEvent(SDL_APP_LOWMEMORY); + /* Do nothing. */ } +#if !TARGET_OS_TV - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation { - BOOL isLandscape = UIInterfaceOrientationIsLandscape(application.statusBarOrientation); - SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_OnApplicationDidChangeStatusBarOrientation(); +} +#endif - if (_this && _this->num_displays > 0) { - SDL_DisplayMode *desktopmode = &_this->displays[0].desktop_mode; - SDL_DisplayMode *currentmode = &_this->displays[0].current_mode; - - /* The desktop display mode should be kept in sync with the screen - * orientation so that updating a window's fullscreen state to - * SDL_WINDOW_FULLSCREEN_DESKTOP keeps the window dimensions in the - * correct orientation. */ - if (isLandscape != (desktopmode->w > desktopmode->h)) { - int height = desktopmode->w; - desktopmode->w = desktopmode->h; - desktopmode->h = height; - } +- (void)applicationWillTerminate:(UIApplication *)application +{ + SDL_OnApplicationWillTerminate(); +} - /* Same deal with the current mode + SDL_GetCurrentDisplayMode. */ - if (isLandscape != (currentmode->w > currentmode->h)) { - int height = currentmode->w; - currentmode->w = currentmode->h; - currentmode->h = height; - } - } +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +{ + SDL_OnApplicationDidReceiveMemoryWarning(); } - (void)applicationWillResignActive:(UIApplication*)application { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - } - SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); + SDL_OnApplicationWillResignActive(); } - (void)applicationDidEnterBackground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); + SDL_OnApplicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); + SDL_OnApplicationWillEnterForeground(); } - (void)applicationDidBecomeActive:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - } + SDL_OnApplicationDidBecomeActive(); } -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +- (void)sendDropFileForURL:(NSURL *)url { NSURL *fileURL = url.filePathURL; if (fileURL != nil) { - SDL_SendDropFile([fileURL.path UTF8String]); + SDL_SendDropFile(NULL, fileURL.path.UTF8String); } else { - SDL_SendDropFile([url.absoluteString UTF8String]); + SDL_SendDropFile(NULL, url.absoluteString.UTF8String); } + SDL_SendDropComplete(NULL); +} + +#if TARGET_OS_TV || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0) + +- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options +{ + /* TODO: Handle options */ + [self sendDropFileForURL:url]; return YES; } +#else + +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +{ + [self sendDropFileForURL:url]; + return YES; +} + +#endif + @end #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.h new file mode 100644 index 0000000000..c4b689dbef --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.h @@ -0,0 +1,35 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_uikitclipboard_h_ +#define SDL_uikitclipboard_h_ + +#include "../SDL_sysvideo.h" + +extern int UIKit_SetClipboardText(_THIS, const char *text); +extern char *UIKit_GetClipboardText(_THIS); +extern SDL_bool UIKit_HasClipboardText(_THIS); + +extern void UIKit_InitClipboard(_THIS); +extern void UIKit_QuitClipboard(_THIS); + +#endif /* SDL_uikitclipboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.m new file mode 100644 index 0000000000..b1d4f6d01a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitclipboard.m @@ -0,0 +1,111 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_uikitvideo.h" +#include "../../events/SDL_clipboardevents_c.h" + +#import + +int +UIKit_SetClipboardText(_THIS, const char *text) +{ +#if TARGET_OS_TV + return SDL_SetError("The clipboard is not available on tvOS"); +#else + @autoreleasepool { + [UIPasteboard generalPasteboard].string = @(text); + return 0; + } +#endif +} + +char * +UIKit_GetClipboardText(_THIS) +{ +#if TARGET_OS_TV + return SDL_strdup(""); // Unsupported. +#else + @autoreleasepool { + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + NSString *string = pasteboard.string; + + if (string != nil) { + return SDL_strdup(string.UTF8String); + } else { + return SDL_strdup(""); + } + } +#endif +} + +SDL_bool +UIKit_HasClipboardText(_THIS) +{ + @autoreleasepool { +#if !TARGET_OS_TV + if ([UIPasteboard generalPasteboard].string != nil) { + return SDL_TRUE; + } +#endif + return SDL_FALSE; + } +} + +void +UIKit_InitClipboard(_THIS) +{ +#if !TARGET_OS_TV + @autoreleasepool { + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + + id observer = [center addObserverForName:UIPasteboardChangedNotification + object:nil + queue:nil + usingBlock:^(NSNotification *note) { + SDL_SendClipboardUpdate(); + }]; + + data.pasteboardObserver = observer; + } +#endif +} + +void +UIKit_QuitClipboard(_THIS) +{ + @autoreleasepool { + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + + if (data.pasteboardObserver != nil) { + [[NSNotificationCenter defaultCenter] removeObserver:data.pasteboardObserver]; + } + + data.pasteboardObserver = nil; + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.h index 9b1d60c59d..0c488291b2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,13 +18,13 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitevents_h -#define _SDL_uikitevents_h +#ifndef SDL_uikitevents_h_ +#define SDL_uikitevents_h_ #include "../SDL_sysvideo.h" extern void UIKit_PumpEvents(_THIS); -#endif /* _SDL_uikitevents_h */ +#endif /* SDL_uikitevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.m similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.m index 1d7044d880..d64e3301c5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitevents.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_uikitvideo.h" #include "SDL_uikitevents.h" +#include "SDL_uikitopengles.h" #import @@ -62,6 +63,9 @@ touch events to get processed (which is important to get certain do { result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE); } while(result == kCFRunLoopRunHandledSource); + + /* See the comment in the function definition. */ + UIKit_GL_RestoreCurrentContext(); } #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.h index 5280724135..a766b577c5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_UIKIT -extern SDL_bool UIKit_ShowingMessageBox(); +extern SDL_bool UIKit_ShowingMessageBox(void); extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.m similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.m index 5778032a06..cf2a8f3457 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmessagebox.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE; SDL_bool -UIKit_ShowingMessageBox() +UIKit_ShowingMessageBox(void) { return s_showingMessageBox; } @@ -109,6 +109,20 @@ alertwindow.hidden = YES; } +#if !TARGET_OS_TV + /* Force the main SDL window to re-evaluate home indicator state */ + SDL_Window *focus = SDL_GetFocusWindow(); + if (focus) { + SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata; + if (data != nil) { + if (@available(iOS 11.0, *)) { + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; + } + } + } +#endif /* !TARGET_OS_TV */ + *buttonid = messageboxdata->buttons[clickedindex].buttonid; return YES; #else diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.h new file mode 100644 index 0000000000..bc977781f2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.h @@ -0,0 +1,58 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_uikitmetalview_h_ +#define SDL_uikitmetalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_uikitmetalview : SDL_uikitview + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale; + +@end + +SDL_uikitmetalview* UIKit_Mtl_AddMetalView(SDL_Window* window); + +void UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ + +#endif /* SDL_uikitmetalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.m new file mode 100644 index 0000000000..436e7425a3 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmetalview.m @@ -0,0 +1,132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" +#import "SDL_uikitmetalview.h" + +#include "SDL_assert.h" + +@implementation SDL_uikitmetalview + +/* Returns a Metal-compatible layer. */ ++ (Class)layerClass +{ + return [CAMetalLayer class]; +} + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale +{ + if ((self = [super initWithFrame:frame])) { + self.tag = METALVIEW_TAG; + self.layer.contentsScale = scale; + [self updateDrawableSize]; + } + + return self; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)layoutSubviews +{ + [super layoutSubviews]; + [self updateDrawableSize]; +} + +- (void)updateDrawableSize +{ + CGSize size = self.bounds.size; + size.width *= self.layer.contentsScale; + size.height *= self.layer.contentsScale; + ((CAMetalLayer *)self.layer).drawableSize = size; +} + +@end + +SDL_uikitmetalview* +UIKit_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + CGFloat scale = 1.0; + + if ([view isKindOfClass:[SDL_uikitmetalview class]]) { + return (SDL_uikitmetalview *)view; + } + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* Set the scale to the natural scale factor of the screen - then + * the backing dimensions of the Metal view will match the pixel + * dimensions of the screen rather than the dimensions in points + * yielding high resolution on retine displays. + */ +#ifdef __IPHONE_8_0 + if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { + scale = data.uiwindow.screen.nativeScale; + } else +#endif + { + scale = data.uiwindow.screen.scale; + } + } + SDL_uikitmetalview *metalview + = [[SDL_uikitmetalview alloc] initWithFrame:view.frame + scale:scale]; + [metalview setSDLWindow:window]; + + return metalview; +} + +void +UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + @autoreleasepool { + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + SDL_uikitmetalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.h index 027cf7aa03..b5c0c650c1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_uikitmodes_h -#define _SDL_uikitmodes_h +#ifndef SDL_uikitmodes_h_ +#define SDL_uikitmodes_h_ #include "SDL_uikitvideo.h" @@ -43,7 +43,12 @@ extern int UIKit_InitModes(_THIS); extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void UIKit_QuitModes(_THIS); +extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); -#endif /* _SDL_uikitmodes_h */ +#if !TARGET_OS_TV +extern void SDL_OnApplicationDidChangeStatusBarOrientation(void); +#endif + +#endif /* SDL_uikitmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.m similarity index 61% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.m index 98d0314848..7ddf1078af 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitmodes.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,8 @@ #include "SDL_assert.h" #include "SDL_uikitmodes.h" +#include "../../events/SDL_events_c.h" + @implementation SDL_DisplayData @synthesize uiscreen; @@ -68,21 +70,33 @@ @implementation SDL_DisplayModeData } } +static NSUInteger +UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen) +{ +#ifdef __IPHONE_10_3 + if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) { + return uiscreen.maximumFramesPerSecond; + } +#endif + return 0; +} + static int UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, - UIScreenMode * uiscreenmode) + UIScreen * uiscreen, UIScreenMode * uiscreenmode) { SDL_DisplayMode mode; SDL_zero(mode); - mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.refresh_rate = 0; if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = w; mode.h = h; + if (SDL_AddDisplayMode(display, &mode)) { return 0; } else { @@ -92,16 +106,16 @@ @implementation SDL_DisplayModeData } static int -UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, +UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, UIScreen * uiscreen, UIScreenMode * uiscreenmode, SDL_bool addRotation) { - if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, w, h, uiscreen, uiscreenmode) < 0) { return -1; } if (addRotation) { /* Add the rotated version */ - if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, h, w, uiscreen, uiscreenmode) < 0) { return -1; } } @@ -112,7 +126,11 @@ @implementation SDL_DisplayModeData static int UIKit_AddDisplay(UIScreen *uiscreen) { + UIScreenMode *uiscreenmode = uiscreen.currentMode; CGSize size = uiscreen.bounds.size; + SDL_VideoDisplay display; + SDL_DisplayMode mode; + SDL_zero(mode); /* Make sure the width/height are oriented correctly */ if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) { @@ -121,15 +139,11 @@ @implementation SDL_DisplayModeData size.height = height; } - SDL_VideoDisplay display; - SDL_DisplayMode mode; - SDL_zero(mode); mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = (int) size.width; mode.h = (int) size.height; - UIScreenMode *uiscreenmode = uiscreen.currentMode; - if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } @@ -156,9 +170,12 @@ @implementation SDL_DisplayModeData SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen) { +#if !TARGET_OS_TV if (uiscreen == [UIScreen mainScreen]) { return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation); - } else { + } else +#endif /* !TARGET_OS_TV */ + { CGSize size = uiscreen.bounds.size; return (size.width > size.height); } @@ -173,6 +190,9 @@ @implementation SDL_DisplayModeData return -1; } } +#if !TARGET_OS_TV + SDL_OnApplicationDidChangeStatusBarOrientation(); +#endif } return 0; @@ -187,6 +207,14 @@ @implementation SDL_DisplayModeData SDL_bool isLandscape = UIKit_IsDisplayLandscape(data.uiscreen); SDL_bool addRotation = (data.uiscreen == [UIScreen mainScreen]); CGFloat scale = data.uiscreen.scale; + NSArray *availableModes = nil; + +#if TARGET_OS_TV + addRotation = SDL_FALSE; + availableModes = @[data.uiscreen.currentMode]; +#else + availableModes = data.uiscreen.availableModes; +#endif #ifdef __IPHONE_8_0 /* The UIScreenMode of an iPhone 6 Plus should be 1080x1920 rather than @@ -196,7 +224,7 @@ @implementation SDL_DisplayModeData } #endif - for (UIScreenMode *uimode in data.uiscreen.availableModes) { + for (UIScreenMode *uimode in availableModes) { /* The size of a UIScreenMode is in pixels, but we deal exclusively * in points (except in SDL_GL_GetDrawableSize.) */ int w = (int)(uimode.size.width / scale); @@ -209,7 +237,7 @@ @implementation SDL_DisplayModeData h = tmp; } - UIKit_AddDisplayMode(display, w, h, uimode, addRotation); + UIKit_AddDisplayMode(display, w, h, data.uiscreen, uimode, addRotation); } } } @@ -219,9 +247,11 @@ @implementation SDL_DisplayModeData { @autoreleasepool { SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; - SDL_DisplayModeData *modedata = (__bridge SDL_DisplayModeData *)mode->driverdata; +#if !TARGET_OS_TV + SDL_DisplayModeData *modedata = (__bridge SDL_DisplayModeData *)mode->driverdata; [data.uiscreen setCurrentMode:modedata.uiscreenmode]; +#endif if (data.uiscreen == [UIScreen mainScreen]) { /* [UIApplication setStatusBarOrientation:] no longer works reliably @@ -242,6 +272,35 @@ @implementation SDL_DisplayModeData return 0; } +int +UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + @autoreleasepool { + int displayIndex = (int) (display - _this->displays); + SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; + CGRect frame = data.uiscreen.bounds; + + /* the default function iterates displays to make a fake offset, + as if all the displays were side-by-side, which is fine for iOS. */ + if (SDL_GetDisplayBounds(displayIndex, rect) < 0) { + return -1; + } + +#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 + if (!UIKit_IsSystemVersionAtLeast(7.0)) { + frame = [data.uiscreen applicationFrame]; + } +#endif + + rect->x += frame.origin.x; + rect->y += frame.origin.y; + rect->w = frame.size.width; + rect->h = frame.size.height; + } + + return 0; +} + void UIKit_QuitModes(_THIS) { @@ -265,6 +324,57 @@ @implementation SDL_DisplayModeData } } +#if !TARGET_OS_TV +void SDL_OnApplicationDidChangeStatusBarOrientation() +{ + BOOL isLandscape = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation); + SDL_VideoDisplay *display = SDL_GetDisplay(0); + + if (display) { + SDL_DisplayMode *desktopmode = &display->desktop_mode; + SDL_DisplayMode *currentmode = &display->current_mode; + SDL_DisplayOrientation orientation = SDL_ORIENTATION_UNKNOWN; + + /* The desktop display mode should be kept in sync with the screen + * orientation so that updating a window's fullscreen state to + * SDL_WINDOW_FULLSCREEN_DESKTOP keeps the window dimensions in the + * correct orientation. */ + if (isLandscape != (desktopmode->w > desktopmode->h)) { + int height = desktopmode->w; + desktopmode->w = desktopmode->h; + desktopmode->h = height; + } + + /* Same deal with the current mode + SDL_GetCurrentDisplayMode. */ + if (isLandscape != (currentmode->w > currentmode->h)) { + int height = currentmode->w; + currentmode->w = currentmode->h; + currentmode->h = height; + } + + switch ([UIApplication sharedApplication].statusBarOrientation) { + case UIInterfaceOrientationPortrait: + orientation = SDL_ORIENTATION_PORTRAIT; + break; + case UIInterfaceOrientationPortraitUpsideDown: + orientation = SDL_ORIENTATION_PORTRAIT_FLIPPED; + break; + case UIInterfaceOrientationLandscapeLeft: + /* Bug: UIInterfaceOrientationLandscapeLeft/Right are reversed - http://openradar.appspot.com/7216046 */ + orientation = SDL_ORIENTATION_LANDSCAPE_FLIPPED; + break; + case UIInterfaceOrientationLandscapeRight: + /* Bug: UIInterfaceOrientationLandscapeLeft/Right are reversed - http://openradar.appspot.com/7216046 */ + orientation = SDL_ORIENTATION_LANDSCAPE; + break; + default: + break; + } + SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); + } +} +#endif /* !TARGET_OS_TV */ + #endif /* SDL_VIDEO_DRIVER_UIKIT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.h index 10697610db..6b57289fff 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitopengles -#define _SDL_uikitopengles +#ifndef SDL_uikitopengles_ +#define SDL_uikitopengles_ #include "../SDL_sysvideo.h" @@ -27,12 +27,14 @@ extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); -extern void UIKit_GL_SwapWindow(_THIS, SDL_Window * window); +extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window); extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context); extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); extern int UIKit_GL_LoadLibrary(_THIS, const char *path); -#endif +extern void UIKit_GL_RestoreCurrentContext(void); + +#endif /* SDL_uikitopengles_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.m similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.m index a2ea4ab679..2f6dec45ee 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopengles.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -111,7 +111,7 @@ - (void)dealloc return 0; } -void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) +int UIKit_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext(); @@ -127,6 +127,7 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) * We don't pump events here because we don't want iOS application events * (low memory, terminate, etc.) to happen inside low level rendering. */ } + return 0; } SDL_GLContext @@ -140,10 +141,19 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) EAGLSharegroup *sharegroup = nil; CGFloat scale = 1.0; int samples = 0; + int major = _this->gl_config.major_version; + int minor = _this->gl_config.minor_version; /* The EAGLRenderingAPI enum values currently map 1:1 to major GLES * versions. */ - EAGLRenderingAPI api = _this->gl_config.major_version; + EAGLRenderingAPI api = major; + + /* iOS currently doesn't support GLES >3.0. iOS 6 also only supports up + * to GLES 2.0. */ + if (major > 3 || (major == 3 && (minor > 0 || !UIKit_IsSystemVersionAtLeast(7.0)))) { + SDL_SetError("OpenGL ES %d.%d context could not be created", major, minor); + return NULL; + } if (_this->gl_config.multisamplebuffers > 0) { samples = _this->gl_config.multisamplesamples; @@ -217,6 +227,24 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) } } +void +UIKit_GL_RestoreCurrentContext(void) +{ + @autoreleasepool { + /* Some iOS system functionality (such as Dictation on the on-screen + keyboard) uses its own OpenGL ES context but doesn't restore the + previous one when it's done. This is a workaround to make sure the + expected SDL-created OpenGL ES context is active after the OS is + finished running its own code for the frame. If this isn't done, the + app may crash or have other nasty symptoms when Dictation is used. + */ + EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext(); + if (context != NULL && [EAGLContext currentContext] != context) { + [EAGLContext setCurrentContext:context]; + } + } +} + #endif /* SDL_VIDEO_DRIVER_UIKIT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.h index 86fb5e12e3..8d12c9ff8b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.m similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.m index 60c247e6ad..9024376320 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitopenglview.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -101,7 +101,7 @@ - (instancetype)initWithFrame:(CGRect)frame SDL_SetError("sRGB drawables are not supported."); return nil; } - } else if (rBits >= 8 || gBits >= 8 || bBits >= 8) { + } else if (rBits >= 8 || gBits >= 8 || bBits >= 8 || aBits > 0) { /* if user specifically requests rbg888 or some color format higher than 16bpp */ colorFormat = kEAGLColorFormatRGBA8; colorBufferFormat = GL_RGBA8; @@ -239,7 +239,7 @@ - (void)updateFrame if (msaaRenderbuffer != 0) { glBindRenderbuffer(GL_RENDERBUFFER, msaaRenderbuffer); - glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8, backingWidth, backingHeight); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, colorBufferFormat, backingWidth, backingHeight); } if (depthRenderbuffer != 0) { diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.h similarity index 76% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.h index 3fbaf92f1f..e24183a0b7 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,18 +18,29 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitvideo_h -#define _SDL_uikitvideo_h +#ifndef SDL_uikitvideo_h_ +#define SDL_uikitvideo_h_ + +#include "../SDL_sysvideo.h" + +#ifdef __OBJC__ #include -#include "../SDL_sysvideo.h" +@interface SDL_VideoData : NSObject -void UIKit_SuspendScreenSaver(_THIS); +@property (nonatomic, assign) id pasteboardObserver; + +@end -BOOL UIKit_IsSystemVersionAtLeast(double version); CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen); -#endif /* _SDL_uikitvideo_h */ +#endif /* __OBJC__ */ + +void UIKit_SuspendScreenSaver(_THIS); + +SDL_bool UIKit_IsSystemVersionAtLeast(double version); + +#endif /* SDL_uikitvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.m new file mode 100644 index 0000000000..10d1dde312 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvideo.m @@ -0,0 +1,249 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +#import + +#include "SDL_video.h" +#include "SDL_mouse.h" +#include "SDL_hints.h" +#include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" +#include "../../events/SDL_events_c.h" + +#include "SDL_uikitvideo.h" +#include "SDL_uikitevents.h" +#include "SDL_uikitmodes.h" +#include "SDL_uikitwindow.h" +#include "SDL_uikitopengles.h" +#include "SDL_uikitclipboard.h" +#include "SDL_uikitvulkan.h" + +#define UIKITVID_DRIVER_NAME "uikit" + +@implementation SDL_VideoData + +@end + +/* Initialization/Query functions */ +static int UIKit_VideoInit(_THIS); +static void UIKit_VideoQuit(_THIS); + +/* DUMMY driver bootstrap functions */ + +static int +UIKit_Available(void) +{ + return 1; +} + +static void UIKit_DeleteDevice(SDL_VideoDevice * device) +{ + @autoreleasepool { + CFRelease(device->driverdata); + SDL_free(device); + } +} + +static SDL_VideoDevice * +UIKit_CreateDevice(int devindex) +{ + @autoreleasepool { + SDL_VideoDevice *device; + SDL_VideoData *data; + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device) { + data = [SDL_VideoData new]; + } else { + SDL_free(device); + SDL_OutOfMemory(); + return (0); + } + + device->driverdata = (void *) CFBridgingRetain(data); + + /* Set the function pointers */ + device->VideoInit = UIKit_VideoInit; + device->VideoQuit = UIKit_VideoQuit; + device->GetDisplayModes = UIKit_GetDisplayModes; + device->SetDisplayMode = UIKit_SetDisplayMode; + device->PumpEvents = UIKit_PumpEvents; + device->SuspendScreenSaver = UIKit_SuspendScreenSaver; + device->CreateSDLWindow = UIKit_CreateWindow; + device->SetWindowTitle = UIKit_SetWindowTitle; + device->ShowWindow = UIKit_ShowWindow; + device->HideWindow = UIKit_HideWindow; + device->RaiseWindow = UIKit_RaiseWindow; + device->SetWindowBordered = UIKit_SetWindowBordered; + device->SetWindowFullscreen = UIKit_SetWindowFullscreen; + device->DestroyWindow = UIKit_DestroyWindow; + device->GetWindowWMInfo = UIKit_GetWindowWMInfo; + device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; + +#if SDL_IPHONE_KEYBOARD + device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; + device->HideScreenKeyboard = UIKit_HideScreenKeyboard; + device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; + device->SetTextInputRect = UIKit_SetTextInputRect; +#endif + + device->SetClipboardText = UIKit_SetClipboardText; + device->GetClipboardText = UIKit_GetClipboardText; + device->HasClipboardText = UIKit_HasClipboardText; + + /* OpenGL (ES) functions */ + device->GL_MakeCurrent = UIKit_GL_MakeCurrent; + device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; + device->GL_SwapWindow = UIKit_GL_SwapWindow; + device->GL_CreateContext = UIKit_GL_CreateContext; + device->GL_DeleteContext = UIKit_GL_DeleteContext; + device->GL_GetProcAddress = UIKit_GL_GetProcAddress; + device->GL_LoadLibrary = UIKit_GL_LoadLibrary; + device->free = UIKit_DeleteDevice; + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions + = UIKit_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize; +#endif + + device->gl_config.accelerated = 1; + + return device; + } +} + +VideoBootStrap UIKIT_bootstrap = { + UIKITVID_DRIVER_NAME, "SDL UIKit video driver", + UIKit_Available, UIKit_CreateDevice +}; + + +int +UIKit_VideoInit(_THIS) +{ + _this->gl_config.driver_loaded = 1; + + if (UIKit_InitModes(_this) < 0) { + return -1; + } + return 0; +} + +void +UIKit_VideoQuit(_THIS) +{ + UIKit_QuitModes(_this); +} + +void +UIKit_SuspendScreenSaver(_THIS) +{ + @autoreleasepool { + /* Ignore ScreenSaver API calls if the idle timer hint has been set. */ + /* FIXME: The idle timer hint should be deprecated for SDL 2.1. */ + if (!SDL_GetHintBoolean(SDL_HINT_IDLE_TIMER_DISABLED, SDL_FALSE)) { + UIApplication *app = [UIApplication sharedApplication]; + + /* Prevent the display from dimming and going to sleep. */ + app.idleTimerDisabled = (_this->suspend_screensaver != SDL_FALSE); + } + } +} + +SDL_bool +UIKit_IsSystemVersionAtLeast(double version) +{ + return [[UIDevice currentDevice].systemVersion doubleValue] >= version; +} + +CGRect +UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) +{ + CGRect frame = screen.bounds; + +#if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) + BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0); + + /* The view should always show behind the status bar in iOS 7+. */ + if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { + frame = screen.applicationFrame; + } +#endif + +#if !TARGET_OS_TV + /* iOS 10 seems to have a bug where, in certain conditions, putting the + * device to sleep with the a landscape-only app open, re-orienting the + * device to portrait, and turning it back on will result in the screen + * bounds returning portrait orientation despite the app being in landscape. + * This is a workaround until a better solution can be found. + * https://bugzilla.libsdl.org/show_bug.cgi?id=3505 + * https://bugzilla.libsdl.org/show_bug.cgi?id=3465 + * https://forums.developer.apple.com/thread/65337 */ + if (UIKit_IsSystemVersionAtLeast(8.0)) { + UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation; + BOOL isLandscape = UIInterfaceOrientationIsLandscape(orient); + + if (isLandscape != (frame.size.width > frame.size.height)) { + float height = frame.size.width; + frame.size.width = frame.size.height; + frame.size.height = height; + } + } +#endif + + return frame; +} + +/* + * iOS log support. + * + * This doesn't really have aything to do with the interfaces of the SDL video + * subsystem, but we need to stuff this into an Objective-C source code file. + */ + +void SDL_NSLog(const char *text) +{ + NSLog(@"%s", text); +} + +/* + * iOS Tablet detection + * + * This doesn't really have aything to do with the interfaces of the SDL video + * subsystem, but we need to stuff this into an Objective-C source code file. + */ +SDL_bool SDL_IsIPad(void) +{ + return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.h index 18fa78f363..4457f6c252 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.m similarity index 54% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.m index 1ccda98ffc..caabfac072 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitview.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_uikitview.h" +#include "SDL_hints.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/SDL_events_c.h" @@ -32,6 +33,9 @@ #import "SDL_uikitmodes.h" #import "SDL_uikitwindow.h" +/* This is defined in SDL_sysjoystick.m */ +extern int SDL_AppleTVRemoteOpenedAsJoystick; + @implementation SDL_uikitview { SDL_Window *sdlwindow; @@ -42,10 +46,31 @@ @implementation SDL_uikitview { - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { +#if TARGET_OS_TV + /* Apple TV Remote touchpad swipe gestures. */ + UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeUp.direction = UISwipeGestureRecognizerDirectionUp; + [self addGestureRecognizer:swipeUp]; + + UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeDown.direction = UISwipeGestureRecognizerDirectionDown; + [self addGestureRecognizer:swipeDown]; + + UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; + [self addGestureRecognizer:swipeLeft]; + + UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeRight.direction = UISwipeGestureRecognizerDirectionRight; + [self addGestureRecognizer:swipeRight]; +#endif + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.autoresizesSubviews = YES; +#if !TARGET_OS_TV self.multipleTouchEnabled = YES; +#endif touchId = 1; SDL_AddTouch(touchId, ""); @@ -141,12 +166,13 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event if (!firstFingerDown) { CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO]; + int clicks = (int) touch.tapCount; /* send mouse moved event */ SDL_SendMouseMotion(sdlwindow, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y); /* send mouse down event */ - SDL_SendMouseButton(sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT, clicks); firstFingerDown = touch; } @@ -164,7 +190,8 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event if (touch == firstFingerDown) { /* send mouse up */ - SDL_SendMouseButton(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); + int clicks = (int) touch.tapCount; + SDL_SendMouseButtonClicks(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT, clicks); firstFingerDown = nil; } @@ -197,6 +224,103 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event } } +#if TARGET_OS_TV || defined(__IPHONE_9_1) +- (SDL_Scancode)scancodeFromPressType:(UIPressType)presstype +{ + switch (presstype) { + case UIPressTypeUpArrow: + return SDL_SCANCODE_UP; + case UIPressTypeDownArrow: + return SDL_SCANCODE_DOWN; + case UIPressTypeLeftArrow: + return SDL_SCANCODE_LEFT; + case UIPressTypeRightArrow: + return SDL_SCANCODE_RIGHT; + case UIPressTypeSelect: + /* HIG says: "primary button behavior" */ + return SDL_SCANCODE_RETURN; + case UIPressTypeMenu: + /* HIG says: "returns to previous screen" */ + return SDL_SCANCODE_ESCAPE; + case UIPressTypePlayPause: + /* HIG says: "secondary button behavior" */ + return SDL_SCANCODE_PAUSE; + default: + return SDL_SCANCODE_UNKNOWN; + } +} + +- (void)pressesBegan:(NSSet *)presses withEvent:(UIPressesEvent *)event +{ + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } + } + [super pressesBegan:presses withEvent:event]; +} + +- (void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)event +{ + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } + [super pressesEnded:presses withEvent:event]; +} + +- (void)pressesCancelled:(NSSet *)presses withEvent:(UIPressesEvent *)event +{ + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } + [super pressesCancelled:presses withEvent:event]; +} + +- (void)pressesChanged:(NSSet *)presses withEvent:(UIPressesEvent *)event +{ + /* This is only called when the force of a press changes. */ + [super pressesChanged:presses withEvent:event]; +} +#endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */ + +#if TARGET_OS_TV +-(void)swipeGesture:(UISwipeGestureRecognizer *)gesture +{ + /* Swipe gestures don't trigger begin states. */ + if (gesture.state == UIGestureRecognizerStateEnded) { + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + /* Send arrow key presses for now, as we don't have an external API + * which better maps to swipe gestures. */ + switch (gesture.direction) { + case UISwipeGestureRecognizerDirectionUp: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_UP); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_UP); + break; + case UISwipeGestureRecognizerDirectionDown: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DOWN); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DOWN); + break; + case UISwipeGestureRecognizerDirectionLeft: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LEFT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LEFT); + break; + case UISwipeGestureRecognizerDirectionRight: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RIGHT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RIGHT); + break; + } + } + } +} +#endif /* TARGET_OS_TV */ + @end #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.h new file mode 100644 index 0000000000..fffb142230 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.h @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#import + +#include "../SDL_sysvideo.h" + +#include "SDL_touch.h" + +#if TARGET_OS_TV +#import +#define SDLRootViewController GCEventViewController +#else +#define SDLRootViewController UIViewController +#endif + +#if SDL_IPHONE_KEYBOARD +@interface SDL_uikitviewcontroller : SDLRootViewController +#else +@interface SDL_uikitviewcontroller : SDLRootViewController +#endif + +@property (nonatomic, assign) SDL_Window *window; + +- (instancetype)initWithSDLWindow:(SDL_Window *)_window; + +- (void)setAnimationCallback:(int)interval + callback:(void (*)(void*))callback + callbackParam:(void*)callbackParam; + +- (void)startAnimation; +- (void)stopAnimation; + +- (void)doLoop:(CADisplayLink*)sender; + +- (void)loadView; +- (void)viewDidLayoutSubviews; + +#if !TARGET_OS_TV +- (NSUInteger)supportedInterfaceOrientations; +- (BOOL)prefersStatusBarHidden; +- (BOOL)prefersHomeIndicatorAutoHidden; +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; + +@property (nonatomic, assign) int homeIndicatorHidden; +#endif + +#if SDL_IPHONE_KEYBOARD +- (void)showKeyboard; +- (void)hideKeyboard; +- (void)initKeyboard; +- (void)deinitKeyboard; + +- (void)keyboardWillShow:(NSNotification *)notification; +- (void)keyboardWillHide:(NSNotification *)notification; + +- (void)updateKeyboard; + +@property (nonatomic, assign, getter=isKeyboardVisible) BOOL keyboardVisible; +@property (nonatomic, assign) SDL_Rect textInputRect; +@property (nonatomic, assign) int keyboardHeight; +#endif + +@end + +#if SDL_IPHONE_KEYBOARD +SDL_bool UIKit_HasScreenKeyboardSupport(_THIS); +void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window); +void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window); +SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window); +void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect); +#endif diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.m similarity index 53% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.m index 58cdf1ac54..49a39b6bc0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitviewcontroller.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,11 +33,38 @@ #include "SDL_uikitvideo.h" #include "SDL_uikitmodes.h" #include "SDL_uikitwindow.h" +#include "SDL_uikitopengles.h" #if SDL_IPHONE_KEYBOARD #include "keyinfotable.h" #endif +#if TARGET_OS_TV +static void SDLCALL +SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + @autoreleasepool { + SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata; + viewcontroller.controllerUserInteractionEnabled = hint && (*hint != '0'); + } +} +#endif + +#if !TARGET_OS_TV +static void SDLCALL +SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + @autoreleasepool { + SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata; + viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1; + if (@available(iOS 11.0, *)) { + [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; + [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; + } + } +} +#endif + @implementation SDL_uikitviewcontroller { CADisplayLink *displayLink; int animationInterval; @@ -46,6 +73,9 @@ @implementation SDL_uikitviewcontroller { #if SDL_IPHONE_KEYBOARD UITextField *textField; + BOOL rotatingOrientation; + NSString *changeText; + NSString *obligateForBackspace; #endif } @@ -58,6 +88,19 @@ - (instancetype)initWithSDLWindow:(SDL_Window *)_window #if SDL_IPHONE_KEYBOARD [self initKeyboard]; + rotatingOrientation = FALSE; +#endif + +#if TARGET_OS_TV + SDL_AddHintCallback(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, + SDL_AppleTVControllerUIHintChanged, + (__bridge void *) self); +#endif + +#if !TARGET_OS_TV + SDL_AddHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); #endif } return self; @@ -68,6 +111,18 @@ - (void)dealloc #if SDL_IPHONE_KEYBOARD [self deinitKeyboard]; #endif + +#if TARGET_OS_TV + SDL_DelHintCallback(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, + SDL_AppleTVControllerUIHintChanged, + (__bridge void *) self); +#endif + +#if !TARGET_OS_TV + SDL_DelHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); +#endif } - (void)setAnimationCallback:(int)interval @@ -88,7 +143,22 @@ - (void)setAnimationCallback:(int)interval - (void)startAnimation { displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)]; - [displayLink setFrameInterval:animationInterval]; + +#ifdef __IPHONE_10_3 + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + + if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] + && data != nil && data.uiwindow != nil + && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) { + displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval; + } else +#endif + { +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300 + [displayLink setFrameInterval:animationInterval]; +#endif + } + [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; } @@ -102,6 +172,9 @@ - (void)doLoop:(CADisplayLink*)sender { /* Don't run the game loop while a messagebox is up */ if (!UIKit_ShowingMessageBox()) { + /* See the comment in the function definition. */ + UIKit_GL_RestoreCurrentContext(); + animationCallback(animationCallbackParam); } } @@ -120,20 +193,52 @@ - (void)viewDidLayoutSubviews SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); } +#if !TARGET_OS_TV - (NSUInteger)supportedInterfaceOrientations { return UIKit_GetSupportedOrientations(window); } +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient { return ([self supportedInterfaceOrientations] & (1 << orient)) != 0; } +#endif - (BOOL)prefersStatusBarHidden { - return (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + return hidden; +} + +- (BOOL)prefersHomeIndicatorAutoHidden +{ + BOOL hidden = NO; + if (self.homeIndicatorHidden == 1) { + hidden = YES; + } + return hidden; +} + +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + if (self.homeIndicatorHidden >= 0) { + if (self.homeIndicatorHidden == 2) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } + } + + /* By default, fullscreen and borderless windows get all screen gestures */ + if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } } +#endif /* ---- Keyboard related functionality below this line ---- @@ -147,10 +252,12 @@ - (BOOL)prefersStatusBarHidden /* Set ourselves up as a UITextFieldDelegate */ - (void)initKeyboard { + changeText = nil; + obligateForBackspace = @" "; /* 64 space */ textField = [[UITextField alloc] initWithFrame:CGRectZero]; textField.delegate = self; /* placeholder so there is something to delete! */ - textField.text = @" "; + textField.text = obligateForBackspace; /* set UITextInputTrait properties, mostly to defaults */ textField.autocapitalizationType = UITextAutocapitalizationTypeNone; @@ -165,8 +272,11 @@ - (void)initKeyboard keyboardVisible = NO; NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; +#if !TARGET_OS_TV [center addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [center addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; +#endif + [center addObserver:self selector:@selector(textFieldTextDidChange:) name:UITextFieldTextDidChangeNotification object:nil]; } - (void)setView:(UIView *)view @@ -180,11 +290,37 @@ - (void)setView:(UIView *)view } } +/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */ +#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator +{ + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + rotatingOrientation = TRUE; + [coordinator animateAlongsideTransition:^(id context) {} + completion:^(id context) { + rotatingOrientation = FALSE; + }]; +} +#else +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; + rotatingOrientation = TRUE; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + rotatingOrientation = FALSE; +} +#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */ + - (void)deinitKeyboard { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; +#if !TARGET_OS_TV [center removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [center removeObserver:self name:UIKeyboardWillHideNotification object:nil]; +#endif + [center removeObserver:self name:UITextFieldTextDidChangeNotification object:nil]; } /* reveal onscreen virtual keyboard */ @@ -205,20 +341,69 @@ - (void)hideKeyboard - (void)keyboardWillShow:(NSNotification *)notification { - CGRect kbrect = [[notification userInfo][UIKeyboardFrameBeginUserInfoKey] CGRectValue]; +#if !TARGET_OS_TV + CGRect kbrect = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; /* The keyboard rect is in the coordinate space of the screen/window, but we * want its height in the coordinate space of the view. */ kbrect = [self.view convertRect:kbrect fromView:nil]; [self setKeyboardHeight:(int)kbrect.size.height]; +#endif } - (void)keyboardWillHide:(NSNotification *)notification { + if (!rotatingOrientation) { + SDL_StopTextInput(); + } [self setKeyboardHeight:0]; } +- (void)textFieldTextDidChange:(NSNotification *)notification +{ + if (changeText!=nil && textField.markedTextRange == nil) + { + NSUInteger len = changeText.length; + if (len > 0) { + /* Go through all the characters in the string we've been sent and + * convert them to key presses */ + int i; + for (i = 0; i < len; i++) { + unichar c = [changeText characterAtIndex:i]; + SDL_Scancode code; + Uint16 mod; + + if (c < 127) { + /* Figure out the SDL_Scancode and SDL_keymod for this unichar */ + code = unicharToUIKeyInfoTable[c].code; + mod = unicharToUIKeyInfoTable[c].mod; + } else { + /* We only deal with ASCII right now */ + code = SDL_SCANCODE_UNKNOWN; + mod = 0; + } + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift down */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); + } + + /* send a keydown and keyup even for the character */ + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift back up */ + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); + } + } + SDL_SendKeyboardText([changeText UTF8String]); + } + changeText = nil; + } +} + - (void)updateKeyboard { CGAffineTransform t = self.view.transform; @@ -257,49 +442,20 @@ - (void)setKeyboardHeight:(int)height - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSUInteger len = string.length; - if (len == 0) { - /* it wants to replace text with nothing, ie a delete */ - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE); - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE); - } else { - /* go through all the characters in the string we've been sent and - * convert them to key presses */ - int i; - for (i = 0; i < len; i++) { - unichar c = [string characterAtIndex:i]; - Uint16 mod = 0; - SDL_Scancode code; - - if (c < 127) { - /* figure out the SDL_Scancode and SDL_keymod for this unichar */ - code = unicharToUIKeyInfoTable[c].code; - mod = unicharToUIKeyInfoTable[c].mod; - } else { - /* we only deal with ASCII right now */ - code = SDL_SCANCODE_UNKNOWN; - mod = 0; - } - - if (mod & KMOD_SHIFT) { - /* If character uses shift, press shift down */ - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); - } - - /* send a keydown and keyup even for the character */ - SDL_SendKeyboardKey(SDL_PRESSED, code); - SDL_SendKeyboardKey(SDL_RELEASED, code); - - if (mod & KMOD_SHIFT) { - /* If character uses shift, press shift back up */ - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); - } + changeText = nil; + if (textField.markedTextRange == nil) { + /* it wants to replace text with nothing, ie a delete */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_BACKSPACE); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_BACKSPACE); } - - SDL_SendKeyboardText([string UTF8String]); + if (textField.text.length < 16) { + textField.text = obligateForBackspace; + } + } else { + changeText = string; } - - return NO; /* don't allow the edit! (keep placeholder text there) */ + return YES; } /* Terminates the editing session */ @@ -307,7 +463,9 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); - SDL_StopTextInput(); + if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + SDL_StopTextInput(); + } return YES; } @@ -361,7 +519,7 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField @autoreleasepool { SDL_uikitviewcontroller *vc = GetWindowViewController(window); if (vc != nil) { - return vc.isKeyboardVisible; + return vc.keyboardVisible; } return SDL_FALSE; } diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.h new file mode 100644 index 0000000000..e3ec350d80 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.h @@ -0,0 +1,54 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_uikitvulkan_h_ +#define SDL_uikitvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); +void UIKit_Vulkan_UnloadLibrary(_THIS); +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); + +#endif + +#endif /* SDL_uikitvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.m new file mode 100644 index 0000000000..771c7a4750 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitvulkan.m @@ -0,0 +1,222 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_uikitvideo.h" +#include "SDL_uikitwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_uikitvulkan.h" +#include "SDL_uikitmetalview.h" +#include "SDL_syswm.h" + +#include + +#define DEFAULT_MOLTENVK "libMoltenVK.dylib" +/* Since libSDL is static, could use RTLD_SELF. Using RTLD_DEFAULT is future + * proofing. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasIOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + return SDL_SetError("MoltenVK/Vulkan already loaded"); + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + if (!path) { + /* Look for the .dylib packaged with the application instead. */ + path = DEFAULT_MOLTENVK; + } + + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if (!_this->vulkan_config.loader_handle) { + return -1; + } + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, + "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + DEFAULT_MOLTENVK, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + SDL_SetError("No vkEnumerateInstanceExtensionProperties found."); + goto fail; + } + + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + + if (!extensions) { + goto fail; + } + + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_IOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasIOSSurfaceExtension = SDL_TRUE; + } + } + + SDL_free(extensions); + + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasIOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_IOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + + return 0; + +fail: + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void UIKit_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForUIKit[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForUIKit), + extensionsForUIKit); +} + +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK = + (PFN_vkCreateIOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateIOSSurfaceMVK"); + VkIOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateIOSSurfaceMVK) { + SDL_SetError(VK_MVK_IOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + + createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = (__bridge void *)UIKit_Mtl_AddMetalView(window); + result = vkCreateIOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateIOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + + return SDL_TRUE; +} + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + UIKit_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.h b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.h similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.h index ed08c55d42..46073eef0a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitwindow_h -#define _SDL_uikitwindow_h +#ifndef SDL_uikitwindow_h_ +#define SDL_uikitwindow_h_ #include "../SDL_sysvideo.h" #import "SDL_uikitvideo.h" @@ -51,6 +51,6 @@ extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window); @end -#endif /* _SDL_uikitwindow_h */ +#endif /* SDL_uikitwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.m b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.m similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.m rename to 3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.m index c5f385b8c1..d01cff3498 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/SDL_uikitwindow.m +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,15 +99,22 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo /* only one window on iOS, always shown */ window->flags &= ~SDL_WINDOW_HIDDEN; - if (displaydata.uiscreen == [UIScreen mainScreen]) { - window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ - } else { + if (displaydata.uiscreen != [UIScreen mainScreen]) { window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizable */ window->flags &= ~SDL_WINDOW_INPUT_FOCUS; /* never has input focus */ window->flags |= SDL_WINDOW_BORDERLESS; /* never has a status bar. */ } +#if !TARGET_OS_TV if (displaydata.uiscreen == [UIScreen mainScreen]) { + /* SDL_CreateWindow sets the window w&h to the display's bounds if the + * fullscreen flag is set. But the display bounds orientation might not + * match what we want, and GetSupportedOrientations call below uses the + * window w&h. They're overridden below anyway, so we'll just set them + * to the requested size for the purposes of determining orientation. */ + window->w = window->windowed.w; + window->h = window->windowed.h; + NSUInteger orients = UIKit_GetSupportedOrientations(window); BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; @@ -119,6 +126,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo height = temp; } } +#endif /* !TARGET_OS_TV */ window->x = 0; window->y = 0; @@ -152,7 +160,6 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo @autoreleasepool { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; - const CGSize origsize = data.uiscreen.currentMode.size; /* SDL currently puts this window at the start of display's linked list. We rely on this. */ SDL_assert(_this->windows == window); @@ -165,6 +172,8 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo /* If monitor has a resolution of 0x0 (hasn't been explicitly set by the * user, so it's in standby), try to force the display to a resolution * that most closely matches the desired window size. */ +#if !TARGET_OS_TV + const CGSize origsize = data.uiscreen.currentMode.size; if ((origsize.width == 0.0f) && (origsize.height == 0.0f)) { if (display->num_display_modes == 0) { _this->GetDisplayModes(_this, display); @@ -197,6 +206,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo [UIApplication sharedApplication].statusBarHidden = NO; } } +#endif /* !TARGET_OS_TV */ /* ignore the size user requested, and make a fullscreen window */ /* !!! FIXME: can we have a smaller view? */ @@ -258,6 +268,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; SDL_uikitviewcontroller *viewcontroller = data.viewcontroller; +#if !TARGET_OS_TV if (data.uiwindow.screen == [UIScreen mainScreen]) { if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) { [UIApplication sharedApplication].statusBarHidden = YES; @@ -273,6 +284,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo /* Update the view's frame to account for the status bar change. */ viewcontroller.view.frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen); +#endif /* !TARGET_OS_TV */ #ifdef SDL_IPHONE_KEYBOARD /* Make sure the view is offset correctly when the keyboard is visible. */ @@ -356,13 +368,14 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } } +#if !TARGET_OS_TV NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window) { @@ -428,6 +441,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo return orientationMask; } +#endif /* !TARGET_OS_TV */ int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam) diff --git a/3rdparty/sdl2-2.0.4/src/video/uikit/keyinfotable.h b/3rdparty/sdl2-2.0.9/src/video/uikit/keyinfotable.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/uikit/keyinfotable.h rename to 3rdparty/sdl2-2.0.9/src/video/uikit/keyinfotable.h index 962dbd922f..3b23837477 100644 --- a/3rdparty/sdl2-2.0.4/src/video/uikit/keyinfotable.h +++ b/3rdparty/sdl2-2.0.9/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.c b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.c rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.c index 687cc6a730..135e838814 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ VIVANTE_GLES_LoadLibrary(_THIS, const char *path) displaydata = SDL_GetDisplayDriverData(0); - return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display); + return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display, 0); } SDL_EGL_CreateContext_impl(VIVANTE) diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.h b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.h index f47bf7797a..162d61ab97 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteopengles_h -#define _SDL_vivanteopengles_h +#ifndef SDL_vivanteopengles_h_ +#define SDL_vivanteopengles_h_ #if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,11 @@ extern int VIVANTE_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext VIVANTE_GLES_CreateContext(_THIS, SDL_Window * window); -extern void VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); extern int VIVANTE_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_vivanteopengles_h */ +#endif /* SDL_vivanteopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.c b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.c rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.c index 76233417eb..67ea63350f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.c +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,16 @@ VIVANTE_SetupPlatform(_THIS) return 0; } +char *VIVANTE_GetDisplayName(_THIS) +{ + return NULL; +} + +void +VIVANTE_UpdateDisplayScale(_THIS) +{ +} + void VIVANTE_CleanupPlatform(_THIS) { diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.h b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.h similarity index 83% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.h rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.h index 6e11cce624..59fbf60642 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivanteplatform.h +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteplatform_h -#define _SDL_vivanteplatform_h +#ifndef SDL_vivanteplatform_h_ +#define SDL_vivanteplatform_h_ #if SDL_VIDEO_DRIVER_VIVANTE @@ -36,10 +36,12 @@ #endif extern int VIVANTE_SetupPlatform(_THIS); +extern char *VIVANTE_GetDisplayName(_THIS); +extern void VIVANTE_UpdateDisplayScale(_THIS); extern void VIVANTE_CleanupPlatform(_THIS); #endif /* SDL_VIDEO_DRIVER_VIVANTE */ -#endif /* _SDL_vivanteplatform_h */ +#endif /* SDL_vivanteplatform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.c b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.c rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.c index fe4ea089d8..656ab55672 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,7 +77,7 @@ VIVANTE_Create() device->driverdata = data; - /* Setup amount of available displays and current display */ + /* Setup amount of available displays */ device->num_displays = 0; /* Set device free function */ @@ -88,7 +88,7 @@ VIVANTE_Create() device->VideoQuit = VIVANTE_VideoQuit; device->GetDisplayModes = VIVANTE_GetDisplayModes; device->SetDisplayMode = VIVANTE_SetDisplayMode; - device->CreateWindow = VIVANTE_CreateWindow; + device->CreateSDLWindow = VIVANTE_CreateWindow; device->SetWindowTitle = VIVANTE_SetWindowTitle; device->SetWindowPosition = VIVANTE_SetWindowPosition; device->SetWindowSize = VIVANTE_SetWindowSize; @@ -97,6 +97,7 @@ VIVANTE_Create() device->DestroyWindow = VIVANTE_DestroyWindow; device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary; device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress; device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary; @@ -106,6 +107,7 @@ VIVANTE_Create() device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval; device->GL_SwapWindow = VIVANTE_GLES_SwapWindow; device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; +#endif device->PumpEvents = VIVANTE_PumpEvents; @@ -152,6 +154,9 @@ VIVANTE_AddVideoDisplays(_THIS) switch (bpp) { default: /* Is another format used? */ + case 32: + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + break; case 16: current_mode.format = SDL_PIXELFORMAT_RGB565; break; @@ -160,6 +165,7 @@ VIVANTE_AddVideoDisplays(_THIS) current_mode.refresh_rate = 60; SDL_zero(display); + display.name = VIVANTE_GetDisplayName(_this); display.desktop_mode = current_mode; display.current_mode = current_mode; display.driverdata = data; @@ -208,6 +214,8 @@ VIVANTE_VideoInit(_THIS) return -1; } + VIVANTE_UpdateDisplayScale(_this); + #ifdef SDL_INPUT_LINUXEV if (SDL_EVDEV_Init() < 0) { return -1; @@ -281,6 +289,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("VIVANTE: Can't create native window"); } +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -289,6 +298,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) } else { data->egl_surface = EGL_NO_SURFACE; } +#endif /* Window has been successfully created */ return 0; @@ -302,9 +312,11 @@ VIVANTE_DestroyWindow(_THIS, SDL_Window * window) data = window->driverdata; if (data) { +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } +#endif if (data->native_window) { #if SDL_VIDEO_DRIVER_VIVANTE_VDK @@ -366,22 +378,20 @@ VIVANTE_HideWindow(_THIS, SDL_Window * window) SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { -/* SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(0); if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_VIVANTE; + info->info.vivante.display = displaydata->native_display; info->info.vivante.window = data->native_window; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } -*/ - SDL_Unsupported(); - return SDL_FALSE; } /*****************************************************************************/ diff --git a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.h b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.h rename to 3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.h index b99c73375b..d335564878 100644 --- a/3rdparty/sdl2-2.0.4/src/video/vivante/SDL_vivantevideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_vivantevideo_h -#define _SDL_vivantevideo_h +#ifndef SDL_vivantevideo_h_ +#define SDL_vivantevideo_h_ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" @@ -86,6 +86,6 @@ SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, /* Event functions */ void VIVANTE_PumpEvents(_THIS); -#endif /* _SDL_vivantevideo_h */ +#endif /* SDL_vivantevideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.c new file mode 100644 index 0000000000..5fd826b9bf --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.c @@ -0,0 +1,123 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylanddatamanager.h" +#include "SDL_waylandevents_c.h" + +int +Wayland_SetClipboardText(_THIS, const char *text) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + int status = 0; + + if (_this == NULL || _this->driverdata == NULL) { + status = SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (text[0] != '\0') { + SDL_WaylandDataSource* source = Wayland_data_source_create(_this); + Wayland_data_source_add_data(source, TEXT_MIME, text, + strlen(text) + 1); + + status = Wayland_data_device_set_selection(data_device, source); + if (status != 0) { + Wayland_data_source_destroy(source); + } + } else { + status = Wayland_data_device_clear_selection(data_device); + } + } + + return status; +} + +char * +Wayland_GetClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + char *text = NULL; + + void *buffer = NULL; + size_t length = 0; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (data_device->selection_offer != NULL) { + buffer = Wayland_data_offer_receive(data_device->selection_offer, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } else if (data_device->selection_source != NULL) { + buffer = Wayland_data_source_get_data(data_device->selection_source, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } + } + + if (text == NULL) { + text = SDL_strdup(""); + } + + return text; +} + +SDL_bool +Wayland_HasClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + SDL_bool result = SDL_FALSE; + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + data_device = Wayland_get_data_device(video_data->input); + if (data_device != NULL && Wayland_data_offer_has_mime( + data_device->selection_offer, TEXT_MIME)) { + result = SDL_TRUE; + } else if(data_device != NULL && Wayland_data_source_has_mime( + data_device->selection_source, TEXT_MIME)) { + result = SDL_TRUE; + } + } + return result; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.h new file mode 100644 index 0000000000..467e1c77f7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandclipboard.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_waylandclipboard_h_ +#define SDL_waylandclipboard_h_ + +extern int Wayland_SetClipboardText(_THIS, const char *text); +extern char *Wayland_GetClipboardText(_THIS); +extern SDL_bool Wayland_HasClipboardText(_THIS); + +#endif /* SDL_waylandclipboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.c new file mode 100644 index 0000000000..f1b9742ce1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.c @@ -0,0 +1,468 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include +#include +#include +#include + +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "../../core/unix/SDL_poll.h" + +#include "SDL_waylandvideo.h" +#include "SDL_waylanddatamanager.h" + +#include "SDL_waylanddyn.h" + +static ssize_t +write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos) +{ + int ready = 0; + ssize_t bytes_written = 0; + ssize_t length = total_length - *pos; + + sigset_t sig_set; + sigset_t old_sig_set; + struct timespec zerotime = {0}; + + ready = SDL_IOReady(fd, SDL_TRUE, 1 * 1000); + + sigemptyset(&sig_set); + sigaddset(&sig_set, SIGPIPE); + + pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); + + if (ready == 0) { + bytes_written = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_written = SDL_SetError("Pipe select error"); + } else { + if (length > 0) { + bytes_written = write(fd, (Uint8*)buffer + *pos, SDL_min(length, PIPE_BUF)); + } + + if (bytes_written > 0) { + *pos += bytes_written; + } + } + + sigtimedwait(&sig_set, 0, &zerotime); + pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL); + + return bytes_written; +} + +static ssize_t +read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate) +{ + int ready = 0; + void* output_buffer = NULL; + char temp[PIPE_BUF]; + size_t new_buffer_length = 0; + ssize_t bytes_read = 0; + size_t pos = 0; + + ready = SDL_IOReady(fd, SDL_FALSE, 1 * 1000); + + if (ready == 0) { + bytes_read = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_read = SDL_SetError("Pipe select error"); + } else { + bytes_read = read(fd, temp, sizeof(temp)); + } + + if (bytes_read > 0) { + pos = *total_length; + *total_length += bytes_read; + + if (null_terminate == SDL_TRUE) { + new_buffer_length = *total_length + 1; + } else { + new_buffer_length = *total_length; + } + + if (*buffer == NULL) { + output_buffer = SDL_malloc(new_buffer_length); + } else { + output_buffer = SDL_realloc(*buffer, new_buffer_length); + } + + if (output_buffer == NULL) { + bytes_read = SDL_OutOfMemory(); + } else { + SDL_memcpy((Uint8*)output_buffer + pos, temp, bytes_read); + + if (null_terminate == SDL_TRUE) { + SDL_memset((Uint8*)output_buffer + (new_buffer_length - 1), 0, 1); + } + + *buffer = output_buffer; + } + } + + return bytes_read; +} + +#define MIME_LIST_SIZE 4 + +static const char* mime_conversion_list[MIME_LIST_SIZE][2] = { + {"text/plain", TEXT_MIME}, + {"TEXT", TEXT_MIME}, + {"UTF8_STRING", TEXT_MIME}, + {"STRING", TEXT_MIME} +}; + +const char* +Wayland_convert_mime_type(const char *mime_type) +{ + const char *found = mime_type; + + size_t index = 0; + + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][0], mime_type) == 0) { + found = mime_conversion_list[index][1]; + break; + } + } + + return found; +} + +static SDL_MimeDataList* +mime_data_list_find(struct wl_list* list, + const char* mime_type) +{ + SDL_MimeDataList *found = NULL; + + SDL_MimeDataList *mime_list = NULL; + wl_list_for_each(mime_list, list, link) { + if (strcmp(mime_list->mime_type, mime_type) == 0) { + found = mime_list; + break; + } + } + return found; +} + +static int +mime_data_list_add(struct wl_list* list, + const char* mime_type, + void* buffer, size_t length) +{ + int status = 0; + size_t mime_type_length = 0; + + SDL_MimeDataList *mime_data = NULL; + + mime_data = mime_data_list_find(list, mime_type); + + if (mime_data == NULL) { + mime_data = SDL_calloc(1, sizeof(*mime_data)); + if (mime_data == NULL) { + status = SDL_OutOfMemory(); + } else { + WAYLAND_wl_list_insert(list, &(mime_data->link)); + + mime_type_length = strlen(mime_type) + 1; + mime_data->mime_type = SDL_malloc(mime_type_length); + if (mime_data->mime_type == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length); + } + } + } + + if (mime_data != NULL && buffer != NULL && length > 0) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + mime_data->data = buffer; + mime_data->length = length; + } + + return status; +} + +static void +mime_data_list_free(struct wl_list *list) +{ + SDL_MimeDataList *mime_data = NULL; + SDL_MimeDataList *next = NULL; + + wl_list_for_each_safe(mime_data, next, list, link) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + if (mime_data->mime_type != NULL) { + SDL_free(mime_data->mime_type); + } + SDL_free(mime_data); + } +} + +ssize_t +Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd) +{ + size_t written_bytes = 0; + ssize_t status = 0; + SDL_MimeDataList *mime_data = NULL; + + mime_type = Wayland_convert_mime_type(mime_type); + mime_data = mime_data_list_find(&source->mimes, + mime_type); + + if (mime_data == NULL || mime_data->data == NULL) { + status = SDL_SetError("Invalid mime type"); + close(fd); + } else { + while (write_pipe(fd, mime_data->data, mime_data->length, + &written_bytes) > 0); + close(fd); + status = written_bytes; + } + return status; +} + +int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length) +{ + int status = 0; + if (length > 0) { + void *internal_buffer = SDL_malloc(length); + if (internal_buffer == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(internal_buffer, buffer, length); + status = mime_data_list_add(&source->mimes, mime_type, + internal_buffer, length); + } + } + return status; +} + +SDL_bool +Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (source != NULL) { + found = mime_data_list_find(&source->mimes, mime_type) != NULL; + } + return found; +} + +void* +Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_MimeDataList *mime_data = NULL; + void *buffer = NULL; + *length = 0; + + if (source == NULL) { + SDL_SetError("Invalid data source"); + } else { + mime_data = mime_data_list_find(&source->mimes, mime_type); + if (mime_data != NULL && mime_data->length > 0) { + buffer = SDL_malloc(mime_data->length); + if (buffer == NULL) { + *length = SDL_OutOfMemory(); + } else { + *length = mime_data->length; + SDL_memcpy(buffer, mime_data->data, mime_data->length); + } + } + } + + return buffer; +} + +void +Wayland_data_source_destroy(SDL_WaylandDataSource *source) +{ + if (source != NULL) { + wl_data_source_destroy(source->source); + mime_data_list_free(&source->mimes); + SDL_free(source); + } +} + +void* +Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_WaylandDataDevice *data_device = NULL; + + int pipefd[2]; + void *buffer = NULL; + *length = 0; + + if (offer == NULL) { + SDL_SetError("Invalid data offer"); + } else if ((data_device = offer->data_device) == NULL) { + SDL_SetError("Data device not initialized"); + } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + SDL_SetError("Could not read pipe"); + } else { + wl_data_offer_receive(offer->offer, mime_type, pipefd[1]); + + /* TODO: Needs pump and flush? */ + WAYLAND_wl_display_flush(data_device->video_data->display); + + close(pipefd[1]); + + while (read_pipe(pipefd[0], &buffer, length, null_terminate) > 0); + close(pipefd[0]); + } + return buffer; +} + +int +Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char* mime_type) +{ + return mime_data_list_add(&offer->mimes, mime_type, NULL, 0); +} + + +SDL_bool +Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (offer != NULL) { + found = mime_data_list_find(&offer->mimes, mime_type) != NULL; + } + return found; +} + +void +Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer) +{ + if (offer != NULL) { + wl_data_offer_destroy(offer->offer); + mime_data_list_free(&offer->mimes); + SDL_free(offer); + } +} + +int +Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device) +{ + int status = 0; + + if (data_device == NULL || data_device->data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (data_device->selection_source != 0) { + wl_data_device_set_selection(data_device->data_device, NULL, 0); + data_device->selection_source = NULL; + } + return status; +} + +int +Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device, + SDL_WaylandDataSource *source) +{ + int status = 0; + size_t num_offers = 0; + size_t index = 0; + + if (data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (source == NULL) { + status = SDL_SetError("Invalid source"); + } else { + SDL_MimeDataList *mime_data = NULL; + + wl_list_for_each(mime_data, &(source->mimes), link) { + wl_data_source_offer(source->source, + mime_data->mime_type); + + /* TODO - Improve system for multiple mime types to same data */ + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][1], mime_data->mime_type) == 0) { + wl_data_source_offer(source->source, + mime_conversion_list[index][0]); + } + } + /* */ + + ++num_offers; + } + + if (num_offers == 0) { + Wayland_data_device_clear_selection(data_device); + status = SDL_SetError("No mime data"); + } else { + /* Only set if there is a valid serial if not set it later */ + if (data_device->selection_serial != 0) { + wl_data_device_set_selection(data_device->data_device, + source->source, + data_device->selection_serial); + } + data_device->selection_source = source; + } + } + + return status; +} + +int +Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device, + uint32_t serial) +{ + int status = -1; + if (data_device != NULL) { + status = 0; + + /* If there was no serial and there is a pending selection set it now. */ + if (data_device->selection_serial == 0 + && data_device->selection_source != NULL) { + wl_data_device_set_selection(data_device->data_device, + data_device->selection_source->source, + serial); + } + + data_device->selection_serial = serial; + } + + return status; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.h new file mode 100644 index 0000000000..9b13e64d51 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddatamanager.h @@ -0,0 +1,103 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylanddatamanager_h_ +#define SDL_waylanddatamanager_h_ + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" + +#define TEXT_MIME "text/plain;charset=utf-8" +#define FILE_MIME "text/uri-list" + +typedef struct { + char *mime_type; + void *data; + size_t length; + struct wl_list link; +} SDL_MimeDataList; + +typedef struct { + struct wl_data_source *source; + struct wl_list mimes; +} SDL_WaylandDataSource; + +typedef struct { + struct wl_data_offer *offer; + struct wl_list mimes; + void *data_device; +} SDL_WaylandDataOffer; + +typedef struct { + struct wl_data_device *data_device; + SDL_VideoData *video_data; + + /* Drag and Drop */ + uint32_t drag_serial; + SDL_WaylandDataOffer *drag_offer; + SDL_WaylandDataOffer *selection_offer; + + /* Clipboard */ + uint32_t selection_serial; + SDL_WaylandDataSource *selection_source; +} SDL_WaylandDataDevice; + +extern const char* Wayland_convert_mime_type(const char *mime_type); + +/* Wayland Data Source - (Sending) */ +extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS); +extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd); +extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length); +extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type); +extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source); + +/* Wayland Data Offer - (Receiving) */ +extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer); + +/* Clipboard */ +extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device); +extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device, + SDL_WaylandDataSource *source); +extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device, + uint32_t serial); +#endif /* SDL_waylanddatamanager_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.c rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.c index bc1d06e468..98cc51887d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.c +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -94,9 +94,6 @@ WAYLAND_GetSym(const char *fnname, int *pHasModule) #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE static int wayland_load_refcount = 0; @@ -115,9 +112,6 @@ SDL_WAYLAND_UnloadSymbols(void) #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @@ -150,20 +144,12 @@ SDL_WAYLAND_LoadSymbols(void) } #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */ -#define SDL_WAYLAND_SYM(rc,fn,params) -#define SDL_WAYLAND_INTERFACE(iface) #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname; #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod); #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod); #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) { /* all required symbols loaded. */ @@ -180,9 +166,6 @@ SDL_WAYLAND_LoadSymbols(void) #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE #endif } diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.h index b3ff9d8e99..720427ea77 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylanddyn.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_waylanddyn_h -#define _SDL_waylanddyn_h +#ifndef SDL_waylanddyn_h_ +#define SDL_waylanddyn_h_ #include "../../SDL_internal.h" @@ -53,10 +53,7 @@ void SDL_WAYLAND_UnloadSymbols(void); extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn; #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface; #include "SDL_waylandsym.h" -#undef SDL_WAYLAND_MODULE -#undef SDL_WAYLAND_SYM -#undef SDL_WAYLAND_INTERFACE - + #ifdef __cplusplus } @@ -79,6 +76,7 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data) #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) +#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) #define wl_seat_interface (*WAYLAND_wl_seat_interface) #define wl_surface_interface (*WAYLAND_wl_surface_interface) @@ -93,12 +91,17 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_output_interface (*WAYLAND_wl_output_interface) #define wl_shell_interface (*WAYLAND_wl_shell_interface) #define wl_shm_interface (*WAYLAND_wl_shm_interface) +#define wl_data_device_interface (*WAYLAND_wl_data_device_interface) +#define wl_data_offer_interface (*WAYLAND_wl_data_offer_interface) +#define wl_data_source_interface (*WAYLAND_wl_data_source_interface) +#define wl_data_device_manager_interface (*WAYLAND_wl_data_device_manager_interface) #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ -#include "wayland-client.h" +#include "wayland-client-core.h" +#include "wayland-client-protocol.h" #include "wayland-egl.h" -#endif /* !defined _SDL_waylanddyn_h */ +#endif /* SDL_waylanddyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents.c new file mode 100644 index 0000000000..0c953a54c2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents.c @@ -0,0 +1,1136 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#include "../../core/unix/SDL_poll.h" +#include "../../events/SDL_sysevents.h" +#include "../../events/SDL_events_c.h" +#include "../../events/scancodes_xfree86.h" + +#include "SDL_waylandvideo.h" +#include "SDL_waylandevents_c.h" +#include "SDL_waylandwindow.h" + +#include "SDL_waylanddyn.h" + +#include "pointer-constraints-unstable-v1-client-protocol.h" +#include "relative-pointer-unstable-v1-client-protocol.h" +#include "xdg-shell-client-protocol.h" +#include "xdg-shell-unstable-v6-client-protocol.h" + +#include +#include +#include +#include +#include +#include + +struct SDL_WaylandInput { + SDL_VideoData *display; + struct wl_seat *seat; + struct wl_pointer *pointer; + struct wl_touch *touch; + struct wl_keyboard *keyboard; + SDL_WaylandDataDevice *data_device; + struct zwp_relative_pointer_v1 *relative_pointer; + SDL_WindowData *pointer_focus; + SDL_WindowData *keyboard_focus; + + /* Last motion location */ + wl_fixed_t sx_w; + wl_fixed_t sy_w; + + double dx_frac; + double dy_frac; + + struct { + struct xkb_keymap *keymap; + struct xkb_state *state; + } xkb; +}; + +struct SDL_WaylandTouchPoint { + SDL_TouchID id; + float x; + float y; + struct wl_surface* surface; + + struct SDL_WaylandTouchPoint* prev; + struct SDL_WaylandTouchPoint* next; +}; + +struct SDL_WaylandTouchPointList { + struct SDL_WaylandTouchPoint* head; + struct SDL_WaylandTouchPoint* tail; +}; + +static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL}; + +static void +touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface) +{ + struct SDL_WaylandTouchPoint* tp = SDL_malloc(sizeof(struct SDL_WaylandTouchPoint)); + + tp->id = id; + tp->x = x; + tp->y = y; + tp->surface = surface; + + if (touch_points.tail) { + touch_points.tail->next = tp; + tp->prev = touch_points.tail; + } else { + touch_points.head = tp; + tp->prev = NULL; + } + + touch_points.tail = tp; + tp->next = NULL; +} + +static void +touch_update(SDL_TouchID id, float x, float y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + tp->x = x; + tp->y = y; + } + + tp = tp->next; + } +} + +static void +touch_del(SDL_TouchID id, float* x, float* y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + *x = tp->x; + *y = tp->y; + + if (tp->prev) { + tp->prev->next = tp->next; + } else { + touch_points.head = tp->next; + } + + if (tp->next) { + tp->next->prev = tp->prev; + } else { + touch_points.tail = tp->prev; + } + + SDL_free(tp); + } + + tp = tp->next; + } +} + +static struct wl_surface* +touch_surface(SDL_TouchID id) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + return tp->surface; + } + + tp = tp->next; + } + + return NULL; +} + +void +Wayland_PumpEvents(_THIS) +{ + SDL_VideoData *d = _this->driverdata; + + WAYLAND_wl_display_flush(d->display); + + if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0)) { + WAYLAND_wl_display_dispatch(d->display); + } + else + { + WAYLAND_wl_display_dispatch_pending(d->display); + } +} + +static void +pointer_handle_enter(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t sx_w, wl_fixed_t sy_w) +{ + struct SDL_WaylandInput *input = data; + SDL_WindowData *window; + + if (!surface) { + /* enter event for a window we've just destroyed */ + return; + } + + /* This handler will be called twice in Wayland 1.4 + * Once for the window surface which has valid user data + * and again for the mouse cursor surface which does not have valid user data + * We ignore the later + */ + + window = (SDL_WindowData *)wl_surface_get_user_data(surface); + + if (window) { + input->pointer_focus = window; + SDL_SetMouseFocus(window->sdlwindow); + } +} + +static void +pointer_handle_leave(void *data, struct wl_pointer *pointer, + uint32_t serial, struct wl_surface *surface) +{ + struct SDL_WaylandInput *input = data; + + if (input->pointer_focus) { + SDL_SetMouseFocus(NULL); + input->pointer_focus = NULL; + } +} + +static void +pointer_handle_motion(void *data, struct wl_pointer *pointer, + uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) +{ + struct SDL_WaylandInput *input = data; + SDL_WindowData *window = input->pointer_focus; + input->sx_w = sx_w; + input->sy_w = sy_w; + if (input->pointer_focus) { + const int sx = wl_fixed_to_int(sx_w); + const int sy = wl_fixed_to_int(sy_w); + SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); + } +} + +static SDL_bool +ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) +{ + SDL_WindowData *window_data = input->pointer_focus; + SDL_Window *window = window_data->sdlwindow; + + if (window->hit_test) { + const SDL_Point point = { wl_fixed_to_int(input->sx_w), wl_fixed_to_int(input->sy_w) }; + const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); + + static const uint32_t directions_wl[] = { + WL_SHELL_SURFACE_RESIZE_TOP_LEFT, WL_SHELL_SURFACE_RESIZE_TOP, + WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, WL_SHELL_SURFACE_RESIZE_RIGHT, + WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM, + WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, WL_SHELL_SURFACE_RESIZE_LEFT + }; + + /* the names are different (ZXDG_TOPLEVEL_V6_RESIZE_EDGE_* vs + WL_SHELL_SURFACE_RESIZE_*), but the values are the same. */ + const uint32_t *directions_zxdg = directions_wl; + + switch (rc) { + case SDL_HITTEST_DRAGGABLE: + if (input->display->shell.xdg) { + xdg_toplevel_move(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, serial); + } else if (input->display->shell.zxdg) { + zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial); + } else { + wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial); + } + return SDL_TRUE; + + case SDL_HITTEST_RESIZE_TOPLEFT: + case SDL_HITTEST_RESIZE_TOP: + case SDL_HITTEST_RESIZE_TOPRIGHT: + case SDL_HITTEST_RESIZE_RIGHT: + case SDL_HITTEST_RESIZE_BOTTOMRIGHT: + case SDL_HITTEST_RESIZE_BOTTOM: + case SDL_HITTEST_RESIZE_BOTTOMLEFT: + case SDL_HITTEST_RESIZE_LEFT: + if (input->display->shell.xdg) { + xdg_toplevel_resize(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } else if (input->display->shell.zxdg) { + zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } else { + wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } + return SDL_TRUE; + + default: return SDL_FALSE; + } + } + + return SDL_FALSE; +} + +static void +pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, + uint32_t time, uint32_t button, uint32_t state_w) +{ + SDL_WindowData *window = input->pointer_focus; + enum wl_pointer_button_state state = state_w; + uint32_t sdl_button; + + if (input->pointer_focus) { + switch (button) { + case BTN_LEFT: + sdl_button = SDL_BUTTON_LEFT; + if (ProcessHitTest(input, serial)) { + return; /* don't pass this event on to app. */ + } + break; + case BTN_MIDDLE: + sdl_button = SDL_BUTTON_MIDDLE; + break; + case BTN_RIGHT: + sdl_button = SDL_BUTTON_RIGHT; + break; + case BTN_SIDE: + sdl_button = SDL_BUTTON_X1; + break; + case BTN_EXTRA: + sdl_button = SDL_BUTTON_X2; + break; + default: + return; + } + + Wayland_data_device_set_serial(input->data_device, serial); + + SDL_SendMouseButton(window->sdlwindow, 0, + state ? SDL_PRESSED : SDL_RELEASED, sdl_button); + } +} + +static void +pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, + uint32_t time, uint32_t button, uint32_t state_w) +{ + struct SDL_WaylandInput *input = data; + + pointer_handle_button_common(input, serial, time, button, state_w); +} + +static void +pointer_handle_axis_common(struct SDL_WaylandInput *input, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ + SDL_WindowData *window = input->pointer_focus; + enum wl_pointer_axis a = axis; + float x, y; + + if (input->pointer_focus) { + switch (a) { + case WL_POINTER_AXIS_VERTICAL_SCROLL: + x = 0; + y = 0 - (float)wl_fixed_to_double(value); + break; + case WL_POINTER_AXIS_HORIZONTAL_SCROLL: + x = 0 - (float)wl_fixed_to_double(value); + y = 0; + break; + default: + return; + } + + SDL_SendMouseWheel(window->sdlwindow, 0, x, y, SDL_MOUSEWHEEL_NORMAL); + } +} + +static void +pointer_handle_axis(void *data, struct wl_pointer *pointer, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ + struct SDL_WaylandInput *input = data; + + pointer_handle_axis_common(input, time, axis, value); +} + +static const struct wl_pointer_listener pointer_listener = { + pointer_handle_enter, + pointer_handle_leave, + pointer_handle_motion, + pointer_handle_button, + pointer_handle_axis, + NULL, /* frame */ + NULL, /* axis_source */ + NULL, /* axis_stop */ + NULL, /* axis_discrete */ +}; + +static void +touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, struct wl_surface *surface, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(surface); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_add(id, x, y, surface); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f); +} + +static void +touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, int id) +{ + float x = 0, y = 0; + + touch_del(id, &x, &y); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f); +} + +static void +touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_update(id, x, y); + SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f); +} + +static void +touch_handler_frame(void *data, struct wl_touch *touch) +{ + +} + +static void +touch_handler_cancel(void *data, struct wl_touch *touch) +{ + +} + +static const struct wl_touch_listener touch_listener = { + touch_handler_down, + touch_handler_up, + touch_handler_motion, + touch_handler_frame, + touch_handler_cancel, + NULL, /* shape */ + NULL, /* orientation */ +}; + +static void +keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, + uint32_t format, int fd, uint32_t size) +{ + struct SDL_WaylandInput *input = data; + char *map_str; + + if (!data) { + close(fd); + return; + } + + if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { + close(fd); + return; + } + + map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (map_str == MAP_FAILED) { + close(fd); + return; + } + + input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context, + map_str, + XKB_KEYMAP_FORMAT_TEXT_V1, + 0); + munmap(map_str, size); + close(fd); + + if (!input->xkb.keymap) { + fprintf(stderr, "failed to compile keymap\n"); + return; + } + + input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); + if (!input->xkb.state) { + fprintf(stderr, "failed to create XKB state\n"); + WAYLAND_xkb_keymap_unref(input->xkb.keymap); + input->xkb.keymap = NULL; + return; + } +} + +static void +keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface, + struct wl_array *keys) +{ + struct SDL_WaylandInput *input = data; + SDL_WindowData *window; + + if (!surface) { + /* enter event for a window we've just destroyed */ + return; + } + + window = wl_surface_get_user_data(surface); + + if (window) { + input->keyboard_focus = window; + window->keyboard_device = input; + SDL_SetKeyboardFocus(window->sdlwindow); + } +} + +static void +keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, + uint32_t serial, struct wl_surface *surface) +{ + SDL_SetKeyboardFocus(NULL); +} + +static void +keyboard_handle_key(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t time, uint32_t key, + uint32_t state_w) +{ + struct SDL_WaylandInput *input = data; + SDL_WindowData *window = input->keyboard_focus; + enum wl_keyboard_key_state state = state_w; + const xkb_keysym_t *syms; + uint32_t scancode; + char text[8]; + int size; + + if (key < SDL_arraysize(xfree86_scancode_table2)) { + scancode = xfree86_scancode_table2[key]; + + // TODO when do we get WL_KEYBOARD_KEY_STATE_REPEAT? + if (scancode != SDL_SCANCODE_UNKNOWN) + SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? + SDL_PRESSED : SDL_RELEASED, scancode); + } + + if (!window || window->keyboard_device != input || !input->xkb.state) + return; + + // TODO can this happen? + if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1) + return; + + if (state) { + size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text); + + if (size > 0) { + text[size] = 0; + + Wayland_data_device_set_serial(input->data_device, serial); + + SDL_SendKeyboardText(text); + } + } +} + +static void +keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, + uint32_t serial, uint32_t mods_depressed, + uint32_t mods_latched, uint32_t mods_locked, + uint32_t group) +{ + struct SDL_WaylandInput *input = data; + + WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, + mods_locked, 0, 0, group); +} + +static const struct wl_keyboard_listener keyboard_listener = { + keyboard_handle_keymap, + keyboard_handle_enter, + keyboard_handle_leave, + keyboard_handle_key, + keyboard_handle_modifiers, + NULL, /* repeat_info */ +}; + +static void +seat_handle_capabilities(void *data, struct wl_seat *seat, + enum wl_seat_capability caps) +{ + struct SDL_WaylandInput *input = data; + + if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { + input->pointer = wl_seat_get_pointer(seat); + input->display->pointer = input->pointer; + wl_pointer_set_user_data(input->pointer, input); + wl_pointer_add_listener(input->pointer, &pointer_listener, + input); + } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { + wl_pointer_destroy(input->pointer); + input->pointer = NULL; + input->display->pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { + SDL_AddTouch(1, "wayland_touch"); + input->touch = wl_seat_get_touch(seat); + wl_touch_set_user_data(input->touch, input); + wl_touch_add_listener(input->touch, &touch_listener, + input); + } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + input->touch = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { + input->keyboard = wl_seat_get_keyboard(seat); + wl_keyboard_set_user_data(input->keyboard, input); + wl_keyboard_add_listener(input->keyboard, &keyboard_listener, + input); + } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { + wl_keyboard_destroy(input->keyboard); + input->keyboard = NULL; + } +} + +static const struct wl_seat_listener seat_listener = { + seat_handle_capabilities, + NULL, /* name */ +}; + +static void +data_source_handle_target(void *data, struct wl_data_source *wl_data_source, + const char *mime_type) +{ +} + +static void +data_source_handle_send(void *data, struct wl_data_source *wl_data_source, + const char *mime_type, int32_t fd) +{ + Wayland_data_source_send((SDL_WaylandDataSource *)data, mime_type, fd); +} + +static void +data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source) +{ + Wayland_data_source_destroy(data); +} + +static void +data_source_handle_dnd_drop_performed(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_dnd_finished(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_action(void *data, struct wl_data_source *wl_data_source, + uint32_t dnd_action) +{ +} + +static const struct wl_data_source_listener data_source_listener = { + data_source_handle_target, + data_source_handle_send, + data_source_handle_cancelled, + data_source_handle_dnd_drop_performed, // Version 3 + data_source_handle_dnd_finished, // Version 3 + data_source_handle_action, // Version 3 +}; + +SDL_WaylandDataSource* +Wayland_data_source_create(_THIS) +{ + SDL_WaylandDataSource *data_source = NULL; + SDL_VideoData *driver_data = NULL; + struct wl_data_source *id = NULL; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + driver_data = _this->driverdata; + + if (driver_data->data_device_manager != NULL) { + id = wl_data_device_manager_create_data_source( + driver_data->data_device_manager); + } + + if (id == NULL) { + SDL_SetError("Wayland unable to create data source"); + } else { + data_source = SDL_calloc(1, sizeof *data_source); + if (data_source == NULL) { + SDL_OutOfMemory(); + wl_data_source_destroy(id); + } else { + WAYLAND_wl_list_init(&(data_source->mimes)); + data_source->source = id; + wl_data_source_set_user_data(id, data_source); + wl_data_source_add_listener(id, &data_source_listener, + data_source); + } + } + } + return data_source; +} + +static void +data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_offer, + const char *mime_type) +{ + SDL_WaylandDataOffer *offer = data; + Wayland_data_offer_add_mime(offer, mime_type); +} + +static void +data_offer_handle_source_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t source_actions) +{ +} + +static void +data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t dnd_action) +{ +} + +static const struct wl_data_offer_listener data_offer_listener = { + data_offer_handle_offer, + data_offer_handle_source_actions, // Version 3 + data_offer_handle_actions, // Version 3 +}; + +static void +data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataOffer *data_offer = NULL; + + data_offer = SDL_calloc(1, sizeof *data_offer); + if (data_offer == NULL) { + SDL_OutOfMemory(); + } else { + data_offer->offer = id; + data_offer->data_device = data; + WAYLAND_wl_list_init(&(data_offer->mimes)); + wl_data_offer_set_user_data(id, data_offer); + wl_data_offer_add_listener(id, &data_offer_listener, data_offer); + } +} + +static void +data_device_handle_enter(void *data, struct wl_data_device *wl_data_device, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_bool has_mime = SDL_FALSE; + uint32_t dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; + + data_device->drag_serial = serial; + + if (id != NULL) { + data_device->drag_offer = wl_data_offer_get_user_data(id); + + /* TODO: SDL Support more mime types */ + has_mime = Wayland_data_offer_has_mime( + data_device->drag_offer, FILE_MIME); + + /* If drag_mime is NULL this will decline the offer */ + wl_data_offer_accept(id, serial, + (has_mime == SDL_TRUE) ? FILE_MIME : NULL); + + /* SDL only supports "copy" style drag and drop */ + if (has_mime == SDL_TRUE) { + dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + } + wl_data_offer_set_actions(data_device->drag_offer->offer, + dnd_action, dnd_action); + } +} + +static void +data_device_handle_leave(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (data_device->selection_offer != NULL) { + data_device->selection_offer = NULL; + Wayland_data_offer_destroy(offer); + } +} + +static void +data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, + uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ +} + +static void +data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + void *buffer = NULL; + size_t length = 0; + + const char *current_uri = NULL; + const char *last_char = NULL; + char *current_char = NULL; + + if (data_device->drag_offer != NULL) { + /* TODO: SDL Support more mime types */ + buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_MIME, SDL_FALSE); + + /* uri-list */ + current_uri = (const char *)buffer; + last_char = (const char *)buffer + length; + for (current_char = buffer; current_char < last_char; ++current_char) { + if (*current_char == '\n' || *current_char == 0) { + if (*current_uri != 0 && *current_uri != '#') { + *current_char = 0; + SDL_SendDropFile(NULL, current_uri); + } + current_uri = (const char *)current_char + 1; + } + } + + SDL_free(buffer); + } +} + +static void +data_device_handle_selection(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (id != NULL) { + offer = wl_data_offer_get_user_data(id); + } + + if (data_device->selection_offer != offer) { + Wayland_data_offer_destroy(data_device->selection_offer); + data_device->selection_offer = offer; + } + + SDL_SendClipboardUpdate(); +} + +static const struct wl_data_device_listener data_device_listener = { + data_device_handle_data_offer, + data_device_handle_enter, + data_device_handle_leave, + data_device_handle_motion, + data_device_handle_drop, + data_device_handle_selection +}; + +void +Wayland_display_add_input(SDL_VideoData *d, uint32_t id) +{ + struct SDL_WaylandInput *input; + SDL_WaylandDataDevice *data_device = NULL; + + input = SDL_calloc(1, sizeof *input); + if (input == NULL) + return; + + input->display = d; + input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, 1); + input->sx_w = wl_fixed_from_int(0); + input->sy_w = wl_fixed_from_int(0); + d->input = input; + + if (d->data_device_manager != NULL) { + data_device = SDL_calloc(1, sizeof *data_device); + if (data_device == NULL) { + return; + } + + data_device->data_device = wl_data_device_manager_get_data_device( + d->data_device_manager, input->seat + ); + data_device->video_data = d; + + if (data_device->data_device == NULL) { + SDL_free(data_device); + } else { + wl_data_device_set_user_data(data_device->data_device, data_device); + wl_data_device_add_listener(data_device->data_device, + &data_device_listener, data_device); + input->data_device = data_device; + } + } + + wl_seat_add_listener(input->seat, &seat_listener, input); + wl_seat_set_user_data(input->seat, input); + + WAYLAND_wl_display_flush(d->display); +} + +void Wayland_display_destroy_input(SDL_VideoData *d) +{ + struct SDL_WaylandInput *input = d->input; + + if (!input) + return; + + if (input->data_device != NULL) { + Wayland_data_device_clear_selection(input->data_device); + if (input->data_device->selection_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->selection_offer); + } + if (input->data_device->drag_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->drag_offer); + } + if (input->data_device->data_device != NULL) { + wl_data_device_release(input->data_device->data_device); + } + SDL_free(input->data_device); + } + + if (input->keyboard) + wl_keyboard_destroy(input->keyboard); + + if (input->pointer) + wl_pointer_destroy(input->pointer); + + if (input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + } + + if (input->seat) + wl_seat_destroy(input->seat); + + if (input->xkb.state) + WAYLAND_xkb_state_unref(input->xkb.state); + + if (input->xkb.keymap) + WAYLAND_xkb_keymap_unref(input->xkb.keymap); + + SDL_free(input); + d->input = NULL; +} + +SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input) +{ + if (input == NULL) { + return NULL; + } + + return input->data_device; +} + +/* !!! FIXME: just merge these into display_handle_global(). */ +void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id) +{ + d->relative_pointer_manager = + wl_registry_bind(d->registry, id, + &zwp_relative_pointer_manager_v1_interface, 1); +} + +void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d) +{ + if (d->relative_pointer_manager) + zwp_relative_pointer_manager_v1_destroy(d->relative_pointer_manager); +} + +void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id) +{ + d->pointer_constraints = + wl_registry_bind(d->registry, id, + &zwp_pointer_constraints_v1_interface, 1); +} + +void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d) +{ + if (d->pointer_constraints) + zwp_pointer_constraints_v1_destroy(d->pointer_constraints); +} + +static void +relative_pointer_handle_relative_motion(void *data, + struct zwp_relative_pointer_v1 *pointer, + uint32_t time_hi, + uint32_t time_lo, + wl_fixed_t dx_w, + wl_fixed_t dy_w, + wl_fixed_t dx_unaccel_w, + wl_fixed_t dy_unaccel_w) +{ + struct SDL_WaylandInput *input = data; + SDL_VideoData *d = input->display; + SDL_WindowData *window = input->pointer_focus; + double dx_unaccel; + double dy_unaccel; + double dx; + double dy; + + dx_unaccel = wl_fixed_to_double(dx_unaccel_w); + dy_unaccel = wl_fixed_to_double(dy_unaccel_w); + + /* Add left over fraction from last event. */ + dx_unaccel += input->dx_frac; + dy_unaccel += input->dy_frac; + + input->dx_frac = modf(dx_unaccel, &dx); + input->dy_frac = modf(dy_unaccel, &dy); + + if (input->pointer_focus && d->relative_mouse_mode) { + SDL_SendMouseMotion(window->sdlwindow, 0, 1, (int)dx, (int)dy); + } +} + +static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = { + relative_pointer_handle_relative_motion, +}; + +static void +locked_pointer_locked(void *data, + struct zwp_locked_pointer_v1 *locked_pointer) +{ +} + +static void +locked_pointer_unlocked(void *data, + struct zwp_locked_pointer_v1 *locked_pointer) +{ +} + +static const struct zwp_locked_pointer_v1_listener locked_pointer_listener = { + locked_pointer_locked, + locked_pointer_unlocked, +}; + +static void +lock_pointer_to_window(SDL_Window *window, + struct SDL_WaylandInput *input) +{ + SDL_WindowData *w = window->driverdata; + SDL_VideoData *d = input->display; + struct zwp_locked_pointer_v1 *locked_pointer; + + if (w->locked_pointer) + return; + + locked_pointer = + zwp_pointer_constraints_v1_lock_pointer(d->pointer_constraints, + w->surface, + input->pointer, + NULL, + ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); + zwp_locked_pointer_v1_add_listener(locked_pointer, + &locked_pointer_listener, + window); + + w->locked_pointer = locked_pointer; +} + +int Wayland_input_lock_pointer(struct SDL_WaylandInput *input) +{ + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *d = input->display; + SDL_Window *window; + struct zwp_relative_pointer_v1 *relative_pointer; + + if (!d->relative_pointer_manager) + return -1; + + if (!d->pointer_constraints) + return -1; + + if (!input->relative_pointer) { + relative_pointer = + zwp_relative_pointer_manager_v1_get_relative_pointer( + d->relative_pointer_manager, + input->pointer); + zwp_relative_pointer_v1_add_listener(relative_pointer, + &relative_pointer_listener, + input); + input->relative_pointer = relative_pointer; + } + + for (window = vd->windows; window; window = window->next) + lock_pointer_to_window(window, input); + + d->relative_mouse_mode = 1; + + return 0; +} + +int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input) +{ + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *d = input->display; + SDL_Window *window; + SDL_WindowData *w; + + for (window = vd->windows; window; window = window->next) { + w = window->driverdata; + if (w->locked_pointer) + zwp_locked_pointer_v1_destroy(w->locked_pointer); + w->locked_pointer = NULL; + } + + zwp_relative_pointer_v1_destroy(input->relative_pointer); + input->relative_pointer = NULL; + + d->relative_mouse_mode = 0; + + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents_c.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents_c.h new file mode 100644 index 0000000000..1c5ffe5171 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandevents_c.h @@ -0,0 +1,51 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylandevents_h_ +#define SDL_waylandevents_h_ + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" +#include "SDL_waylanddatamanager.h" + +struct SDL_WaylandInput; + +extern void Wayland_PumpEvents(_THIS); + +extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id); +extern void Wayland_display_destroy_input(SDL_VideoData *d); + +extern SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input); + +extern void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id); +extern void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d); + +extern int Wayland_input_lock_pointer(struct SDL_WaylandInput *input); +extern int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input); + +extern void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id); +extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d); + +#endif /* SDL_waylandevents_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.c rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.c index b810f77842..c77b53eb77 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,11 +23,6 @@ #if SDL_VIDEO_DRIVER_WAYLAND -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include #include #include #include @@ -70,7 +65,6 @@ wayland_create_tmp_file(off_t size) xdg_path = SDL_getenv("XDG_RUNTIME_DIR"); if (!xdg_path) { - errno = ENOENT; return -1; } @@ -116,8 +110,7 @@ create_buffer_from_shm(Wayland_CursorData *d, shm_fd = wayland_create_tmp_file(size); if (shm_fd < 0) { - fprintf(stderr, "creating mouse cursor buffer failed!\n"); - return -1; + return SDL_SetError("Creating mouse cursor buffer failed."); } d->shm_data = mmap(NULL, @@ -128,8 +121,8 @@ create_buffer_from_shm(Wayland_CursorData *d, 0); if (d->shm_data == MAP_FAILED) { d->shm_data = NULL; - fprintf (stderr, "mmap () failed\n"); close (shm_fd); + return SDL_SetError("mmap() failed."); } shm_pool = wl_shm_create_pool(data->shm, shm_fd, size); @@ -159,6 +152,11 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_VideoDevice *vd = SDL_GetVideoDevice (); SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata; Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData)); + if (!data) { + SDL_OutOfMemory(); + free(cursor); + return NULL; + } cursor->driverdata = (void *) data; /* Assume ARGB8888 */ @@ -169,7 +167,7 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) if (create_buffer_from_shm (data, surface->w, surface->h, - WL_SHM_FORMAT_XRGB8888) < 0) + WL_SHM_FORMAT_ARGB8888) < 0) { free (cursor->driverdata); free (cursor); @@ -187,6 +185,8 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) data->hot_y = hot_y; data->w = surface->w; data->h = surface->h; + } else { + SDL_OutOfMemory(); } return cursor; @@ -200,6 +200,11 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor) cursor = calloc(1, sizeof (*cursor)); if (cursor) { Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData)); + if (!data) { + SDL_OutOfMemory(); + free(cursor); + return NULL; + } cursor->driverdata = (void *) data; data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]); @@ -322,13 +327,13 @@ Wayland_ShowCursor(SDL_Cursor *cursor) { Wayland_CursorData *data = cursor->driverdata; - wl_surface_attach(data->surface, data->buffer, 0, 0); - wl_surface_damage(data->surface, 0, 0, data->w, data->h); - wl_surface_commit(data->surface); wl_pointer_set_cursor (pointer, 0, data->surface, data->hot_x, data->hot_y); + wl_surface_attach(data->surface, data->buffer, 0, 0); + wl_surface_damage(data->surface, 0, 0, data->w, data->h); + wl_surface_commit(data->surface); } else { @@ -356,7 +361,13 @@ Wayland_WarpMouseGlobal(int x, int y) static int Wayland_SetRelativeMouseMode(SDL_bool enabled) { - return SDL_Unsupported(); + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + SDL_VideoData *data = (SDL_VideoData *) vd->driverdata; + + if (enabled) + return Wayland_input_lock_pointer(data->input); + else + return Wayland_input_unlock_pointer(data->input); } void @@ -381,23 +392,5 @@ Wayland_FiniMouse(void) /* This effectively assumes that nobody else * touches SDL_Mouse which is effectively * a singleton */ - - SDL_Mouse *mouse = SDL_GetMouse(); - - /* Free the current cursor if not the same pointer as - * the default cursor */ - if (mouse->def_cursor != mouse->cur_cursor) - Wayland_FreeCursor (mouse->cur_cursor); - - Wayland_FreeCursor (mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->CreateSystemCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.h index 129990ded4..2c50e5ff1e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandmouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.c similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.c rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.c index 6803dbe63d..9c0b84595b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) { int ret; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); Wayland_PumpEvents(_this); WAYLAND_wl_display_flush(data->display); @@ -54,14 +54,16 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window) return context; } -void +int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) { - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) { + return -1; + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + return 0; } - int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.h index 6c3f1f3847..58d7f9b087 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_waylandopengles_h -#define _SDL_waylandopengles_h +#ifndef SDL_waylandopengles_h_ +#define SDL_waylandopengles_h_ #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" typedef struct SDL_PrivateGLESData { + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -39,8 +40,10 @@ typedef struct SDL_PrivateGLESData extern int Wayland_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_waylandopengles_h */ +#endif /* SDL_waylandopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandsym.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandsym.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandsym.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandsym.h index b093d9db10..77783df81d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandsym.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,18 @@ /* *INDENT-OFF* */ +#ifndef SDL_WAYLAND_MODULE +#define SDL_WAYLAND_MODULE(modname) +#endif + +#ifndef SDL_WAYLAND_SYM +#define SDL_WAYLAND_SYM(rc,fn,params) +#endif + +#ifndef SDL_WAYLAND_INTERFACE +#define SDL_WAYLAND_INTERFACE(iface) +#endif + SDL_WAYLAND_MODULE(WAYLAND_CLIENT) SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...)) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *)) @@ -55,6 +67,9 @@ SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10) +SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...)) + SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) @@ -68,6 +83,10 @@ SDL_WAYLAND_INTERFACE(wl_compositor_interface) SDL_WAYLAND_INTERFACE(wl_output_interface) SDL_WAYLAND_INTERFACE(wl_shell_interface) SDL_WAYLAND_INTERFACE(wl_shm_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_interface) +SDL_WAYLAND_INTERFACE(wl_data_source_interface) +SDL_WAYLAND_INTERFACE(wl_data_offer_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_manager_interface) SDL_WAYLAND_MODULE(WAYLAND_EGL) SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int)) @@ -99,8 +118,10 @@ SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_sta xkb_layout_index_t latched_layout,\ xkb_layout_index_t locked_layout) ) +#undef SDL_WAYLAND_MODULE +#undef SDL_WAYLAND_SYM +#undef SDL_WAYLAND_INTERFACE /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ -//SDL_WAYLAND_SYM(ret, fn, params) diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.c rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.c index 4cae425946..1cf37c1a28 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.c +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -89,9 +89,9 @@ touch_handle_touch(void *data, */ SDL_TouchID deviceId = 1; - if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) { - SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__); - } + if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) { + SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__); + } switch (touchState) { case QtWaylandTouchPointPressed: diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.h similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.h index 5f2a05813b..eba0da80d6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandtouch.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,13 +19,13 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_waylandtouch_h_ +#define SDL_waylandtouch_h_ + #include "../../SDL_internal.h" #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH -#ifndef _SDL_waylandtouch_h -#define _SDL_waylandtouch_h - #include "SDL_waylandvideo.h" #include #include @@ -347,6 +347,6 @@ qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t re QT_WINDOWMANAGER_OPEN_URL, remaining, url); } -#endif /* _SDL_waylandtouch_h */ - #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +#endif /* SDL_waylandtouch_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.c similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.c index b47ec29be0..b6155e76d9 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,13 +34,20 @@ #include "SDL_waylandopengles.h" #include "SDL_waylandmouse.h" #include "SDL_waylandtouch.h" +#include "SDL_waylandclipboard.h" +#include "SDL_waylandvulkan.h" +#include +#include #include #include #include "SDL_waylanddyn.h" #include +#include "xdg-shell-client-protocol.h" +#include "xdg-shell-unstable-v6-client-protocol.h" + #define WAYLANDVID_DRIVER_NAME "wayland" /* Initialization/Query functions */ @@ -55,6 +62,62 @@ Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); static void Wayland_VideoQuit(_THIS); +/* Find out what class name we should use + * Based on src/video/x11/SDL_x11video.c */ +static char * +get_classname() +{ +/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: + "The surface class identifies the general class of applications + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class." */ + + char *spot; +#if defined(__LINUX__) || defined(__FREEBSD__) + char procfile[1024]; + char linkfile[1024]; + int linksize; +#endif + + /* First allow environment variable override */ + spot = SDL_getenv("SDL_VIDEO_WAYLAND_WMCLASS"); + if (spot) { + return SDL_strdup(spot); + } else { + /* Fallback to the "old" envvar */ + spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS"); + if (spot) { + return SDL_strdup(spot); + } + } + + /* Next look at the application's executable name */ +#if defined(__LINUX__) || defined(__FREEBSD__) +#if defined(__LINUX__) + SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid()); +#elif defined(__FREEBSD__) + SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file", + getpid()); +#else +#error Where can we find the executable name? +#endif + linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1); + if (linksize > 0) { + linkfile[linksize] = '\0'; + spot = SDL_strrchr(linkfile, '/'); + if (spot) { + return SDL_strdup(spot + 1); + } else { + return SDL_strdup(linkfile); + } + } +#endif /* __LINUX__ || __FREEBSD__ */ + + /* Finally use the default we've used forever */ + return SDL_strdup("SDL_App"); +} + /* Wayland driver bootstrap functions */ static int Wayland_Available(void) @@ -114,13 +177,27 @@ Wayland_CreateDevice(int devindex) device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; device->GL_DeleteContext = Wayland_GLES_DeleteContext; - device->CreateWindow = Wayland_CreateWindow; + device->CreateSDLWindow = Wayland_CreateWindow; device->ShowWindow = Wayland_ShowWindow; device->SetWindowFullscreen = Wayland_SetWindowFullscreen; + device->MaximizeWindow = Wayland_MaximizeWindow; + device->RestoreWindow = Wayland_RestoreWindow; device->SetWindowSize = Wayland_SetWindowSize; + device->SetWindowTitle = Wayland_SetWindowTitle; device->DestroyWindow = Wayland_DestroyWindow; device->SetWindowHitTest = Wayland_SetWindowHitTest; + device->SetClipboardText = Wayland_SetClipboardText; + device->GetClipboardText = Wayland_GetClipboardText; + device->HasClipboardText = Wayland_HasClipboardText; + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface; +#endif + device->free = Wayland_DeleteDevice; return device; @@ -145,7 +222,7 @@ display_handle_geometry(void *data, { SDL_VideoDisplay *display = data; - display->name = strdup(model); + display->name = SDL_strdup(model); display->driverdata = output; } @@ -161,9 +238,11 @@ display_handle_mode(void *data, SDL_DisplayMode mode; SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_RGB888; mode.w = width; mode.h = height; mode.refresh_rate = refresh / 1000; // mHz to Hz + mode.driverdata = display->driverdata; SDL_AddDisplayMode(display, &mode); if (flags & WL_OUTPUT_MODE_CURRENT) { @@ -211,6 +290,7 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) output = wl_registry_bind(d->registry, id, &wl_output_interface, 2); if (!output) { SDL_SetError("Failed to retrieve output."); + SDL_free(display); return; } @@ -236,6 +316,29 @@ static const struct qt_windowmanager_listener windowmanager_listener = { }; #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +static void +handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial) +{ + zxdg_shell_v6_pong(zxdg, serial); +} + +static const struct zxdg_shell_v6_listener shell_listener_zxdg = { + handle_ping_zxdg_shell +}; + + +static void +handle_ping_xdg_wm_base(void *data, struct xdg_wm_base *xdg, uint32_t serial) +{ + xdg_wm_base_pong(xdg, serial); +} + +static const struct xdg_wm_base_listener shell_listener_xdg = { + handle_ping_xdg_wm_base +}; + + static void display_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -248,12 +351,23 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_add_display(d, id); } else if (strcmp(interface, "wl_seat") == 0) { Wayland_display_add_input(d, id); + } else if (strcmp(interface, "xdg_wm_base") == 0) { + d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, 1); + xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL); + } else if (strcmp(interface, "zxdg_shell_v6") == 0) { + d->shell.zxdg = wl_registry_bind(d->registry, id, &zxdg_shell_v6_interface, 1); + zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL); } else if (strcmp(interface, "wl_shell") == 0) { - d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); + d->shell.wl = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm); - d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr"); + } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { + Wayland_display_add_relative_pointer_manager(d, id); + } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { + Wayland_display_add_pointer_constraints(d, id); + } else if (strcmp(interface, "wl_data_device_manager") == 0) { + d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3); #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (strcmp(interface, "qt_touch_extension") == 0) { @@ -270,7 +384,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } static const struct wl_registry_listener registry_listener = { - display_handle_global + display_handle_global, + NULL, /* global_remove */ }; int @@ -283,6 +398,11 @@ Wayland_VideoInit(_THIS) _this->driverdata = data; + data->xkb_context = WAYLAND_xkb_context_new(0); + if (!data->xkb_context) { + return SDL_SetError("Failed to create XKB context"); + } + data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { return SDL_SetError("Failed to connect to a Wayland display"); @@ -301,13 +421,11 @@ Wayland_VideoInit(_THIS) // Second roundtrip to receive all output events. WAYLAND_wl_display_roundtrip(data->display); - data->xkb_context = WAYLAND_xkb_context_new(0); - if (!data->xkb_context) { - return SDL_SetError("Failed to create XKB context"); - } - Wayland_InitMouse(); + /* Get the surface class name, usually the name of the application */ + data->classname = get_classname(); + WAYLAND_wl_display_flush(data->display); return 0; @@ -330,7 +448,7 @@ void Wayland_VideoQuit(_THIS) { SDL_VideoData *data = _this->driverdata; - int i; + int i, j; Wayland_FiniMouse (); @@ -338,9 +456,16 @@ Wayland_VideoQuit(_THIS) SDL_VideoDisplay *display = &_this->displays[i]; wl_output_destroy(display->driverdata); display->driverdata = NULL; + + for (j = display->num_display_modes; j--;) { + display->display_modes[j].driverdata = NULL; + } + display->desktop_mode.driverdata = NULL; } Wayland_display_destroy_input(data); + Wayland_display_destroy_pointer_constraints(data); + Wayland_display_destroy_relative_pointer_manager(data); if (data->xkb_context) { WAYLAND_xkb_context_unref(data->xkb_context); @@ -362,8 +487,14 @@ Wayland_VideoQuit(_THIS) if (data->cursor_theme) WAYLAND_wl_cursor_theme_destroy(data->cursor_theme); - if (data->shell) - wl_shell_destroy(data->shell); + if (data->shell.wl) + wl_shell_destroy(data->shell.wl); + + if (data->shell.xdg) + xdg_wm_base_destroy(data->shell.xdg); + + if (data->shell.zxdg) + zxdg_shell_v6_destroy(data->shell.zxdg); if (data->compositor) wl_compositor_destroy(data->compositor); @@ -376,7 +507,8 @@ Wayland_VideoQuit(_THIS) WAYLAND_wl_display_disconnect(data->display); } - free(data); + SDL_free(data->classname); + SDL_free(data); _this->driverdata = NULL; } diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.h similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.h index 8111bf153d..c16c0bdd49 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,18 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandvideo_h -#define _SDL_waylandvideo_h +#ifndef SDL_waylandvideo_h_ +#define SDL_waylandvideo_h_ + + +/* +!!! FIXME: xdg_wm_base is the stable replacement for zxdg_shell_v6. While it's +!!! FIXME: harmless to leave it here, consider deleting the obsolete codepath +!!! FIXME: soon, since Wayland (with xdg_wm_base) will probably be mainline +!!! FIXME: by the time people are relying on this SDL target. It's available +!!! FIXME: in Ubuntu 18.04 (and other distros). +*/ + #include #include "wayland-util.h" @@ -42,9 +52,15 @@ typedef struct { struct wl_compositor *compositor; struct wl_shm *shm; struct wl_cursor_theme *cursor_theme; - struct wl_cursor *default_cursor; struct wl_pointer *pointer; - struct wl_shell *shell; + struct { + struct xdg_wm_base *xdg; + struct zxdg_shell_v6 *zxdg; + struct wl_shell *wl; + } shell; + struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; + struct zwp_pointer_constraints_v1 *pointer_constraints; + struct wl_data_device_manager *data_device_manager; EGLDisplay edpy; EGLContext context; @@ -58,8 +74,12 @@ typedef struct { struct qt_surface_extension *surface_extension; struct qt_windowmanager *windowmanager; #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + + char *classname; + + int relative_mouse_mode; } SDL_VideoData; -#endif /* _SDL_waylandvideo_h */ +#endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.c new file mode 100644 index 0000000000..d67472cdc2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_waylandvulkan.h" +#include "SDL_syswm.h" + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWaylandSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWaylandSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWaylandSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Wayland_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWayland[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWayland), + extensionsForWayland); +} + +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR = + (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWaylandSurfaceKHR"); + VkWaylandSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWaylandSurfaceKHR) + { + SDL_SetError(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.display = windowData->waylandData->display; + createInfo.surface = windowData->surface; + result = vkCreateWaylandSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWaylandSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.h new file mode 100644 index 0000000000..5ad3a466c1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylandvulkan_h_ +#define SDL_waylandvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); +void Wayland_Vulkan_UnloadLibrary(_THIS); +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_waylandvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.c b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.c new file mode 100644 index 0000000000..aa7299181d --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.c @@ -0,0 +1,676 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../../events/SDL_windowevents_c.h" +#include "../SDL_egl_c.h" +#include "SDL_waylandevents_c.h" +#include "SDL_waylandwindow.h" +#include "SDL_waylandvideo.h" +#include "SDL_waylandtouch.h" +#include "SDL_waylanddyn.h" +#include "SDL_hints.h" + +#include "xdg-shell-client-protocol.h" +#include "xdg-shell-unstable-v6-client-protocol.h" + +/* On modern desktops, we probably will use the xdg-shell protocol instead + of wl_shell, but wl_shell might be useful on older Wayland installs that + don't have the newer protocol, or embedded things that don't have a full + window manager. */ + +static void +handle_ping_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, + uint32_t serial) +{ + wl_shell_surface_pong(shell_surface, serial); +} + +static void +handle_configure_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, + uint32_t edges, int32_t width, int32_t height) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + struct wl_region *region; + + /* wl_shell_surface spec states that this is a suggestion. + Ignore if less than or greater than max/min size. */ + + if (width == 0 || height == 0) { + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->max_w > 0) { + width = SDL_min(width, window->max_w); + } + width = SDL_max(width, window->min_w); + + if (window->max_h > 0) { + height = SDL_min(height, window->max_h); + } + height = SDL_max(height, window->min_h); + } else { + return; + } + } + + WAYLAND_wl_egl_window_resize(wind->egl_window, width, height, 0, 0); + region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, width, height); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); + window->w = width; + window->h = height; +} + +static void +handle_popup_done_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface) +{ +} + +static const struct wl_shell_surface_listener shell_surface_listener_wl = { + handle_ping_wl_shell_surface, + handle_configure_wl_shell_surface, + handle_popup_done_wl_shell_surface +}; + + + + +static void +handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, uint32_t serial) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + struct wl_region *region; + + wind->shell_surface.zxdg.initial_configure_seen = SDL_TRUE; + + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + + region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + zxdg_surface_v6_ack_configure(zxdg, serial); +} + +static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = { + handle_configure_zxdg_shell_surface +}; + + +static void +handle_configure_zxdg_toplevel(void *data, + struct zxdg_toplevel_v6 *zxdg_toplevel_v6, + int32_t width, + int32_t height, + struct wl_array *states) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + + /* wl_shell_surface spec states that this is a suggestion. + Ignore if less than or greater than max/min size. */ + + if (width == 0 || height == 0) { + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->max_w > 0) { + width = SDL_min(width, window->max_w); + } + width = SDL_max(width, window->min_w); + + if (window->max_h > 0) { + height = SDL_min(height, window->max_h); + } + height = SDL_max(height, window->min_h); + } else { + return; + } + } + + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); + window->w = width; + window->h = height; +} + +static void +handle_close_zxdg_toplevel(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel_v6) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static const struct zxdg_toplevel_v6_listener toplevel_listener_zxdg = { + handle_configure_zxdg_toplevel, + handle_close_zxdg_toplevel +}; + + + +static void +handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t serial) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + struct wl_region *region; + + wind->shell_surface.xdg.initial_configure_seen = SDL_TRUE; + + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + + region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + xdg_surface_ack_configure(xdg, serial); +} + +static const struct xdg_surface_listener shell_surface_listener_xdg = { + handle_configure_xdg_shell_surface +}; + + +static void +handle_configure_xdg_toplevel(void *data, + struct xdg_toplevel *xdg_toplevel, + int32_t width, + int32_t height, + struct wl_array *states) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + + /* wl_shell_surface spec states that this is a suggestion. + Ignore if less than or greater than max/min size. */ + + if (width == 0 || height == 0) { + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->max_w > 0) { + width = SDL_min(width, window->max_w); + } + width = SDL_max(width, window->min_w); + + if (window->max_h > 0) { + height = SDL_min(height, window->max_h); + } + height = SDL_max(height, window->min_h); + } else { + return; + } + } + + if (width == window->w && height == window->h) { + return; + } + + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); + window->w = width; + window->h = height; +} + +static void +handle_close_xdg_toplevel(void *data, struct xdg_toplevel *xdg_toplevel) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static const struct xdg_toplevel_listener toplevel_listener_xdg = { + handle_configure_xdg_toplevel, + handle_close_xdg_toplevel +}; + + + + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +static void +handle_onscreen_visibility(void *data, + struct qt_extended_surface *qt_extended_surface, int32_t visible) +{ +} + +static void +handle_set_generic_property(void *data, + struct qt_extended_surface *qt_extended_surface, const char *name, + struct wl_array *value) +{ +} + +static void +handle_close(void *data, struct qt_extended_surface *qt_extended_surface) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static const struct qt_extended_surface_listener extended_surface_listener = { + handle_onscreen_visibility, + handle_set_generic_property, + handle_close, +}; +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +SDL_bool +Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + + /* Before 2.0.6, it was possible to build an SDL with Wayland support + (SDL_SysWMinfo will be large enough to hold Wayland info), but build + your app against SDL headers that didn't have Wayland support + (SDL_SysWMinfo could be smaller than Wayland needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and Wayland will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use Wayland, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } + + info->info.wl.display = data->waylandData->display; + info->info.wl.surface = data->surface; + info->info.wl.shell_surface = data->shell_surface.wl; + info->subsystem = SDL_SYSWM_WAYLAND; + + return SDL_TRUE; +} + +int +Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) +{ + return 0; /* just succeed, the real work is done elsewhere. */ +} + +static void +SetFullscreen(_THIS, SDL_Window * window, struct wl_output *output) +{ + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; + SDL_WindowData *wind = window->driverdata; + + if (viddata->shell.xdg) { + if (output) { + xdg_toplevel_set_fullscreen(wind->shell_surface.xdg.roleobj.toplevel, output); + } else { + xdg_toplevel_unset_fullscreen(wind->shell_surface.xdg.roleobj.toplevel); + } + } else if (viddata->shell.zxdg) { + if (output) { + zxdg_toplevel_v6_set_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel, output); + } else { + zxdg_toplevel_v6_unset_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel); + } + } else { + if (output) { + wl_shell_surface_set_fullscreen(wind->shell_surface.wl, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, output); + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } + } + + WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); +} + +void Wayland_ShowWindow(_THIS, SDL_Window *window) +{ + struct wl_output *output = (struct wl_output *) window->fullscreen_mode.driverdata; + SetFullscreen(_this, window, (window->flags & SDL_WINDOW_FULLSCREEN) ? output : NULL); +} + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +static void SDLCALL +QtExtendedSurface_OnHintChanged(void *userdata, const char *name, + const char *oldValue, const char *newValue) +{ + struct qt_extended_surface *qt_extended_surface = userdata; + + if (name == NULL) { + return; + } + + if (strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) { + int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; + + if (newValue != NULL) { + if (strcmp(newValue, "portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; + } else if (strcmp(newValue, "landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; + } else if (strcmp(newValue, "inverted-portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; + } else if (strcmp(newValue, "inverted-landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; + } + } + + qt_extended_surface_set_content_orientation(qt_extended_surface, orientation); + } else if (strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) { + uint32_t flags = 0; + + if (newValue != NULL) { + char *tmp = strdup(newValue); + char *saveptr = NULL; + + char *flag = strtok_r(tmp, " ", &saveptr); + while (flag) { + if (strcmp(flag, "OverridesSystemGestures") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; + } else if (strcmp(flag, "StaysOnTop") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; + } else if (strcmp(flag, "BypassWindowManager") == 0) { + // See https://github.com/qtproject/qtwayland/commit/fb4267103d + flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */; + } + + flag = strtok_r(NULL, " ", &saveptr); + } + + free(tmp); + } + + qt_extended_surface_set_window_flags(qt_extended_surface, flags); + } +} + +static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} + +static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +void +Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, + SDL_VideoDisplay * _display, SDL_bool fullscreen) +{ + struct wl_output *output = (struct wl_output *) _display->driverdata; + SetFullscreen(_this, window, fullscreen ? output : NULL); +} + +void +Wayland_RestoreWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wind = window->driverdata; + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; + + if (viddata->shell.xdg) { + } else if (viddata->shell.zxdg) { + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } + + WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); +} + +void +Wayland_MaximizeWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + + if (viddata->shell.xdg) { + xdg_toplevel_set_maximized(wind->shell_surface.xdg.roleobj.toplevel); + } else if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_maximized(wind->shell_surface.zxdg.roleobj.toplevel); + } else { + wl_shell_surface_set_maximized(wind->shell_surface.wl, NULL); + } + + WAYLAND_wl_display_flush( viddata->display ); +} + +int Wayland_CreateWindow(_THIS, SDL_Window *window) +{ + SDL_WindowData *data; + SDL_VideoData *c; + struct wl_region *region; + + data = calloc(1, sizeof *data); + if (data == NULL) + return SDL_OutOfMemory(); + + c = _this->driverdata; + window->driverdata = data; + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + SDL_GL_LoadLibrary(NULL); + window->flags |= SDL_WINDOW_OPENGL; + } + + if (window->x == SDL_WINDOWPOS_UNDEFINED) { + window->x = 0; + } + if (window->y == SDL_WINDOWPOS_UNDEFINED) { + window->y = 0; + } + + data->waylandData = c; + data->sdlwindow = window; + + data->surface = + wl_compositor_create_surface(c->compositor); + wl_surface_set_user_data(data->surface, data); + + if (c->shell.xdg) { + data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface); + /* !!! FIXME: add popup role */ + data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); + xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); + xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); + } else if (c->shell.zxdg) { + data->shell_surface.zxdg.surface = zxdg_shell_v6_get_xdg_surface(c->shell.zxdg, data->surface); + /* !!! FIXME: add popup role */ + data->shell_surface.zxdg.roleobj.toplevel = zxdg_surface_v6_get_toplevel(data->shell_surface.zxdg.surface); + zxdg_toplevel_v6_add_listener(data->shell_surface.zxdg.roleobj.toplevel, &toplevel_listener_zxdg, data); + zxdg_toplevel_v6_set_app_id(data->shell_surface.zxdg.roleobj.toplevel, c->classname); + } else { + data->shell_surface.wl = wl_shell_get_shell_surface(c->shell.wl, data->surface); + wl_shell_surface_set_class(data->shell_surface.wl, c->classname); + } + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH + if (c->surface_extension) { + data->extended_surface = qt_surface_extension_get_extended_surface( + c->surface_extension, data->surface); + + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); + } +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + + data->egl_window = WAYLAND_wl_egl_window_create(data->surface, + window->w, window->h); + + /* Create the GLES window surface */ + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); + + if (data->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("failed to create a window surface"); + } + + if (c->shell.xdg) { + if (data->shell_surface.xdg.surface) { + xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); + xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); + } + } else if (c->shell.zxdg) { + if (data->shell_surface.zxdg.surface) { + zxdg_surface_v6_set_user_data(data->shell_surface.zxdg.surface, data); + zxdg_surface_v6_add_listener(data->shell_surface.zxdg.surface, &shell_surface_listener_zxdg, data); + } + } else { + if (data->shell_surface.wl) { + wl_shell_surface_set_user_data(data->shell_surface.wl, data); + wl_shell_surface_add_listener(data->shell_surface.wl, &shell_surface_listener_wl, data); + } + } + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH + if (data->extended_surface) { + qt_extended_surface_set_user_data(data->extended_surface, data); + qt_extended_surface_add_listener(data->extended_surface, + &extended_surface_listener, data); + } +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + + region = wl_compositor_create_region(c->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); + + if (c->relative_mouse_mode) { + Wayland_input_lock_pointer(c->input); + } + + wl_surface_commit(data->surface); + WAYLAND_wl_display_flush(c->display); + + /* we have to wait until the surface gets a "configure" event, or + use of this surface will fail. This is a new rule for xdg_shell. */ + if (c->shell.xdg) { + if (data->shell_surface.xdg.surface) { + while (!data->shell_surface.xdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); + WAYLAND_wl_display_dispatch(c->display); + } + } + } else if (c->shell.zxdg) { + if (data->shell_surface.zxdg.surface) { + while (!data->shell_surface.zxdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); + WAYLAND_wl_display_dispatch(c->display); + } + } + } + + return 0; +} + +void Wayland_SetWindowSize(_THIS, SDL_Window * window) +{ + SDL_VideoData *data = _this->driverdata; + SDL_WindowData *wind = window->driverdata; + struct wl_region *region; + + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + + region =wl_compositor_create_region(data->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); +} + +void Wayland_SetWindowTitle(_THIS, SDL_Window * window) +{ + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + + if (window->title != NULL) { + if (viddata->shell.xdg) { + xdg_toplevel_set_title(wind->shell_surface.xdg.roleobj.toplevel, window->title); + } else if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_title(wind->shell_surface.zxdg.roleobj.toplevel, window->title); + } else { + wl_shell_surface_set_title(wind->shell_surface.wl, window->title); + } + } + + WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); +} + +void Wayland_DestroyWindow(_THIS, SDL_Window *window) +{ + SDL_VideoData *data = _this->driverdata; + SDL_WindowData *wind = window->driverdata; + + if (data) { + SDL_EGL_DestroySurface(_this, wind->egl_surface); + WAYLAND_wl_egl_window_destroy(wind->egl_window); + + if (data->shell.xdg) { + if (wind->shell_surface.xdg.roleobj.toplevel) { + xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); + } + if (wind->shell_surface.zxdg.surface) { + xdg_surface_destroy(wind->shell_surface.xdg.surface); + } + } else if (data->shell.zxdg) { + if (wind->shell_surface.zxdg.roleobj.toplevel) { + zxdg_toplevel_v6_destroy(wind->shell_surface.zxdg.roleobj.toplevel); + } + if (wind->shell_surface.zxdg.surface) { + zxdg_surface_v6_destroy(wind->shell_surface.zxdg.surface); + } + } else { + if (wind->shell_surface.wl) { + wl_shell_surface_destroy(wind->shell_surface.wl); + } + } + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH + if (wind->extended_surface) { + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); + qt_extended_surface_destroy(wind->extended_surface); + } +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + wl_surface_destroy(wind->surface); + + SDL_free(wind); + WAYLAND_wl_display_flush(data->display); + } + window->driverdata = NULL; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.h b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.h similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.h rename to 3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.h index 053b1281fb..69b9889233 100644 --- a/3rdparty/sdl2-2.0.4/src/video/wayland/SDL_waylandwindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandwindow_h -#define _SDL_waylandwindow_h +#ifndef SDL_waylandwindow_h_ +#define SDL_waylandwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" @@ -31,14 +31,37 @@ struct SDL_WaylandInput; +typedef struct { + struct zxdg_surface_v6 *surface; + union { + struct zxdg_toplevel_v6 *toplevel; + struct zxdg_popup_v6 *popup; + } roleobj; + SDL_bool initial_configure_seen; +} SDL_zxdg_shell_surface; + +typedef struct { + struct xdg_surface *surface; + union { + struct xdg_toplevel *toplevel; + struct xdg_popup *popup; + } roleobj; + SDL_bool initial_configure_seen; +} SDL_xdg_shell_surface; + typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; struct wl_surface *surface; - struct wl_shell_surface *shell_surface; + union { + SDL_xdg_shell_surface xdg; + SDL_zxdg_shell_surface zxdg; + struct wl_shell_surface *wl; + } shell_surface; struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; EGLSurface egl_surface; + struct zwp_locked_pointer_v1 *locked_pointer; #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH struct qt_extended_surface *extended_surface; @@ -49,14 +72,17 @@ extern void Wayland_ShowWindow(_THIS, SDL_Window *window); extern void Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen); +extern void Wayland_MaximizeWindow(_THIS, SDL_Window * window); +extern void Wayland_RestoreWindow(_THIS, SDL_Window * window); extern int Wayland_CreateWindow(_THIS, SDL_Window *window); extern void Wayland_SetWindowSize(_THIS, SDL_Window * window); +extern void Wayland_SetWindowTitle(_THIS, SDL_Window * window); extern void Wayland_DestroyWindow(_THIS, SDL_Window *window); extern SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_waylandwindow_h */ +#endif /* SDL_waylandwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_msctf.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_msctf.h similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_msctf.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_msctf.h index 74e22f107a..53cec3d135 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_msctf.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_msctf_h -#define _SDL_msctf_h +#ifndef SDL_msctf_h_ +#define SDL_msctf_h_ #include @@ -239,4 +239,4 @@ struct ITfSource const struct ITfSourceVtbl *lpVtbl; }; -#endif /* _SDL_msctf_h */ +#endif /* SDL_msctf_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_vkeys.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_vkeys.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_vkeys.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_vkeys.h index fd65204192..a38e3a2816 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_vkeys.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.c index b57a66a7be..4e61d7ab0f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.h index d86cd97ec3..937b7d0a57 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsclipboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsclipboard_h -#define _SDL_windowsclipboard_h +#ifndef SDL_windowsclipboard_h_ +#define SDL_windowsclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *WIN_GetClipboardText(_THIS); extern SDL_bool WIN_HasClipboardText(_THIS); extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_windowsclipboard_h */ +#endif /* SDL_windowsclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.c similarity index 67% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.c index 61420894fa..e961cf568e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ #include "SDL_syswm.h" #include "SDL_timer.h" #include "SDL_vkeys.h" +#include "SDL_hints.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/scancodes_windows.h" @@ -81,130 +82,157 @@ #define WM_UNICHAR 0x0109 #endif +static SDL_Scancode +VKeytoScancode(WPARAM vkey) +{ + switch (vkey) { + case VK_CLEAR: return SDL_SCANCODE_CLEAR; + case VK_MODECHANGE: return SDL_SCANCODE_MODE; + case VK_SELECT: return SDL_SCANCODE_SELECT; + case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; + case VK_HELP: return SDL_SCANCODE_HELP; + case VK_PAUSE: return SDL_SCANCODE_PAUSE; + case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; + + case VK_F13: return SDL_SCANCODE_F13; + case VK_F14: return SDL_SCANCODE_F14; + case VK_F15: return SDL_SCANCODE_F15; + case VK_F16: return SDL_SCANCODE_F16; + case VK_F17: return SDL_SCANCODE_F17; + case VK_F18: return SDL_SCANCODE_F18; + case VK_F19: return SDL_SCANCODE_F19; + case VK_F20: return SDL_SCANCODE_F20; + case VK_F21: return SDL_SCANCODE_F21; + case VK_F22: return SDL_SCANCODE_F22; + case VK_F23: return SDL_SCANCODE_F23; + case VK_F24: return SDL_SCANCODE_F24; + + case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; + case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; + case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; + case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; + case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; + case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; + case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; + case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; + case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; + case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; + case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; + + case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; + case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; + case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; + case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; + case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; + case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; + + case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; + + case VK_ATTN: return SDL_SCANCODE_SYSREQ; + case VK_CRSEL: return SDL_SCANCODE_CRSEL; + case VK_EXSEL: return SDL_SCANCODE_EXSEL; + case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; + + case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; + case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; + + default: return SDL_SCANCODE_UNKNOWN; + } +} + static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) { SDL_Scancode code; - char bIsExtended; int nScanCode = (lParam >> 16) & 0xFF; + SDL_bool bIsExtended = (lParam & (1 << 24)) != 0; - /* 0x45 here to work around both pause and numlock sharing the same scancode, so use the VK key to tell them apart */ - if (nScanCode == 0 || nScanCode == 0x45) { - switch(wParam) { - case VK_CLEAR: return SDL_SCANCODE_CLEAR; - case VK_MODECHANGE: return SDL_SCANCODE_MODE; - case VK_SELECT: return SDL_SCANCODE_SELECT; - case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; - case VK_HELP: return SDL_SCANCODE_HELP; - case VK_PAUSE: return SDL_SCANCODE_PAUSE; - case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; - - case VK_F13: return SDL_SCANCODE_F13; - case VK_F14: return SDL_SCANCODE_F14; - case VK_F15: return SDL_SCANCODE_F15; - case VK_F16: return SDL_SCANCODE_F16; - case VK_F17: return SDL_SCANCODE_F17; - case VK_F18: return SDL_SCANCODE_F18; - case VK_F19: return SDL_SCANCODE_F19; - case VK_F20: return SDL_SCANCODE_F20; - case VK_F21: return SDL_SCANCODE_F21; - case VK_F22: return SDL_SCANCODE_F22; - case VK_F23: return SDL_SCANCODE_F23; - case VK_F24: return SDL_SCANCODE_F24; - - case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; - case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; - case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; - case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; - case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; - case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; - case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; - case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; - case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; - case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; - case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; - - case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; - case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; - case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; - case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; - case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; - case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; - - case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; - - case VK_ATTN: return SDL_SCANCODE_SYSREQ; - case VK_CRSEL: return SDL_SCANCODE_CRSEL; - case VK_EXSEL: return SDL_SCANCODE_EXSEL; - case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; - - case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; - case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; - - default: return SDL_SCANCODE_UNKNOWN; - } - } + code = VKeytoScancode(wParam); - if (nScanCode > 127) - return SDL_SCANCODE_UNKNOWN; - - code = windows_scancode_table[nScanCode]; - - bIsExtended = (lParam & (1 << 24)) != 0; - if (!bIsExtended) { - switch (code) { - case SDL_SCANCODE_HOME: - return SDL_SCANCODE_KP_7; - case SDL_SCANCODE_UP: - return SDL_SCANCODE_KP_8; - case SDL_SCANCODE_PAGEUP: - return SDL_SCANCODE_KP_9; - case SDL_SCANCODE_LEFT: - return SDL_SCANCODE_KP_4; - case SDL_SCANCODE_RIGHT: - return SDL_SCANCODE_KP_6; - case SDL_SCANCODE_END: - return SDL_SCANCODE_KP_1; - case SDL_SCANCODE_DOWN: - return SDL_SCANCODE_KP_2; - case SDL_SCANCODE_PAGEDOWN: - return SDL_SCANCODE_KP_3; - case SDL_SCANCODE_INSERT: - return SDL_SCANCODE_KP_0; - case SDL_SCANCODE_DELETE: - return SDL_SCANCODE_KP_PERIOD; - case SDL_SCANCODE_PRINTSCREEN: - return SDL_SCANCODE_KP_MULTIPLY; - default: - break; - } - } else { - switch (code) { - case SDL_SCANCODE_RETURN: - return SDL_SCANCODE_KP_ENTER; - case SDL_SCANCODE_LALT: - return SDL_SCANCODE_RALT; - case SDL_SCANCODE_LCTRL: - return SDL_SCANCODE_RCTRL; - case SDL_SCANCODE_SLASH: - return SDL_SCANCODE_KP_DIVIDE; - case SDL_SCANCODE_CAPSLOCK: - return SDL_SCANCODE_KP_PLUS; - default: - break; + if (code == SDL_SCANCODE_UNKNOWN && nScanCode <= 127) { + code = windows_scancode_table[nScanCode]; + + if (bIsExtended) { + switch (code) { + case SDL_SCANCODE_RETURN: + code = SDL_SCANCODE_KP_ENTER; + break; + case SDL_SCANCODE_LALT: + code = SDL_SCANCODE_RALT; + break; + case SDL_SCANCODE_LCTRL: + code = SDL_SCANCODE_RCTRL; + break; + case SDL_SCANCODE_SLASH: + code = SDL_SCANCODE_KP_DIVIDE; + break; + case SDL_SCANCODE_CAPSLOCK: + code = SDL_SCANCODE_KP_PLUS; + break; + default: + break; + } + } else { + switch (code) { + case SDL_SCANCODE_HOME: + code = SDL_SCANCODE_KP_7; + break; + case SDL_SCANCODE_UP: + code = SDL_SCANCODE_KP_8; + break; + case SDL_SCANCODE_PAGEUP: + code = SDL_SCANCODE_KP_9; + break; + case SDL_SCANCODE_LEFT: + code = SDL_SCANCODE_KP_4; + break; + case SDL_SCANCODE_RIGHT: + code = SDL_SCANCODE_KP_6; + break; + case SDL_SCANCODE_END: + code = SDL_SCANCODE_KP_1; + break; + case SDL_SCANCODE_DOWN: + code = SDL_SCANCODE_KP_2; + break; + case SDL_SCANCODE_PAGEDOWN: + code = SDL_SCANCODE_KP_3; + break; + case SDL_SCANCODE_INSERT: + code = SDL_SCANCODE_KP_0; + break; + case SDL_SCANCODE_DELETE: + code = SDL_SCANCODE_KP_PERIOD; + break; + case SDL_SCANCODE_PRINTSCREEN: + code = SDL_SCANCODE_KP_MULTIPLY; + break; + default: + break; + } } } - return code; } +static SDL_bool +WIN_ShouldIgnoreFocusClick() +{ + return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); +} -void +static void WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID) { - if (data->focus_click_pending && button == SDL_BUTTON_LEFT && !bwParamMousePressed) { - data->focus_click_pending = SDL_FALSE; - WIN_UpdateClipCursor(data->window); + if (data->focus_click_pending & SDL_BUTTON(button)) { + /* Ignore the button click for activation */ + if (!bwParamMousePressed) { + data->focus_click_pending &= ~SDL_BUTTON(button); + WIN_UpdateClipCursor(data->window); + } + if (WIN_ShouldIgnoreFocusClick()) { + return; + } } if (bwParamMousePressed && !bSDLMousePressed) { @@ -218,7 +246,7 @@ WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePress * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also * so this funciton reconciles our view of the world with the current buttons reported by windows */ -void +static void WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mouseID) { if (wParam != data->mouse_button_flags) { @@ -233,7 +261,7 @@ WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mou } -void +static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) { if (rawButtons != data->mouse_button_flags) { @@ -262,7 +290,7 @@ WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) } } -void +static void WIN_CheckAsyncMouseRelease(SDL_WindowData *data) { Uint32 mouseFlags; @@ -296,7 +324,7 @@ WIN_CheckAsyncMouseRelease(SDL_WindowData *data) data->mouse_button_flags = 0; } -BOOL +static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -326,19 +354,14 @@ WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) static SDL_bool ShouldGenerateWindowCloseOnAltF4(void) { - const char *hint; - - hint = SDL_GetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4); - if (hint) { - if (*hint == '0') { - return SDL_TRUE; - } else { - return SDL_FALSE; - } - } - return SDL_TRUE; + return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); } +/* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow()) + doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping. + This is used to implement a workaround.. */ +static SDL_bool isWin10FCUorNewer = SDL_FALSE; + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -391,24 +414,52 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; + case WM_NCACTIVATE: + { + /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */ + data->skip_update_clipcursor = SDL_TRUE; + } + break; + case WM_ACTIVATE: { POINT cursorPos; BOOL minimized; + /* Don't mark the window as shown if it's activated before being shown */ + if (!IsWindowVisible(hwnd)) { + break; + } + minimized = HIWORD(wParam); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { - data->focus_click_pending = (GetAsyncKeyState(VK_LBUTTON) != 0); - + if (LOWORD(wParam) == WA_CLICKACTIVE) { + if (GetAsyncKeyState(VK_LBUTTON)) { + data->focus_click_pending |= SDL_BUTTON_LMASK; + } + if (GetAsyncKeyState(VK_RBUTTON)) { + data->focus_click_pending |= SDL_BUTTON_RMASK; + } + if (GetAsyncKeyState(VK_MBUTTON)) { + data->focus_click_pending |= SDL_BUTTON_MMASK; + } + if (GetAsyncKeyState(VK_XBUTTON1)) { + data->focus_click_pending |= SDL_BUTTON_X1MASK; + } + if (GetAsyncKeyState(VK_XBUTTON2)) { + data->focus_click_pending |= SDL_BUTTON_X2MASK; + } + } + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); if (SDL_GetKeyboardFocus() != data->window) { SDL_SetKeyboardFocus(data->window); } - + GetCursorPos(&cursorPos); ScreenToClient(hwnd, &cursorPos); SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); - + WIN_CheckAsyncMouseRelease(data); /* @@ -419,13 +470,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0); SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); } else { + RECT rect; + data->in_window_deactivation = SDL_TRUE; if (SDL_GetKeyboardFocus() == data->window) { SDL_SetKeyboardFocus(NULL); + WIN_ResetDeadKeys(); } - ClipCursor(NULL); + if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect) == 0)) { + ClipCursor(NULL); + SDL_zero(data->cursor_clipped_rect); + } data->in_window_deactivation = SDL_FALSE; } @@ -439,6 +496,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!mouse->relative_mode || mouse->relative_mode_warp) { SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0); SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { + /* To work around #3931, Win10 bug introduced in Fall Creators Update, where + SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore, + after each windows mouse event generate a fake event for the middle of the window + if relative_mode_warp is used */ + int center_x = 0, center_y = 0; + SDL_GetWindowSize(data->window, ¢er_x, ¢er_y); + center_x /= 2; + center_y /= 2; + SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y); + } } } /* don't break here, fall through to check the wParam like the button presses */ @@ -495,7 +563,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) initialMousePoint.y = rawmouse->lLastY; } - SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) ); + SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y)); initialMousePoint.x = rawmouse->lLastX; initialMousePoint.y = rawmouse->lLastY; @@ -504,10 +572,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else if (isCapture) { /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */ POINT pt; + RECT hwndRect; + HWND currentHnd; + GetCursorPos(&pt); - if (WindowFromPoint(pt) != hwnd) { /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ - ScreenToClient(hwnd, &pt); - SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y); + currentHnd = WindowFromPoint(pt); + ScreenToClient(hwnd, &pt); + GetClientRect(hwnd, &hwndRect); + + /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ + if(currentHnd != hwnd || pt.x < 0 || pt.y < 0 || pt.x > hwndRect.right || pt.y > hwndRect.right) { + SDL_SendMouseMotion(data->window, 0, 0, (int)pt.x, (int)pt.y); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE); @@ -522,40 +597,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEWHEEL: - { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } - } - break; - case WM_MOUSEHWHEEL: { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } + short amount = GET_WHEEL_DELTA_WPARAM(wParam); + float fAmount = (float) amount / WHEEL_DELTA; + if (msg == WM_MOUSEWHEEL) + SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL); + else + SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL); } break; @@ -592,7 +641,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_SendKeyboardKey(SDL_PRESSED, code); } } - + returnCode = 0; break; @@ -614,7 +663,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_UNICHAR: - if ( wParam == UNICODE_NOCHAR ) { + if (wParam == UNICODE_NOCHAR) { returnCode = 1; break; } @@ -622,8 +671,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_CHAR: { char text[5]; - if ( WIN_ConvertUTF32toUTF8( (UINT32)wParam, text ) ) { - SDL_SendKeyboardText( text ); + if (WIN_ConvertUTF32toUTF8((UINT32)wParam, text)) { + SDL_SendKeyboardText(text); } } returnCode = 0; @@ -663,8 +712,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int w, h; int min_w, min_h; int max_w, max_h; - int style; - BOOL menu; BOOL constrain_max_size; if (SDL_IsShapedWindow(data->window)) @@ -697,21 +744,23 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) constrain_max_size = FALSE; } - size.top = 0; - size.left = 0; - size.bottom = h; - size.right = w; - - style = GetWindowLong(hwnd, GWL_STYLE); - /* DJM - according to the docs for GetMenu(), the - return value is undefined if hwnd is a child window. - Apparently it's too difficult for MS to check - inside their function, so I have to do it here. - */ - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&size, style, menu, 0); - w = size.right - size.left; - h = size.bottom - size.top; + if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) { + LONG style = GetWindowLong(hwnd, GWL_STYLE); + /* DJM - according to the docs for GetMenu(), the + return value is undefined if hwnd is a child window. + Apparently it's too difficult for MS to check + inside their function, so I have to do it here. + */ + BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + size.top = 0; + size.left = 0; + size.bottom = h; + size.right = w; + + AdjustWindowRectEx(&size, style, menu, 0); + w = size.right - size.left; + h = size.bottom - size.top; + } /* Fix our size to the current size */ info = (MINMAXINFO *) lParam; @@ -737,12 +786,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; #endif /* WM_GETMINMAXINFO */ + case WM_WINDOWPOSCHANGING: + + if (data->expected_resize) { + returnCode = 0; + } + break; + case WM_WINDOWPOSCHANGED: { RECT rect; int x, y; int w, h; - + if (data->initializing || data->in_border_change) { break; } @@ -763,6 +819,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) h = rect.bottom - rect.top; SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h); + + /* Forces a WM_PAINT event */ + InvalidateRect(hwnd, NULL, FALSE); } break; @@ -770,6 +829,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (wParam) { case SIZE_MAXIMIZED: + SDL_SendWindowEvent(data->window, + SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); break; @@ -845,7 +906,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_TOUCH: - { + if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) { UINT i, num_inputs = LOWORD(wParam); PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs); if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) { @@ -907,35 +968,56 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (buffer) { if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); - SDL_SendDropFile(file); + SDL_SendDropFile(data->window, file); SDL_free(file); } SDL_stack_free(buffer); } } + SDL_SendDropComplete(data->window); DragFinish(drop); return 0; } break; + case WM_NCCALCSIZE: + { + Uint32 window_flags = SDL_GetWindowFlags(data->window); + if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { + /* When borderless, need to tell windows that the size of the non-client area is 0 */ + if (!(window_flags & SDL_WINDOW_RESIZABLE)) { + int w, h; + NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; + w = data->window->windowed.w; + h = data->window->windowed.h; + params->rgrc[0].right = params->rgrc[0].left + w; + params->rgrc[0].bottom = params->rgrc[0].top + h; + } + return 0; + } + } + break; + case WM_NCHITTEST: { SDL_Window *window = data->window; if (window->hit_test) { - POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) }; + POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (ScreenToClient(hwnd, &winpoint)) { const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); switch (rc) { - case SDL_HITTEST_DRAGGABLE: return HTCAPTION; - case SDL_HITTEST_RESIZE_TOPLEFT: return HTTOPLEFT; - case SDL_HITTEST_RESIZE_TOP: return HTTOP; - case SDL_HITTEST_RESIZE_TOPRIGHT: return HTTOPRIGHT; - case SDL_HITTEST_RESIZE_RIGHT: return HTRIGHT; - case SDL_HITTEST_RESIZE_BOTTOMRIGHT: return HTBOTTOMRIGHT; - case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM; - case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT; - case SDL_HITTEST_RESIZE_LEFT: return HTLEFT; + #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; } + case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION); + case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT); + case SDL_HITTEST_RESIZE_TOP: POST_HIT_TEST(HTTOP); + case SDL_HITTEST_RESIZE_TOPRIGHT: POST_HIT_TEST(HTTOPRIGHT); + case SDL_HITTEST_RESIZE_RIGHT: POST_HIT_TEST(HTRIGHT); + case SDL_HITTEST_RESIZE_BOTTOMRIGHT: POST_HIT_TEST(HTBOTTOMRIGHT); + case SDL_HITTEST_RESIZE_BOTTOM: POST_HIT_TEST(HTBOTTOM); + case SDL_HITTEST_RESIZE_BOTTOMLEFT: POST_HIT_TEST(HTBOTTOMLEFT); + case SDL_HITTEST_RESIZE_LEFT: POST_HIT_TEST(HTLEFT); + #undef POST_HIT_TEST case SDL_HITTEST_NORMAL: return HTCLIENT; } } @@ -943,7 +1025,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; - } /* If there's a window proc, assume it's going to handle messages */ @@ -956,6 +1037,20 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } +static void WIN_UpdateClipCursorForWindows() +{ + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_Window *window; + + if (_this) { + for (window = _this->windows; window; window = window->next) { + if (window->driverdata) { + WIN_UpdateClipCursor(window); + } + } + } +} + /* A message hook called before TranslateMessage() */ static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; static void *g_WindowsMessageHookData = NULL; @@ -1001,6 +1096,46 @@ WIN_PumpEvents(_THIS) if ((keystate[SDL_SCANCODE_RSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_RSHIFT) & 0x8000)) { SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT); } + + /* Update the clipping rect in case someone else has stolen it */ + WIN_UpdateClipCursorForWindows(); +} + +/* to work around #3931, a bug introduced in Win10 Fall Creators Update (build nr. 16299) + we need to detect the windows version. this struct and the function below does that. + usually this struct and the corresponding function (RtlGetVersion) are in + but here we just load it dynamically */ +struct SDL_WIN_OSVERSIONINFOW { + ULONG dwOSVersionInfoSize; + ULONG dwMajorVersion; + ULONG dwMinorVersion; + ULONG dwBuildNumber; + ULONG dwPlatformId; + WCHAR szCSDVersion[128]; +}; + +static SDL_bool +IsWin10FCUorNewer(void) +{ + HMODULE handle = GetModuleHandleW(L"ntdll.dll"); + if (handle) { + typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*); + RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion"); + if (getVersionPtr != NULL) { + struct SDL_WIN_OSVERSIONINFOW info; + SDL_zero(info); + info.dwOSVersionInfoSize = sizeof(info); + if (getVersionPtr(&info) == 0) { /* STATUS_SUCCESS == 0 */ + if ((info.dwMajorVersion == 10 && info.dwMinorVersion == 0 && info.dwBuildNumber >= 16299) || + (info.dwMajorVersion == 10 && info.dwMinorVersion > 0) || + (info.dwMajorVersion > 10)) + { + return SDL_TRUE; + } + } + } + } + return SDL_FALSE; } static int app_registered = 0; @@ -1012,7 +1147,9 @@ HINSTANCE SDL_Instance = NULL; int SDL_RegisterApp(char *name, Uint32 style, void *hInst) { - WNDCLASS class; + const char *hint; + WNDCLASSEX wcex; + TCHAR path[MAX_PATH]; /* Only do this once... */ if (app_registered) { @@ -1034,22 +1171,39 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) } /* Register the application class */ - class.hCursor = NULL; - class.hIcon = - LoadImage(SDL_Instance, SDL_Appname, IMAGE_ICON, 0, 0, - LR_DEFAULTCOLOR); - class.lpszMenuName = NULL; - class.lpszClassName = SDL_Appname; - class.hbrBackground = NULL; - class.hInstance = SDL_Instance; - class.style = SDL_Appstyle; - class.lpfnWndProc = WIN_WindowProc; - class.cbWndExtra = 0; - class.cbClsExtra = 0; - if (!RegisterClass(&class)) { + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.hCursor = NULL; + wcex.hIcon = NULL; + wcex.hIconSm = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = SDL_Appname; + wcex.style = SDL_Appstyle; + wcex.hbrBackground = NULL; + wcex.lpfnWndProc = WIN_WindowProc; + wcex.hInstance = SDL_Instance; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); + if (hint && *hint) { + wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL); + if (hint && *hint) { + wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + } + } else { + /* Use the first icon as a default icon, like in the Explorer */ + GetModuleFileName(SDL_Instance, path, MAX_PATH); + ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + } + + if (!RegisterClassEx(&wcex)) { return SDL_SetError("Couldn't register application class"); } + isWin10FCUorNewer = IsWin10FCUorNewer(); + app_registered = 1; return 0; } @@ -1058,7 +1212,7 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) void SDL_UnregisterApp() { - WNDCLASS class; + WNDCLASSEX wcex; /* SDL_RegisterApp might not have been called before */ if (!app_registered) { @@ -1067,8 +1221,10 @@ SDL_UnregisterApp() --app_registered; if (app_registered == 0) { /* Check for any registered window classes. */ - if (GetClassInfo(SDL_Instance, SDL_Appname, &class)) { + if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) { UnregisterClass(SDL_Appname, SDL_Instance); + if (wcex.hIcon) DestroyIcon(wcex.hIcon); + if (wcex.hIconSm) DestroyIcon(wcex.hIconSm); } SDL_free(SDL_Appname); SDL_Appname = NULL; diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.h index dcd3118a48..1ce2fb4827 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsevents.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsevents_h -#define _SDL_windowsevents_h +#ifndef SDL_windowsevents_h_ +#define SDL_windowsevents_h_ extern LPTSTR SDL_Appname; extern Uint32 SDL_Appstyle; @@ -31,6 +31,6 @@ extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern void WIN_PumpEvents(_THIS); -#endif /* _SDL_windowsevents_h */ +#endif /* SDL_windowsevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.c index 7bb07ed2ec..e07d9c4313 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.h index 0c825f9da0..a83cca52bc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsframebuffer.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.c index d3e16c8bfc..c7f357b593 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -157,11 +157,47 @@ WIN_QuitKeyboard(_THIS) #endif } +void +WIN_ResetDeadKeys() +{ + /* + if a deadkey has been typed, but not the next character (which the deadkey might modify), + this tries to undo the effect pressing the deadkey. + see: http://archives.miloush.net/michkap/archive/2006/09/10/748775.html + */ + BYTE keyboardState[256]; + WCHAR buffer[16]; + int keycode, scancode, result, i; + + GetKeyboardState(keyboardState); + + keycode = VK_SPACE; + scancode = MapVirtualKey(keycode, MAPVK_VK_TO_VSC); + if (scancode == 0) { + /* the keyboard doesn't have this key */ + return; + } + + for (i = 0; i < 5; i++) { + result = ToUnicode(keycode, scancode, keyboardState, (LPWSTR)buffer, 16, 0); + if (result > 0) { + /* success */ + return; + } + } +} + void WIN_StartTextInput(_THIS) { #ifndef SDL_DISABLE_WINDOWS_IME - SDL_Window *window = SDL_GetKeyboardFocus(); + SDL_Window *window; +#endif + + WIN_ResetDeadKeys(); + +#ifndef SDL_DISABLE_WINDOWS_IME + window = SDL_GetKeyboardFocus(); if (window) { HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; @@ -176,7 +212,13 @@ void WIN_StopTextInput(_THIS) { #ifndef SDL_DISABLE_WINDOWS_IME - SDL_Window *window = SDL_GetKeyboardFocus(); + SDL_Window *window; +#endif + + WIN_ResetDeadKeys(); + +#ifndef SDL_DISABLE_WINDOWS_IME + window = SDL_GetKeyboardFocus(); if (window) { HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; @@ -226,7 +268,7 @@ void IME_Present(SDL_VideoData *videodata) #else -#ifdef _SDL_msctf_h +#ifdef SDL_msctf_h_ #define USE_INIT_GUID #elif defined(__GNUC__) #define USE_INIT_GUID @@ -253,11 +295,11 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_VER(id) ((id) & 0xffff0000) #define IMEID_LANG(id) ((id) & 0x0000ffff) -#define CHT_HKL_DAYI ((HKL)0xE0060404) -#define CHT_HKL_NEW_PHONETIC ((HKL)0xE0080404) -#define CHT_HKL_NEW_CHANG_JIE ((HKL)0xE0090404) -#define CHT_HKL_NEW_QUICK ((HKL)0xE00A0404) -#define CHT_HKL_HK_CANTONESE ((HKL)0xE00B0404) +#define CHT_HKL_DAYI ((HKL)(UINT_PTR)0xE0060404) +#define CHT_HKL_NEW_PHONETIC ((HKL)(UINT_PTR)0xE0080404) +#define CHT_HKL_NEW_CHANG_JIE ((HKL)(UINT_PTR)0xE0090404) +#define CHT_HKL_NEW_QUICK ((HKL)(UINT_PTR)0xE00A0404) +#define CHT_HKL_HK_CANTONESE ((HKL)(UINT_PTR)0xE00B0404) #define CHT_IMEFILENAME1 "TINTLGNT.IME" #define CHT_IMEFILENAME2 "CINTLGNT.IME" #define CHT_IMEFILENAME3 "MSTCIPHA.IME" @@ -270,7 +312,7 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_CHT_VER60 (LANG_CHT | MAKEIMEVERSION(6, 0)) #define IMEID_CHT_VER_VISTA (LANG_CHT | MAKEIMEVERSION(7, 0)) -#define CHS_HKL ((HKL)0xE00E0804) +#define CHS_HKL ((HKL)(UINT_PTR)0xE00E0804) #define CHS_IMEFILENAME1 "PINTLGNT.IME" #define CHS_IMEFILENAME2 "MSSCIPYA.IME" #define IMEID_CHS_VER41 (LANG_CHS | MAKEIMEVERSION(4, 1)) @@ -289,9 +331,6 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex); static void IME_SendEditingEvent(SDL_VideoData *videodata); static void IME_DestroyTextures(SDL_VideoData *videodata); -#define SDL_IsEqualIID(riid1, riid2) SDL_IsEqualGUID(riid1, riid2) -#define SDL_IsEqualGUID(rguid1, rguid2) (!SDL_memcmp(rguid1, rguid2, sizeof(GUID))) - static SDL_bool UILess_SetupSinks(SDL_VideoData *videodata); static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); @@ -312,6 +351,7 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd) videodata->ime_himm32 = SDL_LoadObject("imm32.dll"); if (!videodata->ime_himm32) { videodata->ime_available = SDL_FALSE; + SDL_ClearError(); return; } videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC"); @@ -406,16 +446,12 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) INT err = 0; BOOL vertical = FALSE; UINT maxuilen = 0; - static OSVERSIONINFOA osversion; if (videodata->ime_uiless) return; videodata->ime_readingstring[0] = 0; - if (!osversion.dwOSVersionInfoSize) { - osversion.dwOSVersionInfoSize = sizeof(osversion); - GetVersionExA(&osversion); - } + id = IME_GetId(videodata, 0); if (!id) return; @@ -476,9 +512,6 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) } break; case IMEID_CHS_VER42: - if (osversion.dwPlatformId != VER_PLATFORM_WIN32_NT) - break; - p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4); if (!p) break; @@ -795,7 +828,11 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) videodata->ime_candpgsize = i - page_start; } else { videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); - page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + if (videodata->ime_candpgsize > 0) { + page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + } else { + page_start = 0; + } } SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { @@ -994,7 +1031,7 @@ STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) return ++sink->refcount; } -STDMETHODIMP_(ULONG)TSFSink_Release(TSFSink *sink) +STDMETHODIMP_(ULONG) TSFSink_Release(TSFSink *sink) { --sink->refcount; if (sink->refcount == 0) { @@ -1010,9 +1047,9 @@ STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfUIElementSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink)) *ppv = (ITfUIElementSink *)sink; if (*ppv) { @@ -1116,9 +1153,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) *ppv = (ITfInputProcessorProfileActivationSink *)sink; if (*ppv) { @@ -1132,8 +1169,8 @@ STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID lan { static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; - if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) + videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; + if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) IME_InputLangChanged((SDL_VideoData *)sink->data); IME_HideCandidateList(videodata); diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.h index d330d38712..49a1b87889 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowskeyboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,19 +20,21 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowskeyboard_h -#define _SDL_windowskeyboard_h +#ifndef SDL_windowskeyboard_h_ +#define SDL_windowskeyboard_h_ extern void WIN_InitKeyboard(_THIS); extern void WIN_UpdateKeymap(void); extern void WIN_QuitKeyboard(_THIS); +extern void WIN_ResetDeadKeys(void); + extern void WIN_StartTextInput(_THIS); extern void WIN_StopTextInput(_THIS); extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); -#endif /* _SDL_windowskeyboard_h */ +#endif /* SDL_windowskeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.c new file mode 100644 index 0000000000..9ddb9e22f1 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.c @@ -0,0 +1,905 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WINDOWS + +#ifdef HAVE_LIMITS_H +#include +#else +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)-1) +#endif +#endif + +#include "../../core/windows/SDL_windows.h" + +#include "SDL_assert.h" +#include "SDL_windowsvideo.h" +#include "SDL_windowstaskdialog.h" + +#ifndef SS_EDITCONTROL +#define SS_EDITCONTROL 0x2000 +#endif + +#ifndef IDOK +#define IDOK 1 +#endif + +#ifndef IDCANCEL +#define IDCANCEL 2 +#endif + +/* Custom dialog return codes */ +#define IDCLOSED 20 +#define IDINVALPTRINIT 50 +#define IDINVALPTRCOMMAND 51 +#define IDINVALPTRSETFOCUS 52 +#define IDINVALPTRDLGITEM 53 +/* First button ID */ +#define IDBUTTONINDEX0 100 + +#define DLGITEMTYPEBUTTON 0x0080 +#define DLGITEMTYPESTATIC 0x0082 + +/* Windows only sends the lower 16 bits of the control ID when a button + * gets clicked. There are also some predefined and custom IDs that lower + * the available number further. 2^16 - 101 buttons should be enough for + * everyone, no need to make the code more complex. + */ +#define MAX_BUTTONS (0xffff - 100) + + +/* Display a Windows message box */ + +#pragma pack(push, 1) + +typedef struct +{ + WORD dlgVer; + WORD signature; + DWORD helpID; + DWORD exStyle; + DWORD style; + WORD cDlgItems; + short x; + short y; + short cx; + short cy; +} DLGTEMPLATEEX; + +typedef struct +{ + DWORD helpID; + DWORD exStyle; + DWORD style; + short x; + short y; + short cx; + short cy; + DWORD id; +} DLGITEMTEMPLATEEX; + +#pragma pack(pop) + +typedef struct +{ + DLGTEMPLATEEX* lpDialog; + Uint8 *data; + size_t size; + size_t used; + WORD numbuttons; +} WIN_DialogData; + +static SDL_bool GetButtonIndex(const SDL_MessageBoxData *messageboxdata, Uint32 flags, size_t *i) +{ + for (*i = 0; *i < (size_t)messageboxdata->numbuttons; ++*i) { + if (messageboxdata->buttons[*i].flags & flags) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static INT_PTR MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam) +{ + const SDL_MessageBoxData *messageboxdata; + size_t buttonindex; + + switch ( iMessage ) { + case WM_INITDIALOG: + if (lParam == 0) { + EndDialog(hDlg, IDINVALPTRINIT); + return TRUE; + } + messageboxdata = (const SDL_MessageBoxData *)lParam; + SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam); + + if (GetButtonIndex(messageboxdata, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, &buttonindex)) { + /* Focus on the first default return-key button */ + HWND buttonctl = GetDlgItem(hDlg, (int)(IDBUTTONINDEX0 + buttonindex)); + if (buttonctl == NULL) { + EndDialog(hDlg, IDINVALPTRDLGITEM); + } + PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)buttonctl, TRUE); + } else { + /* Give the focus to the dialog window instead */ + SetFocus(hDlg); + } + return FALSE; + case WM_SETFOCUS: + messageboxdata = (const SDL_MessageBoxData *)GetWindowLongPtr(hDlg, GWLP_USERDATA); + if (messageboxdata == NULL) { + EndDialog(hDlg, IDINVALPTRSETFOCUS); + return TRUE; + } + + /* Let the default button be focused if there is one. Otherwise, prevent any initial focus. */ + if (GetButtonIndex(messageboxdata, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, &buttonindex)) { + return FALSE; + } + return TRUE; + case WM_COMMAND: + messageboxdata = (const SDL_MessageBoxData *)GetWindowLongPtr(hDlg, GWLP_USERDATA); + if (messageboxdata == NULL) { + EndDialog(hDlg, IDINVALPTRCOMMAND); + return TRUE; + } + + /* Return the ID of the button that was pushed */ + if (wParam == IDOK) { + if (GetButtonIndex(messageboxdata, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, &buttonindex)) { + EndDialog(hDlg, IDBUTTONINDEX0 + buttonindex); + } + } else if (wParam == IDCANCEL) { + if (GetButtonIndex(messageboxdata, SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, &buttonindex)) { + EndDialog(hDlg, IDBUTTONINDEX0 + buttonindex); + } else { + /* Closing of window was requested by user or system. It would be rude not to comply. */ + EndDialog(hDlg, IDCLOSED); + } + } else if (wParam >= IDBUTTONINDEX0 && (int)wParam - IDBUTTONINDEX0 < messageboxdata->numbuttons) { + EndDialog(hDlg, wParam); + } + return TRUE; + + default: + break; + } + return FALSE; +} + +static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space) +{ + /* Growing memory in 64 KiB steps. */ + const size_t sizestep = 0x10000; + size_t size = dialog->size; + + if (size == 0) { + /* Start with 4 KiB or a multiple of 64 KiB to fit the data. */ + size = 0x1000; + if (SIZE_MAX - sizestep < space) { + size = space; + } else if (space > size) { + size = (space + sizestep) & ~(sizestep - 1); + } + } else if (SIZE_MAX - dialog->used < space) { + SDL_OutOfMemory(); + return SDL_FALSE; + } else if (SIZE_MAX - (dialog->used + space) < sizestep) { + /* Close to the maximum. */ + size = dialog->used + space; + } else if (size < dialog->used + space) { + /* Round up to the next 64 KiB block. */ + size = dialog->used + space; + size += sizestep - size % sizestep; + } + + if (size > dialog->size) { + void *data = SDL_realloc(dialog->data, size); + if (!data) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + dialog->data = data; + dialog->size = size; + dialog->lpDialog = (DLGTEMPLATEEX*)dialog->data; + } + return SDL_TRUE; +} + +static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size) +{ + size_t padding = (dialog->used % size); + + if (!ExpandDialogSpace(dialog, padding)) { + return SDL_FALSE; + } + + dialog->used += padding; + + return SDL_TRUE; +} + +static SDL_bool AddDialogData(WIN_DialogData *dialog, const void *data, size_t size) +{ + if (!ExpandDialogSpace(dialog, size)) { + return SDL_FALSE; + } + + SDL_memcpy(dialog->data+dialog->used, data, size); + dialog->used += size; + + return SDL_TRUE; +} + +static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string) +{ + WCHAR *wstring; + WCHAR *p; + size_t count; + SDL_bool status; + + if (!string) { + string = ""; + } + + wstring = WIN_UTF8ToString(string); + if (!wstring) { + return SDL_FALSE; + } + + /* Find out how many characters we have, including null terminator */ + count = 0; + for (p = wstring; *p; ++p) { + ++count; + } + ++count; + + status = AddDialogData(dialog, wstring, count*sizeof(WCHAR)); + SDL_free(wstring); + return status; +} + +static int s_BaseUnitsX; +static int s_BaseUnitsY; +static void Vec2ToDLU(short *x, short *y) +{ + SDL_assert(s_BaseUnitsX != 0); /* we init in WIN_ShowMessageBox(), which is the only public function... */ + + *x = MulDiv(*x, 4, s_BaseUnitsX); + *y = MulDiv(*y, 8, s_BaseUnitsY); +} + + +static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption, WORD ordinal) +{ + DLGITEMTEMPLATEEX item; + WORD marker = 0xFFFF; + WORD extraData = 0; + + SDL_zero(item); + item.style = style; + item.exStyle = exStyle; + item.x = x; + item.y = y; + item.cx = w; + item.cy = h; + item.id = id; + + Vec2ToDLU(&item.x, &item.y); + Vec2ToDLU(&item.cx, &item.cy); + + if (!AlignDialogData(dialog, sizeof(DWORD))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &item, sizeof(item))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &marker, sizeof(marker))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &type, sizeof(type))) { + return SDL_FALSE; + } + if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL)) { + if (!AddDialogString(dialog, caption)) { + return SDL_FALSE; + } + } else { + if (!AddDialogData(dialog, &marker, sizeof(marker))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &ordinal, sizeof(ordinal))) { + return SDL_FALSE; + } + } + if (!AddDialogData(dialog, &extraData, sizeof(extraData))) { + return SDL_FALSE; + } + if (type == DLGITEMTYPEBUTTON) { + dialog->numbuttons++; + } + ++dialog->lpDialog->cDlgItems; + + return SDL_TRUE; +} + +static SDL_bool AddDialogStaticText(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text) +{ + DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX | SS_EDITCONTROL | WS_GROUP; + return AddDialogControl(dialog, DLGITEMTYPESTATIC, style, 0, x, y, w, h, -1, text, 0); +} + +static SDL_bool AddDialogStaticIcon(WIN_DialogData *dialog, int x, int y, int w, int h, Uint16 ordinal) +{ + DWORD style = WS_VISIBLE | WS_CHILD | SS_ICON | WS_GROUP; + return AddDialogControl(dialog, DLGITEMTYPESTATIC, style, 0, x, y, w, h, -2, NULL, ordinal); +} + +static SDL_bool AddDialogButton(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text, int id, SDL_bool isDefault) +{ + DWORD style = WS_VISIBLE | WS_CHILD | WS_TABSTOP; + if (isDefault) { + style |= BS_DEFPUSHBUTTON; + } else { + style |= BS_PUSHBUTTON; + } + /* The first button marks the start of the group. */ + if (dialog->numbuttons == 0) { + style |= WS_GROUP; + } + return AddDialogControl(dialog, DLGITEMTYPEBUTTON, style, 0, x, y, w, h, IDBUTTONINDEX0 + dialog->numbuttons, text, 0); +} + +static void FreeDialogData(WIN_DialogData *dialog) +{ + SDL_free(dialog->data); + SDL_free(dialog); +} + +static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) +{ + WIN_DialogData *dialog; + DLGTEMPLATEEX dialogTemplate; + WORD WordToPass; + + SDL_zero(dialogTemplate); + dialogTemplate.dlgVer = 1; + dialogTemplate.signature = 0xffff; + dialogTemplate.style = (WS_CAPTION | DS_CENTER | DS_SHELLFONT); + dialogTemplate.x = 0; + dialogTemplate.y = 0; + dialogTemplate.cx = w; + dialogTemplate.cy = h; + Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy); + + dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog)); + if (!dialog) { + return NULL; + } + + if (!AddDialogData(dialog, &dialogTemplate, sizeof(dialogTemplate))) { + FreeDialogData(dialog); + return NULL; + } + + /* No menu */ + WordToPass = 0; + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* No custom class */ + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* title */ + if (!AddDialogString(dialog, caption)) { + FreeDialogData(dialog); + return NULL; + } + + /* Font stuff */ + { + /* + * We want to use the system messagebox font. + */ + BYTE ToPass; + + NONCLIENTMETRICSA NCM; + NCM.cbSize = sizeof(NCM); + SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0); + + /* Font size - convert to logical font size for dialog parameter. */ + { + HDC ScreenDC = GetDC(NULL); + int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY); + if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */ + LogicalPixelsY = 72; + WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY); + ReleaseDC(NULL, ScreenDC); + } + + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* Font weight */ + WordToPass = (WORD)NCM.lfMessageFont.lfWeight; + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* italic? */ + ToPass = NCM.lfMessageFont.lfItalic; + if (!AddDialogData(dialog, &ToPass, 1)) { + FreeDialogData(dialog); + return NULL; + } + + /* charset? */ + ToPass = NCM.lfMessageFont.lfCharSet; + if (!AddDialogData(dialog, &ToPass, 1)) { + FreeDialogData(dialog); + return NULL; + } + + /* font typeface. */ + if (!AddDialogString(dialog, NCM.lfMessageFont.lfFaceName)) { + FreeDialogData(dialog); + return NULL; + } + } + + return dialog; +} + +/* Escaping ampersands is necessary to disable mnemonics in dialog controls. + * The caller provides a char** for dst and a size_t* for dstlen where the + * address of the work buffer and its size will be stored. Their values must be + * NULL and 0 on the first call. src is the string to be escaped. On error, the + * function returns NULL and, on success, returns a pointer to the escaped + * sequence as a read-only string that is valid until the next call or until the + * work buffer is freed. Once all strings have been processed, it's the caller's + * responsibilty to free the work buffer with SDL_free, even on errors. + */ +static const char *EscapeAmpersands(char **dst, size_t *dstlen, const char *src) +{ + char *newdst; + size_t ampcount = 0; + size_t srclen = 0; + + if (src == NULL) { + return NULL; + } + + while (src[srclen]) { + if (src[srclen] == '&') { + ampcount++; + } + srclen++; + } + srclen++; + + if (ampcount == 0) { + /* Nothing to do. */ + return src; + } + if (SIZE_MAX - srclen < ampcount) { + return NULL; + } + if (*dst == NULL || *dstlen < srclen + ampcount) { + /* Allocating extra space in case the next strings are a bit longer. */ + size_t extraspace = SIZE_MAX - (srclen + ampcount); + if (extraspace > 512) { + extraspace = 512; + } + *dstlen = srclen + ampcount + extraspace; + SDL_free(*dst); + *dst = NULL; + newdst = SDL_malloc(*dstlen); + if (newdst == NULL) { + return NULL; + } + *dst = newdst; + } else { + newdst = *dst; + } + + /* The escape character is the ampersand itself. */ + while (srclen--) { + if (*src == '&') { + *newdst++ = '&'; + } + *newdst++ = *src++; + } + + return *dst; +} + +/* This function is called if a Task Dialog is unsupported. */ +static int +WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + WIN_DialogData *dialog; + int i, x, y, retval; + const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; + HFONT DialogFont; + SIZE Size; + RECT TextSize; + wchar_t* wmessage; + TEXTMETRIC TM; + HDC FontDC; + INT_PTR result; + char *ampescape = NULL; + size_t ampescapesize = 0; + Uint16 defbuttoncount = 0; + Uint16 icon = 0; + + HWND ParentWindow = NULL; + + const int ButtonWidth = 88; + const int ButtonHeight = 26; + const int TextMargin = 16; + const int ButtonMargin = 12; + const int IconWidth = GetSystemMetrics(SM_CXICON); + const int IconHeight = GetSystemMetrics(SM_CYICON); + const int IconMargin = 20; + + if (messageboxdata->numbuttons > MAX_BUTTONS) { + return SDL_SetError("Number of butons exceeds limit of %d", MAX_BUTTONS); + } + + switch (messageboxdata->flags) { + case SDL_MESSAGEBOX_ERROR: + icon = (Uint16)(size_t)IDI_ERROR; + break; + case SDL_MESSAGEBOX_WARNING: + icon = (Uint16)(size_t)IDI_WARNING; + break; + case SDL_MESSAGEBOX_INFORMATION: + icon = (Uint16)(size_t)IDI_INFORMATION; + break; + } + + /* Jan 25th, 2013 - dant@fleetsa.com + * + * + * I've tried to make this more reasonable, but I've run in to a lot + * of nonsense. + * + * The original issue is the code was written in pixels and not + * dialog units (DLUs). All DialogBox functions use DLUs, which + * vary based on the selected font (yay). + * + * According to MSDN, the most reliable way to convert is via + * MapDialogUnits, which requires an HWND, which we don't have + * at time of template creation. + * + * We do however have: + * The system font (DLU width 8 for me) + * The font we select for the dialog (DLU width 6 for me) + * + * Based on experimentation, *neither* of these return the value + * actually used. Stepping in to MapDialogUnits(), the conversion + * is fairly clear, and uses 7 for me. + * + * As a result, some of this is hacky to ensure the sizing is + * somewhat correct. + * + * Honestly, a long term solution is to use CreateWindow, not CreateDialog. + * + + * + * In order to get text dimensions we need to have a DC with the desired font. + * I'm assuming a dialog box in SDL is rare enough we can to the create. + */ + FontDC = CreateCompatibleDC(0); + + { + /* Create a duplicate of the font used in system message boxes. */ + LOGFONT lf; + NONCLIENTMETRICS NCM; + NCM.cbSize = sizeof(NCM); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0); + lf = NCM.lfMessageFont; + DialogFont = CreateFontIndirect(&lf); + } + + /* Select the font in to our DC */ + SelectObject(FontDC, DialogFont); + + { + /* Get the metrics to try and figure our DLU conversion. */ + GetTextMetrics(FontDC, &TM); + + /* Calculation from the following documentation: + * https://support.microsoft.com/en-gb/help/125681/how-to-calculate-dialog-base-units-with-non-system-based-font + * This fixes bug 2137, dialog box calculation with a fixed-width system font + */ + { + SIZE extent; + GetTextExtentPoint32A(FontDC, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &extent); + s_BaseUnitsX = (extent.cx / 26 + 1) / 2; + } + /*s_BaseUnitsX = TM.tmAveCharWidth + 1;*/ + s_BaseUnitsY = TM.tmHeight; + } + + /* Measure the *pixel* size of the string. */ + wmessage = WIN_UTF8ToString(messageboxdata->message); + SDL_zero(TextSize); + DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT | DT_LEFT | DT_NOPREFIX | DT_EDITCONTROL); + + /* Add margins and some padding for hangs, etc. */ + TextSize.left += TextMargin; + TextSize.right += TextMargin + 2; + TextSize.top += TextMargin; + TextSize.bottom += TextMargin + 2; + + /* Done with the DC, and the string */ + DeleteDC(FontDC); + SDL_free(wmessage); + + /* Increase the size of the dialog by some border spacing around the text. */ + Size.cx = TextSize.right - TextSize.left; + Size.cy = TextSize.bottom - TextSize.top; + Size.cx += TextMargin * 2; + Size.cy += TextMargin * 2; + + /* Make dialog wider and shift text over for the icon. */ + if (icon) { + Size.cx += IconMargin + IconWidth; + TextSize.left += IconMargin + IconWidth; + TextSize.right += IconMargin + IconWidth; + } + + /* Ensure the size is wide enough for all of the buttons. */ + if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin) + Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin; + + /* Reset the height to the icon size if it is actually bigger than the text. */ + if (icon && Size.cy < IconMargin * 2 + IconHeight) { + Size.cy = IconMargin * 2 + IconHeight; + } + + /* Add vertical space for the buttons and border. */ + Size.cy += ButtonHeight + TextMargin; + + dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title); + if (!dialog) { + return -1; + } + + if (icon && ! AddDialogStaticIcon(dialog, IconMargin, IconMargin, IconWidth, IconHeight, icon)) { + FreeDialogData(dialog); + return -1; + } + + if (!AddDialogStaticText(dialog, TextSize.left, TextSize.top, TextSize.right - TextSize.left, TextSize.bottom - TextSize.top, messageboxdata->message)) { + FreeDialogData(dialog); + return -1; + } + + /* Align the buttons to the right/bottom. */ + x = Size.cx - (ButtonWidth + ButtonMargin) * messageboxdata->numbuttons; + y = Size.cy - ButtonHeight - ButtonMargin; + for (i = messageboxdata->numbuttons - 1; i >= 0; --i) { + SDL_bool isdefault = SDL_FALSE; + const char *buttontext; + + if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { + defbuttoncount++; + if (defbuttoncount == 1) { + isdefault = SDL_TRUE; + } + } + + buttontext = EscapeAmpersands(&escape, &escapesize, buttons[i].text); + if (buttontext == NULL || !AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttontext, buttons[i].buttonid, isdefault)) { + FreeDialogData(dialog); + SDL_free(ampescape); + return -1; + } + x += ButtonWidth + ButtonMargin; + } + SDL_free(ampescape); + + /* If we have a parent window, get the Instance and HWND for them + * so that our little dialog gets exclusive focus at all times. */ + if (messageboxdata->window) { + ParentWindow = ((SDL_WindowData*)messageboxdata->window->driverdata)->hwnd; + } + + result = DialogBoxIndirectParam(NULL, (DLGTEMPLATE*)dialog->lpDialog, ParentWindow, (DLGPROC)MessageBoxDialogProc, (LPARAM)messageboxdata); + if (result >= IDBUTTONINDEX0 && result - IDBUTTONINDEX0 < messageboxdata->numbuttons) { + *buttonid = messageboxdata->buttons[(messageboxdata->numbuttons - 1) - (result - IDBUTTONINDEX0)].buttonid; + retval = 0; + } else if (result == IDCLOSED) { + /* Dialog window closed by user or system. */ + /* This could use a special return code. */ + retval = 0; + *buttonid = -1; + } else { + if (result == 0) { + SDL_SetError("Invalid parent window handle"); + } else if (result == -1) { + SDL_SetError("The message box encountered an error."); + } else if (result == IDINVALPTRINIT || result == IDINVALPTRSETFOCUS || result == IDINVALPTRCOMMAND) { + SDL_SetError("Invalid message box pointer in dialog procedure"); + } else if (result == IDINVALPTRDLGITEM) { + SDL_SetError("Couldn't find dialog control of the default enter-key button"); + } else { + SDL_SetError("An unknown error occured"); + } + retval = -1; + } + + FreeDialogData(dialog); + return retval; +} + +/* TaskDialogIndirect procedure + * This is because SDL targets Windows XP (0x501), so this is not defined in the platform SDK. + */ +typedef HRESULT(FAR WINAPI *TASKDIALOGINDIRECTPROC)(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, int *pnRadioButton, BOOL *pfVerificationFlagChecked); + +int +WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + HWND ParentWindow = NULL; + wchar_t *wmessage; + wchar_t *wtitle; + TASKDIALOGCONFIG TaskConfig; + TASKDIALOG_BUTTON *pButtons; + TASKDIALOG_BUTTON *pButton; + HMODULE hComctl32; + TASKDIALOGINDIRECTPROC pfnTaskDialogIndirect; + HRESULT hr; + char *ampescape = NULL; + size_t ampescapesize = 0; + int nButton; + int nCancelButton; + int i; + + if (SIZE_MAX / sizeof(TASKDIALOG_BUTTON) < messageboxdata->numbuttons) { + return SDL_OutOfMemory(); + } + + /* If we cannot load comctl32.dll use the old messagebox! */ + hComctl32 = LoadLibrary(TEXT("Comctl32.dll")); + if (hComctl32 == NULL) { + return WIN_ShowOldMessageBox(messageboxdata, buttonid); + } + + /* If TaskDialogIndirect doesn't exist use the old messagebox! + This will fail prior to Windows Vista. + The manifest file in the application may require targeting version 6 of comctl32.dll, even + when we use LoadLibrary here! + If you don't want to bother with manifests, put this #pragma in your app's source code somewhere: + pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") + */ + pfnTaskDialogIndirect = (TASKDIALOGINDIRECTPROC) GetProcAddress(hComctl32, "TaskDialogIndirect"); + if (pfnTaskDialogIndirect == NULL) { + FreeLibrary(hComctl32); + return WIN_ShowOldMessageBox(messageboxdata, buttonid); + } + + /* If we have a parent window, get the Instance and HWND for them + so that our little dialog gets exclusive focus at all times. */ + if (messageboxdata->window) { + ParentWindow = ((SDL_WindowData *) messageboxdata->window->driverdata)->hwnd; + } + + wmessage = WIN_UTF8ToString(messageboxdata->message); + wtitle = WIN_UTF8ToString(messageboxdata->title); + + SDL_zero(TaskConfig); + TaskConfig.cbSize = sizeof (TASKDIALOGCONFIG); + TaskConfig.hwndParent = ParentWindow; + TaskConfig.dwFlags = TDF_SIZE_TO_CONTENT; + TaskConfig.pszWindowTitle = wtitle; + if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { + TaskConfig.pszMainIcon = TD_ERROR_ICON; + } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { + TaskConfig.pszMainIcon = TD_WARNING_ICON; + } else if (messageboxdata->flags & SDL_MESSAGEBOX_INFORMATION) { + TaskConfig.pszMainIcon = TD_INFORMATION_ICON; + } else { + TaskConfig.pszMainIcon = NULL; + } + + TaskConfig.pszContent = wmessage; + TaskConfig.cButtons = messageboxdata->numbuttons; + pButtons = SDL_malloc(sizeof (TASKDIALOG_BUTTON) * messageboxdata->numbuttons); + TaskConfig.nDefaultButton = 0; + nCancelButton = 0; + for (i = 0; i < messageboxdata->numbuttons; i++) + { + const char *buttontext; + pButton = &pButtons[messageboxdata->numbuttons-1-i]; + if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { + nCancelButton = messageboxdata->buttons[i].buttonid; + pButton->nButtonID = 2; + } else { + pButton->nButtonID = messageboxdata->buttons[i].buttonid + 1; + if (pButton->nButtonID >= 2) { + pButton->nButtonID++; + } + } + buttontext = EscapeAmpersands(&escape, &escapesize, messageboxdata->buttons[i].text); + if (buttontext == NULL) { + int j; + FreeLibrary(hComctl32); + SDL_free(ampescape); + SDL_free(wmessage); + SDL_free(wtitle); + for (j = 0; j < i; j++) { + SDL_free((wchar_t *) pButtons[j].pszButtonText); + } + SDL_free(pButtons); + return -1; + } + pButton->pszButtonText = WIN_UTF8ToString(buttontext); + if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { + TaskConfig.nDefaultButton = pButton->nButtonID; + } + } + TaskConfig.pButtons = pButtons; + + /* Show the Task Dialog */ + hr = pfnTaskDialogIndirect(&TaskConfig, &nButton, NULL, NULL); + + /* Free everything */ + FreeLibrary(hComctl32); + SDL_free(ampescape); + SDL_free(wmessage); + SDL_free(wtitle); + for (i = 0; i < messageboxdata->numbuttons; i++) { + SDL_free((wchar_t *) pButtons[i].pszButtonText); + } + SDL_free(pButtons); + + /* Check the Task Dialog was successful and give the result */ + if (SUCCEEDED(hr)) { + if (nButton == 2) { + *buttonid = nCancelButton; + } else if (nButton > 2) { + *buttonid = nButton-1-1; + } else { + *buttonid = nButton-1; + } + return 0; + } + + /* We failed showing the Task Dialog, use the old message box! */ + return WIN_ShowOldMessageBox(messageboxdata, buttonid); +} + +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.h index e9c692546e..2cb29beb6a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmessagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.c similarity index 54% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.c index 91ed67f871..7425d9ab34 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,86 +23,25 @@ #if SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" +#include "../../../include/SDL_assert.h" +#include "../../../include/SDL_log.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN #define CDS_FULLSCREEN 0 #endif -typedef struct _WIN_GetMonitorDPIData { - SDL_VideoData *vid_data; - SDL_DisplayMode *mode; - SDL_DisplayModeData *mode_data; -} WIN_GetMonitorDPIData; +/* #define DEBUG_MODES */ -static BOOL CALLBACK -WIN_GetMonitorDPI(HMONITOR hMonitor, - HDC hdcMonitor, - LPRECT lprcMonitor, - LPARAM dwData) -{ - WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData; - UINT hdpi, vdpi; - - if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK && - hdpi > 0 && - vdpi > 0) { - float hsize, vsize; - - data->mode_data->HorzDPI = (float)hdpi; - data->mode_data->VertDPI = (float)vdpi; - - // Figure out the monitor size and compute the diagonal DPI. - hsize = data->mode->w / data->mode_data->HorzDPI; - vsize = data->mode->h / data->mode_data->VertDPI; - - data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w, - data->mode->h, - hsize, - vsize ); - - // We can only handle one DPI per display mode so end the enumeration. - return FALSE; - } - - // We didn't get DPI information so keep going. - return TRUE; -} - -static SDL_bool -WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) +static void +WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) { - SDL_VideoData *vid_data = (SDL_VideoData *) _this->driverdata; - SDL_DisplayModeData *data; - DEVMODE devmode; + SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; HDC hdc; - devmode.dmSize = sizeof(devmode); - devmode.dmDriverExtra = 0; - if (!EnumDisplaySettings(deviceName, index, &devmode)) { - return SDL_FALSE; - } - - data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); - if (!data) { - return SDL_FALSE; - } - data->DeviceMode = devmode; data->DeviceMode.dmFields = (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS); - data->ScaleX = 1.0f; - data->ScaleY = 1.0f; - data->DiagDPI = 0.0f; - data->HorzDPI = 0.0f; - data->VertDPI = 0.0f; - - /* Fill in the mode information */ - mode->format = SDL_PIXELFORMAT_UNKNOWN; - mode->w = devmode.dmPelsWidth; - mode->h = devmode.dmPelsHeight; - mode->refresh_rate = devmode.dmDisplayFrequency; - mode->driverdata = data; if (index == ENUM_CURRENT_SETTINGS && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { @@ -112,39 +51,8 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); - data->ScaleX = (float)logical_width / devmode.dmPelsWidth; - data->ScaleY = (float)logical_height / devmode.dmPelsHeight; mode->w = logical_width; mode->h = logical_height; - - // WIN_GetMonitorDPI needs mode->w and mode->h - // so only call after those are set. - if (vid_data->GetDpiForMonitor) { - WIN_GetMonitorDPIData dpi_data; - RECT monitor_rect; - - dpi_data.vid_data = vid_data; - dpi_data.mode = mode; - dpi_data.mode_data = data; - monitor_rect.left = devmode.dmPosition.x; - monitor_rect.top = devmode.dmPosition.y; - monitor_rect.right = monitor_rect.left + 1; - monitor_rect.bottom = monitor_rect.top + 1; - EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data); - } else { - // We don't have the Windows 8.1 routine so just - // get system DPI. - data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX ); - data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY ); - if (data->HorzDPI == data->VertDPI) { - data->DiagDPI = data->HorzDPI; - } else { - data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w, - mode->h, - (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f, - (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f ); - } - } SDL_zero(bmi_data); bmi = (LPBITMAPINFO) bmi_data; @@ -175,10 +83,10 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } else if (bmi->bmiHeader.biBitCount == 4) { mode->format = SDL_PIXELFORMAT_INDEX4LSB; } - } else { + } else if (mode->format == SDL_PIXELFORMAT_UNKNOWN) { /* FIXME: Can we tell what this will be? */ - if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { - switch (devmode.dmBitsPerPel) { + if ((data->DeviceMode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { + switch (data->DeviceMode.dmBitsPerPel) { case 32: mode->format = SDL_PIXELFORMAT_RGB888; break; @@ -200,11 +108,40 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } } } +} + +static SDL_bool +WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) +{ + SDL_DisplayModeData *data; + DEVMODE devmode; + + devmode.dmSize = sizeof(devmode); + devmode.dmDriverExtra = 0; + if (!EnumDisplaySettings(deviceName, index, &devmode)) { + return SDL_FALSE; + } + + data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); + if (!data) { + return SDL_FALSE; + } + + mode->driverdata = data; + data->DeviceMode = devmode; + + mode->format = SDL_PIXELFORMAT_UNKNOWN; + mode->w = data->DeviceMode.dmPelsWidth; + mode->h = data->DeviceMode.dmPelsHeight; + mode->refresh_rate = data->DeviceMode.dmDisplayFrequency; + + /* Fill in the mode information */ + WIN_UpdateDisplayMode(_this, deviceName, index, mode); return SDL_TRUE; } static SDL_bool -WIN_AddDisplay(_THIS, LPTSTR DeviceName) +WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEX *info) { SDL_VideoDisplay display; SDL_DisplayData *displaydata; @@ -212,9 +149,10 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) DISPLAY_DEVICE device; #ifdef DEBUG_MODES - printf("Display: %s\n", WIN_StringToUTF8(DeviceName)); + SDL_Log("Display: %s\n", WIN_StringToUTF8(info->szDevice)); #endif - if (!WIN_GetDisplayMode(_this, DeviceName, ENUM_CURRENT_SETTINGS, &mode)) { + + if (!WIN_GetDisplayMode(_this, info->szDevice, ENUM_CURRENT_SETTINGS, &mode)) { return SDL_FALSE; } @@ -222,12 +160,13 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) if (!displaydata) { return SDL_FALSE; } - SDL_memcpy(displaydata->DeviceName, DeviceName, + SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName)); + displaydata->MonitorHandle = hMonitor; SDL_zero(display); device.cb = sizeof(device); - if (EnumDisplayDevices(DeviceName, 0, &device, 0)) { + if (EnumDisplayDevices(info->szDevice, 0, &device, 0)) { display.name = WIN_StringToUTF8(device.DeviceString); } display.desktop_mode = mode; @@ -238,63 +177,53 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) return SDL_TRUE; } -int -WIN_InitModes(_THIS) +typedef struct _WIN_AddDisplaysData { + SDL_VideoDevice *video_device; + SDL_bool want_primary; +} WIN_AddDisplaysData; + +static BOOL CALLBACK +WIN_AddDisplaysCallback(HMONITOR hMonitor, + HDC hdcMonitor, + LPRECT lprcMonitor, + LPARAM dwData) { - int pass; - DWORD i, j, count; - DISPLAY_DEVICE device; + WIN_AddDisplaysData *data = (WIN_AddDisplaysData*)dwData; + MONITORINFOEX info; - device.cb = sizeof(device); + SDL_zero(info); + info.cbSize = sizeof(info); - /* Get the primary display in the first pass */ - for (pass = 0; pass < 2; ++pass) { - for (i = 0; ; ++i) { - TCHAR DeviceName[32]; + if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&info) != 0) { + const SDL_bool is_primary = ((info.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY); - if (!EnumDisplayDevices(NULL, i, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - SDL_memcpy(DeviceName, device.DeviceName, sizeof(DeviceName)); -#ifdef DEBUG_MODES - printf("Device: %s\n", WIN_StringToUTF8(DeviceName)); -#endif - count = 0; - for (j = 0; ; ++j) { - if (!EnumDisplayDevices(DeviceName, j, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - count += WIN_AddDisplay(_this, device.DeviceName); - } - if (count == 0) { - WIN_AddDisplay(_this, DeviceName); - } + if (is_primary == data->want_primary) { + WIN_AddDisplay(data->video_device, hMonitor, &info); } } + + // continue enumeration + return TRUE; +} + +static void +WIN_AddDisplays(_THIS) +{ + WIN_AddDisplaysData callback_data; + callback_data.video_device = _this; + + callback_data.want_primary = SDL_TRUE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); + + callback_data.want_primary = SDL_FALSE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); +} + +int +WIN_InitModes(_THIS) +{ + WIN_AddDisplays(_this); + if (_this->num_displays == 0) { return SDL_SetError("No displays available"); } @@ -304,32 +233,106 @@ WIN_InitModes(_THIS) int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + MONITORINFO minfo; + BOOL rc; + + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); - rect->x = (int)SDL_ceil(data->DeviceMode.dmPosition.x * data->ScaleX); - rect->y = (int)SDL_ceil(data->DeviceMode.dmPosition.y * data->ScaleY); - rect->w = (int)SDL_ceil(data->DeviceMode.dmPelsWidth * data->ScaleX); - rect->h = (int)SDL_ceil(data->DeviceMode.dmPelsHeight * data->ScaleY); + if (!rc) { + return SDL_SetError("Couldn't find monitor data"); + } + + rect->x = minfo.rcMonitor.left; + rect->y = minfo.rcMonitor.top; + rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left; + rect->h = minfo.rcMonitor.bottom - minfo.rcMonitor.top; return 0; } int -WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out) { - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; + const SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; + const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; + float hdpi = 0, vdpi = 0, ddpi = 0; + + if (videodata->GetDpiForMonitor) { + UINT hdpi_uint, vdpi_uint; + // Windows 8.1+ codepath + if (videodata->GetDpiForMonitor(displaydata->MonitorHandle, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) { + // GetDpiForMonitor docs promise to return the same hdpi/vdpi + hdpi = (float)hdpi_uint; + vdpi = (float)hdpi_uint; + ddpi = (float)hdpi_uint; + } else { + return SDL_SetError("GetDpiForMonitor failed"); + } + } else { + // Window 8.0 and below: same DPI for all monitors. + HDC hdc; + int hdpi_int, vdpi_int, hpoints, vpoints, hpix, vpix; + float hinches, vinches; + + hdc = GetDC(NULL); + if (hdc == NULL) { + return SDL_SetError("GetDC failed"); + } + hdpi_int = GetDeviceCaps(hdc, LOGPIXELSX); + vdpi_int = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(NULL, hdc); + + hpoints = GetSystemMetrics(SM_CXVIRTUALSCREEN); + vpoints = GetSystemMetrics(SM_CYVIRTUALSCREEN); - if (ddpi) { - *ddpi = data->DiagDPI; + hpix = MulDiv(hpoints, hdpi_int, 96); + vpix = MulDiv(vpoints, vdpi_int, 96); + + hinches = (float)hpoints / 96.0f; + vinches = (float)vpoints / 96.0f; + + hdpi = (float)hdpi_int; + vdpi = (float)vdpi_int; + ddpi = SDL_ComputeDiagonalDPI(hpix, vpix, hinches, vinches); + } + + if (ddpi_out) { + *ddpi_out = ddpi; } - if (hdpi) { - *hdpi = data->HorzDPI; + if (hdpi_out) { + *hdpi_out = hdpi; } - if (vdpi) { - *vdpi = data->VertDPI; + if (vdpi_out) { + *vdpi_out = vdpi; + } + + return ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); +} + +int +WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + MONITORINFO minfo; + BOOL rc; + + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); + + if (!rc) { + return SDL_SetError("Couldn't find monitor data"); } - return data->DiagDPI != 0.0f ? 0 : -1; + rect->x = minfo.rcWork.left; + rect->y = minfo.rcWork.top; + rect->w = minfo.rcWork.right - minfo.rcWork.left; + rect->h = minfo.rcWork.bottom - minfo.rcWork.top; + + return 0; } void @@ -366,7 +369,7 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) LONG status; if (mode->driverdata == display->desktop_mode.driverdata) { - status = ChangeDisplaySettingsEx(displaydata->DeviceName, NULL, NULL, 0, NULL); + status = ChangeDisplaySettingsEx(displaydata->DeviceName, NULL, NULL, CDS_FULLSCREEN, NULL); } else { status = ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode, NULL, CDS_FULLSCREEN, NULL); } @@ -389,6 +392,7 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); } EnumDisplaySettings(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode); + WIN_UpdateDisplayMode(_this, displaydata->DeviceName, ENUM_CURRENT_SETTINGS, mode); return 0; } diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.h index e725848b22..a5c19b7b53 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmodes.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,31 +20,28 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmodes_h -#define _SDL_windowsmodes_h +#ifndef SDL_windowsmodes_h_ +#define SDL_windowsmodes_h_ typedef struct { TCHAR DeviceName[32]; + HMONITOR MonitorHandle; } SDL_DisplayData; typedef struct { DEVMODE DeviceMode; - float ScaleX; - float ScaleY; - float DiagDPI; - float HorzDPI; - float VertDPI; } SDL_DisplayModeData; extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void WIN_QuitModes(_THIS); -#endif /* _SDL_windowsmodes_h */ +#endif /* SDL_windowsmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.c index 72d7892d47..eff31605b3 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -304,20 +304,11 @@ WIN_InitMouse(_THIS) mouse->GetGlobalMouseState = WIN_GetGlobalMouseState; SDL_SetDefaultCursor(WIN_CreateDefaultCursor()); - - SDL_SetDoubleClickTime(GetDoubleClickTime()); } void WIN_QuitMouse(_THIS) { - SDL_Mouse *mouse = SDL_GetMouse(); - if ( mouse->def_cursor ) { - SDL_free(mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - } - if (rawInputEnableCount) { /* force RAWINPUT off here. */ rawInputEnableCount = 1; ToggleRawInput(SDL_FALSE); diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.h index 60672e6bb9..775c32c367 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsmouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmouse_h -#define _SDL_windowsmouse_h +#ifndef SDL_windowsmouse_h_ +#define SDL_windowsmouse_h_ extern HCURSOR SDL_cursor; extern void WIN_InitMouse(_THIS); extern void WIN_QuitMouse(_THIS); -#endif /* _SDL_windowsmouse_h */ +#endif /* SDL_windowsmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.c similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.c index d30d838fdc..c3ba56c0ee 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_loadso.h" #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" +#include "SDL_hints.h" /* WGL implementation of SDL OpenGL support */ @@ -81,6 +82,11 @@ #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #endif +#ifndef WGL_ARB_create_context_no_error +#define WGL_ARB_create_context_no_error +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif + typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, @@ -131,6 +137,44 @@ WIN_GL_LoadLibrary(_THIS, const char *path) return SDL_SetError("Could not retrieve OpenGL functions"); } + /* XXX Too sleazy? WIN_GL_InitExtensions looks for certain OpenGL + extensions via SDL_GL_DeduceMaxSupportedESProfile. This uses + SDL_GL_ExtensionSupported which in turn calls SDL_GL_GetProcAddress. + However SDL_GL_GetProcAddress will fail if the library is not + loaded; it checks for gl_config.driver_loaded > 0. To avoid this + test failing, increment driver_loaded around the call to + WIN_GLInitExtensions. + + Successful loading of the library is normally indicated by + SDL_GL_LoadLibrary incrementing driver_loaded immediately after + this function returns 0 to it. + + Alternatives to this are: + - moving SDL_GL_DeduceMaxSupportedESProfile to both the WIN and + X11 platforms while adding a function equivalent to + SDL_GL_ExtensionSupported but which directly calls + glGetProcAddress(). Having 3 copies of the + SDL_GL_ExtensionSupported makes this alternative unattractive. + - moving SDL_GL_DeduceMaxSupportedESProfile to a new file shared + by the WIN and X11 platforms while adding a function equivalent + to SDL_GL_ExtensionSupported. This is unattractive due to the + number of project files that will need updating, plus there + will be 2 copies of the SDL_GL_ExtensionSupported code. + - Add a private equivalent of SDL_GL_ExtensionSupported to + SDL_video.c. + - Move the call to WIN_GL_InitExtensions back to WIN_CreateWindow + and add a flag to gl_data to avoid multiple calls to this + expensive function. This is probably the least objectionable + alternative if this increment/decrement trick is unacceptable. + + Note that the driver_loaded > 0 check needs to remain in + SDL_GL_ExtensionSupported and SDL_GL_GetProcAddress as they are + public API functions. + */ + ++_this->gl_config.driver_loaded; + WIN_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; + return 0; } @@ -407,16 +451,28 @@ WIN_GL_InitExtensions(_THIS) } /* Check for WGL_EXT_create_context_es2_profile */ - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE; if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE; + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); } - /* Check for GLX_ARB_context_flush_control */ + /* Check for WGL_ARB_context_flush_control */ if (HasExtension("WGL_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_WGL_ARB_context_flush_control = SDL_TRUE; } + /* Check for WGL_ARB_create_context_robustness */ + if (HasExtension("WGL_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for WGL_ARB_create_context_no_error */ + if (HasExtension("WGL_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE; + } + _this->gl_data->wglMakeCurrent(hdc, NULL); _this->gl_data->wglDeleteContext(hglrc); ReleaseDC(hwnd, hdc); @@ -593,14 +649,26 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) return retval; } +SDL_bool +WIN_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No WGL extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; HGLRC context, share_context; - if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) { + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) { #if SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ WIN_GL_UnloadLibrary(_this); @@ -660,13 +728,13 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) SDL_SetError("GL 3.x is not supported"); context = temp_context; } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, - WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, - 0 - }; - int iattr = 4; + int attribs[15]; /* max 14 attributes plus terminator */ + int iattr = 0; + + attribs[iattr++] = WGL_CONTEXT_MAJOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.major_version; + attribs[iattr++] = WGL_CONTEXT_MINOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.minor_version; /* SDL profile bits match WGL profile bits */ if (_this->gl_config.profile_mask != 0) { @@ -688,6 +756,20 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_robustness) { + attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = _this->gl_config.reset_notification ? + WGL_LOSE_CONTEXT_ON_RESET_ARB : + WGL_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_no_error) { + attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Create the GL 3.x context */ @@ -766,12 +848,15 @@ WIN_GL_GetSwapInterval(_THIS) return retval; } -void +int WIN_GL_SwapWindow(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; - SwapBuffers(hdc); + if (!SwapBuffers(hdc)) { + return WIN_SetError("SwapBuffers()"); + } + return 0; } void diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.h similarity index 73% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.h index 7b95cc8d92..87044117c5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsopengl_h -#define _SDL_windowsopengl_h +#ifndef SDL_windowsopengl_h_ +#define SDL_windowsopengl_h_ #if SDL_VIDEO_OPENGL_WGL @@ -29,25 +29,35 @@ struct SDL_GLDriverData { SDL_bool HAS_WGL_ARB_pixel_format; SDL_bool HAS_WGL_EXT_swap_control_tear; - SDL_bool HAS_WGL_EXT_create_context_es2_profile; SDL_bool HAS_WGL_ARB_context_flush_control; + SDL_bool HAS_WGL_ARB_create_context_robustness; + SDL_bool HAS_WGL_ARB_create_context_no_error; + + /* Max version of OpenGL ES context that can be created if the + implementation supports WGL_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; void *(WINAPI * wglGetProcAddress) (const char *proc); - HGLRC(WINAPI * wglCreateContext) (HDC hdc); - BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); - BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); - BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2); - BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc, - const int *piAttribIList, - const FLOAT * pfAttribFList, - UINT nMaxFormats, - int *piFormats, - UINT * nNumFormats); - BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - int *piValues); + HGLRC(WINAPI * wglCreateContext) (HDC hdc); + BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); + BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); + BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2); + BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc, + const int *piAttribIList, + const FLOAT * pfAttribFList, + UINT nMaxFormats, + int *piFormats, + UINT * nNumFormats); + BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, + int iLayerPlane, + UINT nAttributes, + const int *piAttributes, + int *piValues); BOOL (WINAPI * wglSwapIntervalEXT) (int interval); int (WINAPI * wglGetSwapIntervalEXT) (void); }; @@ -56,13 +66,14 @@ struct SDL_GLDriverData extern int WIN_GL_LoadLibrary(_THIS, const char *path); extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); extern void WIN_GL_UnloadLibrary(_THIS); +extern SDL_bool WIN_GL_UseEGL(_THIS); extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int WIN_GL_SetSwapInterval(_THIS, int interval); extern int WIN_GL_GetSwapInterval(_THIS); -extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window); extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); extern void WIN_GL_InitExtensions(_THIS); extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow); @@ -126,6 +137,6 @@ extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Wi #endif /* SDL_VIDEO_OPENGL_WGL */ -#endif /* _SDL_windowsopengl_h */ +#endif /* SDL_windowsopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.c index f66cc088a5..0ff61c3d0c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) { } if (_this->egl_data == NULL) { - return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY); + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); } return 0; @@ -110,7 +110,7 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) if (_this->egl_data == NULL) { - if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY) < 0) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { SDL_EGL_UnloadLibrary(_this); return -1; } @@ -126,17 +126,6 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) return WIN_GLES_MakeCurrent(_this, current_win, current_ctx); } -int -WIN_GLES_SetSwapInterval(_THIS, int interval) -{ - /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this - * from working if we do (the window contents freeze and don't swap properly). So, we ignore - * the request for now. - */ - SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug"); - return 0; -} - #endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.h similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.h index dbdf5f6a17..86844292a6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winopengles_h -#define _SDL_winopengles_h +#ifndef SDL_winopengles_h_ +#define SDL_winopengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -33,19 +33,17 @@ #define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress #define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval -/* See the WIN_GLES_GetSwapInterval implementation to see why this is commented out */ -/*#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval*/ -extern int WIN_GLES_SetSwapInterval(_THIS, int interval); +#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval extern int WIN_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WIN_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winopengles_h */ +#endif /* SDL_winopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.c index 0a50985a25..bed4588c51 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ Win32_CreateShaper(SDL_Window * window) { return result; } -void +static void CombineRectRegions(SDL_ShapeTree* node,void* closure) { HRGN mask_region = *((HRGN*)closure),temp_region = NULL; if(node->kind == OpaqueShape) { diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.h index ddd8f49ba8..eb1a887e9b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsshape.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_windowsshape_h -#define _SDL_windowsshape_h +#ifndef SDL_windowsshape_h_ +#define SDL_windowsshape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -37,4 +37,4 @@ extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window); extern int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Win32_ResizeWindowShape(SDL_Window *window); -#endif /* _SDL_windowsshape_h */ +#endif /* SDL_windowsshape_h_ */ diff --git a/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowstaskdialog.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowstaskdialog.h new file mode 100644 index 0000000000..a2a9e8a4b8 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowstaskdialog.h @@ -0,0 +1,156 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include + +typedef HRESULT(CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData); + +enum _TASKDIALOG_FLAGS +{ + TDF_ENABLE_HYPERLINKS = 0x0001, + TDF_USE_HICON_MAIN = 0x0002, + TDF_USE_HICON_FOOTER = 0x0004, + TDF_ALLOW_DIALOG_CANCELLATION = 0x0008, + TDF_USE_COMMAND_LINKS = 0x0010, + TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020, + TDF_EXPAND_FOOTER_AREA = 0x0040, + TDF_EXPANDED_BY_DEFAULT = 0x0080, + TDF_VERIFICATION_FLAG_CHECKED = 0x0100, + TDF_SHOW_PROGRESS_BAR = 0x0200, + TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400, + TDF_CALLBACK_TIMER = 0x0800, + TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000, + TDF_RTL_LAYOUT = 0x2000, + TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000, + TDF_CAN_BE_MINIMIZED = 0x8000, + //#if (NTDDI_VERSION >= NTDDI_WIN8) + TDF_NO_SET_FOREGROUND = 0x00010000, // Don't call SetForegroundWindow() when activating the dialog + //#endif // (NTDDI_VERSION >= NTDDI_WIN8) + TDF_SIZE_TO_CONTENT = 0x01000000 // used by ShellMessageBox to emulate MessageBox sizing behavior +}; +typedef int TASKDIALOG_FLAGS; // Note: _TASKDIALOG_FLAGS is an int + +typedef enum _TASKDIALOG_MESSAGES +{ + TDM_NAVIGATE_PAGE = WM_USER + 101, + TDM_CLICK_BUTTON = WM_USER + 102, // wParam = Button ID + TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103, // wParam = 0 (nonMarque) wParam != 0 (Marquee) + TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104, // wParam = new progress state + TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105, // lParam = MAKELPARAM(nMinRange, nMaxRange) + TDM_SET_PROGRESS_BAR_POS = WM_USER + 106, // wParam = new position + TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints) + TDM_SET_ELEMENT_TEXT = WM_USER + 108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR) + TDM_CLICK_RADIO_BUTTON = WM_USER + 110, // wParam = Radio Button ID + TDM_ENABLE_BUTTON = WM_USER + 111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID + TDM_ENABLE_RADIO_BUTTON = WM_USER + 112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID + TDM_CLICK_VERIFICATION = WM_USER + 113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus) + TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR) + TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required) + TDM_UPDATE_ICON = WM_USER + 116 // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise) +} TASKDIALOG_MESSAGES; + +typedef enum _TASKDIALOG_NOTIFICATIONS +{ + TDN_CREATED = 0, + TDN_NAVIGATED = 1, + TDN_BUTTON_CLICKED = 2, // wParam = Button ID + TDN_HYPERLINK_CLICKED = 3, // lParam = (LPCWSTR)pszHREF + TDN_TIMER = 4, // wParam = Milliseconds since dialog created or timer reset + TDN_DESTROYED = 5, + TDN_RADIO_BUTTON_CLICKED = 6, // wParam = Radio Button ID + TDN_DIALOG_CONSTRUCTED = 7, + TDN_VERIFICATION_CLICKED = 8, // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0 + TDN_HELP = 9, + TDN_EXPANDO_BUTTON_CLICKED = 10 // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded) +} TASKDIALOG_NOTIFICATIONS; + +typedef struct _TASKDIALOG_BUTTON +{ + int nButtonID; + PCWSTR pszButtonText; +} TASKDIALOG_BUTTON; + +typedef enum _TASKDIALOG_ELEMENTS +{ + TDE_CONTENT, + TDE_EXPANDED_INFORMATION, + TDE_FOOTER, + TDE_MAIN_INSTRUCTION +} TASKDIALOG_ELEMENTS; + +typedef enum _TASKDIALOG_ICON_ELEMENTS +{ + TDIE_ICON_MAIN, + TDIE_ICON_FOOTER +} TASKDIALOG_ICON_ELEMENTS; + +#define TD_WARNING_ICON MAKEINTRESOURCEW(-1) +#define TD_ERROR_ICON MAKEINTRESOURCEW(-2) +#define TD_INFORMATION_ICON MAKEINTRESOURCEW(-3) +#define TD_SHIELD_ICON MAKEINTRESOURCEW(-4) + +enum _TASKDIALOG_COMMON_BUTTON_FLAGS +{ + TDCBF_OK_BUTTON = 0x0001, // selected control return value IDOK + TDCBF_YES_BUTTON = 0x0002, // selected control return value IDYES + TDCBF_NO_BUTTON = 0x0004, // selected control return value IDNO + TDCBF_CANCEL_BUTTON = 0x0008, // selected control return value IDCANCEL + TDCBF_RETRY_BUTTON = 0x0010, // selected control return value IDRETRY + TDCBF_CLOSE_BUTTON = 0x0020 // selected control return value IDCLOSE +}; +typedef int TASKDIALOG_COMMON_BUTTON_FLAGS; // Note: _TASKDIALOG_COMMON_BUTTON_FLAGS is an int + +typedef struct _TASKDIALOGCONFIG +{ + UINT cbSize; + HWND hwndParent; // incorrectly named, this is the owner window, not a parent. + HINSTANCE hInstance; // used for MAKEINTRESOURCE() strings + TASKDIALOG_FLAGS dwFlags; // TASKDIALOG_FLAGS (TDF_XXX) flags + TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons; // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags + PCWSTR pszWindowTitle; // string or MAKEINTRESOURCE() + union + { + HICON hMainIcon; + PCWSTR pszMainIcon; + } /*DUMMYUNIONNAME*/; + PCWSTR pszMainInstruction; + PCWSTR pszContent; + UINT cButtons; + const TASKDIALOG_BUTTON *pButtons; + int nDefaultButton; + UINT cRadioButtons; + const TASKDIALOG_BUTTON *pRadioButtons; + int nDefaultRadioButton; + PCWSTR pszVerificationText; + PCWSTR pszExpandedInformation; + PCWSTR pszExpandedControlText; + PCWSTR pszCollapsedControlText; + union + { + HICON hFooterIcon; + PCWSTR pszFooterIcon; + } /*DUMMYUNIONNAME2*/; + PCWSTR pszFooter; + PFTASKDIALOGCALLBACK pfCallback; + LONG_PTR lpCallbackData; + UINT cxWidth; // width of the Task Dialog's client area in DLU's. If 0, Task Dialog will calculate the ideal width. +} TASKDIALOGCONFIG; + +#include diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.c index 37199805b8..358ab2356c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_windowsvideo.h" #include "SDL_windowsframebuffer.h" #include "SDL_windowsshape.h" +#include "SDL_windowsvulkan.h" /* Initialization/Query functions */ static int WIN_VideoInit(_THIS); @@ -42,7 +43,8 @@ static void WIN_VideoQuit(_THIS); SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE; SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE; -static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowsEnableMessageLoop = SDL_FALSE; @@ -51,7 +53,8 @@ static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, con } } -static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowFrameUsableWhileCursorHidden = SDL_FALSE; @@ -60,6 +63,15 @@ static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char } } +static void WIN_SuspendScreenSaver(_THIS) +{ + if (_this->suspend_screensaver) { + SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); + } else { + SetThreadExecutionState(ES_CONTINUOUS); + } +} + /* Windows driver bootstrap functions */ @@ -113,29 +125,36 @@ WIN_CreateDevice(int devindex) data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo"); data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow"); + } else { + SDL_ClearError(); } data->shcoreDLL = SDL_LoadObject("SHCORE.DLL"); if (data->shcoreDLL) { data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); + } else { + SDL_ClearError(); } /* Set the function pointers */ device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; device->GetDisplayBounds = WIN_GetDisplayBounds; + device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds; device->GetDisplayDPI = WIN_GetDisplayDPI; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; device->PumpEvents = WIN_PumpEvents; + device->SuspendScreenSaver = WIN_SuspendScreenSaver; -#undef CreateWindow - device->CreateWindow = WIN_CreateWindow; - device->CreateWindowFrom = WIN_CreateWindowFrom; + device->CreateSDLWindow = WIN_CreateWindow; + device->CreateSDLWindowFrom = WIN_CreateWindowFrom; device->SetWindowTitle = WIN_SetWindowTitle; device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; + device->GetWindowBordersSize = WIN_GetWindowBordersSize; + device->SetWindowOpacity = WIN_SetWindowOpacity; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; device->RaiseWindow = WIN_RaiseWindow; @@ -143,6 +162,7 @@ WIN_CreateDevice(int devindex) device->MinimizeWindow = WIN_MinimizeWindow; device->RestoreWindow = WIN_RestoreWindow; device->SetWindowBordered = WIN_SetWindowBordered; + device->SetWindowResizable = WIN_SetWindowResizable; device->SetWindowFullscreen = WIN_SetWindowFullscreen; device->SetWindowGammaRamp = WIN_SetWindowGammaRamp; device->GetWindowGammaRamp = WIN_GetWindowGammaRamp; @@ -154,6 +174,7 @@ WIN_CreateDevice(int devindex) device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer; device->OnWindowEnter = WIN_OnWindowEnter; device->SetWindowHitTest = WIN_SetWindowHitTest; + device->AcceptDragAndDrop = WIN_AcceptDragAndDrop; device->shape_driver.CreateShaper = Win32_CreateShaper; device->shape_driver.SetWindowShape = Win32_SetWindowShape; @@ -181,6 +202,13 @@ WIN_CreateDevice(int devindex) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; #endif +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; +#endif + device->StartTextInput = WIN_StartTextInput; device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.h similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.h index 912d8763df..13037544f6 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowsvideo.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsvideo_h -#define _SDL_windowsvideo_h +#ifndef SDL_windowsvideo_h_ +#define SDL_windowsvideo_h_ #include "../../core/windows/SDL_windows.h" @@ -194,6 +194,6 @@ extern SDL_bool g_WindowFrameUsableWhileCursorHidden; typedef struct IDirect3D9 IDirect3D9; extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface ); -#endif /* _SDL_windowsvideo_h */ +#endif /* SDL_windowsvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.c new file mode 100644 index 0000000000..6bb8f2a428 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +#include "SDL_windowsvideo.h" +#include "SDL_windowswindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_windowsvulkan.h" +#include "SDL_syswm.h" + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + Uint32 i; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWin32SurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "vulkan-1.dll"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWin32SurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWin32SurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WIN32_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void WIN_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWin32[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWin32), + extensionsForWin32); +} + +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR = + (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWin32SurfaceKHR"); + VkWin32SurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWin32SurfaceKHR) + { + SDL_SetError(VK_KHR_WIN32_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.hinstance = windowData->hinstance; + createInfo.hwnd = windowData->hwnd; + result = vkCreateWin32SurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWin32SurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.h new file mode 100644 index 0000000000..0acc0a9f50 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowsvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_windowsvulkan_h_ +#define SDL_windowsvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path); +void WIN_Vulkan_UnloadLibrary(_THIS); +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_windowsvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.c b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.c similarity index 64% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.c rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.c index 26683a0ed0..45463c4c7f 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.c +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,9 +51,17 @@ static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); static ATOM SDL_HelperWindowClass = 0; +/* For borderless Windows, still want the following flags: + - WS_CAPTION: this seems to enable the Windows minimize animation + - WS_SYSMENU: enables system context menu on task bar + - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. + This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen + */ + #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) #define STYLE_FULLSCREEN (WS_POPUP) #define STYLE_BORDERLESS (WS_POPUP) +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE) @@ -67,46 +75,89 @@ GetWindowStyle(SDL_Window * window) style |= STYLE_FULLSCREEN; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style |= STYLE_BORDERLESS; + /* SDL 2.1: + This behavior more closely matches other platform where the window is borderless + but still interacts with the window manager (e.g. task bar shows above it, it can + be resized to fit within usable desktop area, etc.) so this should be the behavior + for a future SDL release. + + If you want a borderless window the size of the desktop that looks like a fullscreen + window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag. + */ + if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) { + style |= STYLE_BORDERLESS_WINDOWED; + } else { + style |= STYLE_BORDERLESS; + } } else { style |= STYLE_NORMAL; } + + /* You can have a borderless resizable window */ if (window->flags & SDL_WINDOW_RESIZABLE) { style |= STYLE_RESIZABLE; } + + /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */ + if (window->flags & SDL_WINDOW_MINIMIZED) { + style |= WS_MINIMIZE; + } } return style; } static void -WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) +WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current) +{ + RECT rect; + + rect.left = 0; + rect.top = 0; + rect.right = (use_current ? window->w : window->windowed.w); + rect.bottom = (use_current ? window->h : window->windowed.h); + + /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message + expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. + */ + if (!(window->flags & SDL_WINDOW_BORDERLESS)) + AdjustWindowRectEx(&rect, style, menu, 0); + + *x = (use_current ? window->x : window->windowed.x) + rect.left; + *y = (use_current ? window->y : window->windowed.y) + rect.top; + *width = (rect.right - rect.left); + *height = (rect.bottom - rect.top); +} + +static void +WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_bool use_current) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - RECT rect; DWORD style; - HWND top; BOOL menu; + + style = GetWindowLong(hwnd, GWL_STYLE); + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current); +} + +static void +WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + HWND hwnd = data->hwnd; + HWND top; int x, y; int w, h; /* Figure out what the window area will be */ - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; } - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; + + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE); data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, top, x, y, w, h, flags); @@ -114,7 +165,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) } static int -SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) +SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *data; @@ -126,7 +177,9 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } data->window = window; data->hwnd = hwnd; + data->parent = parent; data->hdc = GetDC(hwnd); + data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->mouse_button_flags = 0; data->videodata = videodata; @@ -164,27 +217,11 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) if (GetClientRect(hwnd, &rect)) { int w = rect.right; int h = rect.bottom; - if ((window->w && window->w != w) || (window->h && window->h != h)) { + if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) { /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ - RECT rect; - DWORD style; - BOOL menu; int x, y; - int w, h; - /* Figure out what the window area will be */ - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; - + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE); SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); } else { window->w = w; @@ -208,10 +245,10 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } else { window->flags &= ~SDL_WINDOW_SHOWN; } - if (style & (WS_BORDER | WS_THICKFRAME)) { - window->flags &= ~SDL_WINDOW_BORDERLESS; - } else { + if (style & WS_POPUP) { window->flags |= SDL_WINDOW_BORDERLESS; + } else { + window->flags &= ~SDL_WINDOW_BORDERLESS; } if (style & WS_THICKFRAME) { window->flags |= SDL_WINDOW_RESIZABLE; @@ -253,39 +290,33 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM)); } - /* Enable dropping files */ - DragAcceptFiles(hwnd, TRUE); - data->initializing = SDL_FALSE; /* All done! */ return 0; } + + int WIN_CreateWindow(_THIS, SDL_Window * window) { - HWND hwnd; - RECT rect; + HWND hwnd, parent = NULL; DWORD style = STYLE_BASIC; int x, y; int w, h; + if (window->flags & SDL_WINDOW_SKIP_TASKBAR) { + parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL); + } + style |= GetWindowStyle(window); /* Figure out what the window area will be */ - rect.left = window->x; - rect.top = window->y; - rect.right = window->x + window->w; - rect.bottom = window->y + window->h; - AdjustWindowRectEx(&rect, style, FALSE, 0); - x = rect.left; - y = rect.top; - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); + WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE); hwnd = - CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, + CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL, SDL_Instance, NULL); if (!hwnd) { return WIN_SetError("Couldn't create window"); @@ -293,43 +324,51 @@ WIN_CreateWindow(_THIS, SDL_Window * window) WIN_PumpEvents(_this); - if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { + if (SetupWindowData(_this, window, hwnd, parent, SDL_TRUE) < 0) { DestroyWindow(hwnd); + if (parent) { + DestroyWindow(parent); + } return -1; } -#if SDL_VIDEO_OPENGL_WGL - /* We need to initialize the extensions before deciding how to create ES profiles */ - if (window->flags & SDL_WINDOW_OPENGL) { - WIN_GL_InitExtensions(_this); + /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */ + SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + + if (window->flags & SDL_WINDOW_MINIMIZED) { + ShowWindow(hwnd, SW_SHOWMINNOACTIVE); + } + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; } -#endif + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ #if SDL_VIDEO_OPENGL_ES2 - if ((window->flags & SDL_WINDOW_OPENGL) && - _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES -#if SDL_VIDEO_OPENGL_WGL - && (!_this->gl_data || !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) -#endif - ) { -#if SDL_VIDEO_OPENGL_EGL + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES +#if SDL_VIDEO_OPENGL_WGL + && (!_this->gl_data || WIN_GL_UseEGL(_this)) +#endif /* SDL_VIDEO_OPENGL_WGL */ + ) { +#if SDL_VIDEO_OPENGL_EGL if (WIN_GLES_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; } + return 0; #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); -#endif /* SDL_VIDEO_OPENGL_EGL */ - } else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } #endif /* SDL_VIDEO_OPENGL_ES2 */ #if SDL_VIDEO_OPENGL_WGL - if (window->flags & SDL_WINDOW_OPENGL) { - if (WIN_GL_SetupWindow(_this, window) < 0) { - WIN_DestroyWindow(_this, window); - return -1; - } + if (WIN_GL_SetupWindow(_this, window) < 0) { + WIN_DestroyWindow(_this, window); + return -1; } +#else + return SDL_SetError("Could not create GL window (WGL support not configured)"); #endif return 0; @@ -357,7 +396,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) SDL_stack_free(title); } - if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) { + if (SetupWindowData(_this, window, hwnd, GetParent(hwnd), SDL_FALSE) < 0) { return -1; } @@ -372,13 +411,11 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) SDL_sscanf(hint, "%p", (void**)&otherWindow); /* Do some error checking on the pointer */ - if (otherWindow != NULL && otherWindow->magic == &_this->window_magic) - { + if (otherWindow != NULL && otherWindow->magic == &_this->window_magic) { /* If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well */ - if (otherWindow->flags & SDL_WINDOW_OPENGL) - { + if (otherWindow->flags & SDL_WINDOW_OPENGL) { window->flags |= SDL_WINDOW_OPENGL; - if(!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) { + if (!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) { return -1; } } @@ -404,11 +441,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HICON hicon = NULL; BYTE *icon_bmp; - int icon_len, y; + int icon_len, mask_len, y; SDL_RWops *dst; - /* Create temporary bitmap buffer */ - icon_len = 40 + icon->h * icon->w * 4; + /* Create temporary buffer for ICONIMAGE structure */ + mask_len = (icon->h * (icon->w + 7)/8); + icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len; icon_bmp = SDL_stack_alloc(BYTE, icon_len); dst = SDL_RWFromMem(icon_bmp, icon_len); if (!dst) { @@ -423,7 +461,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) SDL_WriteLE16(dst, 1); SDL_WriteLE16(dst, 32); SDL_WriteLE32(dst, BI_RGB); - SDL_WriteLE32(dst, icon->h * icon->w * 4); + SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32)); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); @@ -434,9 +472,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) y = icon->h; while (y--) { Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch; - SDL_RWwrite(dst, src, icon->pitch, 1); + SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1); } + /* Write the mask */ + SDL_memset(icon_bmp + icon_len - mask_len, 0xFF, mask_len); + hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); SDL_RWclose(dst); @@ -461,11 +502,63 @@ WIN_SetWindowSize(_THIS, SDL_Window * window) WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE); } +int +WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + RECT rcClient, rcWindow; + POINT ptDiff; + + /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left + * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ + GetClientRect(hwnd, &rcClient); + GetWindowRect(hwnd, &rcWindow); + + /* convert the top/left values to make them relative to + * the window; they will end up being slightly negative */ + ptDiff.y = rcWindow.top; + ptDiff.x = rcWindow.left; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.top = ptDiff.y; + rcWindow.left = ptDiff.x; + + /* convert the bottom/right values to make them relative to the window, + * these will be slightly bigger than the inner width/height */ + ptDiff.y = rcWindow.bottom; + ptDiff.x = rcWindow.right; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.bottom = ptDiff.y; + rcWindow.right = ptDiff.x; + + /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size. + * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0}, + * so switch them around because SDL2 wants them in positive. */ + *top = rcClient.top - rcWindow.top; + *left = rcClient.left - rcWindow.left; + *bottom = rcWindow.bottom - rcClient.bottom; + *right = rcWindow.right - rcClient.right; + + return 0; +} + void WIN_ShowWindow(_THIS, SDL_Window * window) { - HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; - ShowWindow(hwnd, SW_SHOW); + DWORD style; + HWND hwnd; + int nCmdShow; + + hwnd = ((SDL_WindowData *)window->driverdata)->hwnd; + nCmdShow = SW_SHOW; + style = GetWindowLong(hwnd, GWL_EXSTYLE); + if (style & WS_EX_NOACTIVATE) { + nCmdShow = SW_SHOWNOACTIVATE; + } + ShowWindow(hwnd, nCmdShow); } void @@ -478,7 +571,8 @@ WIN_HideWindow(_THIS, SDL_Window * window) void WIN_RaiseWindow(_THIS, SDL_Window * window) { - WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE); + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + SetForegroundWindow(hwnd); } void @@ -503,15 +597,11 @@ WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + DWORD style; - if (bordered) { - style &= ~STYLE_BORDERLESS; - style |= STYLE_NORMAL; - } else { - style &= ~STYLE_NORMAL; - style |= STYLE_BORDERLESS; - } + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); data->in_border_change = SDL_TRUE; SetWindowLong(hwnd, GWL_STYLE, style); @@ -519,6 +609,20 @@ WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) data->in_border_change = SDL_FALSE; } +void +WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + HWND hwnd = data->hwnd; + DWORD style; + + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); + + SetWindowLong(hwnd, GWL_STYLE, style); +} + void WIN_RestoreWindow(_THIS, SDL_Window * window) { @@ -534,15 +638,13 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - RECT rect; SDL_Rect bounds; DWORD style; HWND top; - BOOL menu; int x, y; int w, h; - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -568,6 +670,8 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style &= ~WS_MAXIMIZE; } } else { + BOOL menu; + /* Restore window-maximization state, as applicable. Special care is taken to *not* do this if and when we're alt-tab'ing away (to some other window; as indicated by @@ -578,16 +682,9 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style |= WS_MAXIMIZE; data->windowed_mode_was_maximized = SDL_FALSE; } - rect.left = 0; - rect.top = 0; - rect.right = window->windowed.w; - rect.bottom = window->windowed.h; + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->windowed.x + rect.left; - y = window->windowed.y + rect.top; + WIN_AdjustWindowRectWithStyle(window, style, menu, &x, &y, &w, &h, SDL_FALSE); } SetWindowLong(hwnd, GWL_STYLE, style); data->expected_resize = SDL_TRUE; @@ -658,6 +755,9 @@ WIN_DestroyWindow(_THIS, SDL_Window * window) RemoveProp(data->hwnd, TEXT("SDL_WindowData")); if (data->created) { DestroyWindow(data->hwnd); + if (data->parent) { + DestroyWindow(data->parent); + } } else { /* Restore any original event handler... */ if (data->wndproc != NULL) { @@ -680,12 +780,22 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata; if (info->version.major <= SDL_MAJOR_VERSION) { + int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch); + info->subsystem = SDL_SYSWM_WINDOWS; info->info.win.window = data->hwnd; - info->info.win.hdc = data->hdc; + + if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) { + info->info.win.hdc = data->hdc; + } + + if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) { + info->info.win.hinstance = data->hinstance; + } + return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -763,20 +873,27 @@ SDL_HelperWindowDestroy(void) void WIN_OnWindowEnter(_THIS, SDL_Window * window) { -#ifdef WM_MOUSELEAVE SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - TRACKMOUSEEVENT trackMouseEvent; if (!data || !data->hwnd) { /* The window wasn't fully initialized */ return; } - trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); - trackMouseEvent.dwFlags = TME_LEAVE; - trackMouseEvent.hwndTrack = data->hwnd; + if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE); + } + +#ifdef WM_MOUSELEAVE + { + TRACKMOUSEEVENT trackMouseEvent; + + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE; + trackMouseEvent.hwndTrack = data->hwnd; - TrackMouseEvent(&trackMouseEvent); + TrackMouseEvent(&trackMouseEvent); + } #endif /* WM_MOUSELEAVE */ } @@ -785,8 +902,13 @@ WIN_UpdateClipCursor(SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_Mouse *mouse = SDL_GetMouse(); + RECT rect; - if (data->focus_click_pending) { + if (data->in_title_click || data->focus_click_pending) { + return; + } + if (data->skip_update_clipcursor) { + data->skip_update_clipcursor = SDL_FALSE; return; } @@ -794,7 +916,6 @@ WIN_UpdateClipCursor(SDL_Window *window) (window->flags & SDL_WINDOW_INPUT_FOCUS)) { if (mouse->relative_mode && !mouse->relative_mode_warp) { LONG cx, cy; - RECT rect; GetWindowRect(data->hwnd, &rect); cx = (rect.left + rect.right) / 2; @@ -806,17 +927,21 @@ WIN_UpdateClipCursor(SDL_Window *window) rect.top = cy - 1; rect.bottom = cy + 1; - ClipCursor(&rect); + if (ClipCursor(&rect)) { + data->cursor_clipped_rect = rect; + } } else { - RECT rect; if (GetClientRect(data->hwnd, &rect) && !IsRectEmpty(&rect)) { ClientToScreen(data->hwnd, (LPPOINT) & rect); ClientToScreen(data->hwnd, (LPPOINT) & rect + 1); - ClipCursor(&rect); + if (ClipCursor(&rect)) { + data->cursor_clipped_rect = rect; + } } } - } else { + } else if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect)) == 0) { ClipCursor(NULL); + SDL_zero(data->cursor_clipped_rect); } } @@ -826,6 +951,46 @@ WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } +int +WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + const SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + const HWND hwnd = data->hwnd; + const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); + + SDL_assert(style != 0); + + if (opacity == 1.0f) { + /* want it fully opaque, just mark it unlayered if necessary. */ + if (style & WS_EX_LAYERED) { + if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_LAYERED) == 0) { + return WIN_SetError("SetWindowLong()"); + } + } + } else { + const BYTE alpha = (BYTE) ((int) (opacity * 255.0f)); + /* want it transparent, mark it layered if necessary. */ + if ((style & WS_EX_LAYERED) == 0) { + if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) { + return WIN_SetError("SetWindowLong()"); + } + } + + if (SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == 0) { + return WIN_SetError("SetLayeredWindowAttributes()"); + } + } + + return 0; +} + +void +WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) +{ + const SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + DragAcceptFiles(data->hwnd, accept ? TRUE : FALSE); +} + #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.h b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.h index f91aa0ed2b..b738c34949 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/SDL_windowswindow.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowswindow_h -#define _SDL_windowswindow_h +#ifndef SDL_windowswindow_h_ +#define SDL_windowswindow_h_ #if SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" @@ -31,8 +31,10 @@ typedef struct { SDL_Window *window; HWND hwnd; + HWND parent; HDC hdc; HDC mdc; + HINSTANCE hinstance; HBITMAP hbm; WNDPROC wndproc; SDL_bool created; @@ -41,9 +43,11 @@ typedef struct SDL_bool expected_resize; SDL_bool in_border_change; SDL_bool in_title_click; - SDL_bool focus_click_pending; + Uint8 focus_click_pending; + SDL_bool skip_update_clipcursor; SDL_bool windowed_mode_was_maximized; SDL_bool in_window_deactivation; + RECT cursor_clipped_rect; struct SDL_VideoData *videodata; #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; @@ -56,6 +60,8 @@ extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); +extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); +extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); extern void WIN_RaiseWindow(_THIS, SDL_Window * window); @@ -63,6 +69,7 @@ extern void WIN_MaximizeWindow(_THIS, SDL_Window * window); extern void WIN_MinimizeWindow(_THIS, SDL_Window * window); extern void WIN_RestoreWindow(_THIS, SDL_Window * window); extern void WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); +extern void WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable); extern void WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); extern int WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); @@ -73,7 +80,8 @@ extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window, extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); extern void WIN_UpdateClipCursor(SDL_Window *window); extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); +extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); -#endif /* _SDL_windowswindow_h */ +#endif /* SDL_windowswindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/windows/wmmsg.h b/3rdparty/sdl2-2.0.9/src/video/windows/wmmsg.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/windows/wmmsg.h rename to 3rdparty/sdl2-2.0.9/src/video/windows/wmmsg.h index 8c1351fe92..19c1bf432c 100644 --- a/3rdparty/sdl2-2.0.4/src/video/windows/wmmsg.h +++ b/3rdparty/sdl2-2.0.9/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents.cpp similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents.cpp index e9df726d4a..370e8c514d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,7 @@ using Windows::UI::Core::CoreCursor; #include "SDL_system.h" extern "C" { +#include "../../thread/SDL_systhread.h" #include "../SDL_sysvideo.h" #include "../../events/SDL_events_c.h" } @@ -104,7 +105,7 @@ WINRT_XAMLThreadMain(void * userdata) } void -WINRT_CycleXAMLThread() +WINRT_CycleXAMLThread(void) { switch (_threadState) { case ThreadState_NotLaunched: @@ -113,7 +114,7 @@ WINRT_CycleXAMLThread() _mutex = SDL_CreateMutex(); _threadState = ThreadState_Running; - _XAMLThread = SDL_CreateThread(WINRT_XAMLThreadMain, "SDL/XAML App Thread", nullptr); + _XAMLThread = SDL_CreateThreadInternal(WINRT_XAMLThreadMain, "SDL/XAML App Thread", 0, nullptr); SDL_LockMutex(_mutex); while (_threadState != ThreadState_Yielding) { diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents_c.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents_c.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents_c.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents_c.h index dc94526bbb..8b346ec229 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtevents_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -67,8 +67,15 @@ extern void WINRT_ProcessKeyDownEvent(Windows::UI::Core::KeyEventArgs ^args); extern void WINRT_ProcessKeyUpEvent(Windows::UI::Core::KeyEventArgs ^args); extern void WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArgs ^args); +#if NTDDI_VERSION >= NTDDI_WIN10 +extern SDL_bool WINRT_HasScreenKeyboardSupport(_THIS); +extern void WINRT_ShowScreenKeyboard(_THIS, SDL_Window *window); +extern void WINRT_HideScreenKeyboard(_THIS, SDL_Window *window); +extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window); +#endif // NTDDI_VERSION >= ... + /* XAML Thread Management */ -extern void WINRT_CycleXAMLThread(); +extern void WINRT_CycleXAMLThread(void); #endif // ifdef __cplusplus_winrt diff --git a/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar.cpp new file mode 100644 index 0000000000..9617111158 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar.cpp @@ -0,0 +1,196 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WINRT + +/* Windows includes */ +#include +#include +#include + + +/* SDL includes */ +extern "C" { +#include "SDL_mouse.h" +#include "../SDL_sysvideo.h" +} +#include "SDL_winrtvideo_cpp.h" + + +/* Game Bar events can come in off the main thread. Use the following + WinRT CoreDispatcher to deal with them on SDL's thread. +*/ +static Platform::WeakReference WINRT_MainThreadDispatcher; + + +/* Win10's initial SDK (the 10.0.10240.0 release) does not include references + to Game Bar APIs, as the Game Bar was released via Win10 10.0.10586.0. + + Declare its WinRT/COM interface here, to allow compilation with earlier + Windows SDKs. +*/ +MIDL_INTERFACE("1DB9A292-CC78-4173-BE45-B61E67283EA7") +IGameBarStatics_ : public IInspectable +{ +public: + virtual HRESULT STDMETHODCALLTYPE add_VisibilityChanged( + __FIEventHandler_1_IInspectable *handler, + Windows::Foundation::EventRegistrationToken *token) = 0; + + virtual HRESULT STDMETHODCALLTYPE remove_VisibilityChanged( + Windows::Foundation::EventRegistrationToken token) = 0; + + virtual HRESULT STDMETHODCALLTYPE add_IsInputRedirectedChanged( + __FIEventHandler_1_IInspectable *handler, + Windows::Foundation::EventRegistrationToken *token) = 0; + + virtual HRESULT STDMETHODCALLTYPE remove_IsInputRedirectedChanged( + Windows::Foundation::EventRegistrationToken token) = 0; + + virtual HRESULT STDMETHODCALLTYPE get_Visible( + boolean *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE get_IsInputRedirected( + boolean *value) = 0; +}; + +/* Declare the game bar's COM GUID */ +static GUID IID_IGameBarStatics_ = { MAKELONG(0xA292, 0x1DB9), 0xCC78, 0x4173, { 0xBE, 0x45, 0xB6, 0x1E, 0x67, 0x28, 0x3E, 0xA7 } }; + +/* Retrieves a pointer to the game bar, or NULL if it is not available. + If a pointer is returned, it's ->Release() method must be called + after the caller has finished using it. +*/ +static IGameBarStatics_ * +WINRT_GetGameBar() +{ + wchar_t *wClassName = L"Windows.Gaming.UI.GameBar"; + HSTRING hClassName; + IActivationFactory *pActivationFactory = NULL; + IGameBarStatics_ *pGameBar = NULL; + HRESULT hr; + + hr = ::WindowsCreateString(wClassName, (UINT32)wcslen(wClassName), &hClassName); + if (FAILED(hr)) { + goto done; + } + + hr = Windows::Foundation::GetActivationFactory(hClassName, &pActivationFactory); + if (FAILED(hr)) { + goto done; + } + + pActivationFactory->QueryInterface(IID_IGameBarStatics_, (void **) &pGameBar); + +done: + if (pActivationFactory) { + pActivationFactory->Release(); + } + if (hClassName) { + ::WindowsDeleteString(hClassName); + } + return pGameBar; +} + +static void +WINRT_HandleGameBarIsInputRedirected_MainThread() +{ + IGameBarStatics_ *gameBar; + boolean isInputRedirected = 0; + if (!WINRT_MainThreadDispatcher) { + /* The game bar event handler has been deregistered! */ + return; + } + gameBar = WINRT_GetGameBar(); + if (!gameBar) { + /* Shouldn't happen, but just in case... */ + return; + } + if (SUCCEEDED(gameBar->get_IsInputRedirected(&isInputRedirected))) { + if ( ! isInputRedirected) { + /* Input-control is now back to the SDL app. Restore the cursor, + in case Windows does not (it does not in either Win10 + 10.0.10240.0 or 10.0.10586.0, maybe later version(s) too. + */ + SDL_Cursor *cursor = SDL_GetCursor(); + SDL_SetCursor(cursor); + } + } + gameBar->Release(); +} + +static void +WINRT_HandleGameBarIsInputRedirected_NonMainThread(Platform::Object ^ o1, Platform::Object ^o2) +{ + Windows::UI::Core::CoreDispatcher ^dispatcher = WINRT_MainThreadDispatcher.Resolve(); + if (dispatcher) { + dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler(&WINRT_HandleGameBarIsInputRedirected_MainThread)); + } +} + +void +WINRT_InitGameBar(_THIS) +{ + SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata; + IGameBarStatics_ *gameBar = WINRT_GetGameBar(); + if (gameBar) { + /* GameBar.IsInputRedirected events can come in via something other than + the main/SDL thread. + + Get a WinRT 'CoreDispatcher' that can be used to call back into the + SDL thread. + */ + WINRT_MainThreadDispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher; + Windows::Foundation::EventHandler ^handler = \ + ref new Windows::Foundation::EventHandler(&WINRT_HandleGameBarIsInputRedirected_NonMainThread); + __FIEventHandler_1_IInspectable * pHandler = reinterpret_cast<__FIEventHandler_1_IInspectable *>(handler); + gameBar->add_IsInputRedirectedChanged(pHandler, &driverdata->gameBarIsInputRedirectedToken); + gameBar->Release(); + } +} + +void +WINRT_QuitGameBar(_THIS) +{ + SDL_VideoData *driverdata; + IGameBarStatics_ *gameBar; + if (!_this || !_this->driverdata) { + return; + } + gameBar = WINRT_GetGameBar(); + if (!gameBar) { + return; + } + driverdata = (SDL_VideoData *)_this->driverdata; + if (driverdata->gameBarIsInputRedirectedToken.Value) { + gameBar->remove_IsInputRedirectedChanged(driverdata->gameBarIsInputRedirectedToken); + driverdata->gameBarIsInputRedirectedToken.Value = 0; + } + WINRT_MainThreadDispatcher = nullptr; + gameBar->Release(); +} + +#endif /* SDL_VIDEO_DRIVER_WINRT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/SDL_internal.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar_cpp.h similarity index 71% rename from 3rdparty/sdl2-2.0.4/src/SDL_internal.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar_cpp.h index 7e928501a9..a3e477798f 100644 --- a/3rdparty/sdl2-2.0.4/src/SDL_internal.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtgamebar_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,21 +18,18 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_internal_h -#define _SDL_internal_h +#include "SDL_config.h" -#include "dynapi/SDL_dynapi.h" +#ifndef SDL_winrtgamebar_h_ +#define SDL_winrtgamebar_h_ -#if SDL_DYNAMIC_API -#include "dynapi/SDL_dynapi_overrides.h" -/* force DECLSPEC and SDLCALL off...it's all internal symbols now. - These will have actual #defines during SDL_dynapi.c only */ -#define DECLSPEC -#define SDLCALL +#ifdef __cplusplus +/* These are exported as C++ functions, rather than C, to fix a compilation + bug with MSVC 2013, for Windows 8.x builds. */ +extern void WINRT_InitGameBar(_THIS); +extern void WINRT_QuitGameBar(_THIS); #endif -#include "SDL_config.h" - -#endif +#endif /* SDL_winrtgamebar_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtkeyboard.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtkeyboard.cpp similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtkeyboard.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtkeyboard.cpp index 7477cdeebf..34f2421a7e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ /* SDL-specific includes */ -#include +#include "SDL.h" #include "SDL_winrtevents_c.h" extern "C" { @@ -383,4 +383,48 @@ WINRT_ProcessCharacterReceivedEvent(Windows::UI::Core::CharacterReceivedEventArg } } + +#if NTDDI_VERSION >= NTDDI_WIN10 + +SDL_bool WINRT_HasScreenKeyboardSupport(_THIS) +{ + return SDL_TRUE; +} + +void WINRT_ShowScreenKeyboard(_THIS, SDL_Window *window) +{ + using namespace Windows::UI::ViewManagement; + InputPane ^ inputPane = InputPane::GetForCurrentView(); + if (inputPane) { + inputPane->TryShow(); + } +} + +void WINRT_HideScreenKeyboard(_THIS, SDL_Window *window) +{ + using namespace Windows::UI::ViewManagement; + InputPane ^ inputPane = InputPane::GetForCurrentView(); + if (inputPane) { + inputPane->TryHide(); + } +} + +SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window) +{ + using namespace Windows::UI::ViewManagement; + InputPane ^ inputPane = InputPane::GetForCurrentView(); + if (inputPane) { + // dludwig@pobox.com: checking inputPane->Visible doesn't seem to detect visibility, + // at least not on the Windows Phone 10.0.10240.0 emulator. Checking + // the size of inputPane->OccludedRect, however, does seem to work. + Windows::Foundation::Rect rect = inputPane->OccludedRect; + if (rect.Width > 0 && rect.Height > 0) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +#endif // NTDDI_VERSION >= ... + #endif // SDL_VIDEO_DRIVER_WINRT diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.cpp similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.cpp index ca958107c9..3576a3f1c0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.h index 4184aa5ee6..204cf4a014 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmessagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse.cpp similarity index 57% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse.cpp index d3140a4a4f..093a1b91f0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ * Windows includes: */ #include +#include using namespace Windows::UI::Core; using Windows::UI::Core::CoreCursor; @@ -116,11 +117,69 @@ WINRT_ShowCursor(SDL_Cursor * cursor) return 0; } + CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread(); if (cursor) { CoreCursor ^* theCursor = (CoreCursor ^*) cursor->driverdata; - CoreWindow::GetForCurrentThread()->PointerCursor = *theCursor; + coreWindow->PointerCursor = *theCursor; } else { - CoreWindow::GetForCurrentThread()->PointerCursor = nullptr; + // HACK ALERT: TL;DR - Hiding the cursor in WinRT/UWP apps is weird, and + // a Win32-style cursor resource file must be directly included in apps, + // otherwise hiding the cursor will cause mouse-motion data to never be + // received. + // + // Here's the lengthy explanation: + // + // There are two ways to hide a cursor in WinRT/UWP apps. + // Both involve setting the WinRT CoreWindow's (which is somewhat analogous + // to a Win32 HWND) 'PointerCursor' property. + // + // The first way to hide a cursor sets PointerCursor to nullptr. This + // is, arguably, the easiest to implement for an app. It does have an + // unfortunate side-effect: it'll prevent mouse-motion events from being + // sent to the app (via CoreWindow). + // + // The second way to hide a cursor sets PointerCursor to a transparent + // cursor. This allows mouse-motion events to be sent to the app, but is + // more difficult to set up, as: + // 1. WinRT/UWP, while providing a few stock cursors, does not provide + // a completely transparent cursor. + // 2. WinRT/UWP allows apps to provide custom-built cursors, but *ONLY* + // if they are linked directly inside the app, via Win32-style + // cursor resource files. APIs to create cursors at runtime are + // not provided to apps, and attempting to link-to or use Win32 + // cursor-creation APIs could cause an app to fail Windows Store + // certification. + // + // SDL can use either means of hiding the cursor. It provides a Win32-style + // set of cursor resource files in its source distribution, inside + // src/main/winrt/. If those files are linked to an SDL-for-WinRT/UWP app + // (by including them in a MSVC project, for example), SDL will attempt to + // use those, if and when the cursor is hidden via SDL APIs. If those + // files are not linked in, SDL will attempt to hide the cursor via the + // 'set PointerCursor to nullptr' means (which, if you recall, causes + // mouse-motion data to NOT be sent to the app!). + // + // Tech notes: + // - SDL's blank cursor resource uses a resource ID of 5000. + // - SDL's cursor resources consist of the following two files: + // - src/main/winrt/SDL2-WinRTResource_BlankCursor.cur -- cursor pixel data + // - src/main/winrt/SDL2-WinRTResources.rc -- declares the cursor resource, and its ID (of 5000) + // + + const unsigned int win32CursorResourceID = 5000; + CoreCursor ^ blankCursor = ref new CoreCursor(CoreCursorType::Custom, win32CursorResourceID); + + // Set 'PointerCursor' to 'blankCursor' in a way that shouldn't throw + // an exception if the app hasn't loaded that resource. + ABI::Windows::UI::Core::ICoreCursor * iblankCursor = reinterpret_cast(blankCursor); + ABI::Windows::UI::Core::ICoreWindow * icoreWindow = reinterpret_cast(coreWindow); + HRESULT hr = icoreWindow->put_PointerCursor(iblankCursor); + if (FAILED(hr)) { + // The app doesn't contain the cursor resource, or some other error + // occurred. Just use the other, but mouse-motion-preventing, means of + // hiding the cursor. + coreWindow->PointerCursor = nullptr; + } } return 0; } diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse_c.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse_c.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse_c.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse_c.h index 464ba4d475..22a80fc863 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtmouse_c.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtmouse_h -#define _SDL_winrtmouse_h +#ifndef SDL_winrtmouse_h_ +#define SDL_winrtmouse_h_ #ifdef __cplusplus extern "C" { @@ -35,6 +35,6 @@ extern SDL_bool WINRT_UsingRelativeMouseMode; } #endif -#endif /* _SDL_winrtmouse_h */ +#endif /* SDL_winrtmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.cpp similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.cpp index cca07fa1bc..7874501e99 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ extern "C" { #include "SDL_winrtopengles.h" #include "SDL_loadso.h" +#include "../SDL_egl_c.h" } /* Windows includes */ @@ -57,7 +58,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) { SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata; - if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY) != 0) { + if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) != 0) { return -1; } @@ -87,11 +88,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) Microsoft::WRL::ComPtr cpp_display = video_data->winrtEglWindow; _this->egl_data->egl_display = ((eglGetDisplay_Old_Function)_this->egl_data->eglGetDisplay)(cpp_display); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get Windows 8.0 EGL display"); + return SDL_EGL_SetError("Could not get Windows 8.0 EGL display", "eglGetDisplay"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize Windows 8.0 EGL"); + return SDL_EGL_SetError("Could not initialize Windows 8.0 EGL", "eglInitialize"); } } else { /* Declare some ANGLE/EGL initialization property-sets, as suggested by @@ -132,7 +133,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ eglGetPlatformDisplayEXT_Function eglGetPlatformDisplayEXT = (eglGetPlatformDisplayEXT_Function)_this->egl_data->eglGetProcAddress("eglGetPlatformDisplayEXT"); if (!eglGetPlatformDisplayEXT) { - return SDL_SetError("Could not retrieve ANGLE/WinRT display function(s)"); + return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress"); } #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) @@ -141,7 +142,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 10_0+ EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 10_0+", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) @@ -153,7 +154,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 9_3 EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 9_3", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { @@ -162,11 +163,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get WARP EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D WARP", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize WinRT 8.x+ EGL"); + return SDL_EGL_SetError("Could not initialize WinRT 8.x+ EGL", "eglInitialize"); } } } diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.h similarity index 92% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.h index 1da757b6cf..a222c2b6e4 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtopengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtopengles_h -#define _SDL_winrtopengles_h +#ifndef SDL_winrtopengles_h_ +#define SDL_winrtopengles_h_ #if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL @@ -38,7 +38,7 @@ extern int WINRT_GLES_LoadLibrary(_THIS, const char *path); extern void WINRT_GLES_UnloadLibrary(_THIS); extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); @@ -65,6 +65,6 @@ typedef EGLDisplay (EGLAPIENTRY *eglGetPlatformDisplayEXT_Function)(EGLenum, voi #endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winrtopengles_h */ +#endif /* SDL_winrtopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtpointerinput.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtpointerinput.cpp similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtpointerinput.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtpointerinput.cpp index 1d648f966f..bc438f2755 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -295,7 +295,7 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P } WINRT_LeftFingerDown = 0; } - + SDL_SendTouch( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, @@ -335,9 +335,8 @@ WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::Po return; } - // FIXME: This may need to accumulate deltas up to WHEEL_DELTA - short motion = pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; - SDL_SendMouseWheel(window, 0, 0, motion, SDL_MOUSEWHEEL_NORMAL); + float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; + SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL); } void @@ -369,7 +368,7 @@ WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::Mouse // http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ), // does not seem to indicate (to me) that its values should be so large. It // says that its values should be a "change in screen location". I could - // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: + // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: // http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ), // indicates that these values are in DIPs, which is the same unit used // by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo.cpp b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo.cpp similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo.cpp rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo.cpp index 9d7c1ccee3..99bfd07b3b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo.cpp +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ /* Windows includes */ #include #include +#include #include #include using namespace Windows::ApplicationModel::Core; @@ -41,7 +42,8 @@ using namespace Windows::UI::ViewManagement; /* [re]declare Windows GUIDs locally, to limit the amount of external lib(s) SDL has to link to */ -static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48,{ 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; +static const GUID IID_IDisplayRequest = { 0xe5732044, 0xf49f, 0x4b60, { 0x8d, 0xd4, 0x5e, 0x7e, 0x3a, 0x63, 0x2a, 0xc0 } }; +static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; /* SDL includes */ @@ -61,6 +63,7 @@ extern "C" { #include "../../core/winrt/SDL_winrtapp_xaml.h" #include "SDL_winrtvideo_cpp.h" #include "SDL_winrtevents_c.h" +#include "SDL_winrtgamebar_cpp.h" #include "SDL_winrtmouse_c.h" #include "SDL_main.h" #include "SDL_system.h" @@ -82,6 +85,11 @@ static void WINRT_DestroyWindow(_THIS, SDL_Window * window); static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); +/* Misc functions */ +static ABI::Windows::System::Display::IDisplayRequest * WINRT_CreateDisplayRequest(_THIS); +extern void WINRT_SuspendScreenSaver(_THIS); + + /* SDL-internal globals: */ SDL_Window * WINRT_GlobalSDLWindow = NULL; @@ -118,30 +126,36 @@ WINRT_CreateDevice(int devindex) device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) { SDL_OutOfMemory(); - if (device) { - SDL_free(device); - } return (0); } data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); if (!data) { SDL_OutOfMemory(); + SDL_free(device); return (0); } - SDL_zerop(data); device->driverdata = data; /* Set the function pointers */ device->VideoInit = WINRT_VideoInit; device->VideoQuit = WINRT_VideoQuit; - device->CreateWindow = WINRT_CreateWindow; + device->CreateSDLWindow = WINRT_CreateWindow; device->SetWindowSize = WINRT_SetWindowSize; device->SetWindowFullscreen = WINRT_SetWindowFullscreen; device->DestroyWindow = WINRT_DestroyWindow; device->SetDisplayMode = WINRT_SetDisplayMode; device->PumpEvents = WINRT_PumpEvents; device->GetWindowWMInfo = WINRT_GetWindowWMInfo; + device->SuspendScreenSaver = WINRT_SuspendScreenSaver; + +#if NTDDI_VERSION >= NTDDI_WIN10 + device->HasScreenKeyboardSupport = WINRT_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = WINRT_ShowScreenKeyboard; + device->HideScreenKeyboard = WINRT_HideScreenKeyboard; + device->IsScreenKeyboardShown = WINRT_IsScreenKeyboardShown; +#endif + #ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = WINRT_GLES_LoadLibrary; device->GL_GetProcAddress = WINRT_GLES_GetProcAddress; @@ -167,12 +181,17 @@ VideoBootStrap WINRT_bootstrap = { int WINRT_VideoInit(_THIS) { + SDL_VideoData * driverdata = (SDL_VideoData *) _this->driverdata; if (WINRT_InitModes(_this) < 0) { return -1; } WINRT_InitMouse(_this); WINRT_InitTouch(_this); - + WINRT_InitGameBar(_this); + if (driverdata) { + /* Initialize screensaver-disabling support */ + driverdata->displayRequest = WINRT_CreateDisplayRequest(_this); + } return 0; } @@ -414,6 +433,12 @@ WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) void WINRT_VideoQuit(_THIS) { + SDL_VideoData * driverdata = (SDL_VideoData *) _this->driverdata; + if (driverdata && driverdata->displayRequest) { + driverdata->displayRequest->Release(); + driverdata->displayRequest = NULL; + } + WINRT_QuitGameBar(_this); WINRT_QuitMouse(_this); } @@ -483,7 +508,7 @@ WINRT_DetectWindowFlags(SDL_Window * window) // data->coreWindow->PointerPosition is not supported on WinPhone 8.0 latestFlags |= SDL_WINDOW_MOUSE_FOCUS; #else - if (data->coreWindow->Bounds.Contains(data->coreWindow->PointerPosition)) { + if (data->coreWindow->Visible && data->coreWindow->Bounds.Contains(data->coreWindow->PointerPosition)) { latestFlags |= SDL_WINDOW_MOUSE_FOCUS; } #endif @@ -596,7 +621,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) _this->egl_data->egl_config, cpp_winrtEglWindow, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else if (data->coreWindow.Get() != nullptr) { /* Attempt to create a window surface using newer versions of @@ -609,7 +634,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) coreWindowAsIInspectable, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else { return SDL_SetError("No supported means to create an EGL window surface are available"); @@ -746,13 +771,72 @@ WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.winrt.window = reinterpret_cast(data->coreWindow.Get()); return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } return SDL_FALSE; } +static ABI::Windows::System::Display::IDisplayRequest * +WINRT_CreateDisplayRequest(_THIS) +{ + /* Setup a WinRT DisplayRequest object, usable for enabling/disabling screensaver requests */ + wchar_t *wClassName = L"Windows.System.Display.DisplayRequest"; + HSTRING hClassName; + IActivationFactory *pActivationFactory = NULL; + IInspectable * pDisplayRequestRaw = nullptr; + ABI::Windows::System::Display::IDisplayRequest * pDisplayRequest = nullptr; + HRESULT hr; + + hr = ::WindowsCreateString(wClassName, (UINT32)wcslen(wClassName), &hClassName); + if (FAILED(hr)) { + goto done; + } + + hr = Windows::Foundation::GetActivationFactory(hClassName, &pActivationFactory); + if (FAILED(hr)) { + goto done; + } + + hr = pActivationFactory->ActivateInstance(&pDisplayRequestRaw); + if (FAILED(hr)) { + goto done; + } + + hr = pDisplayRequestRaw->QueryInterface(IID_IDisplayRequest, (void **) &pDisplayRequest); + if (FAILED(hr)) { + goto done; + } + +done: + if (pDisplayRequestRaw) { + pDisplayRequestRaw->Release(); + } + if (pActivationFactory) { + pActivationFactory->Release(); + } + if (hClassName) { + ::WindowsDeleteString(hClassName); + } + + return pDisplayRequest; +} + +void +WINRT_SuspendScreenSaver(_THIS) +{ + SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata; + if (driverdata && driverdata->displayRequest) { + ABI::Windows::System::Display::IDisplayRequest * displayRequest = (ABI::Windows::System::Display::IDisplayRequest *) driverdata->displayRequest; + if (_this->suspend_screensaver) { + displayRequest->RequestActive(); + } else { + displayRequest->RequestRelease(); + } + } +} + #endif /* SDL_VIDEO_DRIVER_WINRT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo_cpp.h b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo_cpp.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo_cpp.h rename to 3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo_cpp.h index 26eb008d4d..91e967e0db 100644 --- a/3rdparty/sdl2-2.0.4/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/3rdparty/sdl2-2.0.9/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,17 @@ typedef struct SDL_VideoData { * passed to eglGetDisplay and eglCreateWindowSurface: */ IUnknown *winrtEglWindow; + + /* Event token(s), for unregistering WinRT event handler(s). + These are just a struct with a 64-bit integer inside them + */ + Windows::Foundation::EventRegistrationToken gameBarIsInputRedirectedToken; + + /* A WinRT DisplayRequest, used for implementing SDL_*ScreenSaver() functions. + * This is really a pointer to a 'ABI::Windows::System::Display::IDisplayRequest *', + * It's casted to 'IUnknown *', to help with building SDL. + */ + IUnknown *displayRequest; } SDL_VideoData; /* The global, WinRT, SDL Window. diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.c index 34c0a71c69..fad8c9cbfd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,13 +40,23 @@ static Window GetWindow(_THIS) { - SDL_Window *window; - - window = _this->windows; - if (window) { - return ((SDL_WindowData *) window->driverdata)->xwindow; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + + /* We create an unmapped window that exists just to manage the clipboard, + since X11 selection data is tied to a specific window and dies with it. + We create the window on demand, so apps that don't use the clipboard + don't have to keep an unnecessary resource around. */ + if (data->clipboard_window == None) { + Display *dpy = data->display; + Window parent = RootWindow(dpy, DefaultScreen(dpy)); + XSetWindowAttributes xattr; + data->clipboard_window = X11_XCreateWindow(dpy, parent, -10, -10, 1, 1, 0, + CopyFromParent, InputOnly, + CopyFromParent, 0, &xattr); + X11_XFlush(data->display); } - return None; + + return data->clipboard_window; } /* We use our own cut-buffer for intermediate storage instead of diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.h index 15dae7dfdc..97aff1b731 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11clipboard_h -#define _SDL_x11clipboard_h +#ifndef SDL_x11clipboard_h_ +#define SDL_x11clipboard_h_ extern int X11_SetClipboardText(_THIS, const char *text); extern char *X11_GetClipboardText(_THIS); extern SDL_bool X11_HasClipboardText(_THIS); extern Atom X11_GetSDLCutBufferClipboardType(Display *display); -#endif /* _SDL_x11clipboard_h */ +#endif /* SDL_x11clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.c index 7cbfa3e97d..89f736acf0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -106,11 +106,8 @@ X11_GetSym(const char *fnname, int *pHasModule) #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ /* Define all the function pointers and wrappers... */ -#define SDL_X11_MODULE(modname) #define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING @@ -120,10 +117,7 @@ SDL_DYNX11FN_XGetICValues X11_XGetICValues = NULL; /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0; -#define SDL_X11_SYM(rc,fn,params,args,ret) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM static int x11_load_refcount = 0; @@ -139,8 +133,6 @@ SDL_X11_UnloadSymbols(void) #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0; #define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = NULL; @@ -177,16 +169,11 @@ SDL_X11_LoadSymbols(void) } #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ -#define SDL_X11_SYM(a,fn,x,y,z) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod); #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = (SDL_DYNX11FN_XCreateIC) @@ -209,8 +196,6 @@ SDL_X11_LoadSymbols(void) #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = XCreateIC; diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.h similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.h index 136609b857..d3866e70c2 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11dyn_h -#define _SDL_x11dyn_h +#ifndef SDL_x11dyn_h_ +#define SDL_x11dyn_h_ #include #include @@ -86,13 +86,10 @@ int SDL_X11_LoadSymbols(void); void SDL_X11_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ -#define SDL_X11_MODULE(modname) #define SDL_X11_SYM(rc,fn,params,args,ret) \ typedef rc (*SDL_DYNX11FN_##fn) params; \ extern SDL_DYNX11FN_##fn X11_##fn; #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING @@ -104,14 +101,11 @@ extern SDL_DYNX11FN_XGetICValues X11_XGetICValues; /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname; -#define SDL_X11_SYM(rc,fn,params,args,ret) #include "SDL_x11sym.h" -#undef SDL_X11_MODULE -#undef SDL_X11_SYM #ifdef __cplusplus } #endif -#endif /* !defined _SDL_x11dyn_h */ +#endif /* !defined SDL_x11dyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.c similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.c index 208009607f..d293a5efca 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,15 @@ #include "SDL_x11video.h" #include "SDL_x11touch.h" #include "SDL_x11xinput2.h" +#include "../../core/unix/SDL_poll.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" +#include "SDL_hints.h" #include "SDL_timer.h" #include "SDL_syswm.h" +#include "SDL_assert.h" #include @@ -117,7 +120,9 @@ static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) int i; for (i=0; i < list_count && request == None; i++) { name = X11_XGetAtomName(disp, list[i]); - if (strcmp("text/uri-list", name)==0) request = list[i]; + if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) { + request = list[i]; + } X11_XFree(name); } return request; @@ -198,7 +203,7 @@ X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks) On error, -1 is returned. */ -int X11_URIDecode(char *buf, int len) { +static int X11_URIDecode(char *buf, int len) { int ri, wi, di; char decode = '\0'; if (buf == NULL || len < 0) { @@ -298,10 +303,10 @@ static char* X11_URIToLocal(char* uri) { } #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS -static void X11_HandleGenericEvent(SDL_VideoData *videodata,XEvent event) +static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) { /* event is a union, so cookie == &event, but this is type safe. */ - XGenericEventCookie *cookie = &event.xcookie; + XGenericEventCookie *cookie = &xev->xcookie; if (X11_XGetEventData(videodata->display, cookie)) { X11_HandleXinput2Event(videodata, cookie); X11_XFreeEventData(videodata->display, cookie); @@ -345,6 +350,7 @@ X11_ReconcileKeyboardState(_THIS) Window junk_window; int x, y; unsigned int mask; + const Uint8 *keyboardState; X11_XQueryKeymap(display, keys); @@ -354,11 +360,16 @@ X11_ReconcileKeyboardState(_THIS) SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0); } + keyboardState = SDL_GetKeyboardState(0); for (keycode = 0; keycode < 256; ++keycode) { - if (keys[keycode / 8] & (1 << (keycode % 8))) { - SDL_SendKeyboardKey(SDL_PRESSED, viddata->key_layout[keycode]); - } else { - SDL_SendKeyboardKey(SDL_RELEASED, viddata->key_layout[keycode]); + SDL_Scancode scancode = viddata->key_layout[keycode]; + SDL_bool x11KeyPressed = (keys[keycode / 8] & (1 << (keycode % 8))) != 0; + SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; + + if (x11KeyPressed && !sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else if (!x11KeyPressed && sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } } @@ -377,8 +388,8 @@ X11_DispatchFocusIn(_THIS, SDL_WindowData *data) X11_XSetICFocus(data->ic); } #endif -#ifdef SDL_USE_IBUS - SDL_IBus_SetFocus(SDL_TRUE); +#ifdef SDL_USE_IME + SDL_IME_SetFocus(SDL_TRUE); #endif } @@ -400,8 +411,8 @@ X11_DispatchFocusOut(_THIS, SDL_WindowData *data) X11_XUnsetICFocus(data->ic); } #endif -#ifdef SDL_USE_IBUS - SDL_IBus_SetFocus(SDL_FALSE); +#ifdef SDL_USE_IME + SDL_IME_SetFocus(SDL_FALSE); #endif } @@ -513,10 +524,116 @@ ProcessHitTest(_THIS, const SDL_WindowData *data, const XEvent *xev) } static void -X11_DispatchEvent(_THIS) +X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) +{ + if (latest && (latest != data->user_time)) { + SDL_VideoData *videodata = data->videodata; + Display *display = videodata->display; + X11_XChangeProperty(display, data->xwindow, videodata->_NET_WM_USER_TIME, + XA_CARDINAL, 32, PropModeReplace, + (const unsigned char *) &latest, 1); +#ifdef DEBUG_XEVENTS + printf("window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest); +#endif + data->user_time = latest; + } +} + +static void +X11_HandleClipboardEvent(_THIS, const XEvent *xevent) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; + + SDL_assert(videodata->clipboard_window != None); + SDL_assert(xevent->xany.window == videodata->clipboard_window); + + switch (xevent->type) { + /* Copy the selection from our own CUTBUFFER to the requested property */ + case SelectionRequest: { + const XSelectionRequestEvent *req = &xevent->xselectionrequest; + XEvent sevent; + int seln_format; + unsigned long nbytes; + unsigned long overflow; + unsigned char *seln_data; + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld)\n", + req->requestor, req->target); +#endif + + SDL_zero(sevent); + sevent.xany.type = SelectionNotify; + sevent.xselection.selection = req->selection; + sevent.xselection.target = None; + sevent.xselection.property = None; /* tell them no by default */ + sevent.xselection.requestor = req->requestor; + sevent.xselection.time = req->time; + + /* !!! FIXME: We were probably storing this on the root window + because an SDL window might go away...? but we don't have to do + this now (or ever, really). */ + if (X11_XGetWindowProperty(display, DefaultRootWindow(display), + X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, + &sevent.xselection.target, &seln_format, &nbytes, + &overflow, &seln_data) == Success) { + /* !!! FIXME: cache atoms */ + Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); + if (sevent.xselection.target == req->target) { + X11_XChangeProperty(display, req->requestor, req->property, + sevent.xselection.target, seln_format, PropModeReplace, + seln_data, nbytes); + sevent.xselection.property = req->property; + } else if (XA_TARGETS == req->target) { + Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; + X11_XChangeProperty(display, req->requestor, req->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char*)SupportedFormats, + SDL_arraysize(SupportedFormats)); + sevent.xselection.property = req->property; + sevent.xselection.target = XA_TARGETS; + } + X11_XFree(seln_data); + } + X11_XSendEvent(display, req->requestor, False, 0, &sevent); + X11_XSync(display, False); + } + break; + + case SelectionNotify: { +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionNotify (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + videodata->selection_waiting = SDL_FALSE; + } + break; + + case SelectionClear: { + /* !!! FIXME: cache atoms */ + Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionClear (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + + if (xevent->xselectionclear.selection == XA_PRIMARY || + (XA_CLIPBOARD != None && xevent->xselectionclear.selection == XA_CLIPBOARD)) { + SDL_SendClipboardUpdate(); + } + } + break; + } +} + + +static void +X11_DispatchEvent(_THIS) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + Display *display; SDL_WindowData *data; XEvent xevent; int orig_event_type; @@ -524,6 +641,11 @@ X11_DispatchEvent(_THIS) XClientMessageEvent m; int i; + if (!videodata) { + return; + } + display = videodata->display; + SDL_zero(xevent); /* valgrind fix. --ryan. */ X11_XNextEvent(display, &xevent); @@ -543,17 +665,21 @@ X11_DispatchEvent(_THIS) printf("Filtered event type = %d display = %d window = %d\n", xevent.type, xevent.xany.display, xevent.xany.window); #endif + /* Make sure dead key press/release events are sent */ + /* But only if we're using one of the DBus IMEs, otherwise + some XIM IMEs will generate duplicate events */ if (orig_keycode) { - /* Make sure dead key press/release events are sent */ - /* Actually, don't do this because it causes double-delivery - of some keys on Ubuntu 14.04 (bug 2526) +#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) SDL_Scancode scancode = videodata->key_layout[orig_keycode]; + videodata->filter_code = orig_keycode; + videodata->filter_time = xevent.xkey.time; + if (orig_event_type == KeyPress) { SDL_SendKeyboardKey(SDL_PRESSED, scancode); } else { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } - */ +#endif } return; } @@ -570,7 +696,7 @@ X11_DispatchEvent(_THIS) #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS if(xevent.type == GenericEvent) { - X11_HandleGenericEvent(videodata,xevent); + X11_HandleGenericEvent(videodata, &xevent); return; } #endif @@ -580,6 +706,12 @@ X11_DispatchEvent(_THIS) xevent.type, xevent.xany.display, xevent.xany.window); #endif + if ((videodata->clipboard_window != None) && + (videodata->clipboard_window == xevent.xany.window)) { + X11_HandleClipboardEvent(_this, &xevent); + return; + } + data = NULL; if (videodata && videodata->windowlist) { for (i = 0; i < videodata->numwindows; ++i) { @@ -617,6 +749,7 @@ X11_DispatchEvent(_THIS) /* Gaining mouse coverage? */ case EnterNotify:{ + SDL_Mouse *mouse = SDL_GetMouse(); #ifdef DEBUG_XEVENTS printf("window %p: EnterNotify! (%d,%d,%d)\n", data, xevent.xcrossing.x, @@ -629,7 +762,10 @@ X11_DispatchEvent(_THIS) #endif SDL_SetMouseFocus(data->window); - if (!SDL_GetMouse()->relative_mode) { + mouse->last_x = xevent.xcrossing.x; + mouse->last_y = xevent.xcrossing.y; + + if (!mouse->relative_mode) { SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y); } } @@ -688,6 +824,7 @@ X11_DispatchEvent(_THIS) data->pending_focus = PENDING_FOCUS_IN; data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME; } + data->last_focus_event_time = SDL_GetTicks(); } break; @@ -739,13 +876,9 @@ X11_DispatchEvent(_THIS) if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) { int min_keycode, max_keycode; X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM - keysym = X11_XkbKeycodeToKeysym(display, keycode, 0, 0); -#else - keysym = X11_XKeycodeToKeysym(display, keycode, 0); -#endif + keysym = X11_KeyCodeToSym(_this, keycode, xevent.xkey.state >> 13); fprintf(stderr, - "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", + "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", keycode, keycode - min_keycode, keysym, X11_XKeysymToString(keysym)); } @@ -756,23 +889,29 @@ X11_DispatchEvent(_THIS) if (data->ic) { X11_Xutf8LookupString(data->ic, &xevent.xkey, text, sizeof(text), &keysym, &status); + } else { + X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL); } #else X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL); #endif -#ifdef SDL_USE_IBUS +#ifdef SDL_USE_IME if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ - handled_by_ime = SDL_IBus_ProcessKeyEvent(keysym, keycode); + handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode); } #endif if (!handled_by_ime) { - SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ + if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) { + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + } if(*text) { SDL_SendKeyboardText(text); } } + X11_UpdateUserTime(data, xevent.xkey.time); } break; @@ -816,36 +955,28 @@ X11_DispatchEvent(_THIS) xevent.xconfigure.x, xevent.xconfigure.y, xevent.xconfigure.width, xevent.xconfigure.height); #endif - long border_left = 0; - long border_top = 0; - if (data->xwindow) { - Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); - Atom type; - int format; - unsigned long nitems, bytes_after; - unsigned char *property; - if (X11_XGetWindowProperty(display, data->xwindow, - _net_frame_extents, 0, 16, 0, - XA_CARDINAL, &type, &format, - &nitems, &bytes_after, &property) == Success) { - if (type != None && nitems == 4) - { - border_left = ((long*)property)[0]; - border_top = ((long*)property)[2]; - } - X11_XFree(property); - } + /* Real configure notify events are relative to the parent, synthetic events are absolute. */ + if (!xevent.xconfigure.send_event) { + unsigned int NumChildren; + Window ChildReturn, Root, Parent; + Window * Children; + /* Translate these coodinates back to relative to root */ + X11_XQueryTree(data->videodata->display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren); + X11_XTranslateCoordinates(xevent.xconfigure.display, + Parent, DefaultRootWindow(xevent.xconfigure.display), + xevent.xconfigure.x, xevent.xconfigure.y, + &xevent.xconfigure.x, &xevent.xconfigure.y, + &ChildReturn); } - + if (xevent.xconfigure.x != data->last_xconfigure.x || xevent.xconfigure.y != data->last_xconfigure.y) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, - xevent.xconfigure.x - border_left, - xevent.xconfigure.y - border_top); -#ifdef SDL_USE_IBUS + xevent.xconfigure.x, xevent.xconfigure.y); +#ifdef SDL_USE_IME if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ - /* Update IBus candidate list position */ - SDL_IBus_UpdateTextRect(NULL); + /* Update IME candidate list position */ + SDL_IME_UpdateTextRect(NULL); } #endif } @@ -874,7 +1005,7 @@ X11_DispatchEvent(_THIS) printf("Protocol version to use : %d\n", xdnd_version); printf("More then 3 data types : %d\n", (int) use_list); #endif - + if (use_list) { /* fetch conversion targets */ SDL_x11Prop p; @@ -888,7 +1019,7 @@ X11_DispatchEvent(_THIS) } } else if (xevent.xclient.message_type == videodata->XdndPosition) { - + #ifdef DEBUG_XEVENTS Atom act= videodata->XdndActionCopy; if(xdnd_version >= 2) { @@ -896,7 +1027,7 @@ X11_DispatchEvent(_THIS) } printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act)); #endif - + /* reply with status */ memset(&m, 0, sizeof(XClientMessageEvent)); @@ -959,6 +1090,16 @@ X11_DispatchEvent(_THIS) SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; } + else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && + (xevent.xclient.format == 32) && + (xevent.xclient.data.l[0] == videodata->WM_TAKE_FOCUS)) { + +#ifdef DEBUG_XEVENTS + printf("window %p: WM_TAKE_FOCUS\n", data); +#endif + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0); + break; + } } break; @@ -975,7 +1116,7 @@ X11_DispatchEvent(_THIS) SDL_Mouse *mouse = SDL_GetMouse(); if(!mouse->relative_mode || mouse->relative_mode_warp) { #ifdef DEBUG_MOTION - printf("window %p: X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); + printf("window %p: X11 motion: %d,%d\n", data, xevent.xmotion.x, xevent.xmotion.y); #endif SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y); @@ -985,12 +1126,17 @@ X11_DispatchEvent(_THIS) case ButtonPress:{ int xticks = 0, yticks = 0; +#ifdef DEBUG_XEVENTS + printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button); +#endif if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { - SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL); } else { + SDL_bool ignore_click = SDL_FALSE; int button = xevent.xbutton.button; if(button == Button1) { if (ProcessHitTest(_this, data, &xevent)) { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); break; /* don't pass this event on to app. */ } } @@ -999,8 +1145,18 @@ X11_DispatchEvent(_THIS) => subtract (8-SDL_BUTTON_X1) to get value SDL expects */ button -= (8-SDL_BUTTON_X1); } - SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button); + if (data->last_focus_event_time) { + const int X11_FOCUS_CLICK_TIMEOUT = 10; + if (!SDL_TICKS_PASSED(SDL_GetTicks(), data->last_focus_event_time + X11_FOCUS_CLICK_TIMEOUT)) { + ignore_click = !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); + } + data->last_focus_event_time = 0; + } + if (!ignore_click) { + SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button); + } } + X11_UpdateUserTime(data, xevent.xbutton.time); } break; @@ -1008,7 +1164,10 @@ X11_DispatchEvent(_THIS) int button = xevent.xbutton.button; /* The X server sends a Release event for each Press for wheels. Ignore them. */ int xticks = 0, yticks = 0; - if (!X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { +#ifdef DEBUG_XEVENTS + printf("window %p: ButtonRelease (X11 button = %d)\n", data, xevent.xbutton.button); +#endif + if (!X11_IsWheelEvent(display, &xevent, &xticks, &yticks)) { if (button > 7) { /* see explanation at case ButtonPress */ button -= (8-SDL_BUTTON_X1); @@ -1027,7 +1186,7 @@ X11_DispatchEvent(_THIS) char *name = X11_XGetAtomName(display, xevent.xproperty.atom); if (name) { - printf("window %p: PropertyNotify: %s %s\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed"); + printf("window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent.xproperty.time); X11_XFree(name); } @@ -1095,6 +1254,17 @@ X11_DispatchEvent(_THIS) } #endif /* DEBUG_XEVENTS */ + /* Take advantage of this moment to make sure user_time has a + valid timestamp from the X server, so if we later try to + raise/restore this window, _NET_ACTIVE_WINDOW can have a + non-zero timestamp, even if there's never been a mouse or + key press to this window so far. Note that we don't try to + set _NET_WM_USER_TIME here, though. That's only for legit + user interaction with the window. */ + if (!data->user_time) { + data->user_time = xevent.xproperty.time; + } + if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) { /* Get the new state from the window manager. Compositing window managers can alter visibility of windows @@ -1128,105 +1298,56 @@ X11_DispatchEvent(_THIS) right approach, but it seems to work. */ X11_UpdateKeymap(_this); SDL_SendKeymapChangedEvent(); - } - } - break; - - /* Copy the selection from our own CUTBUFFER to the requested property */ - case SelectionRequest: { - XSelectionRequestEvent *req; - XEvent sevent; - int seln_format; - unsigned long nbytes; - unsigned long overflow; - unsigned char *seln_data; - - req = &xevent.xselectionrequest; -#ifdef DEBUG_XEVENTS - printf("window %p: SelectionRequest (requestor = %ld, target = %ld)\n", data, - req->requestor, req->target); -#endif - - SDL_zero(sevent); - sevent.xany.type = SelectionNotify; - sevent.xselection.selection = req->selection; - sevent.xselection.target = None; - sevent.xselection.property = None; - sevent.xselection.requestor = req->requestor; - sevent.xselection.time = req->time; + } else if (xevent.xproperty.atom == videodata->_NET_FRAME_EXTENTS) { + Atom type; + int format; + unsigned long nitems, bytes_after; + unsigned char *property; + if (X11_XGetWindowProperty(display, data->xwindow, videodata->_NET_FRAME_EXTENTS, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property) == Success) { + if (type != None && nitems == 4) { + data->border_left = (int) ((long*)property)[0]; + data->border_right = (int) ((long*)property)[1]; + data->border_top = (int) ((long*)property)[2]; + data->border_bottom = (int) ((long*)property)[3]; + } + X11_XFree(property); - if (X11_XGetWindowProperty(display, DefaultRootWindow(display), - X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, - &sevent.xselection.target, &seln_format, &nbytes, - &overflow, &seln_data) == Success) { - Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); - if (sevent.xselection.target == req->target) { - X11_XChangeProperty(display, req->requestor, req->property, - sevent.xselection.target, seln_format, PropModeReplace, - seln_data, nbytes); - sevent.xselection.property = req->property; - } else if (XA_TARGETS == req->target) { - Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; - X11_XChangeProperty(display, req->requestor, req->property, - XA_ATOM, 32, PropModeReplace, - (unsigned char*)SupportedFormats, - SDL_arraysize(SupportedFormats)); - sevent.xselection.property = req->property; - sevent.xselection.target = XA_TARGETS; + #ifdef DEBUG_XEVENTS + printf("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); + #endif } - X11_XFree(seln_data); } - X11_XSendEvent(display, req->requestor, False, 0, &sevent); - X11_XSync(display, False); } break; case SelectionNotify: { + Atom target = xevent.xselection.target; #ifdef DEBUG_XEVENTS printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, xevent.xselection.requestor, xevent.xselection.target); #endif - Atom target = xevent.xselection.target; if (target == data->xdnd_req) { /* read data */ SDL_x11Prop p; X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY); if (p.format == 8) { - SDL_bool expect_lf = SDL_FALSE; - char *start = NULL; - char *scan = (char*)p.data; - char *fn; - char *uri; - int length = 0; - while (p.count--) { - if (!expect_lf) { - if (*scan == 0x0D) { - expect_lf = SDL_TRUE; - } - if (start == NULL) { - start = scan; - length = 0; - } - length++; - } else { - if (*scan == 0x0A && length > 0) { - uri = SDL_malloc(length--); - SDL_memcpy(uri, start, length); - uri[length] = '\0'; - fn = X11_URIToLocal(uri); - if (fn) { - SDL_SendDropFile(fn); - } - SDL_free(uri); + /* !!! FIXME: don't use strtok here. It's not reentrant and not in SDL_stdinc. */ + char* name = X11_XGetAtomName(display, target); + char *token = strtok((char *) p.data, "\r\n"); + while (token != NULL) { + if (SDL_strcmp("text/plain", name)==0) { + SDL_SendDropText(data->window, token); + } else if (SDL_strcmp("text/uri-list", name)==0) { + char *fn = X11_URIToLocal(token); + if (fn) { + SDL_SendDropFile(data->window, fn); } - expect_lf = SDL_FALSE; - start = NULL; } - scan++; + token = strtok(NULL, "\r\n"); } + SDL_SendDropComplete(data->window); } - X11_XFree(p.data); /* send reply */ @@ -1242,19 +1363,6 @@ X11_DispatchEvent(_THIS) X11_XSendEvent(display, data->xdnd_source, False, NoEventMask, (XEvent*)&m); X11_XSync(display, False); - - } else { - videodata->selection_waiting = SDL_FALSE; - } - } - break; - - case SelectionClear: { - Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); - - if (xevent.xselectionclear.selection == XA_PRIMARY || - (XA_CLIPBOARD != None && xevent.xselectionclear.selection == XA_CLIPBOARD)) { - SDL_SendClipboardUpdate(); } } break; @@ -1302,17 +1410,8 @@ X11_Pending(Display * display) } /* More drastic measures are required -- see if X is ready to talk */ - { - static struct timeval zero_time; /* static == 0 */ - int x11_fd; - fd_set fdset; - - x11_fd = ConnectionNumber(display); - FD_ZERO(&fdset); - FD_SET(x11_fd, &fdset); - if (select(x11_fd + 1, &fdset, NULL, NULL, &zero_time) == 1) { - return (X11_XPending(display)); - } + if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, 0)) { + return (X11_XPending(display)); } /* Oh well, nothing is ready .. */ @@ -1350,9 +1449,9 @@ X11_PumpEvents(_THIS) X11_DispatchEvent(_this); } -#ifdef SDL_USE_IBUS +#ifdef SDL_USE_IME if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ - SDL_IBus_PumpEvents(); + SDL_IME_PumpEvents(); } #endif diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.h index 024fca3f45..53c69a5a14 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11events_h -#define _SDL_x11events_h +#ifndef SDL_x11events_h_ +#define SDL_x11events_h_ extern void X11_PumpEvents(_THIS); extern void X11_SuspendScreenSaver(_THIS); -#endif /* _SDL_x11events_h */ +#endif /* SDL_x11events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.c index a4886169fd..ad58170bca 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,7 +97,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, shm_error = False; X_handler = X11_XSetErrorHandler(shm_errhandler); X11_XShmAttach(display, shminfo); - X11_XSync(display, True); + X11_XSync(display, False); X11_XSetErrorHandler(X_handler); if ( shm_error ) shmdt(shminfo->shmaddr); diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.h similarity index 89% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.h index 7326e7da96..6a3178869b 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,6 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_x11framebuffer_h_ +#define SDL_x11framebuffer_h_ + #include "../../SDL_internal.h" @@ -28,4 +32,6 @@ extern int X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window); +#endif /* SDL_x11framebuffer_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.c similarity index 65% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.c index 2c3acdadd0..a57adf9bbf 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,10 @@ #include "imKStoUCS.h" +#ifdef X_HAVE_UTF8_STRING +#include +#endif + /* *INDENT-OFF* */ static const struct { KeySym keysym; @@ -129,9 +133,21 @@ static const struct { { XK_Control_R, SDL_SCANCODE_RCTRL }, { XK_Shift_R, SDL_SCANCODE_RSHIFT }, { XK_Alt_R, SDL_SCANCODE_RALT }, + { XK_ISO_Level3_Shift, SDL_SCANCODE_RALT }, { XK_Meta_R, SDL_SCANCODE_RGUI }, { XK_Super_R, SDL_SCANCODE_RGUI }, { XK_Mode_switch, SDL_SCANCODE_MODE }, + { XK_period, SDL_SCANCODE_PERIOD }, + { XK_comma, SDL_SCANCODE_COMMA }, + { XK_slash, SDL_SCANCODE_SLASH }, + { XK_backslash, SDL_SCANCODE_BACKSLASH }, + { XK_minus, SDL_SCANCODE_MINUS }, + { XK_equal, SDL_SCANCODE_EQUALS }, + { XK_space, SDL_SCANCODE_SPACE }, + { XK_grave, SDL_SCANCODE_GRAVE }, + { XK_apostrophe, SDL_SCANCODE_APOSTROPHE }, + { XK_bracketleft, SDL_SCANCODE_LEFTBRACKET }, + { XK_bracketright, SDL_SCANCODE_RIGHTBRACKET }, }; static const struct @@ -142,31 +158,34 @@ static const struct { darwin_scancode_table, SDL_arraysize(darwin_scancode_table) }, { xfree86_scancode_table, SDL_arraysize(xfree86_scancode_table) }, { xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) }, + { xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) }, }; /* *INDENT-OFF* */ /* This function only works for keyboards in US QWERTY layout */ static SDL_Scancode -X11_KeyCodeToSDLScancode(Display *display, KeyCode keycode) +X11_KeyCodeToSDLScancode(_THIS, KeyCode keycode) { KeySym keysym; int i; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM - keysym = X11_XkbKeycodeToKeysym(display, keycode, 0, 0); -#else - keysym = X11_XKeycodeToKeysym(display, keycode, 0); -#endif + keysym = X11_KeyCodeToSym(_this, keycode, 0); if (keysym == NoSymbol) { return SDL_SCANCODE_UNKNOWN; } + if (keysym >= XK_a && keysym <= XK_z) { + return SDL_SCANCODE_A + (keysym - XK_a); + } if (keysym >= XK_A && keysym <= XK_Z) { return SDL_SCANCODE_A + (keysym - XK_A); } - if (keysym >= XK_0 && keysym <= XK_9) { - return SDL_SCANCODE_0 + (keysym - XK_0); + if (keysym == XK_0) { + return SDL_SCANCODE_0; + } + if (keysym >= XK_1 && keysym <= XK_9) { + return SDL_SCANCODE_1 + (keysym - XK_1); } for (i = 0; i < SDL_arraysize(KeySymToSDLScancode); ++i) { @@ -178,15 +197,10 @@ X11_KeyCodeToSDLScancode(Display *display, KeyCode keycode) } static Uint32 -X11_KeyCodeToUcs4(Display *display, KeyCode keycode, unsigned char group) +X11_KeyCodeToUcs4(_THIS, KeyCode keycode, unsigned char group) { - KeySym keysym; + KeySym keysym = X11_KeyCodeToSym(_this, keycode, group); -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM - keysym = X11_XkbKeycodeToKeysym(display, keycode, group, 0); -#else - keysym = X11_XKeycodeToKeysym(display, keycode, 0); -#endif if (keysym == NoSymbol) { return 0; } @@ -194,6 +208,42 @@ X11_KeyCodeToUcs4(Display *display, KeyCode keycode, unsigned char group) return X11_KeySymToUcs4(keysym); } +KeySym +X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + KeySym keysym; + +#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM + if (data->xkb) { + int num_groups = XkbKeyNumGroups(data->xkb, keycode); + unsigned char info = XkbKeyGroupInfo(data->xkb, keycode); + + if (num_groups && group >= num_groups) { + + int action = XkbOutOfRangeGroupAction(info); + + if (action == XkbRedirectIntoRange) { + if ((group = XkbOutOfRangeGroupNumber(info)) >= num_groups) { + group = 0; + } + } else if (action == XkbClampIntoRange) { + group = num_groups - 1; + } else { + group %= num_groups; + } + } + keysym = X11_XkbKeycodeToKeysym(data->display, keycode, group, 0); + } else { + keysym = X11_XKeycodeToKeysym(data->display, keycode, 0); + } +#else + keysym = X11_XKeycodeToKeysym(data->display, keycode, 0); +#endif + + return keysym; +} + int X11_InitKeyboard(_THIS) { @@ -216,9 +266,76 @@ X11_InitKeyboard(_THIS) int best_distance; int best_index; int distance; - + Bool xkb_repeat = 0; + X11_XAutoRepeatOn(data->display); +#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM + { + int xkb_major = XkbMajorVersion; + int xkb_minor = XkbMinorVersion; + + if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) { + data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd); + } + + /* This will remove KeyRelease events for held keys */ + X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat); + } +#endif + + /* Open a connection to the X input manager */ +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that + Compose keys will work correctly. */ + char *prev_locale = setlocale(LC_ALL, NULL); + char *prev_xmods = X11_XSetLocaleModifiers(NULL); + const char *new_xmods = ""; + const char *env_xmods = SDL_getenv("XMODIFIERS"); + SDL_bool has_dbus_ime_support = SDL_FALSE; + + if (prev_locale) { + prev_locale = SDL_strdup(prev_locale); + } + + if (prev_xmods) { + prev_xmods = SDL_strdup(prev_xmods); + } + + /* IBus resends some key events that were filtered by XFilterEvents + when it is used via XIM which causes issues. Prevent this by forcing + @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via + the DBus implementation, which also has support for pre-editing. */ + if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } + if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } + if (has_dbus_ime_support || !xkb_repeat) { + new_xmods = "@im=none"; + } + + setlocale(LC_ALL, ""); + X11_XSetLocaleModifiers(new_xmods); + + data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); + + /* Reset the locale + X locale modifiers back to how they were, + locale first because the X locale modifiers depend on it. */ + setlocale(LC_ALL, prev_locale); + X11_XSetLocaleModifiers(prev_xmods); + + if (prev_locale) { + SDL_free(prev_locale); + } + + if (prev_xmods) { + SDL_free(prev_xmods); + } + } +#endif /* Try to determine which scancodes are being used based on fingerprint */ best_distance = SDL_arraysize(fingerprint) + 1; best_index = -1; @@ -257,22 +374,18 @@ X11_InitKeyboard(_THIS) SDL_Keycode keymap[SDL_NUM_SCANCODES]; printf - ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n"); + ("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); /* Determine key_layout - only works on US QWERTY layout */ SDL_GetDefaultKeymap(keymap); for (i = min_keycode; i <= max_keycode; ++i) { KeySym sym; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM - sym = X11_XkbKeycodeToKeysym(data->display, i, 0, 0); -#else - sym = X11_XKeycodeToKeysym(data->display, i, 0); -#endif + sym = X11_KeyCodeToSym(_this, (KeyCode) i, 0); if (sym != NoSymbol) { SDL_Scancode scancode; printf("code = %d, sym = 0x%X (%s) ", i - min_keycode, (unsigned int) sym, X11_XKeysymToString(sym)); - scancode = X11_KeyCodeToSDLScancode(data->display, i); + scancode = X11_KeyCodeToSDLScancode(_this, i); data->key_layout[i] = scancode; if (scancode == SDL_SCANCODE_UNKNOWN) { printf("scancode not found\n"); @@ -287,8 +400,8 @@ X11_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); -#ifdef SDL_USE_IBUS - SDL_IBus_Init(); +#ifdef SDL_USE_IME + SDL_IME_Init(); #endif return 0; @@ -304,10 +417,12 @@ X11_UpdateKeymap(_THIS) unsigned char group = 0; SDL_GetDefaultKeymap(keymap); - + #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM - { + if (data->xkb) { XkbStateRec state; + X11_XkbGetUpdatedMap(data->display, XkbAllClientInfoMask, data->xkb); + if (X11_XkbGetState(data->display, XkbUseCoreKbd, &state) == Success) { group = state.group; } @@ -325,11 +440,11 @@ X11_UpdateKeymap(_THIS) } /* See if there is a UCS keycode for this scancode */ - key = X11_KeyCodeToUcs4(data->display, (KeyCode)i, group); + key = X11_KeyCodeToUcs4(_this, (KeyCode)i, group); if (key) { keymap[scancode] = key; } else { - SDL_Scancode keyScancode = X11_KeyCodeToSDLScancode(data->display, (KeyCode)i); + SDL_Scancode keyScancode = X11_KeyCodeToSDLScancode(_this, (KeyCode)i); switch (keyScancode) { case SDL_SCANCODE_RETURN: @@ -359,22 +474,54 @@ X11_UpdateKeymap(_THIS) void X11_QuitKeyboard(_THIS) { -#ifdef SDL_USE_IBUS - SDL_IBus_Quit(); + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + +#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM + if (data->xkb) { + X11_XkbFreeKeyboard(data->xkb, 0, True); + data->xkb = NULL; + } +#endif + +#ifdef SDL_USE_IME + SDL_IME_Quit(); +#endif +} + +static void +X11_ResetXIM(_THIS) +{ +#ifdef X_HAVE_UTF8_STRING + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + int i; + + if (videodata && videodata->windowlist) { + for (i = 0; i < videodata->numwindows; ++i) { + SDL_WindowData *data = videodata->windowlist[i]; + if (data && data->ic) { + /* Clear any partially entered dead keys */ + char *contents = X11_Xutf8ResetIC(data->ic); + if (contents) { + X11_XFree(contents); + } + } + } + } #endif } void X11_StartTextInput(_THIS) { - + X11_ResetXIM(_this); } void X11_StopTextInput(_THIS) { -#ifdef SDL_USE_IBUS - SDL_IBus_Reset(); + X11_ResetXIM(_this); +#ifdef SDL_USE_IME + SDL_IME_Reset(); #endif } @@ -386,8 +533,8 @@ X11_SetTextInputRect(_THIS, SDL_Rect *rect) return; } -#ifdef SDL_USE_IBUS - SDL_IBus_UpdateTextRect(rect); +#ifdef SDL_USE_IME + SDL_IME_UpdateTextRect(rect); #endif } diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.h similarity index 84% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.h index a1102ed757..c1cc69c96d 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11keyboard_h -#define _SDL_x11keyboard_h +#ifndef SDL_x11keyboard_h_ +#define SDL_x11keyboard_h_ extern int X11_InitKeyboard(_THIS); extern void X11_UpdateKeymap(_THIS); @@ -29,7 +29,8 @@ extern void X11_QuitKeyboard(_THIS); extern void X11_StartTextInput(_THIS); extern void X11_StopTextInput(_THIS); extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect); +extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group); -#endif /* _SDL_x11keyboard_h */ +#endif /* SDL_x11keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.c similarity index 93% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.c index fc8b1b26b5..70a472ab4a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_x11video.h" #include "SDL_x11dyn.h" #include "SDL_assert.h" +#include "SDL_x11messagebox.h" #include #include @@ -43,13 +44,12 @@ #endif #define MAX_BUTTONS 8 /* Maximum number of buttons supported */ -#define MAX_TEXT_LINES 32 /* Maximum number of text lines supported */ #define MIN_BUTTON_WIDTH 64 /* Minimum button width */ #define MIN_DIALOG_WIDTH 200 /* Minimum dialog width */ #define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1"; -static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-120-*-*-*-*-*-*"; +static const char g_MessageBoxFont[] = "-*-*-medium-r-normal--*-120-*-*-*-*-*-*"; static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */ @@ -100,7 +100,7 @@ typedef struct SDL_MessageBoxDataX11 int xtext, ytext; /* Text position to start drawing at. */ int numlines; /* Count of Text lines. */ int text_height; /* Height for text lines. */ - TextLineData linedata[ MAX_TEXT_LINES ]; + TextLineData *linedata; int *pbuttonid; /* Pointer to user return buttonid value. */ @@ -222,6 +222,18 @@ X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * mess return 0; } +static int +CountLinesOfText(const char *text) +{ + int retval = 0; + while (text && *text) { + const char *lf = SDL_strchr(text, '\n'); + retval++; /* even without an endline, this counts as a line. */ + text = lf ? lf + 1 : NULL; + } + return retval; +} + /* Calculate and initialize text and button locations. */ static int X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) @@ -236,29 +248,35 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) /* Go over text and break linefeeds into separate lines. */ if ( messageboxdata->message && messageboxdata->message[ 0 ] ) { const char *text = messageboxdata->message; - TextLineData *plinedata = data->linedata; + const int linecount = CountLinesOfText(text); + TextLineData *plinedata = (TextLineData *) SDL_malloc(sizeof (TextLineData) * linecount); - for ( i = 0; i < MAX_TEXT_LINES; i++, plinedata++ ) { - int height; - char *lf = SDL_strchr( ( char * )text, '\n' ); + if (!plinedata) { + return SDL_OutOfMemory(); + } - data->numlines++; + data->linedata = plinedata; + data->numlines = linecount; + + for ( i = 0; i < linecount; i++, plinedata++ ) { + const char *lf = SDL_strchr( text, '\n' ); + const int length = lf ? ( lf - text ) : SDL_strlen( text ); + int height; - /* Only grab length up to lf if it exists and isn't the last line. */ - plinedata->length = ( lf && ( i < MAX_TEXT_LINES - 1 ) ) ? ( lf - text ) : SDL_strlen( text ); plinedata->text = text; - GetTextWidthHeight( data, text, plinedata->length, &plinedata->width, &height ); + GetTextWidthHeight( data, text, length, &plinedata->width, &height ); /* Text and widths are the largest we've ever seen. */ data->text_height = IntMax( data->text_height, height ); text_width_max = IntMax( text_width_max, plinedata->width ); + plinedata->length = length; if (lf && (lf > text) && (lf[-1] == '\r')) { plinedata->length--; } - text += plinedata->length + 1; + text += length + 1; /* Break if there are no more linefeeds. */ if ( !lf ) @@ -368,6 +386,8 @@ X11_MessageBoxShutdown( SDL_MessageBoxDataX11 *data ) X11_XCloseDisplay( data->display ); data->display = NULL; } + + SDL_free(data->linedata); } /* Create and set up our X11 dialog box indow. */ @@ -377,10 +397,11 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) int x, y; XSizeHints *sizehints; XSetWindowAttributes wnd_attr; - Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME, UTF8_STRING; + Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME; Display *display = data->display; SDL_WindowData *windowdata = NULL; const SDL_MessageBoxData *messageboxdata = data->messageboxdata; + char *title_locale = NULL; if ( messageboxdata->window ) { SDL_DisplayData *displaydata = @@ -413,10 +434,30 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) X11_XStoreName( display, data->window, messageboxdata->title ); _NET_WM_NAME = X11_XInternAtom(display, "_NET_WM_NAME", False); - UTF8_STRING = X11_XInternAtom(display, "UTF8_STRING", False); - X11_XChangeProperty(display, data->window, _NET_WM_NAME, UTF8_STRING, 8, - PropModeReplace, (unsigned char *) messageboxdata->title, - strlen(messageboxdata->title) + 1 ); + + title_locale = SDL_iconv_utf8_locale(messageboxdata->title); + if (title_locale) { + XTextProperty titleprop; + Status status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop); + SDL_free(title_locale); + if (status) { + X11_XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME); + X11_XFree(titleprop.value); + } + } + +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + XTextProperty titleprop; + Status status = X11_Xutf8TextListToTextProperty(display, (char **) &messageboxdata->title, 1, + XUTF8StringStyle, &titleprop); + if (status == Success) { + X11_XSetTextProperty(display, data->window, &titleprop, + _NET_WM_NAME); + X11_XFree(titleprop.value); + } + } +#endif /* Let the window manager know this is a dialog box */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.h similarity index 87% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.h index c77c57fb18..6515983fa5 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,10 +19,15 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef SDL_x11messagebox_h_ +#define SDL_x11messagebox_h_ + #if SDL_VIDEO_DRIVER_X11 extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); #endif /* SDL_VIDEO_DRIVER_X11 */ +#endif /* SDL_x11messagebox_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.c index 446da2b64c..5eafe73436 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -134,37 +134,32 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo) } else { return SDL_PIXELFORMAT_INDEX4MSB; } - break; + /* break; -Wunreachable-code-break */ case 1: if (BitmapBitOrder(display) == LSBFirst) { return SDL_PIXELFORMAT_INDEX1LSB; } else { return SDL_PIXELFORMAT_INDEX1MSB; } - break; + /* break; -Wunreachable-code-break */ } } return SDL_PIXELFORMAT_UNKNOWN; } -/* Global for the error handler */ -int vm_event, vm_error = -1; - #if SDL_VIDEO_DRIVER_X11_XINERAMA static SDL_bool CheckXinerama(Display * display, int *major, int *minor) { int event_base = 0; int error_base = 0; - const char *env; /* Default the extension not available */ *major = *minor = 0; /* Allow environment override */ - env = SDL_GetHint(SDL_HINT_VIDEO_X11_XINERAMA); - if (env && !SDL_atoi(env)) { + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XINERAMA, SDL_TRUE)) { #ifdef X11MODES_DEBUG printf("Xinerama disabled due to hint\n"); #endif @@ -213,22 +208,19 @@ X11_XineramaFailed(Display * d, XErrorEvent * e) static SDL_bool CheckXRandR(Display * display, int *major, int *minor) { - const char *env; - /* Default the extension not available */ *major = *minor = 0; /* Allow environment override */ - env = SDL_GetHint(SDL_HINT_VIDEO_X11_XRANDR); #ifdef XRANDR_DISABLED_BY_DEFAULT - if (!env || !SDL_atoi(env)) { + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, SDL_FALSE)) { #ifdef X11MODES_DEBUG printf("XRandR disabled by default due to window manager issues\n"); #endif return SDL_FALSE; } #else - if (env && !SDL_atoi(env)) { + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XRANDR, SDL_TRUE)) { #ifdef X11MODES_DEBUG printf("XRandR disabled due to hint\n"); #endif @@ -264,8 +256,8 @@ CheckXRandR(Display * display, int *major, int *minor) static int CalculateXRandRRefreshRate(const XRRModeInfo *info) { - return (info->hTotal - && info->vTotal) ? (info->dotClock / (info->hTotal * info->vTotal)) : 0; + return (info->hTotal && info->vTotal) ? + round(((double)info->dotClock / (double)(info->hTotal * info->vTotal))) : 0; } static SDL_bool @@ -342,7 +334,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, X11_XFree(props); } - inches = (int)((SDL_sqrt(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f); + inches = (int)((SDL_sqrtf(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f); if (*name && inches) { const size_t len = SDL_strlen(name); SDL_snprintf(&name[len], namelen-len, " %d\"", inches); @@ -354,7 +346,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, } -int +static int X11_InitModes_XRandR(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -401,9 +393,16 @@ X11_InitModes_XRandR(_THIS) X11_XFree(pixmapformats); } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; + res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + if (!res) { + continue; + } } for (output = 0; output < res->noutput; output++) { @@ -469,8 +468,8 @@ X11_InitModes_XRandR(_THIS) displaydata->screen = screen; displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width; - displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); displaydata->scanline_pad = scanline_pad; displaydata->x = display_x; @@ -507,14 +506,12 @@ X11_InitModes_XRandR(_THIS) static SDL_bool CheckVidMode(Display * display, int *major, int *minor) { - const char *env; - + int vm_event, vm_error = -1; /* Default the extension not available */ *major = *minor = 0; /* Allow environment override */ - env = SDL_GetHint(SDL_HINT_VIDEO_X11_XVIDMODE); - if (env && !SDL_atoi(env)) { + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XVIDMODE, SDL_TRUE)) { #ifdef X11MODES_DEBUG printf("XVidMode disabled due to hint\n"); #endif @@ -529,7 +526,6 @@ CheckVidMode(Display * display, int *major, int *minor) } /* Query the extension version */ - vm_error = -1; if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error) || !X11_XF86VidModeQueryVersion(display, major, minor)) { #ifdef X11MODES_DEBUG @@ -577,7 +573,7 @@ CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) info->vtotal)) : 0; } -SDL_bool +static SDL_bool SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) { mode->w = info->hdisplay; @@ -592,7 +588,7 @@ int X11_InitModes(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int snum, screen, screencount; + int snum, screen, screencount = 0; #if SDL_VIDEO_DRIVER_X11_XINERAMA int xinerama_major, xinerama_minor; int use_xinerama = 0; @@ -612,12 +608,26 @@ X11_InitModes(_THIS) /* require at least XRandR v1.3 */ if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { - return X11_InitModes_XRandR(_this); + if (X11_InitModes_XRandR(_this) == 0) + return 0; } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ + /* This is a workaround for some apps (UnrealEngine4, for example) until + we sort out the ramifications of removing XVidMode support outright. + This block should be removed with the XVidMode support. */ + { + if (SDL_GetHintBoolean("SDL_VIDEO_X11_REQUIRE_XRANDR", SDL_FALSE)) { + #if SDL_VIDEO_DRIVER_X11_XRANDR + return SDL_SetError("XRandR support is required but not available"); + #else + return SDL_SetError("XRandR support is required but not built into SDL!"); + #endif + } + } + #if SDL_VIDEO_DRIVER_X11_XINERAMA /* Query Xinerama extention * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) @@ -736,9 +746,9 @@ X11_InitModes(_THIS) displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - // We use the displaydata screen index here so that this works - // for both the Xinerama case, where we get the overall DPI, - // and the regular X11 screen info case. + /* We use the displaydata screen index here so that this works + for both the Xinerama case, where we get the overall DPI, + and the regular X11 screen info case. */ displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f / DisplayWidthMM(data->display, displaydata->screen); displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f / @@ -819,8 +829,6 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) int nmodes; XF86VidModeModeInfo ** modes; #endif - int screen_w; - int screen_h; SDL_DisplayMode mode; /* Unfortunately X11 requires the window to be created with the correct @@ -832,11 +840,14 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; - screen_w = DisplayWidth(display, data->screen); - screen_h = DisplayHeight(display, data->screen); - #if SDL_VIDEO_DRIVER_X11_XINERAMA if (data->use_xinerama) { + int screen_w; + int screen_h; + + screen_w = DisplayWidth(display, data->screen); + screen_h = DisplayHeight(display, data->screen); + if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org && (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { SDL_DisplayModeData *modedata; @@ -1056,7 +1067,44 @@ X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * h *vdpi = data->vdpi; } - return data->ddpi != 0.0f ? 0 : -1; + return data->ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); +} + +int +X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + Display *display = data->display; + Atom _NET_WORKAREA; + int status, real_format; + int retval = -1; + Atom real_type; + unsigned long items_read = 0, items_left = 0; + unsigned char *propdata = NULL; + + if (X11_GetDisplayBounds(_this, sdl_display, rect) < 0) { + return -1; + } + + _NET_WORKAREA = X11_XInternAtom(display, "_NET_WORKAREA", False); + status = X11_XGetWindowProperty(display, DefaultRootWindow(display), + _NET_WORKAREA, 0L, 4L, False, XA_CARDINAL, + &real_type, &real_format, &items_read, + &items_left, &propdata); + if ((status == Success) && (items_read >= 4)) { + const long *p = (long*) propdata; + const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] }; + retval = 0; + if (!SDL_IntersectRect(rect, &usable, rect)) { + SDL_zerop(rect); + } + } + + if (propdata) { + X11_XFree(propdata); + } + + return retval; } #endif /* SDL_VIDEO_DRIVER_X11 */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.h index a68286ab19..7d3ff3ef9e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11modes_h -#define _SDL_x11modes_h +#ifndef SDL_x11modes_h_ +#define SDL_x11modes_h_ typedef struct { @@ -77,8 +77,9 @@ extern int X11_GetVisualInfoFromVisual(Display * display, Visual * visual, extern Uint32 X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo); extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); +extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); -#endif /* _SDL_x11modes_h */ +#endif /* SDL_x11modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.c index 245b116ea6..3b98726d06 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -308,23 +308,27 @@ X11_ShowCursor(SDL_Cursor * cursor) return 0; } +static void +WarpMouseInternal(Window xwindow, const int x, const int y) +{ + SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; + Display *display = videodata->display; + X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); + X11_XSync(display, False); + videodata->global_mouse_changed = SDL_TRUE; +} + static void X11_WarpMouse(SDL_Window * window, int x, int y) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; - - X11_XWarpPointer(display, None, data->xwindow, 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(data->xwindow, x, y); } static int X11_WarpMouseGlobal(int x, int y) { - Display *display = GetDisplay(); - - X11_XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(DefaultRootWindow(GetDisplay()), x, y); return 0; } @@ -366,39 +370,52 @@ X11_CaptureMouse(SDL_Window *window) static Uint32 X11_GetGlobalMouseState(int *x, int *y) { + SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; Display *display = GetDisplay(); const int num_screens = SDL_GetNumVideoDisplays(); int i; /* !!! FIXME: should we XSync() here first? */ - for (i = 0; i < num_screens; i++) { - SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i); - if (data != NULL) { - Window root, child; - int rootx, rooty, winx, winy; - unsigned int mask; - if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { - XWindowAttributes root_attrs; - Uint32 retval = 0; - retval |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; - retval |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; - retval |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; - /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing - * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). - * - * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */ - X11_XGetWindowAttributes(display, root, &root_attrs); - *x = root_attrs.x + rootx; - *y = root_attrs.y + rooty; - return retval; +#if !SDL_VIDEO_DRIVER_X11_XINPUT2 + videodata->global_mouse_changed = SDL_TRUE; +#endif + + /* check if we have this cached since XInput last saw the mouse move. */ + /* !!! FIXME: can we just calculate this from XInput's events? */ + if (videodata->global_mouse_changed) { + for (i = 0; i < num_screens; i++) { + SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i); + if (data != NULL) { + Window root, child; + int rootx, rooty, winx, winy; + unsigned int mask; + if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { + XWindowAttributes root_attrs; + Uint32 buttons = 0; + buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; + buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; + buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; + /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing + * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). + * + * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */ + X11_XGetWindowAttributes(display, root, &root_attrs); + videodata->global_mouse_position.x = root_attrs.x + rootx; + videodata->global_mouse_position.y = root_attrs.y + rooty; + videodata->global_mouse_buttons = buttons; + videodata->global_mouse_changed = SDL_FALSE; + break; + } } } } - SDL_assert(0 && "The pointer wasn't on any X11 screen?!"); + SDL_assert(!videodata->global_mouse_changed); /* The pointer wasn't on any X11 screen?! */ - return 0; + *x = videodata->global_mouse_position.x; + *y = videodata->global_mouse_position.y; + return videodata->global_mouse_buttons; } diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.h similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.h index d31d6b7220..104185832e 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11mouse_h -#define _SDL_x11mouse_h +#ifndef SDL_x11mouse_h_ +#define SDL_x11mouse_h_ extern void X11_InitMouse(_THIS); extern void X11_QuitMouse(_THIS); -#endif /* _SDL_x11mouse_h */ +#endif /* SDL_x11mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.c similarity index 79% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.c index 8b634be3d4..7c3cb339d1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_x11video.h" #include "SDL_assert.h" +#include "SDL_hints.h" /* GLX implementation of SDL OpenGL support */ @@ -113,6 +114,13 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, #endif #endif +#ifndef GLX_ARB_create_context_no_error +#define GLX_ARB_create_context_no_error +#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif +#endif + #ifndef GLX_EXT_swap_control #define GLX_SWAP_INTERVAL_EXT 0x20F1 #define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 @@ -143,7 +151,6 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, static void X11_GL_InitExtensions(_THIS); - int X11_GL_LoadLibrary(_THIS, const char *path) { @@ -222,13 +229,17 @@ X11_GL_LoadLibrary(_THIS, const char *path) } /* Initialize extensions */ + /* See lengthy comment about the inc/dec in + ../windows/SDL_windowsopengl.c. */ + ++_this->gl_config.driver_loaded; X11_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; /* If we need a GL ES context and there's no * GLX_EXT_create_context_es2_profile extension, switch over to X11_GLES functions */ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) { + X11_GL_UseEGL(_this) ) { #if SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); /* Better avoid conflicts! */ @@ -320,9 +331,48 @@ X11_GL_InitExtensions(_THIS) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; const int screen = DefaultScreen(display); + XVisualInfo *vinfo = NULL; + Window w = 0; + GLXContext prev_ctx = 0; + GLXDrawable prev_drawable = 0; + GLXContext context = 0; const char *(*glXQueryExtensionsStringFunc) (Display *, int); const char *extensions; + vinfo = X11_GL_GetVisual(_this, display, screen); + if (vinfo) { + GLXContext (*glXGetCurrentContextFunc) (void) = + (GLXContext(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentContext"); + + GLXDrawable (*glXGetCurrentDrawableFunc) (void) = + (GLXDrawable(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable"); + + if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) { + XSetWindowAttributes xattr; + prev_ctx = glXGetCurrentContextFunc(); + prev_drawable = glXGetCurrentDrawableFunc(); + + xattr.background_pixel = 0; + xattr.border_pixel = 0; + xattr.colormap = + X11_XCreateColormap(display, RootWindow(display, screen), + vinfo->visual, AllocNone); + w = X11_XCreateWindow(display, RootWindow(display, screen), 0, 0, + 32, 32, 0, vinfo->depth, InputOutput, vinfo->visual, + (CWBackPixel | CWBorderPixel | CWColormap), &xattr); + + context = _this->gl_data->glXCreateContext(display, vinfo, + NULL, True); + if (context) { + _this->gl_data->glXMakeCurrent(display, w, context); + } + } + + X11_XFree(vinfo); + } + glXQueryExtensionsStringFunc = (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this, "glXQueryExtensionsString"); @@ -380,23 +430,58 @@ X11_GL_InitExtensions(_THIS) /* Check for GLX_EXT_create_context_es2_profile */ if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE; + /* this wants to call glGetString(), so it needs a context. */ + /* !!! FIXME: it would be nice not to make a context here though! */ + if (context) { + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); + } } /* Check for GLX_ARB_context_flush_control */ if (HasExtension("GLX_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE; } + + /* Check for GLX_ARB_create_context_robustness */ + if (HasExtension("GLX_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for GLX_ARB_create_context_no_error */ + if (HasExtension("GLX_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_no_error = SDL_TRUE; + } + + if (context) { + _this->gl_data->glXMakeCurrent(display, None, NULL); + _this->gl_data->glXDestroyContext(display, context); + if (prev_ctx && prev_drawable) { + _this->gl_data->glXMakeCurrent(display, prev_drawable, prev_ctx); + } + } + + if (w) { + X11_XDestroyWindow(display, w); + } + X11_PumpEvents(_this); } /* glXChooseVisual and glXChooseFBConfig have some small differences in * the attribute encoding, it can be chosen with the for_FBConfig parameter. + * Some targets fail if you use GLX_X_VISUAL_TYPE_EXT/GLX_DIRECT_COLOR_EXT, + * so it gets specified last if used and is pointed to by *_pvistypeattr. + * In case of failure, if that pointer is not NULL, set that pointer to None + * and try again. */ static int -X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig) +X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig, int **_pvistypeattr) { int i = 0; const int MAX_ATTRIBUTES = 64; + int *pvistypeattr = NULL; /* assert buffer is large enough to hold all SDL attributes. */ SDL_assert(size >= MAX_ATTRIBUTES); @@ -488,6 +573,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si EXT_visual_info extension, then add GLX_X_VISUAL_TYPE_EXT. */ if (X11_UseDirectColorVisuals() && _this->gl_data->HAS_GLX_EXT_visual_info) { + pvistypeattr = &attribs[i]; attribs[i++] = GLX_X_VISUAL_TYPE_EXT; attribs[i++] = GLX_DIRECT_COLOR_EXT; } @@ -496,6 +582,10 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si SDL_assert(i <= MAX_ATTRIBUTES); + if (_pvistypeattr) { + *_pvistypeattr = pvistypeattr; + } + return i; } @@ -505,29 +595,27 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) /* 64 seems nice. */ int attribs[64]; XVisualInfo *vinfo; + int *pvistypeattr = NULL; if (!_this->gl_data) { /* The OpenGL library wasn't loaded, SDL_GetError() should have info */ return NULL; } - X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE); + X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr); vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + + if (!vinfo && (pvistypeattr != NULL)) { + *pvistypeattr = None; + vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + } + if (!vinfo) { SDL_SetError("Couldn't find matching GLX visual"); } return vinfo; } -#ifndef GLXBadContext -#define GLXBadContext 0 -#endif -#ifndef GLXBadFBConfig -#define GLXBadFBConfig 9 -#endif -#ifndef GLXBadProfileARB -#define GLXBadProfileARB 13 -#endif static int (*handler) (Display *, XErrorEvent *) = NULL; static const char *errorHandlerOperation = NULL; static int errorBase = 0; @@ -551,12 +639,25 @@ X11_GL_ErrorHandler(Display * d, XErrorEvent * e) } else { - SDL_SetError("Could not %s: %i (Base %i)\n", errorHandlerOperation, errorCode, errorBase); + SDL_SetError("Could not %s: %i (Base %i)", errorHandlerOperation, errorCode, errorBase); } return (0); } +SDL_bool +X11_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No GLX extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window) { @@ -593,8 +694,8 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) context = _this->gl_data->glXCreateContext(display, vinfo, share_context, True); } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { + /* max 14 attributes plus terminator */ + int attribs[15] = { GLX_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, GLX_CONTEXT_MINOR_VERSION_ARB, @@ -624,6 +725,21 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) { + attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = + _this->gl_config.reset_notification ? + GLX_LOSE_CONTEXT_ON_RESET_ARB : + GLX_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) { + attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Get a pointer to the context creation function for GL 3.0 */ @@ -635,19 +751,28 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) /* Create a GL 3.x context */ GLXFBConfig *framebuffer_config = NULL; int fbcount = 0; + int *pvistypeattr = NULL; - X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE); + X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE,&pvistypeattr); - if (!_this->gl_data->glXChooseFBConfig - || !(framebuffer_config = - _this->gl_data->glXChooseFBConfig(display, + if (_this->gl_data->glXChooseFBConfig) { + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, DefaultScreen(display), glxAttribs, - &fbcount))) { - SDL_SetError("No good framebuffers found. OpenGL 3.0 and later unavailable"); - } else { - context = _this->gl_data->glXCreateContextAttribsARB(display, - framebuffer_config[0], - share_context, True, attribs); + &fbcount); + + if (!framebuffer_config && (pvistypeattr != NULL)) { + *pvistypeattr = None; + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, + DefaultScreen(display), glxAttribs, + &fbcount); + } + + if (framebuffer_config) { + context = _this->gl_data->glXCreateContextAttribsARB(display, + framebuffer_config[0], + share_context, True, attribs); + X11_XFree(framebuffer_config); + } } } } @@ -695,7 +820,7 @@ X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) if (errorCode != Success) { /* uhoh, an X error was thrown! */ return -1; /* the error handler called SDL_SetError() already. */ - } else if (!rc) { /* glxMakeCurrent() failed without throwing an X error */ + } else if (!rc) { /* glXMakeCurrent() failed without throwing an X error */ return SDL_SetError("Unable to make GL context current"); } @@ -703,14 +828,14 @@ X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) } /* - 0 is a valid argument to glxSwapInterval(MESA|EXT) and setting it to 0 + 0 is a valid argument to glXSwapInterval(MESA|EXT) and setting it to 0 will undo the effect of a previous call with a value that is greater than zero (or at least that is what the docs say). OTOH, 0 is an invalid - argument to glxSwapIntervalSGI and it returns an error if you call it + argument to glXSwapIntervalSGI and it returns an error if you call it with 0 as an argument. */ -static int swapinterval = -1; +static int swapinterval = 0; int X11_GL_SetSwapInterval(_THIS, int interval) { @@ -742,14 +867,14 @@ X11_GL_SetSwapInterval(_THIS, int interval) } else if (_this->gl_data->glXSwapIntervalMESA) { status = _this->gl_data->glXSwapIntervalMESA(interval); if (status != 0) { - SDL_SetError("glxSwapIntervalMESA failed"); + SDL_SetError("glXSwapIntervalMESA failed"); } else { swapinterval = interval; } } else if (_this->gl_data->glXSwapIntervalSGI) { status = _this->gl_data->glXSwapIntervalSGI(interval); if (status != 0) { - SDL_SetError("glxSwapIntervalSGI failed"); + SDL_SetError("glXSwapIntervalSGI failed"); } else { swapinterval = interval; } @@ -791,13 +916,14 @@ X11_GL_GetSwapInterval(_THIS) } } -void +int X11_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; _this->gl_data->glXSwapBuffers(display, data->xwindow); + return 0; } void diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.h index 86e77d7da1..7331b71ff0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengl_h -#define _SDL_x11opengl_h +#ifndef SDL_x11opengl_h_ +#define SDL_x11opengl_h_ #if SDL_VIDEO_OPENGL_GLX #include "SDL_opengl.h" @@ -34,8 +34,18 @@ struct SDL_GLDriverData SDL_bool HAS_GLX_EXT_visual_rating; SDL_bool HAS_GLX_EXT_visual_info; SDL_bool HAS_GLX_EXT_swap_control_tear; - SDL_bool HAS_GLX_EXT_create_context_es2_profile; SDL_bool HAS_GLX_ARB_context_flush_control; + SDL_bool HAS_GLX_ARB_create_context_robustness; + SDL_bool HAS_GLX_ARB_create_context_no_error; + + /* Max version of OpenGL ES context that can be created if the + implementation supports GLX_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; Bool (*glXQueryExtension) (Display*,int*,int*); void *(*glXGetProcAddress) (const GLubyte*); @@ -57,17 +67,18 @@ struct SDL_GLDriverData extern int X11_GL_LoadLibrary(_THIS, const char *path); extern void *X11_GL_GetProcAddress(_THIS, const char *proc); extern void X11_GL_UnloadLibrary(_THIS); +extern SDL_bool X11_GL_UseEGL(_THIS); extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window); extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int X11_GL_SetSwapInterval(_THIS, int interval); extern int X11_GL_GetSwapInterval(_THIS); -extern void X11_GL_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GL_SwapWindow(_THIS, SDL_Window * window); extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_GLX */ -#endif /* _SDL_x11opengl_h */ +#endif /* SDL_x11opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.c index 5311722008..76b6cd7883 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) #endif } - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); } XVisualInfo * diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.h similarity index 81% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.h index 716e6e6882..b189b76890 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengles_h -#define _SDL_x11opengles_h +#ifndef SDL_x11opengles_h_ +#define SDL_x11opengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -30,6 +30,9 @@ typedef struct SDL_PrivateGLESData { + /* 1401 If the struct-declaration-list contains no named members, the behavior is undefined. */ + /* warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] */ + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -43,11 +46,11 @@ typedef struct SDL_PrivateGLESData extern int X11_GLES_LoadLibrary(_THIS, const char *path); extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window); -extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GLES_SwapWindow(_THIS, SDL_Window * window); extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_x11opengles_h */ +#endif /* SDL_x11opengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.c index 4f78ae8997..4d68fe0eec 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,11 +28,6 @@ #include "SDL_x11window.h" #include "../SDL_shape_internals.h" -SDL_Window* -X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags); -} - SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; @@ -118,4 +113,3 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo } #endif /* SDL_VIDEO_DRIVER_X11 */ - diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.h index cd88ab70f5..a8c2e2c946 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11shape_h -#define _SDL_x11shape_h +#ifndef SDL_x11shape_h_ +#define SDL_x11shape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -32,9 +32,8 @@ typedef struct { Uint32 bitmapsize; } SDL_ShapeData; -extern SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window); extern int X11_ResizeWindowShape(SDL_Window* window); extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_x11shape_h */ +#endif /* SDL_x11shape_h_ */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11sym.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11sym.h similarity index 94% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11sym.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11sym.h index 3683ac0a52..6709992155 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11sym.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,14 @@ /* *INDENT-OFF* */ +#ifndef SDL_X11_MODULE +#define SDL_X11_MODULE(modname) +#endif + +#ifndef SDL_X11_SYM +#define SDL_X11_SYM(rc,fn,params,args,ret) +#endif + SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) @@ -37,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char * SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return) -SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) +SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return) SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return) @@ -153,6 +161,7 @@ SDL_X11_SYM(SDL_X11_XSynchronizeRetType,XSynchronize,(Display* a,Bool b),(a,b),r SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return) SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return) SDL_X11_SYM(void,XRefreshKeyboardMapping,(XMappingEvent *a),(a),) +SDL_X11_SYM(int,XQueryTree,(Display* a,Window b,Window* c,Window* d,Window** e,unsigned int* f),(a,b,c,d,e,f),return) #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return) @@ -160,12 +169,18 @@ SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),) #endif #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +SDL_X11_SYM(Bool,XkbQueryExtension,(Display* a,int * b,int * c,int * d,int * e, int *f),(a,b,c,d,e,f),return) #if NeedWidePrototypes SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,unsigned int b,int c,int d),(a,b,c,d),return) #else SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,KeyCode b,int c,int d),(a,b,c,d),return) #endif SDL_X11_SYM(Status,XkbGetState,(Display* a,unsigned int b,XkbStatePtr c),(a,b,c),return) +SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return) +SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return) +SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) #endif #if NeedWidePrototypes @@ -186,7 +201,9 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),) SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return) SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return) SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) -SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) +SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) +SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) +SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) #endif #ifndef NO_SHARED_MEMORY @@ -275,6 +292,7 @@ SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(confi SDL_X11_SYM(void,XRRSetScreenSize,(Display *dpy, Window window,int width, int height,int mmWidth, int mmHeight),(dpy,window,width,height,mmWidth,mmHeight),) SDL_X11_SYM(Status,XRRGetScreenSizeRange,(Display *dpy, Window window,int *minWidth, int *minHeight, int *maxWidth, int *maxHeight),(dpy,window,minWidth,minHeight,maxWidth,maxHeight),return) SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResources,(Display *dpy, Window window),(dpy, window),return) +SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResourcesCurrent,(Display *dpy, Window window),(dpy, window),return) SDL_X11_SYM(void,XRRFreeScreenResources,(XRRScreenResources *resources),(resources),) SDL_X11_SYM(XRROutputInfo *,XRRGetOutputInfo,(Display *dpy, XRRScreenResources *resources, RROutput output),(dpy,resources,output),return) SDL_X11_SYM(void,XRRFreeOutputInfo,(XRROutputInfo *outputInfo),(outputInfo),) @@ -311,6 +329,9 @@ SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo * SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) #endif +#undef SDL_X11_MODULE +#undef SDL_X11_SYM + /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.c index c19e80a673..2d0e73b8bc 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,6 +42,13 @@ X11_QuitTouch(_THIS) SDL_TouchQuit(); } +void +X11_ResetTouch(_THIS) +{ + X11_QuitTouch(_this); + X11_InitTouch(_this); +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.h similarity index 85% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.h index 7f8d18e1c4..5a59af0289 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11touch_h -#define _SDL_x11touch_h +#ifndef SDL_x11touch_h_ +#define SDL_x11touch_h_ extern void X11_InitTouch(_THIS); extern void X11_QuitTouch(_THIS); +extern void X11_ResetTouch(_THIS); -#endif /* _SDL_x11touch_h */ +#endif /* SDL_x11touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.c index 01f8ae60f8..b3b1a70dd0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_video.h" #include "SDL_mouse.h" +#include "SDL_timer.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" @@ -39,6 +40,8 @@ #include "SDL_x11opengles.h" #endif +#include "SDL_x11vulkan.h" + /* Initialization/Query functions */ static int X11_VideoInit(_THIS); static void X11_VideoQuit(_THIS); @@ -106,6 +109,9 @@ static void X11_DeleteDevice(SDL_VideoDevice * device) { SDL_VideoData *data = (SDL_VideoData *) device->driverdata; + if (device->vulkan_config.loader_handle) { + device->Vulkan_UnloadLibrary(device); + } if (data->display) { X11_XCloseDisplay(data->display); } @@ -175,6 +181,8 @@ X11_CreateDevice(int devindex) } device->driverdata = data; + data->global_mouse_changed = SDL_TRUE; + /* FIXME: Do we need this? if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) || (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) { @@ -184,8 +192,8 @@ X11_CreateDevice(int devindex) } */ data->display = X11_XOpenDisplay(display); -#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC) - /* On Tru64 if linking without -lX11, it fails and you get following message. +#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC + /* On some systems if linking without -lX11, it fails and you get following message. * Xlib: connection to ":0.0" refused by server * Xlib: XDM authorization key matches an existing client! * @@ -214,21 +222,27 @@ X11_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; + device->ResetTouch = X11_ResetTouch; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; + device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds; device->GetDisplayDPI = X11_GetDisplayDPI; device->SetDisplayMode = X11_SetDisplayMode; device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; - device->CreateWindow = X11_CreateWindow; - device->CreateWindowFrom = X11_CreateWindowFrom; + device->CreateSDLWindow = X11_CreateWindow; + device->CreateSDLWindowFrom = X11_CreateWindowFrom; device->SetWindowTitle = X11_SetWindowTitle; device->SetWindowIcon = X11_SetWindowIcon; device->SetWindowPosition = X11_SetWindowPosition; device->SetWindowSize = X11_SetWindowSize; device->SetWindowMinimumSize = X11_SetWindowMinimumSize; device->SetWindowMaximumSize = X11_SetWindowMaximumSize; + device->GetWindowBordersSize = X11_GetWindowBordersSize; + device->SetWindowOpacity = X11_SetWindowOpacity; + device->SetWindowModalFor = X11_SetWindowModalFor; + device->SetWindowInputFocus = X11_SetWindowInputFocus; device->ShowWindow = X11_ShowWindow; device->HideWindow = X11_HideWindow; device->RaiseWindow = X11_RaiseWindow; @@ -236,6 +250,7 @@ X11_CreateDevice(int devindex) device->MinimizeWindow = X11_MinimizeWindow; device->RestoreWindow = X11_RestoreWindow; device->SetWindowBordered = X11_SetWindowBordered; + device->SetWindowResizable = X11_SetWindowResizable; device->SetWindowFullscreen = X11_SetWindowFullscreen; device->SetWindowGammaRamp = X11_SetWindowGammaRamp; device->SetWindowGrab = X11_SetWindowGrab; @@ -245,6 +260,7 @@ X11_CreateDevice(int devindex) device->DestroyWindowFramebuffer = X11_DestroyWindowFramebuffer; device->GetWindowWMInfo = X11_GetWindowWMInfo; device->SetWindowHitTest = X11_SetWindowHitTest; + device->AcceptDragAndDrop = X11_AcceptDragAndDrop; device->shape_driver.CreateShaper = X11_CreateShaper; device->shape_driver.SetWindowShape = X11_SetWindowShape; @@ -278,9 +294,16 @@ X11_CreateDevice(int devindex) device->StartTextInput = X11_StartTextInput; device->StopTextInput = X11_StopTextInput; device->SetTextInputRect = X11_SetTextInputRect; - + device->free = X11_DeleteDevice; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface; +#endif + return device; } @@ -373,31 +396,33 @@ X11_VideoInit(_THIS) /* Get the process PID to be associated to the window */ data->pid = getpid(); - /* Open a connection to the X input manager */ -#ifdef X_HAVE_UTF8_STRING - if (SDL_X11_HAVE_UTF8) { - data->im = - X11_XOpenIM(data->display, NULL, data->classname, data->classname); - } -#endif + /* I have no idea how random this actually is, or has to be. */ + data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this)); /* Look up some useful Atoms */ #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_DELETE_WINDOW); + GET_ATOM(WM_TAKE_FOCUS); GET_ATOM(_NET_WM_STATE); GET_ATOM(_NET_WM_STATE_HIDDEN); GET_ATOM(_NET_WM_STATE_FOCUSED); GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT); GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ); GET_ATOM(_NET_WM_STATE_FULLSCREEN); + GET_ATOM(_NET_WM_STATE_ABOVE); + GET_ATOM(_NET_WM_STATE_SKIP_TASKBAR); + GET_ATOM(_NET_WM_STATE_SKIP_PAGER); GET_ATOM(_NET_WM_ALLOWED_ACTIONS); GET_ATOM(_NET_WM_ACTION_FULLSCREEN); GET_ATOM(_NET_WM_NAME); GET_ATOM(_NET_WM_ICON_NAME); GET_ATOM(_NET_WM_ICON); GET_ATOM(_NET_WM_PING); + GET_ATOM(_NET_WM_WINDOW_OPACITY); + GET_ATOM(_NET_WM_USER_TIME); GET_ATOM(_NET_ACTIVE_WINDOW); + GET_ATOM(_NET_FRAME_EXTENTS); GET_ATOM(UTF8_STRING); GET_ATOM(PRIMARY); GET_ATOM(XdndEnter); @@ -438,6 +463,10 @@ X11_VideoQuit(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + if (data->clipboard_window) { + X11_XDestroyWindow(data->display, data->clipboard_window); + } + SDL_free(data->classname); #ifdef X_HAVE_UTF8_STRING if (data->im) { @@ -450,6 +479,8 @@ X11_VideoQuit(_THIS) X11_QuitMouse(_this); X11_QuitTouch(_this); +/* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here; + have SDL.c do this at a higher level, or add refcounting. */ #if SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.h similarity index 76% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.h index 2083defd2f..c0dc08efee 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11video_h -#define _SDL_x11video_h +#ifndef SDL_x11video_h_ +#define SDL_x11video_h_ #include "SDL_keycode.h" @@ -57,7 +57,7 @@ #endif #include "../../core/linux/SDL_dbus.h" -#include "../../core/linux/SDL_ibus.h" +#include "../../core/linux/SDL_ime.h" #include "SDL_x11dyn.h" @@ -68,6 +68,7 @@ #include "SDL_x11mouse.h" #include "SDL_x11opengl.h" #include "SDL_x11window.h" +#include "SDL_x11vulkan.h" /* Private display data */ @@ -81,6 +82,8 @@ typedef struct SDL_VideoData int numwindows; SDL_WindowData **windowlist; int windowlistlength; + XID window_group; + Window clipboard_window; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; @@ -88,19 +91,26 @@ typedef struct SDL_VideoData /* Useful atoms */ Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; + Atom WM_TAKE_FOCUS; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN; + Atom _NET_WM_STATE_ABOVE; + Atom _NET_WM_STATE_SKIP_TASKBAR; + Atom _NET_WM_STATE_SKIP_PAGER; Atom _NET_WM_ALLOWED_ACTIONS; Atom _NET_WM_ACTION_FULLSCREEN; Atom _NET_WM_NAME; Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON; Atom _NET_WM_PING; + Atom _NET_WM_WINDOW_OPACITY; + Atom _NET_WM_USER_TIME; Atom _NET_ACTIVE_WINDOW; + Atom _NET_FRAME_EXTENTS; Atom UTF8_STRING; Atom PRIMARY; Atom XdndEnter; @@ -116,11 +126,31 @@ typedef struct SDL_VideoData SDL_Scancode key_layout[256]; SDL_bool selection_waiting; + SDL_bool broken_pointer_grab; /* true if XGrabPointer seems unreliable. */ + Uint32 last_mode_change_deadline; + + SDL_bool global_mouse_changed; + SDL_Point global_mouse_position; + Uint32 global_mouse_buttons; + +#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM + XkbDescPtr xkb; +#endif + + KeyCode filter_code; + Time filter_time; + +#if SDL_VIDEO_VULKAN + /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ + void *vulkan_xlib_xcb_library; + PFN_XGetXCBConnection vulkan_XGetXCBConnection; +#endif + } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); -#endif /* _SDL_x11video_h */ +#endif /* SDL_x11video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.c new file mode 100644 index 0000000000..ec43aef9be --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.c @@ -0,0 +1,243 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +#include "SDL_x11video.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_x11vulkan.h" + +#include +/*#include */ +/* +typedef uint32_t xcb_window_t; +typedef uint32_t xcb_visualid_t; +*/ + +int X11_Vulkan_LoadLibrary(_THIS, const char *path) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasXlibSurfaceExtension = SDL_FALSE; + SDL_bool hasXCBSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + Uint32 i; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXCBSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXlibSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + if(hasXlibSurfaceExtension) + { + videoData->vulkan_xlib_xcb_library = NULL; + } + else if(!hasXCBSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement either the " + VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the " + VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else + { + const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY"); + if(!libX11XCBLibraryName) + libX11XCBLibraryName = "libX11-xcb.so"; + videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName); + if(!videoData->vulkan_xlib_xcb_library) + goto fail; + videoData->vulkan_XGetXCBConnection = + SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection"); + if(!videoData->vulkan_XGetXCBConnection) + { + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + goto fail; + } + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void X11_Vulkan_UnloadLibrary(_THIS) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(_this->vulkan_config.loader_handle) + { + if(videoData->vulkan_xlib_xcb_library) + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + if(videoData->vulkan_xlib_xcb_library) + { + static const char *const extensionsForXCB[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB); + } + else + { + static const char *const extensionsForXlib[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib); + } +} + +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + if(videoData->vulkan_xlib_xcb_library) + { + PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR = + (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXcbSurfaceKHR"); + VkXcbSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXcbSurfaceKHR) + { + SDL_SetError(VK_KHR_XCB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display); + if(!createInfo.connection) + { + SDL_SetError("XGetXCBConnection failed"); + return SDL_FALSE; + } + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXcbSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXcbSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } + else + { + PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR = + (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXlibSurfaceKHR"); + VkXlibSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXlibSurfaceKHR) + { + SDL_SetError(VK_KHR_XLIB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; + createInfo.dpy = videoData->display; + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXlibSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXlibSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.h new file mode 100644 index 0000000000..152d9d79ea --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_x11vulkan_h_ +#define SDL_x11vulkan_h_ + +#include "../SDL_vulkan_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +/*typedef struct xcb_connection_t xcb_connection_t;*/ +typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); + +int X11_Vulkan_LoadLibrary(_THIS, const char *path); +void X11_Vulkan_UnloadLibrary(_THIS); +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_x11vulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.c index afc802198e..0a254b0fff 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,11 +40,10 @@ #include "SDL_timer.h" #include "SDL_syswm.h" -#include "SDL_assert.h" +#include "SDL_log.h" #define _NET_WM_STATE_REMOVE 0l #define _NET_WM_STATE_ADD 1l -#define _NET_WM_STATE_TOGGLE 2l static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win) { @@ -130,13 +129,17 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; + /* !!! FIXME: just dereference videodata below instead of copying to locals. */ Atom _NET_WM_STATE = videodata->_NET_WM_STATE; /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN; - Atom atoms[5]; + Atom _NET_WM_STATE_ABOVE = videodata->_NET_WM_STATE_ABOVE; + Atom _NET_WM_STATE_SKIP_TASKBAR = videodata->_NET_WM_STATE_SKIP_TASKBAR; + Atom _NET_WM_STATE_SKIP_PAGER = videodata->_NET_WM_STATE_SKIP_PAGER; + Atom atoms[16]; int count = 0; /* The window manager sets this property, we shouldn't set it. @@ -147,6 +150,14 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) atoms[count++] = _NET_WM_STATE_HIDDEN; } */ + + if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { + atoms[count++] = _NET_WM_STATE_ABOVE; + } + if (flags & SDL_WINDOW_SKIP_TASKBAR) { + atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; + atoms[count++] = _NET_WM_STATE_SKIP_PAGER; + } if (flags & SDL_WINDOW_INPUT_FOCUS) { atoms[count++] = _NET_WM_STATE_FOCUSED; } @@ -157,6 +168,9 @@ X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) if (flags & SDL_WINDOW_FULLSCREEN) { atoms[count++] = _NET_WM_STATE_FULLSCREEN; } + + SDL_assert(count <= SDL_arraysize(atoms)); + if (count > 0) { X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, count); @@ -206,9 +220,24 @@ X11_GetNetWMState(_THIS, Window xwindow) } if (maximized == 3) { flags |= SDL_WINDOW_MAXIMIZED; - } else if (fullscreen == 1) { + } + + if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } + + /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN + * will not be set. Do an additional check to see if the window is unmapped + * and mark it as SDL_WINDOW_HIDDEN if it is. + */ + { + XWindowAttributes attr; + SDL_memset(&attr,0,sizeof(attr)); + X11_XGetWindowAttributes(videodata->display, xwindow, &attr); + if (attr.map_state == IsUnmapped) { + flags |= SDL_WINDOW_HIDDEN; + } + } X11_XFree(propertyValue); } @@ -355,12 +384,12 @@ X11_CreateWindow(_THIS, SDL_Window * window) XSizeHints *sizehints; XWMHints *wmhints; XClassHint *classhints; - const long _NET_WM_BYPASS_COMPOSITOR_HINT_ON = 1; Atom _NET_WM_BYPASS_COMPOSITOR; Atom _NET_WM_WINDOW_TYPE; - Atom _NET_WM_WINDOW_TYPE_NORMAL; + Atom wintype; + const char *wintype_name = NULL; + long compositor = 1; Atom _NET_WM_PID; - Atom XdndAware, xdnd_version = 5; long fevent = 0; #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL @@ -371,7 +400,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) #if SDL_VIDEO_OPENGL_EGL if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { vinfo = X11_GLES_GetVisual(_this, display, screen); @@ -396,7 +425,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) depth = displaydata->depth; } - xattr.override_redirect = False; + xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False; xattr.background_pixmap = None; xattr.border_pixel = 0; @@ -506,7 +535,8 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* Setup the input hints so we get keyboard input */ wmhints = X11_XAllocWMHints(); wmhints->input = True; - wmhints->flags = InputHint; + wmhints->window_group = data->window_group; + wmhints->flags = InputHint | WindowGroupHint; /* Setup the class hints so we can get an icon (AfterStep) */ classhints = X11_XAllocClassHint(); @@ -521,39 +551,50 @@ X11_CreateWindow(_THIS, SDL_Window * window) X11_XFree(classhints); /* Set the PID related to the window for the given hostname, if possible */ if (data->pid > 0) { + long pid = (long) data->pid; _NET_WM_PID = X11_XInternAtom(display, "_NET_WM_PID", False); X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&data->pid, 1); + (unsigned char *) &pid, 1); } /* Set the window manager state */ X11_SetNetWMState(_this, w, window->flags); - /* Let the window manager know we're a "normal" window */ + compositor = 2; /* don't disable compositing except for "normal" windows */ + + if (window->flags & SDL_WINDOW_UTILITY) { + wintype_name = "_NET_WM_WINDOW_TYPE_UTILITY"; + } else if (window->flags & SDL_WINDOW_TOOLTIP) { + wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP"; + } else if (window->flags & SDL_WINDOW_POPUP_MENU) { + wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU"; + } else { + wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL"; + compositor = 1; /* disable compositing for "normal" windows */ + } + + /* Let the window manager know what type of window we are. */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); - _NET_WM_WINDOW_TYPE_NORMAL = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False); + wintype = X11_XInternAtom(display, wintype_name, False); X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, - PropModeReplace, - (unsigned char *)&_NET_WM_WINDOW_TYPE_NORMAL, 1); - - _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); - X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, - PropModeReplace, - (unsigned char *)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON, 1); + PropModeReplace, (unsigned char *)&wintype, 1); + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, SDL_TRUE)) { + _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); + X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, + PropModeReplace, + (unsigned char *)&compositor, 1); + } { - Atom protocols[2]; + Atom protocols[3]; int proto_count = 0; - const char *ping_hint; - protocols[proto_count] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */ - proto_count++; - - ping_hint = SDL_GetHint(SDL_HINT_VIDEO_X11_NET_WM_PING); + protocols[proto_count++] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */ + protocols[proto_count++] = data->WM_TAKE_FOCUS; /* Since we will want to set input focus explicitly */ + /* Default to using ping if there is no hint */ - if (!ping_hint || SDL_atoi(ping_hint)) { - protocols[proto_count] = data->_NET_WM_PING; /* Respond so WM knows we're alive */ - proto_count++; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_PING, SDL_TRUE)) { + protocols[proto_count++] = data->_NET_WM_PING; /* Respond so WM knows we're alive */ } SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0])); @@ -571,7 +612,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { #if SDL_VIDEO_OPENGL_EGL @@ -588,7 +629,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); #endif /* SDL_VIDEO_OPENGL_EGL */ } #endif @@ -609,11 +650,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) PropertyChangeMask | StructureNotifyMask | KeymapStateMask | fevent)); - XdndAware = X11_XInternAtom(display, "XdndAware", False); - X11_XChangeProperty(display, w, XdndAware, XA_ATOM, 32, - PropModeReplace, - (unsigned char*)&xdnd_version, 1); - X11_XFlush(display); return 0; @@ -750,7 +786,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XFlush(display); } @@ -776,7 +812,7 @@ X11_SetWindowMinimumSize(_THIS, SDL_Window * window) /* See comment in X11_SetWindowSize. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } @@ -805,7 +841,7 @@ X11_SetWindowMaximumSize(_THIS, SDL_Window * window) /* See comment in X11_SetWindowSize. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } @@ -854,7 +890,7 @@ X11_SetWindowSize(_THIS, SDL_Window * window) and transitioning from windowed to fullscreen in Unity. */ X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XMoveWindow(display, data->xwindow, window->x, window->y); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); X11_XRaiseWindow(display, data->xwindow); } else { X11_XResizeWindow(display, data->xwindow, window->w, window->h); @@ -863,6 +899,61 @@ X11_SetWindowSize(_THIS, SDL_Window * window) X11_XFlush(display); } +int +X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + + *left = data->border_left; + *right = data->border_right; + *top = data->border_top; + *bottom = data->border_bottom; + + return 0; +} + +int +X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + Atom _NET_WM_WINDOW_OPACITY = data->videodata->_NET_WM_WINDOW_OPACITY; + + if (opacity == 1.0f) { + X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY); + } else { + const Uint32 FullyOpaque = 0xFFFFFFFF; + const long alpha = (long) ((double)opacity * (double)FullyOpaque); + X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&alpha, 1); + } + + return 0; +} + +int +X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) { + SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata; + SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata; + Display *display = data->videodata->display; + + X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow); + return 0; +} + +int +X11_SetWindowInputFocus(_THIS, SDL_Window * window) +{ + if (X11_IsWindowMapped(_this, window)) { + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime); + X11_XFlush(display); + return 0; + } + return -1; +} + void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { @@ -895,6 +986,44 @@ X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); } +void +X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + + XSizeHints *sizehints = X11_XAllocSizeHints(); + long userhints; + + X11_XGetWMNormalHints(display, data->xwindow, sizehints, &userhints); + + if (resizable) { + /* FIXME: Is there a better way to get max window size from X? -flibit */ + const int maxsize = 0x7FFFFFFF; + sizehints->min_width = window->min_w; + sizehints->min_height = window->min_h; + sizehints->max_width = (window->max_w == 0) ? maxsize : window->max_w; + sizehints->max_height = (window->max_h == 0) ? maxsize : window->max_h; + } else { + sizehints->min_width = window->w; + sizehints->min_height = window->h; + sizehints->max_width = window->w; + sizehints->max_height = window->h; + } + sizehints->flags |= PMinSize | PMaxSize; + + X11_XSetWMNormalHints(display, data->xwindow, sizehints); + + X11_XFree(sizehints); + + /* See comment in X11_SetWindowSize. */ + X11_XResizeWindow(display, data->xwindow, window->w, window->h); + X11_XMoveWindow(display, data->xwindow, window->x - data->border_left, window->y - data->border_top); + X11_XRaiseWindow(display, data->xwindow); + + X11_XFlush(display); +} + void X11_ShowWindow(_THIS, SDL_Window * window) { @@ -907,7 +1036,8 @@ X11_ShowWindow(_THIS, SDL_Window * window) /* Blocking wait for "MapNotify" event. * We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type, * and XCheckTypedWindowEvent doesn't block */ - X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } @@ -929,7 +1059,8 @@ X11_HideWindow(_THIS, SDL_Window * window) if (X11_IsWindowMapped(_this, window)) { X11_XWithdrawWindow(display, data->xwindow, displaydata->screen); /* Blocking wait for "UnmapNotify" event */ - X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } } @@ -946,13 +1077,15 @@ SetWindowActive(_THIS, SDL_Window * window) if (X11_IsWindowMapped(_this, window)) { XEvent e; + /*printf("SDL Window %p: sending _NET_ACTIVE_WINDOW with timestamp %lu\n", window, data->user_time);*/ + SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_ACTIVE_WINDOW; e.xclient.format = 32; e.xclient.window = data->xwindow; e.xclient.data.l[0] = 1; /* source indication. 1 = application */ - e.xclient.data.l[1] = CurrentTime; + e.xclient.data.l[1] = data->user_time; e.xclient.data.l[2] = 0; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, @@ -1038,7 +1171,7 @@ X11_RestoreWindow(_THIS, SDL_Window * window) SetWindowActive(_this, window); } -/* This asks the Window Manager to handle fullscreen for us. Most don't do it right, though. */ +/* This asks the Window Manager to handle fullscreen for us. This is the modern way. */ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { @@ -1083,6 +1216,22 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); + + /* Fullscreen windows sometimes end up being marked maximized by + window managers. Force it back to how we expect it to be. */ + if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) { + SDL_zero(e); + e.xany.type = ClientMessage; + e.xclient.message_type = _NET_WM_STATE; + e.xclient.format = 32; + e.xclient.window = data->xwindow; + e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT; + e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ; + e.xclient.data.l[3] = 0l; + X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, + SubstructureNotifyMask | SubstructureRedirectMask, &e); + } } else { Uint32 flags; @@ -1335,7 +1484,6 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) Display *display = data->videodata->display; SDL_bool oldstyle_fullscreen; SDL_bool grab_keyboard; - const char *hint; /* ICCCM2.0-compliant window managers can handle fullscreen windows If we're using XVidMode to change resolution we need to confine @@ -1345,22 +1493,32 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) if (oldstyle_fullscreen || grabbed) { /* Try to grab the mouse */ - for (;;) { - int result = - X11_XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync, - GrabModeAsync, data->xwindow, None, CurrentTime); - if (result == GrabSuccess) { - break; + if (!data->videodata->broken_pointer_grab) { + const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask; + int attempts; + int result; + + /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */ + for (attempts = 0; attempts < 100; attempts++) { + result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync, + GrabModeAsync, data->xwindow, None, CurrentTime); + if (result == GrabSuccess) { + break; + } + SDL_Delay(50); + } + + if (result != GrabSuccess) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "The X server refused to let us grab the mouse. You might experience input bugs."); + data->videodata->broken_pointer_grab = SDL_TRUE; /* don't try again. */ } - SDL_Delay(50); } /* Raise the window if we grab the mouse */ X11_XRaiseWindow(display, data->xwindow); /* Now grab the keyboard */ - hint = SDL_GetHint(SDL_HINT_GRAB_KEYBOARD); - if (hint && SDL_atoi(hint)) { + if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE)) { grab_keyboard = SDL_TRUE; } else { /* We need to do this with the old style override_redirect @@ -1428,7 +1586,7 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.x11.window = data->xwindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -1440,6 +1598,22 @@ X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } +void +X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + Atom XdndAware = X11_XInternAtom(display, "XdndAware", False); + + if (accept) { + Atom xdnd_version = 5; + X11_XChangeProperty(display, data->xwindow, XdndAware, XA_ATOM, 32, + PropModeReplace, (unsigned char*)&xdnd_version, 1); + } else { + X11_XDeleteProperty(display, data->xwindow, XdndAware); + } +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.h similarity index 82% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.h index efe7ec0f08..6ee80169f1 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11window_h -#define _SDL_x11window_h +#ifndef SDL_x11window_h_ +#define SDL_x11window_h_ /* We need to queue the focus in/out changes because they may occur during video mode changes and we can respond to them by triggering more mode @@ -56,10 +56,16 @@ typedef struct GC gc; XIC ic; SDL_bool created; + int border_left; + int border_right; + int border_top; + int border_bottom; + Uint32 last_focus_event_time; PendingFocusEnum pending_focus; Uint32 pending_focus_time; XConfigureEvent last_xconfigure; struct SDL_VideoData *videodata; + unsigned long user_time; Atom xdnd_req; Window xdnd_source; #if SDL_VIDEO_OPENGL_EGL @@ -78,6 +84,10 @@ extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void X11_SetWindowPosition(_THIS, SDL_Window * window); extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window); +extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); +extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); +extern int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window); +extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window); extern void X11_SetWindowSize(_THIS, SDL_Window * window); extern void X11_ShowWindow(_THIS, SDL_Window * window); extern void X11_HideWindow(_THIS, SDL_Window * window); @@ -86,6 +96,7 @@ extern void X11_MaximizeWindow(_THIS, SDL_Window * window); extern void X11_MinimizeWindow(_THIS, SDL_Window * window); extern void X11_RestoreWindow(_THIS, SDL_Window * window); extern void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); +extern void X11_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable); extern void X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); extern void X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); @@ -93,7 +104,8 @@ extern void X11_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); +extern void X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); -#endif /* _SDL_x11window_h */ +#endif /* SDL_x11window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.c b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.c similarity index 80% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.c index 57132fe9e0..06a8937cf0 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,35 @@ xinput2_version_atleast(const int version, const int wantmajor, const int wantmi { return ( version >= ((wantmajor * 1000) + wantminor) ); } + +#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +static void +xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window, + double in_x, double in_y, float *out_x, float *out_y) +{ + int i; + for (i = 0; i < videodata->numwindows; i++) { + SDL_WindowData *d = videodata->windowlist[i]; + if (d->xwindow == window) { + if (d->window->w == 1) { + *out_x = 0.5f; + } else { + *out_x = in_x / (d->window->w - 1); + } + if (d->window->h == 1) { + *out_y = 0.5f; + } else { + *out_y = in_y / (d->window->h - 1); + } + return; + } + } + // couldn't find the window... + *out_x = in_x; + *out_y = in_y; +} +#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ + #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ void @@ -118,6 +147,8 @@ X11_InitXinput2(_THIS) eventmask.mask = mask; XISetMask(mask, XI_RawMotion); + XISetMask(mask, XI_RawButtonPress); + XISetMask(mask, XI_RawButtonRelease); if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { return; @@ -140,6 +171,8 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) static Time prev_time = 0; static double prev_rel_coords[2]; + videodata->global_mouse_changed = SDL_TRUE; + if (!mouse->relative_mode || mouse->relative_mode_warp) { return 0; } @@ -158,25 +191,37 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) return 1; } break; + + case XI_RawButtonPress: + case XI_RawButtonRelease: + videodata->global_mouse_changed = SDL_TRUE; + break; + #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_TRUE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, x, y, 1.0); return 1; } break; case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_FALSE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_FALSE, x, y, 1.0); return 1; } break; case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouchMotion(xev->sourceid,xev->detail, - xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouchMotion(xev->sourceid,xev->detail, x, y, 1.0); return 1; } break; diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.h b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.h similarity index 91% rename from 3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.h index ed8dd1a4a0..4780fbb93a 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11xinput2_h -#define _SDL_x11xinput2_h +#ifndef SDL_x11xinput2_h_ +#define SDL_x11xinput2_h_ #ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /* Define XGenericEventCookie as forward declaration when @@ -37,6 +37,6 @@ extern int X11_Xinput2IsInitialized(void); extern int X11_Xinput2IsMultitouchSupported(void); extern void X11_Xinput2SelectTouch(_THIS, SDL_Window *window); -#endif /* _SDL_x11xinput2_h */ +#endif /* SDL_x11xinput2_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/edid-parse.c b/3rdparty/sdl2-2.0.9/src/video/x11/edid-parse.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/src/video/x11/edid-parse.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/edid-parse.c index 2c145e23c4..e22324f2cd 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/edid-parse.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/edid-parse.c @@ -21,6 +21,8 @@ */ /* Author: Soren Sandmann */ +#include "../../SDL_internal.h" +#include "SDL_stdinc.h" #include "edid.h" #include @@ -138,14 +140,14 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) }; bits = get_bits (edid[0x14], 4, 6); - info->digital.bits_per_primary = bit_depth[bits]; + info->ad.digital.bits_per_primary = bit_depth[bits]; bits = get_bits (edid[0x14], 0, 3); if (bits <= 5) - info->digital.interface = interfaces[bits]; + info->ad.digital.interface = interfaces[bits]; else - info->digital.interface = UNDEFINED; + info->ad.digital.interface = UNDEFINED; } else { @@ -159,17 +161,17 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) { 0.7, 0.0, 0.7 }, }; - info->analog.video_signal_level = levels[bits][0]; - info->analog.sync_signal_level = levels[bits][1]; - info->analog.total_signal_level = levels[bits][2]; + info->ad.analog.video_signal_level = levels[bits][0]; + info->ad.analog.sync_signal_level = levels[bits][1]; + info->ad.analog.total_signal_level = levels[bits][2]; - info->analog.blank_to_black = get_bit (edid[0x14], 4); + info->ad.analog.blank_to_black = get_bit (edid[0x14], 4); - info->analog.separate_hv_sync = get_bit (edid[0x14], 3); - info->analog.composite_sync_on_h = get_bit (edid[0x14], 2); - info->analog.composite_sync_on_green = get_bit (edid[0x14], 1); + info->ad.analog.separate_hv_sync = get_bit (edid[0x14], 3); + info->ad.analog.composite_sync_on_h = get_bit (edid[0x14], 2); + info->ad.analog.composite_sync_on_green = get_bit (edid[0x14], 1); - info->analog.serration_on_vsync = get_bit (edid[0x14], 0); + info->ad.analog.serration_on_vsync = get_bit (edid[0x14], 0); } /* Screen Size / Aspect Ratio */ @@ -211,11 +213,11 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) if (info->is_digital) { - info->digital.rgb444 = TRUE; + info->ad.digital.rgb444 = TRUE; if (get_bit (edid[0x18], 3)) - info->digital.ycrcb444 = 1; + info->ad.digital.ycrcb444 = 1; if (get_bit (edid[0x18], 4)) - info->digital.ycrcb422 = 1; + info->ad.digital.ycrcb422 = 1; } else { @@ -225,7 +227,7 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR }; - info->analog.color_type = color_type[bits]; + info->ad.analog.color_type = color_type[bits]; } info->srgb_is_standard = get_bit (edid[0x18], 2); @@ -247,7 +249,7 @@ decode_fraction (int high, int low) high = (high << 2) | low; for (i = 0; i < 10; ++i) - result += get_bit (high, i) * pow (2, i - 10); + result += get_bit (high, i) * SDL_pow (2, i - 10); return result; } @@ -453,26 +455,26 @@ decode_detailed_timing (const uchar *timing, detailed->digital_sync = get_bit (bits, 4); if (detailed->digital_sync) { - detailed->digital.composite = !get_bit (bits, 3); + detailed->ad.digital.composite = !get_bit (bits, 3); - if (detailed->digital.composite) + if (detailed->ad.digital.composite) { - detailed->digital.serrations = get_bit (bits, 2); - detailed->digital.negative_vsync = FALSE; + detailed->ad.digital.serrations = get_bit (bits, 2); + detailed->ad.digital.negative_vsync = FALSE; } else { - detailed->digital.serrations = FALSE; - detailed->digital.negative_vsync = !get_bit (bits, 2); + detailed->ad.digital.serrations = FALSE; + detailed->ad.digital.negative_vsync = !get_bit (bits, 2); } - detailed->digital.negative_hsync = !get_bit (bits, 0); + detailed->ad.digital.negative_hsync = !get_bit (bits, 0); } else { - detailed->analog.bipolar = get_bit (bits, 3); - detailed->analog.serrations = get_bit (bits, 2); - detailed->analog.sync_on_green = !get_bit (bits, 1); + detailed->ad.analog.bipolar = get_bit (bits, 3); + detailed->ad.analog.serrations = get_bit (bits, 2); + detailed->ad.analog.sync_on_green = !get_bit (bits, 1); } } @@ -577,12 +579,12 @@ dump_monitor_info (MonitorInfo *info) if (info->is_digital) { const char *interface; - if (info->digital.bits_per_primary != -1) - printf ("Bits Per Primary: %d\n", info->digital.bits_per_primary); + if (info->ad.digital.bits_per_primary != -1) + printf ("Bits Per Primary: %d\n", info->ad.digital.bits_per_primary); else printf ("Bits Per Primary: undefined\n"); - switch (info->digital.interface) + switch (info->ad.digital.interface) { case DVI: interface = "DVI"; break; case HDMI_A: interface = "HDMI-a"; break; @@ -594,27 +596,27 @@ dump_monitor_info (MonitorInfo *info) } printf ("Interface: %s\n", interface); - printf ("RGB 4:4:4: %s\n", yesno (info->digital.rgb444)); - printf ("YCrCb 4:4:4: %s\n", yesno (info->digital.ycrcb444)); - printf ("YCrCb 4:2:2: %s\n", yesno (info->digital.ycrcb422)); + printf ("RGB 4:4:4: %s\n", yesno (info->ad.digital.rgb444)); + printf ("YCrCb 4:4:4: %s\n", yesno (info->ad.digital.ycrcb444)); + printf ("YCrCb 4:2:2: %s\n", yesno (info->ad.digital.ycrcb422)); } else { const char *s; - printf ("Video Signal Level: %f\n", info->analog.video_signal_level); - printf ("Sync Signal Level: %f\n", info->analog.sync_signal_level); - printf ("Total Signal Level: %f\n", info->analog.total_signal_level); + printf ("Video Signal Level: %f\n", info->ad.analog.video_signal_level); + printf ("Sync Signal Level: %f\n", info->ad.analog.sync_signal_level); + printf ("Total Signal Level: %f\n", info->ad.analog.total_signal_level); printf ("Blank to Black: %s\n", - yesno (info->analog.blank_to_black)); + yesno (info->ad.analog.blank_to_black)); printf ("Separate HV Sync: %s\n", - yesno (info->analog.separate_hv_sync)); + yesno (info->ad.analog.separate_hv_sync)); printf ("Composite Sync on H: %s\n", - yesno (info->analog.composite_sync_on_h)); + yesno (info->ad.analog.composite_sync_on_h)); printf ("Serration on VSync: %s\n", - yesno (info->analog.serration_on_vsync)); + yesno (info->ad.analog.serration_on_vsync)); - switch (info->analog.color_type) + switch (info->ad.analog.color_type) { case UNDEFINED_COLOR: s = "undefined"; break; case MONOCHROME: s = "monochrome"; break; @@ -727,20 +729,20 @@ dump_monitor_info (MonitorInfo *info) if (timing->digital_sync) { printf (" Digital Sync:\n"); - printf (" composite: %s\n", yesno (timing->digital.composite)); - printf (" serrations: %s\n", yesno (timing->digital.serrations)); + printf (" composite: %s\n", yesno (timing->ad.digital.composite)); + printf (" serrations: %s\n", yesno (timing->ad.digital.serrations)); printf (" negative vsync: %s\n", - yesno (timing->digital.negative_vsync)); + yesno (timing->ad.digital.negative_vsync)); printf (" negative hsync: %s\n", - yesno (timing->digital.negative_hsync)); + yesno (timing->ad.digital.negative_hsync)); } else { printf (" Analog Sync:\n"); - printf (" bipolar: %s\n", yesno (timing->analog.bipolar)); - printf (" serrations: %s\n", yesno (timing->analog.serrations)); + printf (" bipolar: %s\n", yesno (timing->ad.analog.bipolar)); + printf (" serrations: %s\n", yesno (timing->ad.analog.serrations)); printf (" sync on green: %s\n", yesno ( - timing->analog.sync_on_green)); + timing->ad.analog.sync_on_green)); } } diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/edid.h b/3rdparty/sdl2-2.0.9/src/video/x11/edid.h similarity index 99% rename from 3rdparty/sdl2-2.0.4/src/video/x11/edid.h rename to 3rdparty/sdl2-2.0.9/src/video/x11/edid.h index 8c217eba2b..cb9f0e87e7 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/edid.h +++ b/3rdparty/sdl2-2.0.9/src/video/x11/edid.h @@ -74,7 +74,7 @@ struct DetailedTiming int negative_vsync; int negative_hsync; } digital; - }; + } ad; }; struct MonitorInfo @@ -118,7 +118,7 @@ struct MonitorInfo int serration_on_vsync; ColorType color_type; } analog; - }; + } ad; int width_mm; /* -1 if not specified */ int height_mm; /* -1 if not specified */ diff --git a/3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.c b/3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.c similarity index 60% rename from 3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.c rename to 3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.c index e4f086464e..40e2242435 100644 --- a/3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.c +++ b/3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.c @@ -1,297 +1,296 @@ -/* Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +/* +Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett +Copyright © 2009 Red Hat, Inc. +Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from the XFree86 -Project. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. */ + #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_X11 - -/* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.4 2003/04/29 11:29:18 pascal Exp $ */ - #include #include "imKStoUCS.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { - 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ - 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ - 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ - 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ - 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ - 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ - 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ - 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ - 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ - 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ - 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ - 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ + 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ + 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ + 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ + 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ + 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ + 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ + 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ + 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ + 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ + 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ + 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ + 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ }; static unsigned short const keysym_to_unicode_2a1_2fe[] = { - 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ - 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ - 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ - 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ - 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ - 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ + 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ + 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ + 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ + 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ + 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ + 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ }; static unsigned short const keysym_to_unicode_3a2_3fe[] = { - 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ - 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ - 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ - 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ - 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ - 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ - 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ - 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ - 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ - 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ + 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ + 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ + 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ + 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ + 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ + 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ + 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ + 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ + 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ + 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ }; static unsigned short const keysym_to_unicode_4a1_4df[] = { - 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ - 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ - 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ - 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ - 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ - 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ - 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ - 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ + 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ + 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ + 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ + 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ + 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ + 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ + 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ + 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ }; static unsigned short const keysym_to_unicode_590_5fe[] = { - 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ - 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ - - 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ - 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ - 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ - 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ - 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ - 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ + 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ + 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ + + 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ + 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ + 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ + 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ + 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ + 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ }; -static unsigned short const keysym_to_unicode_680_6ff[] = { - 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ - 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ - 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ - 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ +static unsigned short keysym_to_unicode_680_6ff[] = { + 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ + 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ + 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ + 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ }; static unsigned short const keysym_to_unicode_7a1_7f9[] = { - 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ - 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ + 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ + 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ }; static unsigned short const keysym_to_unicode_8a4_8fe[] = { - 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ - 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ - 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ - 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x22a2, 0x0000, /* 0x08c8-0x08cf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ + 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ + 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ + 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ + 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ }; static unsigned short const keysym_to_unicode_9df_9f8[] = { - 0x2422, /* 0x09d8-0x09df */ - 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ - 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ - 0x2502 /* 0x09f8-0x09ff */ + 0x2422, /* 0x09d8-0x09df */ + 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ + 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ + 0x2502 /* 0x09f8-0x09ff */ }; static unsigned short const keysym_to_unicode_aa1_afe[] = { - 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ - 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ - 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ - 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ - 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ - 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ - 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ - 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ + 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ + 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ + 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ + 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ + 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ + 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ + 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ + 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ }; /* none of the APL keysyms match the Unicode characters */ static unsigned short const keysym_to_unicode_cdf_cfa[] = { - 0x2017, /* 0x0cd8-0x0cdf */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ - 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ + 0x2017, /* 0x0cd8-0x0cdf */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ + 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ }; static unsigned short const keysym_to_unicode_da1_df9[] = { - 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ - 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ - 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ + 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ + 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ + 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ }; static unsigned short const keysym_to_unicode_ea0_eff[] = { - 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ - 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ - 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ - 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ - 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ - 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ - 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ - 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ - 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ + 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ + 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ + 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ + 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ + 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ + 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ + 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ + 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ + 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ }; -static unsigned short const keysym_to_unicode_12a1_12fe[] = { - 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ - 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ - 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ - 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ - 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ +static unsigned short keysym_to_unicode_12a1_12fe[] = { + 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ + 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ + 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ + 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ + 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; static unsigned short const keysym_to_unicode_13bc_13be[] = { - 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ + 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ }; -static unsigned short const keysym_to_unicode_14a1_14ff[] = { - 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ - 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ - 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ - 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ - 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ - 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ - 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ - 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ - 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ - 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ - 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ - 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ +static unsigned short keysym_to_unicode_14a1_14ff[] = { + 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ + 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ + 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ + 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ + 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ + 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ + 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ + 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ + 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ + 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ + 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ + 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ }; -static unsigned short const keysym_to_unicode_15d0_15f6[] = { - 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ - 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ - 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ - 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ - 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ +static unsigned short keysym_to_unicode_15d0_15f6[] = { + 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ + 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ + 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ + 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ + 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ }; -static unsigned short const keysym_to_unicode_16a0_16f6[] = { - 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ - 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ - 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ - 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ - 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ - 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ +static unsigned short keysym_to_unicode_16a0_16f6[] = { + 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ + 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ + 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ + 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ + 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ + 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ }; static unsigned short const keysym_to_unicode_1e9f_1eff[] = { - 0x0303, - 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ - 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ - 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ - 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ - 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ - 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ - 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ - 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ - 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ - 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ - 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ - 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ + 0x0303, + 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ + 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ + 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ + 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ + 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ + 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ + 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ + 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ + 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ + 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ + 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ + 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ }; static unsigned short const keysym_to_unicode_20a0_20ac[] = { - 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ - 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ + 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ + 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ }; unsigned int @@ -302,49 +301,50 @@ X11_KeySymToUcs4(KeySym keysym) return (keysym & 0x00ffffff); if (keysym > 0 && keysym < 0x100) - return keysym; + return keysym; else if (keysym > 0x1a0 && keysym < 0x200) - return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; + return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; else if (keysym > 0x2a0 && keysym < 0x2ff) - return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; + return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; else if (keysym > 0x3a1 && keysym < 0x3ff) - return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; + return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; else if (keysym > 0x4a0 && keysym < 0x4e0) - return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; + return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; else if (keysym > 0x589 && keysym < 0x5ff) - return keysym_to_unicode_590_5fe[keysym - 0x590]; + return keysym_to_unicode_590_5fe[keysym - 0x590]; else if (keysym > 0x67f && keysym < 0x700) - return keysym_to_unicode_680_6ff[keysym - 0x680]; + return keysym_to_unicode_680_6ff[keysym - 0x680]; else if (keysym > 0x7a0 && keysym < 0x7fa) - return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; + return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; else if (keysym > 0x8a3 && keysym < 0x8ff) - return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; + return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; else if (keysym > 0x9de && keysym < 0x9f9) - return keysym_to_unicode_9df_9f8[keysym - 0x9df]; + return keysym_to_unicode_9df_9f8[keysym - 0x9df]; else if (keysym > 0xaa0 && keysym < 0xaff) - return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; + return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; else if (keysym > 0xcde && keysym < 0xcfb) - return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; + return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; else if (keysym > 0xda0 && keysym < 0xdfa) - return keysym_to_unicode_da1_df9[keysym - 0xda1]; + return keysym_to_unicode_da1_df9[keysym - 0xda1]; else if (keysym > 0xe9f && keysym < 0xf00) - return keysym_to_unicode_ea0_eff[keysym - 0xea0]; + return keysym_to_unicode_ea0_eff[keysym - 0xea0]; else if (keysym > 0x12a0 && keysym < 0x12ff) - return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; + return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; else if (keysym > 0x13bb && keysym < 0x13bf) - return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; + return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; else if (keysym > 0x14a0 && keysym < 0x1500) return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; else if (keysym > 0x15cf && keysym < 0x15f7) - return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; + return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; else if (keysym > 0x169f && keysym < 0x16f7) - return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; + return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; else if (keysym > 0x1e9e && keysym < 0x1f00) - return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; + return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; else if (keysym > 0x209f && keysym < 0x20ad) - return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; + return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; else - return 0; + return 0; } #endif /* SDL_VIDEO_DRIVER_X11 */ + diff --git a/3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.h b/3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.h new file mode 100644 index 0000000000..fe4381d98f --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.h @@ -0,0 +1,32 @@ +#ifndef _imKStoUCS_h +#define _imKStoUCS_h + +/* +Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett +Copyright © 2009 Red Hat, Inc. +Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ + +extern unsigned int X11_KeySymToUcs4(KeySym keysym); + +#endif /* _imKStoUCS_h */ diff --git a/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/LICENSE b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/LICENSE new file mode 100644 index 0000000000..a76efd7be2 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Adrien Descamps +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of yuv2rgb nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/README.md b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/README.md new file mode 100644 index 0000000000..21191e9797 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/README.md @@ -0,0 +1,63 @@ +From: https://github.com/descampsa/yuv2rgb +# yuv2rgb +C library for fast image conversion between yuv420p and rgb24. + +This is a simple library for optimized image conversion between YUV420p and rgb24. +It was done mainly as an exercise to learn to use sse intrinsics, so there may still be room for optimization. + +For each conversion, a standard c optimized function and two sse function (with aligned and unaligned memory) are implemented. +The sse version requires only SSE2, which is available on any reasonably recent CPU. +The library also supports the three different YUV (YCrCb to be correct) color spaces that exist (see comments in code), and others can be added simply. + +There is a simple test program, that convert a raw YUV file to rgb ppm format, and measure computation time. +Optionally, it also compares the result and computation time with the ffmpeg implementation (that uses MMX), and with the IPP functions. + +To compile, simply do : + + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make + +The test program only support raw YUV files for the YUV420 format, and ppm for the RGB24 format. +To generate a raw yuv file, you can use avconv: + + avconv -i example.jpg -c:v rawvideo -pix_fmt yuv420p example.yuv + +To generate the rgb file, you can use the ImageMagick convert program: + + convert example.jpg example.ppm + +Then, for YUV420 to RGB24 conversion, use the test program like that: + + ./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image + +The second and third parameters are image width and height (that are needed because not available in the raw YUV file), and fourth parameter is the output filename template (several output files will be generated, named for example output_sse.ppm, output_av.ppm, etc.) + +Similarly, for RGB24 to YUV420 conversion: + + ./test_yuv_rgb yuv2rgb image.ppm image + +On my computer, the test program on a 4K image give the following for yuv2rgb: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.630193 sec + Processing time (sse2_unaligned) : 0.704394 sec + Processing time (ffmpeg_unaligned) : 1.221432 sec + Processing time (ipp_unaligned) : 0.636274 sec + Processing time (sse2_aligned) : 0.606648 sec + Processing time (ffmpeg_aligned) : 1.227100 sec + Processing time (ipp_aligned) : 0.636951 sec + +And for rgb2yuv: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.588675 sec + Processing time (sse2_unaligned) : 0.676625 sec + Processing time (ffmpeg_unaligned) : 3.385816 sec + Processing time (ipp_unaligned) : 0.593890 sec + Processing time (sse2_aligned) : 0.640630 sec + Processing time (ffmpeg_aligned) : 3.397952 sec + Processing time (ipp_aligned) : 0.579043 sec + +configuration : gcc 4.9.2, swscale 3.0.0, IPP 9.0.1, intel i7-5500U diff --git a/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb.c b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb.c new file mode 100644 index 0000000000..891dae2295 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb.c @@ -0,0 +1,687 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License +#include "../../SDL_internal.h" + +#include "yuv_rgb.h" + +#include "SDL_cpuinfo.h" +/*#include */ + +#define PRECISION 6 +#define PRECISION_FACTOR (1<[0-255]) +// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255]) +// all values are rounded to the fourth decimal + +static const YUV2RGBParam YUV2RGB[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)} +}; + +static const RGB2YUVParam RGB2YUV[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}} +}; + +/* The various layouts of YUV data we support */ +#define YUV_FORMAT_420 1 +#define YUV_FORMAT_422 2 +#define YUV_FORMAT_NV12 3 + +/* The various formats of RGB pixel that we support */ +#define RGB_FORMAT_RGB565 1 +#define RGB_FORMAT_RGB24 2 +#define RGB_FORMAT_RGBA 3 +#define RGB_FORMAT_BGRA 4 +#define RGB_FORMAT_ARGB 5 +#define RGB_FORMAT_ABGR 6 + +// divide by PRECISION_FACTOR and clamp to [0:255] interval +// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range +static uint8_t clampU8(int32_t v) +{ + static const uint8_t lut[512] = + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, + 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, + 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, + 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224, + 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 + }; + return lut[(v+128*PRECISION_FACTOR)>>PRECISION]; +} + + +#define STD_FUNCTION_NAME yuv420_rgb565_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb565_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb24_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgba_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_bgra_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_argb_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_abgr_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb565_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb24_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgba_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_bgra_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_argb_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_abgr_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *RGB, uint32_t RGB_stride, + uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + YCbCrType yuv_type) +{ + const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]); + + uint32_t x, y; + for(y=0; y<(height-1); y+=2) + { + const uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/2)*UV_stride, + *v_ptr=V+(y/2)*UV_stride; + + for(x=0; x<(width-1); x+=2) + { + // compute yuv for the four pixels, u and v values are summed + int32_t y_tmp, u_tmp, v_tmp; + + y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2]; + u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2]; + v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2]; + y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5]; + u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5]; + v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5]; + y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2]; + u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2]; + v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2]; + y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5]; + u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5]; + v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5]; + y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \ +Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \ +Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<matrix[1][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \ +U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \ +U = _mm_add_epi16(U, _mm_set1_epi16(128<matrix[2][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \ +V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \ +V = _mm_add_epi16(V, _mm_set1_epi16(128<*/ + +typedef enum +{ + YCBCR_JPEG, + YCBCR_601, + YCBCR_709 +} YCbCrType; + +// yuv to rgb, standard c implementation +void yuv420_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers must be 16 byte aligned, and strides must be divisable by 16 +void yuv420_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers do not need to be 16 byte aligned +void yuv420_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + + +// rgb to yuv, standard c implementation +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers must be 16 byte aligned, and strides must be divisible by 16 +void rgb24_yuv420_sse( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers do not need to be 16 byte aligned +void rgb24_yuv420_sseu( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + diff --git a/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_sse_func.h b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_sse_func.h new file mode 100644 index 0000000000..f81140e18e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -0,0 +1,498 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + SSE_FUNCTION_NAME + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ +/* You may define the following macro, which affects generated code: + SSE_ALIGNED +*/ + +#ifdef SSE_ALIGNED +/* Unaligned instructions seem faster, even on aligned data? */ +/* +#define LOAD_SI128 _mm_load_si128 +#define SAVE_SI128 _mm_stream_si128 +*/ +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#else +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#endif + +#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \ + r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \ + g_tmp = _mm_add_epi16( \ + _mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \ + _mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \ + b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \ + R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \ + G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \ + B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \ + R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \ + G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \ + B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \ + +#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \ + Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + \ + R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \ + G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \ + B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \ + R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \ + G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \ + B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \ + +#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \ +{ \ + __m128i red_mask, tmp1, tmp2, tmp3, tmp4; \ +\ + red_mask = _mm_set1_epi16((short)0xF800); \ + RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \ + RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \ + tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \ + tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ + tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \ + tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \ + tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \ + tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ +} + +#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \ +RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \ +RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \ +RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \ +RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \ +RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \ + +#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \ +R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \ +G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \ +G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \ +B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \ +B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \ + +#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ + +#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \ +{ \ + __m128i lo_ab, hi_ab, lo_gr, hi_gr; \ +\ + lo_ab = _mm_unpacklo_epi8( A1, B1 ); \ + hi_ab = _mm_unpackhi_epi8( A1, B1 ); \ + lo_gr = _mm_unpacklo_epi8( G1, R1 ); \ + hi_gr = _mm_unpackhi_epi8( G1, R1 ); \ + RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +\ + lo_ab = _mm_unpacklo_epi8( A2, B2 ); \ + hi_ab = _mm_unpackhi_epi8( A2, B2 ); \ + lo_gr = _mm_unpacklo_epi8( G2, R2 ); \ + hi_gr = _mm_unpackhi_epi8( G2, R2 ); \ + RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +} + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + \ + PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \ + \ + PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \ + __m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \ + \ + PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \ + \ + PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#else +#error PACK_PIXEL unimplemented +#endif + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \ + SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \ + SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \ + +#else +#error SAVE_LINE unimplemented +#endif + +#if YUV_FORMAT == YUV_FORMAT_420 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ + u = LOAD_SI128((const __m128i*)(u_ptr)); \ + v = LOAD_SI128((const __m128i*)(v_ptr)); \ + +#elif YUV_FORMAT == YUV_FORMAT_422 + +#define READ_Y(y_ptr) \ +{ \ + __m128i y1, y2; \ + y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \ + y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \ + y = _mm_packus_epi16(y1, y2); \ +} + +#define READ_UV \ +{ \ + __m128i u1, u2, u3, u4, v1, v2, v3, v4; \ + u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \ + u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \ + u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \ + u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \ + u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \ + v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \ + v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \ + v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \ + v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \ + v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \ +} + +#elif YUV_FORMAT == YUV_FORMAT_NV12 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ +{ \ + __m128i u1, u2, v1, v2; \ + u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \ + u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \ + u = _mm_packus_epi16(u1, u2); \ + v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \ + v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \ + v = _mm_packus_epi16(v1, v2); \ +} + +#else +#error READ_UV unimplemented +#endif + +#define YUV2RGB_32 \ + __m128i r_tmp, g_tmp, b_tmp; \ + __m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \ + __m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \ + __m128i y_16_1, y_16_2; \ + __m128i y, u, v, u_16, v_16; \ + __m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \ + __m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \ + \ + READ_UV \ + \ + /* process first 16 pixels of first line */\ + u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process first 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of first line */\ + u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + + +void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#elif YUV_FORMAT == YUV_FORMAT_422 + const int y_pixel_stride = 2; + const int uv_pixel_stride = 4; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 1; +#elif YUV_FORMAT == YUV_FORMAT_NV12 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 2; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif +#if RGB_FORMAT == RGB_FORMAT_RGB565 + const int rgb_pixel_stride = 2; +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + const int rgb_pixel_stride = 3; +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + const int rgb_pixel_stride = 4; +#else +#error Unknown RGB pixel size +#endif + + if (width >= 32) { + uint32_t xpos, ypos; + for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+ypos*Y_stride, + *y_ptr2=Y+(ypos+1)*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+ypos*RGB_stride, + *rgb_ptr2=RGB+(ypos+1)*RGB_stride; + + for(xpos=0; xpos<(width-31); xpos+=32) + { + YUV2RGB_32 + { + PACK_PIXEL + SAVE_LINE1 + if (uv_y_sample_interval > 1) + { + SAVE_LINE2 + } + } + + y_ptr1+=32*y_pixel_stride; + y_ptr2+=32*y_pixel_stride; + u_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + rgb_ptr1+=32*rgb_pixel_stride; + rgb_ptr2+=32*rgb_pixel_stride; + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && ypos == (height-1)) + { + const uint8_t *y_ptr=Y+ypos*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr=RGB+ypos*RGB_stride; + + STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } + + /* Catch the right column, if needed */ + { + int converted = (width & ~31); + if (converted != width) + { + const uint8_t *y_ptr=Y+converted*y_pixel_stride, + *u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval, + *v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval; + + uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride; + + STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } +} + +#undef SSE_FUNCTION_NAME +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef SSE_ALIGNED +#undef LOAD_SI128 +#undef SAVE_SI128 +#undef UV2RGB_16 +#undef ADD_Y2RGB_16 +#undef PACK_RGB24_32_STEP1 +#undef PACK_RGB24_32_STEP2 +#undef PACK_RGB24_32 +#undef PACK_RGBA_32 +#undef PACK_PIXEL +#undef SAVE_LINE1 +#undef SAVE_LINE2 +#undef READ_Y +#undef READ_UV +#undef YUV2RGB_32 diff --git a/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_std_func.h b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_std_func.h new file mode 100644 index 0000000000..f0ab5c6609 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -0,0 +1,228 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint16 *)rgb_ptr = \ + ((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \ + ((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \ + (((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \ + rgb_ptr += 2; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL(rgb_ptr) \ + rgb_ptr[0] = clampU8(y_tmp+r_tmp); \ + rgb_ptr[1] = clampU8(y_tmp+g_tmp); \ + rgb_ptr[2] = clampU8(y_tmp+b_tmp); \ + rgb_ptr += 3; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 0); \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 0); \ + rgb_ptr += 4; \ + +#else +#error PACK_PIXEL unimplemented +#endif + + +void STD_FUNCTION_NAME( + uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + #define y_pixel_stride 1 + #define uv_pixel_stride 1 + #define uv_x_sample_interval 2 + #define uv_y_sample_interval 2 +#elif YUV_FORMAT == YUV_FORMAT_422 + #define y_pixel_stride 2 + #define uv_pixel_stride 4 + #define uv_x_sample_interval 2 + #define uv_y_sample_interval 1 +#elif YUV_FORMAT == YUV_FORMAT_NV12 + #define y_pixel_stride 1 + #define uv_pixel_stride 2 + #define uv_x_sample_interval 2 + #define uv_y_sample_interval 2 +#endif + + uint32_t x, y; + for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride; + + #if uv_y_sample_interval > 1 + uint8_t *rgb_ptr2=RGB+(y+1)*RGB_stride; + #endif + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + #if uv_y_sample_interval > 1 + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + + y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + #endif + + y_ptr1+=2*y_pixel_stride; + y_ptr2+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + #if uv_y_sample_interval > 1 + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + #endif + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && y == (height-1)) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride; + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_ptr1+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + } + } + + #undef y_pixel_stride + #undef uv_pixel_stride + #undef uv_x_sample_interval + #undef uv_y_sample_interval +} + +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef PACK_PIXEL diff --git a/3rdparty/sdl2-2.0.9/test/CMakeLists.txt b/3rdparty/sdl2-2.0.9/test/CMakeLists.txt new file mode 100644 index 0000000000..3c25c5c7c9 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 2.8.11) +project(SDL2 C) + +# Global settings for all of the test targets +# FIXME: is this wrong? +remove_definitions(-DUSING_GENERATED_CONFIG_H) +link_libraries(SDL2_test SDL2-static) + +# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, +# but we need them for VS as well. +if(WINDOWS) + link_libraries(SDL2main) + add_definitions(-Dmain=SDL_main) +endif() + +add_executable(checkkeys checkkeys.c) +add_executable(loopwave loopwave.c) +add_executable(loopwavequeue loopwavequeue.c) +add_executable(testresample testresample.c) +add_executable(testaudioinfo testaudioinfo.c) + +file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) +add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) + +add_executable(testmultiaudio testmultiaudio.c) +add_executable(testaudiohotplug testaudiohotplug.c) +add_executable(testaudiocapture testaudiocapture.c) +add_executable(testatomic testatomic.c) +add_executable(testintersections testintersections.c) +add_executable(testrelative testrelative.c) +add_executable(testhittesting testhittesting.c) +add_executable(testdraw2 testdraw2.c) +add_executable(testdrawchessboard testdrawchessboard.c) +add_executable(testdropfile testdropfile.c) +add_executable(testerror testerror.c) +add_executable(testfile testfile.c) +add_executable(testgamecontroller testgamecontroller.c) +add_executable(testgesture testgesture.c) +add_executable(testgl2 testgl2.c) +add_executable(testgles testgles.c) +add_executable(testgles2 testgles2.c) +add_executable(testhaptic testhaptic.c) +add_executable(testhotplug testhotplug.c) +add_executable(testrumble testrumble.c) +add_executable(testthread testthread.c) +add_executable(testiconv testiconv.c) +add_executable(testime testime.c) +add_executable(testjoystick testjoystick.c) +add_executable(testkeys testkeys.c) +add_executable(testloadso testloadso.c) +add_executable(testlock testlock.c) + +if(APPLE) + add_executable(testnative testnative.c + testnativecocoa.m + testnativex11.c) +elseif(WINDOWS) + add_executable(testnative testnative.c testnativew32.c) +elseif(UNIX) + add_executable(testnative testnative.c testnativex11.c) +endif() + +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) +add_executable(testplatform testplatform.c) +add_executable(testpower testpower.c) +add_executable(testfilesystem testfilesystem.c) +add_executable(testrendertarget testrendertarget.c) +add_executable(testscale testscale.c) +add_executable(testsem testsem.c) +add_executable(testshader testshader.c) +add_executable(testshape testshape.c) +add_executable(testsprite2 testsprite2.c) +add_executable(testspriteminimal testspriteminimal.c) +add_executable(teststreaming teststreaming.c) +add_executable(testtimer testtimer.c) +add_executable(testver testver.c) +add_executable(testviewport testviewport.c) +add_executable(testwm2 testwm2.c) +add_executable(testyuv testyuv.c testyuv_cvt.c) +add_executable(torturethread torturethread.c) +add_executable(testrendercopyex testrendercopyex.c) +add_executable(testmessage testmessage.c) +add_executable(testdisplayinfo testdisplayinfo.c) +add_executable(testqsort testqsort.c) +add_executable(testbounds testbounds.c) +add_executable(testcustomcursor testcustomcursor.c) +add_executable(controllermap controllermap.c) +add_executable(testvulkan testvulkan.c) + +# HACK: Dummy target to cause the resource files to be copied to the build directory. +# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression. +# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n") +add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c) + +file(GLOB RESOURCE_FILES *.bmp *.wav) +foreach(RESOURCE_FILE ${RESOURCE_FILES}) + add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) +endforeach(RESOURCE_FILE) + +file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +# TODO: Might be easier to make all targets depend on the resources...? +add_dependencies(testscale SDL2_test_resoureces) +add_dependencies(testrendercopyex SDL2_test_resoureces) +add_dependencies(controllermap SDL2_test_resoureces) +add_dependencies(testyuv SDL2_test_resoureces) +add_dependencies(testgamecontroller SDL2_test_resoureces) +add_dependencies(testshape SDL2_test_resoureces) +add_dependencies(testshader SDL2_test_resoureces) +add_dependencies(testnative SDL2_test_resoureces) +add_dependencies(testspriteminimal SDL2_test_resoureces) +add_dependencies(testautomation SDL2_test_resoureces) +add_dependencies(testcustomcursor SDL2_test_resoureces) +add_dependencies(testrendertarget SDL2_test_resoureces) +add_dependencies(testsprite2 SDL2_test_resoureces) + +add_dependencies(loopwave SDL2_test_resoureces) +add_dependencies(loopwavequeue SDL2_test_resoureces) +add_dependencies(testresample SDL2_test_resoureces) +add_dependencies(testaudiohotplug SDL2_test_resoureces) +add_dependencies(testmultiaudio SDL2_test_resoureces) diff --git a/3rdparty/sdl2-2.0.4/test/COPYING b/3rdparty/sdl2-2.0.9/test/COPYING similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/COPYING rename to 3rdparty/sdl2-2.0.9/test/COPYING diff --git a/3rdparty/sdl2-2.0.4/test/Makefile.in b/3rdparty/sdl2-2.0.9/test/Makefile.in similarity index 84% rename from 3rdparty/sdl2-2.0.4/test/Makefile.in rename to 3rdparty/sdl2-2.0.9/test/Makefile.in index 9a1df774e0..9ddd6ffe77 100644 --- a/3rdparty/sdl2-2.0.4/test/Makefile.in +++ b/3rdparty/sdl2-2.0.9/test/Makefile.in @@ -9,16 +9,23 @@ LIBS = @LIBS@ TARGETS = \ checkkeys$(EXE) \ + controllermap$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ + testaudiocapture$(EXE) \ + testaudiohotplug$(EXE) \ testaudioinfo$(EXE) \ testautomation$(EXE) \ + testbounds$(EXE) \ + testcustomcursor$(EXE) \ + testdisplayinfo$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ + testfilesystem$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ testgl2$(EXE) \ @@ -26,44 +33,44 @@ TARGETS = \ testgles2$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ - testrumble$(EXE) \ testhotplug$(EXE) \ - testthread$(EXE) \ testiconv$(EXE) \ testime$(EXE) \ testintersections$(EXE) \ - testrelative$(EXE) \ testjoystick$(EXE) \ testkeys$(EXE) \ testloadso$(EXE) \ testlock$(EXE) \ + testmessage$(EXE) \ testmultiaudio$(EXE) \ - testaudiohotplug$(EXE) \ testnative$(EXE) \ testoverlay2$(EXE) \ testplatform$(EXE) \ testpower$(EXE) \ - testfilesystem$(EXE) \ + testqsort$(EXE) \ + testrelative$(EXE) \ + testrendercopyex$(EXE) \ testrendertarget$(EXE) \ testresample$(EXE) \ + testrumble$(EXE) \ testscale$(EXE) \ testsem$(EXE) \ + testsensor$(EXE) \ testshader$(EXE) \ testshape$(EXE) \ testsprite2$(EXE) \ testspriteminimal$(EXE) \ teststreaming$(EXE) \ + testthread$(EXE) \ testtimer$(EXE) \ testver$(EXE) \ testviewport$(EXE) \ + testvulkan$(EXE) \ testwm2$(EXE) \ + testyuv$(EXE) \ torturethread$(EXE) \ - testrendercopyex$(EXE) \ - testmessage$(EXE) \ - testdisplayinfo$(EXE) \ - controllermap$(EXE) \ -all: Makefile $(TARGETS) +all: Makefile $(TARGETS) copydatafiles Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -110,6 +117,9 @@ testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + testatomic$(EXE): $(srcdir)/testatomic.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -210,7 +220,7 @@ endif endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -231,6 +241,9 @@ testscale$(EXE): $(srcdir)/testscale.c testsem$(EXE): $(srcdir)/testsem.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testsensor$(EXE): $(srcdir)/testsensor.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + testshader$(EXE): $(srcdir)/testshader.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@ @@ -258,6 +271,9 @@ testviewport$(EXE): $(srcdir)/testviewport.c testwm2$(EXE): $(srcdir)/testwm2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -270,9 +286,21 @@ testmessage$(EXE): $(srcdir)/testmessage.c testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testqsort$(EXE): $(srcdir)/testqsort.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +testbounds$(EXE): $(srcdir)/testbounds.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testvulkan$(EXE): $(srcdir)/testvulkan.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + clean: rm -f $(TARGETS) @@ -281,3 +309,26 @@ distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* + + +%.bmp: $(srcdir)/%.bmp + cp $< $@ + +%.wav: $(srcdir)/%.wav + cp $< $@ + +%.dat: $(srcdir)/%.dat + cp $< $@ + +copydatafiles: copybmpfiles copywavfiles copydatfiles +.PHONY : copydatafiles + +copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp))) +.PHONY : copybmpfiles + +copywavfiles: $(foreach wav,$(wildcard $(srcdir)/*.wav),$(notdir $(wav))) +.PHONY : copywavfiles + +copydatfiles: $(foreach dat,$(wildcard $(srcdir)/*.dat),$(notdir $(dat))) +.PHONY : copydatfiles + diff --git a/3rdparty/sdl2-2.0.4/test/README b/3rdparty/sdl2-2.0.9/test/README similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/README rename to 3rdparty/sdl2-2.0.9/test/README diff --git a/3rdparty/sdl2-2.0.4/test/acinclude.m4 b/3rdparty/sdl2-2.0.9/test/acinclude.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/acinclude.m4 rename to 3rdparty/sdl2-2.0.9/test/acinclude.m4 diff --git a/3rdparty/sdl2-2.0.4/test/aclocal.m4 b/3rdparty/sdl2-2.0.9/test/aclocal.m4 similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/aclocal.m4 rename to 3rdparty/sdl2-2.0.9/test/aclocal.m4 diff --git a/3rdparty/sdl2-2.0.4/test/autogen.sh b/3rdparty/sdl2-2.0.9/test/autogen.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/autogen.sh rename to 3rdparty/sdl2-2.0.9/test/autogen.sh diff --git a/3rdparty/sdl2-2.0.9/test/axis.bmp b/3rdparty/sdl2-2.0.9/test/axis.bmp new file mode 100644 index 0000000000..2b3a7c8af6 Binary files /dev/null and b/3rdparty/sdl2-2.0.9/test/axis.bmp differ diff --git a/3rdparty/sdl2-2.0.4/test/button.bmp b/3rdparty/sdl2-2.0.9/test/button.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/button.bmp rename to 3rdparty/sdl2-2.0.9/test/button.bmp diff --git a/3rdparty/sdl2-2.0.4/test/checkkeys.c b/3rdparty/sdl2-2.0.9/test/checkkeys.c similarity index 91% rename from 3rdparty/sdl2-2.0.4/test/checkkeys.c rename to 3rdparty/sdl2-2.0.9/test/checkkeys.c index 771369fa3f..4452acaba5 100644 --- a/3rdparty/sdl2-2.0.4/test/checkkeys.c +++ b/3rdparty/sdl2-2.0.9/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -168,7 +168,19 @@ loop() PrintText("INPUT", event.text.text); break; case SDL_MOUSEBUTTONDOWN: - /* Any button press quits the app... */ + /* Left button quits the app, other buttons toggles text input */ + if (event.button.button == SDL_BUTTON_LEFT) { + done = 1; + } else { + if (SDL_IsTextInputActive()) { + SDL_Log("Stopping text input\n"); + SDL_StopTextInput(); + } else { + SDL_Log("Starting text input\n"); + SDL_StartTextInput(); + } + } + break; case SDL_QUIT: done = 1; break; diff --git a/3rdparty/sdl2-2.0.4/test/configure b/3rdparty/sdl2-2.0.9/test/configure similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/configure rename to 3rdparty/sdl2-2.0.9/test/configure diff --git a/3rdparty/sdl2-2.0.4/test/configure.in b/3rdparty/sdl2-2.0.9/test/configure.in similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/configure.in rename to 3rdparty/sdl2-2.0.9/test/configure.in diff --git a/3rdparty/sdl2-2.0.4/test/controllermap.bmp b/3rdparty/sdl2-2.0.9/test/controllermap.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/controllermap.bmp rename to 3rdparty/sdl2-2.0.9/test/controllermap.bmp diff --git a/3rdparty/sdl2-2.0.9/test/controllermap.c b/3rdparty/sdl2-2.0.9/test/controllermap.c new file mode 100644 index 0000000000..2ca53518a7 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/controllermap.c @@ -0,0 +1,781 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* Game controller mapping generator */ +/* Gabriel Jacobo */ + +#include +#include +#include + +#include "SDL.h" + +#ifndef SDL_JOYSTICK_DISABLED + +#ifdef __IPHONEOS__ +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 480 +#else +#define SCREEN_WIDTH 512 +#define SCREEN_HEIGHT 320 +#endif + +#define MARKER_BUTTON 1 +#define MARKER_AXIS 2 + +enum +{ + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BINDING_AXIS_MAX, +}; + +#define BINDING_COUNT (SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_MAX) + +static struct +{ + int x, y; + double angle; + int marker; + +} s_arrBindingDisplay[BINDING_COUNT] = { + { 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */ + { 431, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_B */ + { 342, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_X */ + { 389, 101, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_Y */ + { 174, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_BACK */ + { 233, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_GUIDE */ + { 289, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_START */ + { 75, 154, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */ + { 305, 230, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */ + { 77, 40, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */ + { 396, 36, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */ + { 154, 188, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_UP */ + { 154, 249, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */ + { 116, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */ + { 186, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */ + { 74, 153, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE */ + { 74, 153, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE */ + { 74, 153, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE */ + { 74, 153, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE */ + { 306, 231, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE */ + { 306, 231, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE */ + { 306, 231, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE */ + { 306, 231, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE */ + { 91, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT */ + { 375, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT */ +}; + +static int s_arrBindingOrder[BINDING_COUNT] = { + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, +}; + +typedef struct +{ + SDL_GameControllerBindType bindType; + union + { + int button; + + struct { + int axis; + int axis_min; + int axis_max; + } axis; + + struct { + int hat; + int hat_mask; + } hat; + + } value; + + SDL_bool committed; + +} SDL_GameControllerExtendedBind; + +static SDL_GameControllerExtendedBind s_arrBindings[BINDING_COUNT]; + +typedef struct +{ + SDL_bool m_bMoving; + int m_nStartingValue; + int m_nFarthestValue; +} AxisState; + +static int s_nNumAxes; +static AxisState *s_arrAxisState; + +static int s_iCurrentBinding; +static Uint32 s_unPendingAdvanceTime; +static SDL_bool s_bBindingComplete; + +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + +static int +StandardizeAxisValue(int nValue) +{ + if (nValue > SDL_JOYSTICK_AXIS_MAX/2) { + return SDL_JOYSTICK_AXIS_MAX; + } else if (nValue < SDL_JOYSTICK_AXIS_MIN/2) { + return SDL_JOYSTICK_AXIS_MIN; + } else { + return 0; + } +} + +static void +SetCurrentBinding(int iBinding) +{ + int iIndex; + SDL_GameControllerExtendedBind *pBinding; + + if (iBinding < 0) { + return; + } + + if (iBinding == BINDING_COUNT) { + s_bBindingComplete = SDL_TRUE; + return; + } + + s_iCurrentBinding = iBinding; + + pBinding = &s_arrBindings[s_arrBindingOrder[s_iCurrentBinding]]; + SDL_zerop(pBinding); + + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + s_arrAxisState[iIndex].m_nFarthestValue = s_arrAxisState[iIndex].m_nStartingValue; + } + + s_unPendingAdvanceTime = 0; +} + +static SDL_bool +BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const SDL_GameControllerExtendedBind *pBindingB) +{ + if (pBindingA->bindType != pBindingB->bindType) + { + return SDL_FALSE; + } + switch (pBindingA->bindType) + { + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBindingA->value.axis.axis != pBindingB->value.axis.axis) { + return SDL_FALSE; + } + if (!pBindingA->committed) { + return SDL_FALSE; + } + { + int minA = SDL_min(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int maxA = SDL_max(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int minB = SDL_min(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + int maxB = SDL_max(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + return (minA <= minB && maxA >= maxB); + } + /* Not reached */ + default: + return SDL_memcmp(pBindingA, pBindingB, sizeof(*pBindingA)) == 0; + } +} + +static void +ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding) +{ + SDL_GameControllerExtendedBind *pCurrent; + int iIndex; + int iCurrentElement = s_arrBindingOrder[s_iCurrentBinding]; + + /* Do we already have this binding? */ + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + pCurrent = &s_arrBindings[iIndex]; + if (BBindingContainsBinding(pCurrent, pBinding)) { + if (iIndex == SDL_CONTROLLER_BUTTON_A && iCurrentElement != SDL_CONTROLLER_BUTTON_B) { + /* Skip to the next binding */ + SetCurrentBinding(s_iCurrentBinding + 1); + return; + } + + if (iIndex == SDL_CONTROLLER_BUTTON_B) { + /* Go back to the previous binding */ + SetCurrentBinding(s_iCurrentBinding - 1); + return; + } + + /* Already have this binding, ignore it */ + return; + } + } + +#ifdef DEBUG_CONTROLLERMAP + switch ( pBinding->bindType ) + { + case SDL_CONTROLLER_BINDTYPE_NONE: + break; + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_Log("Configuring button binding for button %d\n", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + SDL_Log("Configuring axis binding for axis %d %d/%d committed = %s\n", pBinding->value.axis.axis, pBinding->value.axis.axis_min, pBinding->value.axis.axis_max, pBinding->committed ? "true" : "false"); + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_Log("Configuring hat binding for hat %d %d\n", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + } +#endif /* DEBUG_CONTROLLERMAP */ + + /* Should the new binding override the existing one? */ + pCurrent = &s_arrBindings[iCurrentElement]; + if (pCurrent->bindType != SDL_CONTROLLER_BINDTYPE_NONE) { + SDL_bool bNativeDPad, bCurrentDPad; + SDL_bool bNativeAxis, bCurrentAxis; + + bNativeDPad = (iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_UP || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_DOWN || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_LEFT || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_RIGHT); + bCurrentDPad = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_HAT); + if (bNativeDPad && bCurrentDPad) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + + bNativeAxis = (iCurrentElement >= SDL_CONTROLLER_BUTTON_MAX); + bCurrentAxis = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_AXIS); + if (bNativeAxis == bCurrentAxis && + (pBinding->bindType != SDL_CONTROLLER_BINDTYPE_AXIS || + pBinding->value.axis.axis != pCurrent->value.axis.axis)) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + } + + *pCurrent = *pBinding; + + if (pBinding->committed) { + s_unPendingAdvanceTime = SDL_GetTicks(); + } else { + s_unPendingAdvanceTime = 0; + } +} + +static SDL_bool +BMergeAxisBindings(int iIndex) +{ + SDL_GameControllerExtendedBind *pBindingA = &s_arrBindings[iIndex]; + SDL_GameControllerExtendedBind *pBindingB = &s_arrBindings[iIndex+1]; + if (pBindingA->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingB->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingA->value.axis.axis == pBindingB->value.axis.axis) { + if (pBindingA->value.axis.axis_min == pBindingB->value.axis.axis_min) { + pBindingA->value.axis.axis_min = pBindingA->value.axis.axis_max; + pBindingA->value.axis.axis_max = pBindingB->value.axis.axis_max; + pBindingB->bindType = SDL_CONTROLLER_BINDTYPE_NONE; + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void +WatchJoystick(SDL_Joystick * joystick) +{ + SDL_Window *window = NULL; + SDL_Renderer *screen = NULL; + SDL_Texture *background, *button, *axis, *marker; + const char *name = NULL; + SDL_bool done = SDL_FALSE; + SDL_Event event; + SDL_Rect dst; + Uint8 alpha=200, alpha_step = -1; + Uint32 alpha_ticks = 0; + SDL_JoystickID nJoystickID; + int iIndex; + + /* Create a window to display joystick axis position */ + window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, + SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, + SCREEN_HEIGHT, 0); + if (window == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + return; + } + + screen = SDL_CreateRenderer(window, -1, 0); + if (screen == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + SDL_DestroyWindow(window); + return; + } + + background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); + button = LoadTexture(screen, "button.bmp", SDL_TRUE); + axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); + SDL_RaiseWindow(window); + + /* scale for platforms that don't give you the window size you asked for. */ + SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT); + + /* Print info about the joystick we are watching */ + name = SDL_JoystickName(joystick); + SDL_Log("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick), + name ? name : "Unknown Joystick"); + SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n", + SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick), + SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick)); + + SDL_Log("\n\n\ + ====================================================================================\n\ + Press the buttons on your controller when indicated\n\ + (Your controller may look different than the picture)\n\ + If you want to correct a mistake, press backspace or the back button on your device\n\ + To skip a button, press SPACE or click/touch the screen\n\ + To exit, press ESC\n\ + ====================================================================================\n"); + + nJoystickID = SDL_JoystickInstanceID(joystick); + + s_nNumAxes = SDL_JoystickNumAxes(joystick); + s_arrAxisState = (AxisState *)SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState)); + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + AxisState *pAxisState = &s_arrAxisState[iIndex]; + Sint16 nInitialValue; + pAxisState->m_bMoving = SDL_JoystickGetAxisInitialState(joystick, iIndex, &nInitialValue); + pAxisState->m_nStartingValue = nInitialValue; + pAxisState->m_nFarthestValue = nInitialValue; + } + + /* Loop, getting joystick events! */ + while (!done && !s_bBindingComplete) { + int iElement = s_arrBindingOrder[s_iCurrentBinding]; + + switch (s_arrBindingDisplay[iElement].marker) { + case MARKER_AXIS: + marker = axis; + break; + case MARKER_BUTTON: + marker = button; + break; + default: + break; + } + + dst.x = s_arrBindingDisplay[iElement].x; + dst.y = s_arrBindingDisplay[iElement].y; + SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h); + + if (SDL_GetTicks() - alpha_ticks > 5) { + alpha_ticks = SDL_GetTicks(); + alpha += alpha_step; + if (alpha == 255) { + alpha_step = -1; + } + if (alpha < 128) { + alpha_step = 1; + } + } + + SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); + SDL_RenderClear(screen); + SDL_RenderCopy(screen, background, NULL, NULL); + SDL_SetTextureAlphaMod(marker, alpha); + SDL_SetTextureColorMod(marker, 10, 255, 21); + SDL_RenderCopyEx(screen, marker, NULL, &dst, s_arrBindingDisplay[iElement].angle, NULL, SDL_FLIP_NONE); + SDL_RenderPresent(screen); + + while (SDL_PollEvent(&event) > 0) { + switch (event.type) { + case SDL_JOYDEVICEREMOVED: + if (event.jaxis.which == nJoystickID) { + done = SDL_TRUE; + } + break; + case SDL_JOYAXISMOTION: + if (event.jaxis.which == nJoystickID) { + AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis]; + int nValue = event.jaxis.value; + int nCurrentDistance, nFarthestDistance; + if (!pAxisState->m_bMoving) { + pAxisState->m_bMoving = SDL_TRUE; + pAxisState->m_nStartingValue = nValue; + pAxisState->m_nFarthestValue = nValue; + } + nCurrentDistance = SDL_abs(nValue - pAxisState->m_nStartingValue); + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + if (nCurrentDistance > nFarthestDistance) { + pAxisState->m_nFarthestValue = nValue; + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + } + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event.jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); +#endif + if (nFarthestDistance >= 16000) { + /* If we've gone out far enough and started to come back, let's bind this axis */ + SDL_bool bCommitBinding = (nCurrentDistance <= 10000) ? SDL_TRUE : SDL_FALSE; + SDL_GameControllerExtendedBind binding; + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; + binding.value.axis.axis = event.jaxis.axis; + binding.value.axis.axis_min = StandardizeAxisValue(pAxisState->m_nStartingValue); + binding.value.axis.axis_max = StandardizeAxisValue(pAxisState->m_nFarthestValue); + binding.committed = bCommitBinding; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYHATMOTION: + if (event.jhat.which == nJoystickID) { + if (event.jhat.value != SDL_HAT_CENTERED) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("HAT %d %d\n", event.jhat.hat, event.jhat.value); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_HAT; + binding.value.hat.hat = event.jhat.hat; + binding.value.hat.hat_mask = event.jhat.value; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYBALLMOTION: + break; + case SDL_JOYBUTTONDOWN: + if (event.jbutton.which == nJoystickID) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("BUTTON %d\n", event.jbutton.button); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; + binding.value.button = event.jbutton.button; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + break; + case SDL_FINGERDOWN: + case SDL_MOUSEBUTTONDOWN: + /* Skip this step */ + SetCurrentBinding(s_iCurrentBinding + 1); + break; + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { + SetCurrentBinding(s_iCurrentBinding - 1); + break; + } + if (event.key.keysym.sym == SDLK_SPACE) { + SetCurrentBinding(s_iCurrentBinding + 1); + break; + } + + if ((event.key.keysym.sym != SDLK_ESCAPE)) { + break; + } + /* Fall through to signal quit */ + case SDL_QUIT: + done = SDL_TRUE; + break; + default: + break; + } + } + + SDL_Delay(15); + + /* Wait 100 ms for joystick events to stop coming in, + in case a controller sends multiple events for a single control (e.g. axis and button for trigger) + */ + if (s_unPendingAdvanceTime && SDL_GetTicks() - s_unPendingAdvanceTime >= 100) { + SetCurrentBinding(s_iCurrentBinding + 1); + } + } + + if (s_bBindingComplete) { + char mapping[1024]; + char trimmed_name[128]; + char *spot; + int iIndex; + char pszElement[12]; + + SDL_strlcpy(trimmed_name, name, SDL_arraysize(trimmed_name)); + while (SDL_isspace(trimmed_name[0])) { + SDL_memmove(&trimmed_name[0], &trimmed_name[1], SDL_strlen(trimmed_name)); + } + while (trimmed_name[0] && SDL_isspace(trimmed_name[SDL_strlen(trimmed_name) - 1])) { + trimmed_name[SDL_strlen(trimmed_name) - 1] = '\0'; + } + while ((spot = SDL_strchr(trimmed_name, ',')) != NULL) { + SDL_memmove(spot, spot + 1, SDL_strlen(spot)); + } + + /* Initialize mapping with GUID and name */ + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), mapping, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, trimmed_name, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, "platform:", SDL_arraysize(mapping)); + SDL_strlcat(mapping, SDL_GetPlatform(), SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + SDL_GameControllerExtendedBind *pBinding = &s_arrBindings[iIndex]; + if (pBinding->bindType == SDL_CONTROLLER_BINDTYPE_NONE) { + continue; + } + + if (iIndex < SDL_CONTROLLER_BUTTON_MAX) { + SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex; + SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping)); + } else { + const char *pszAxisName; + switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) { + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERLEFT); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT); + break; + } + SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); + } + SDL_strlcat(mapping, ":", SDL_arraysize(mapping)); + + pszElement[0] = '\0'; + switch (pBinding->bindType) { + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_snprintf(pszElement, sizeof(pszElement), "b%d", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MIN) { + /* The negative half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "-a%d", pBinding->value.axis.axis); + } else if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MAX) { + /* The positive half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "+a%d", pBinding->value.axis.axis); + } else { + SDL_snprintf(pszElement, sizeof(pszElement), "a%d", pBinding->value.axis.axis); + if (pBinding->value.axis.axis_min > pBinding->value.axis.axis_max) { + /* Invert the axis */ + SDL_strlcat(pszElement, "~", SDL_arraysize(pszElement)); + } + } + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_snprintf(pszElement, sizeof(pszElement), "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + default: + SDL_assert(!"Unknown bind type"); + break; + } + SDL_strlcat(mapping, pszElement, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + } + + SDL_Log("Mapping:\n\n%s\n\n", mapping); + /* Print to stdout as well so the user can cat the output somewhere */ + printf("%s\n", mapping); + } + + SDL_free(s_arrAxisState); + s_arrAxisState = NULL; + + SDL_DestroyRenderer(screen); + SDL_DestroyWindow(window); +} + +int +main(int argc, char *argv[]) +{ + const char *name; + int i; + SDL_Joystick *joystick; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize SDL (Note: video is required to start event loop) */ + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + exit(1); + } + + /* Print information about the joysticks */ + SDL_Log("There are %d joysticks attached\n", SDL_NumJoysticks()); + for (i = 0; i < SDL_NumJoysticks(); ++i) { + name = SDL_JoystickNameForIndex(i); + SDL_Log("Joystick %d: %s\n", i, name ? name : "Unknown Joystick"); + joystick = SDL_JoystickOpen(i); + if (joystick == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_JoystickOpen(%d) failed: %s\n", i, + SDL_GetError()); + } else { + char guid[64]; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), + guid, sizeof (guid)); + SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick)); + SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); + SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); + SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); + SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); + SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); + SDL_JoystickClose(joystick); + } + } + +#ifdef __ANDROID__ + if (SDL_NumJoysticks() > 0) { +#else + if (argv[1]) { +#endif + int device; +#ifdef __ANDROID__ + device = 0; +#else + device = atoi(argv[1]); +#endif + joystick = SDL_JoystickOpen(device); + if (joystick == NULL) { + SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); + } else { + WatchJoystick(joystick); + SDL_JoystickClose(joystick); + } + } + else { + SDL_Log("\n\nUsage: ./controllermap number\nFor example: ./controllermap 0\nOr: ./controllermap 0 >> gamecontrollerdb.txt"); + } + SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); + + return 0; +} + +#else + +int +main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n"); + exit(1); +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/emscripten/joystick-pre.js b/3rdparty/sdl2-2.0.9/test/emscripten/joystick-pre.js similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/emscripten/joystick-pre.js rename to 3rdparty/sdl2-2.0.9/test/emscripten/joystick-pre.js diff --git a/3rdparty/sdl2-2.0.4/test/gcc-fat.sh b/3rdparty/sdl2-2.0.9/test/gcc-fat.sh similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/gcc-fat.sh rename to 3rdparty/sdl2-2.0.9/test/gcc-fat.sh diff --git a/3rdparty/sdl2-2.0.4/test/icon.bmp b/3rdparty/sdl2-2.0.9/test/icon.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/icon.bmp rename to 3rdparty/sdl2-2.0.9/test/icon.bmp diff --git a/3rdparty/sdl2-2.0.4/test/loopwave.c b/3rdparty/sdl2-2.0.9/test/loopwave.c similarity index 73% rename from 3rdparty/sdl2-2.0.4/test/loopwave.c rename to 3rdparty/sdl2-2.0.9/test/loopwave.c index ec9f528191..88d8fc8718 100644 --- a/3rdparty/sdl2-2.0.4/test/loopwave.c +++ b/3rdparty/sdl2-2.0.9/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,17 +20,13 @@ #include #include -#if HAVE_SIGNAL_H -#include -#endif - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ @@ -38,6 +34,7 @@ struct int soundpos; /* Current play position */ } wave; +static SDL_AudioDeviceID device; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -47,6 +44,37 @@ quit(int rc) exit(rc); } +static void +close_audio() +{ + if (device != 0) { + SDL_CloseAudioDevice(device); + device = 0; + } +} + +static void +open_audio() +{ + /* Initialize fillerup() variables */ + device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); + if (!device) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_FreeWAV(wave.sound); + quit(2); + } + + + /* Let the audio run */ + SDL_PauseAudioDevice(device, SDL_FALSE); +} + +static void reopen_audio() +{ + close_audio(); + open_audio(); +} + void SDLCALL fillerup(void *unused, Uint8 * stream, int len) @@ -72,17 +100,12 @@ fillerup(void *unused, Uint8 * stream, int len) } static int done = 0; -void -poked(int sig) -{ - done = 1; -} #ifdef __EMSCRIPTEN__ void loop() { - if(done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) + if(done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) emscripten_cancel_main_loop(); } #endif @@ -97,7 +120,7 @@ main(int argc, char *argv[]) SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Load the SDL library */ - if (SDL_Init(SDL_INIT_AUDIO) < 0) { + if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_EVENTS) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } @@ -114,17 +137,6 @@ main(int argc, char *argv[]) } wave.spec.callback = fillerup; -#if HAVE_SIGNAL_H - /* Set the signals */ -#ifdef SIGHUP - signal(SIGHUP, poked); -#endif - signal(SIGINT, poked); -#ifdef SIGQUIT - signal(SIGQUIT, poked); -#endif - signal(SIGTERM, poked); -#endif /* HAVE_SIGNAL_H */ /* Show the list of available drivers */ SDL_Log("Available audio drivers:"); @@ -132,27 +144,33 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - /* Initialize fillerup() variables */ - if (SDL_OpenAudio(&wave.spec, NULL) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); - SDL_FreeWAV(wave.sound); - quit(2); - } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); - /* Let the audio run */ - SDL_PauseAudio(0); + open_audio(); + + SDL_FlushEvents(SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) - SDL_Delay(1000); + while (!done) { + SDL_Event event; + + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if ((event.type == SDL_AUDIODEVICEADDED && !event.adevice.iscapture) || + (event.type == SDL_AUDIODEVICEREMOVED && !event.adevice.iscapture && event.adevice.which == device)) { + reopen_audio(); + } + } + SDL_Delay(100); + } #endif /* Clean up on signal */ - SDL_CloseAudio(); + close_audio(); SDL_FreeWAV(wave.sound); SDL_Quit(); return (0); diff --git a/3rdparty/sdl2-2.0.4/test/loopwavequeue.c b/3rdparty/sdl2-2.0.9/test/loopwavequeue.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/test/loopwavequeue.c rename to 3rdparty/sdl2-2.0.9/test/loopwavequeue.c index 85f5bd5793..3f0a69e159 100644 --- a/3rdparty/sdl2-2.0.4/test/loopwavequeue.c +++ b/3rdparty/sdl2-2.0.9/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,12 +25,11 @@ #include #endif -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ Uint32 soundlen; /* Length of wave data */ - int soundpos; /* Current play position */ } wave; diff --git a/3rdparty/sdl2-2.0.4/test/moose.dat b/3rdparty/sdl2-2.0.9/test/moose.dat similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/moose.dat rename to 3rdparty/sdl2-2.0.9/test/moose.dat diff --git a/3rdparty/sdl2-2.0.4/test/nacl/Makefile b/3rdparty/sdl2-2.0.9/test/nacl/Makefile similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/nacl/Makefile rename to 3rdparty/sdl2-2.0.9/test/nacl/Makefile diff --git a/3rdparty/sdl2-2.0.4/test/nacl/background.js b/3rdparty/sdl2-2.0.9/test/nacl/background.js similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/nacl/background.js rename to 3rdparty/sdl2-2.0.9/test/nacl/background.js diff --git a/3rdparty/sdl2-2.0.4/test/nacl/common.js b/3rdparty/sdl2-2.0.9/test/nacl/common.js similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/nacl/common.js rename to 3rdparty/sdl2-2.0.9/test/nacl/common.js index a108fad329..a700015513 100644 --- a/3rdparty/sdl2-2.0.4/test/nacl/common.js +++ b/3rdparty/sdl2-2.0.9/test/nacl/common.js @@ -39,7 +39,7 @@ var common = (function() { mimetype = 'application/x-ppapi-release'; else mimetype = 'application/x-ppapi-debug'; - } else if (tool == 'pnacl' && isRelease) { + } else if (tool == 'pnacl') { mimetype = 'application/x-pnacl'; } return mimetype; @@ -147,6 +147,11 @@ var common = (function() { var listenerDiv = document.getElementById('listener'); listenerDiv.appendChild(moduleEl); + // Request the offsetTop property to force a relayout. As of Apr 10, 2014 + // this is needed if the module is being loaded on a Chrome App's + // background page (see crbug.com/350445). + moduleEl.offsetTop; + // Host plugins don't send a moduleDidLoad message. We'll fake it here. var isHost = isHostToolchain(tool); if (isHost) { diff --git a/3rdparty/sdl2-2.0.4/test/nacl/index.html b/3rdparty/sdl2-2.0.9/test/nacl/index.html similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/nacl/index.html rename to 3rdparty/sdl2-2.0.9/test/nacl/index.html diff --git a/3rdparty/sdl2-2.0.4/test/nacl/manifest.json b/3rdparty/sdl2-2.0.9/test/nacl/manifest.json similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/nacl/manifest.json rename to 3rdparty/sdl2-2.0.9/test/nacl/manifest.json diff --git a/3rdparty/sdl2-2.0.4/test/picture.xbm b/3rdparty/sdl2-2.0.9/test/picture.xbm similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/picture.xbm rename to 3rdparty/sdl2-2.0.9/test/picture.xbm diff --git a/3rdparty/sdl2-2.0.4/test/relative_mode.markdown b/3rdparty/sdl2-2.0.9/test/relative_mode.markdown similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/relative_mode.markdown rename to 3rdparty/sdl2-2.0.9/test/relative_mode.markdown diff --git a/3rdparty/sdl2-2.0.4/test/sample.bmp b/3rdparty/sdl2-2.0.9/test/sample.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/sample.bmp rename to 3rdparty/sdl2-2.0.9/test/sample.bmp diff --git a/3rdparty/sdl2-2.0.4/test/sample.wav b/3rdparty/sdl2-2.0.9/test/sample.wav similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/sample.wav rename to 3rdparty/sdl2-2.0.9/test/sample.wav diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p01_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p01_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p01_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p01_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p01_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p01_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p01_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p01_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p01_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p01_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p01_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p01_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p02_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p02_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p02_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p02_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p02_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p02_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p02_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p02_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p02_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p02_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p02_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p02_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p03_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p03_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p03_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p03_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p03_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p03_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p03_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p03_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p04_shape1.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p04_shape1.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p04_shape1.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p04_shape1.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p04_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p04_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p04_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p04_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p04_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p04_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p04_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p04_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p04_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p04_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p04_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p04_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p05_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p05_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p05_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p05_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p06_shape1alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p06_shape1alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p06_shape1alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p06_shape1alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p06_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p06_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p06_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p06_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p06_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p06_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p06_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p06_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p06_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p06_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p06_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p06_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p07_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p07_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p07_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p07_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p07_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p07_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p07_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p07_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p07_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p07_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p07_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p07_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p08_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p08_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p08_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p08_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p08_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p08_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p08_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p08_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p08_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p08_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p08_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p08_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p09_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p09_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p09_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p09_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p09_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p09_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p09_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p09_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p09_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p09_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p09_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p09_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p10_shape1.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p10_shape1.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p10_shape1.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p10_shape1.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p10_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p10_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p10_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p10_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p10_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p10_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p10_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p10_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p10_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p10_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p10_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p10_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p11_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p11_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p11_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p11_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p11_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p11_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p11_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p11_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p11_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p11_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p11_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p11_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p12_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p12_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p12_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p12_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p12_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p12_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p12_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p12_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p13_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p13_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p13_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p13_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p13_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p13_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p13_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p13_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p13_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p13_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p13_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p13_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p14_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p14_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p14_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p14_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p14_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p14_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p14_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p14_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p15_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p15_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p15_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p15_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p15_shape32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p15_shape32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p15_shape32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p15_shape32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p15_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p15_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p15_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p15_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p16_shape1.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p16_shape1.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p16_shape1.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p16_shape1.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p16_shape24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p16_shape24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p16_shape24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p16_shape24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/p16_shape8.bmp b/3rdparty/sdl2-2.0.9/test/shapes/p16_shape8.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/p16_shape8.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/p16_shape8.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/trollface_24.bmp b/3rdparty/sdl2-2.0.9/test/shapes/trollface_24.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/trollface_24.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/trollface_24.bmp diff --git a/3rdparty/sdl2-2.0.4/test/shapes/trollface_32alpha.bmp b/3rdparty/sdl2-2.0.9/test/shapes/trollface_32alpha.bmp similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/shapes/trollface_32alpha.bmp rename to 3rdparty/sdl2-2.0.9/test/shapes/trollface_32alpha.bmp diff --git a/3rdparty/sdl2-2.0.4/test/testatomic.c b/3rdparty/sdl2-2.0.9/test/testatomic.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/test/testatomic.c rename to 3rdparty/sdl2-2.0.9/test/testatomic.c index 41cc9ab1b3..6af9d4bf62 100644 --- a/3rdparty/sdl2-2.0.4/test/testatomic.c +++ b/3rdparty/sdl2-2.0.9/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,7 +103,10 @@ void RunBasicTest() #define NInter (CountTo/CountInc/NThreads) #define Expect (CountTo-NInter*CountInc*NThreads) -SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */ +enum { + CountTo_GreaterThanZero = CountTo > 0, +}; +SDL_COMPILE_TIME_ASSERT(size, CountTo_GreaterThanZero); /* check for rollover */ static SDL_atomic_t good = { 42 }; @@ -114,7 +117,7 @@ static SDL_atomic_t threadsRunning; static SDL_sem *threadDone; static -int adder(void* junk) +int SDLCALL adder(void* junk) { unsigned long N=NInter; SDL_Log("Thread subtracting %d %lu times\n",CountInc,N); @@ -284,7 +287,7 @@ typedef struct char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)]; #endif - volatile SDL_bool active; + SDL_atomic_t active; /* Only needed for the mutex test */ SDL_mutex *mutex; @@ -305,7 +308,7 @@ static void InitEventQueue(SDL_EventQueue *queue) SDL_AtomicSet(&queue->rwcount, 0); SDL_AtomicSet(&queue->watcher, 0); #endif - queue->active = SDL_TRUE; + SDL_AtomicSet(&queue->active, 1); } static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event) @@ -492,7 +495,7 @@ typedef struct char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; } ReaderData; -static int FIFO_Writer(void* _data) +static int SDLCALL FIFO_Writer(void* _data) { WriterData *data = (WriterData *)_data; SDL_EventQueue *queue = data->queue; @@ -527,7 +530,7 @@ static int FIFO_Writer(void* _data) return 0; } -static int FIFO_Reader(void* _data) +static int SDLCALL FIFO_Reader(void* _data) { ReaderData *data = (ReaderData *)_data; SDL_EventQueue *queue = data->queue; @@ -538,7 +541,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_LockFree(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -551,7 +554,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_Mutex(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -567,11 +570,11 @@ static int FIFO_Reader(void* _data) #ifdef TEST_SPINLOCK_FIFO /* This thread periodically locks the queue for no particular reason */ -static int FIFO_Watcher(void* _data) +static int SDLCALL FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; - while (queue->active) { + while (SDL_AtomicGet(&queue->active)) { SDL_AtomicLock(&queue->lock); SDL_AtomicIncRef(&queue->watcher); while (SDL_AtomicGet(&queue->rwcount) > 0) { @@ -597,7 +600,7 @@ static void RunFIFOTest(SDL_bool lock_free) int i, j; int grand_total; char textBuffer[1024]; - int len; + size_t len; SDL_Log("\nFIFO test---------------------------------------\n\n"); SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); @@ -652,7 +655,7 @@ static void RunFIFOTest(SDL_bool lock_free) } /* Shut down the queue so readers exit */ - queue.active = SDL_FALSE; + SDL_AtomicSet(&queue.active, 0); /* Wait for the readers */ while (SDL_AtomicGet(&readersRunning) > 0) { diff --git a/3rdparty/sdl2-2.0.9/test/testaudiocapture.c b/3rdparty/sdl2-2.0.9/test/testaudiocapture.c new file mode 100644 index 0000000000..a418d123c4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testaudiocapture.c @@ -0,0 +1,165 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include "SDL.h" + +#include + +#ifdef __EMSCRIPTEN__ +#include +#endif + +static SDL_Window *window = NULL; +static SDL_Renderer *renderer = NULL; +static SDL_AudioSpec spec; +static SDL_AudioDeviceID devid_in = 0; +static SDL_AudioDeviceID devid_out = 0; + +static void +loop() +{ + SDL_bool please_quit = SDL_FALSE; + SDL_Event e; + + while (SDL_PollEvent(&e)) { + if (e.type == SDL_QUIT) { + please_quit = SDL_TRUE; + } else if (e.type == SDL_KEYDOWN) { + if (e.key.keysym.sym == SDLK_ESCAPE) { + please_quit = SDL_TRUE; + } + } else if (e.type == SDL_MOUSEBUTTONDOWN) { + if (e.button.button == 1) { + SDL_PauseAudioDevice(devid_out, SDL_TRUE); + SDL_PauseAudioDevice(devid_in, SDL_FALSE); + } + } else if (e.type == SDL_MOUSEBUTTONUP) { + if (e.button.button == 1) { + SDL_PauseAudioDevice(devid_in, SDL_TRUE); + SDL_PauseAudioDevice(devid_out, SDL_FALSE); + } + } + } + + if (SDL_GetAudioDeviceStatus(devid_in) == SDL_AUDIO_PLAYING) { + SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); + } else { + SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); + } + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + if (please_quit) { + /* stop playing back, quit. */ + SDL_Log("Shutting down.\n"); + SDL_PauseAudioDevice(devid_in, 1); + SDL_CloseAudioDevice(devid_in); + SDL_PauseAudioDevice(devid_out, 1); + SDL_CloseAudioDevice(devid_out); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); + #ifdef __EMSCRIPTEN__ + emscripten_cancel_main_loop(); + #endif + exit(0); + } + + /* Note that it would be easier to just have a one-line function that + calls SDL_QueueAudio() as a capture device callback, but we're + trying to test the API, so we use SDL_DequeueAudio() here. */ + while (SDL_TRUE) { + Uint8 buf[1024]; + const Uint32 br = SDL_DequeueAudio(devid_in, buf, sizeof (buf)); + SDL_QueueAudio(devid_out, buf, br); + if (br < sizeof (buf)) { + break; + } + } +} + +int +main(int argc, char **argv) +{ + /* (argv[1] == NULL means "open default device.") */ + const char *devname = argv[1]; + SDL_AudioSpec wanted; + int devcount; + int i; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Load the SDL library */ + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + return (1); + } + + window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0); + renderer = SDL_CreateRenderer(window, -1, 0); + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + + devcount = SDL_GetNumAudioDevices(SDL_TRUE); + for (i = 0; i < devcount; i++) { + SDL_Log(" Capture device #%d: '%s'\n", i, SDL_GetAudioDeviceName(i, SDL_TRUE)); + } + + SDL_zero(wanted); + wanted.freq = 44100; + wanted.format = AUDIO_F32SYS; + wanted.channels = 1; + wanted.samples = 4096; + wanted.callback = NULL; + + SDL_zero(spec); + + /* DirectSound can fail in some instances if you open the same hardware + for both capture and output and didn't open the output end first, + according to the docs, so if you're doing something like this, always + open your capture devices second in case you land in those bizarre + circumstances. */ + + SDL_Log("Opening default playback device...\n"); + devid_out = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wanted, &spec, SDL_AUDIO_ALLOW_ANY_CHANGE); + if (!devid_out) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!\n", SDL_GetError()); + SDL_Quit(); + exit(1); + } + + SDL_Log("Opening capture device %s%s%s...\n", + devname ? "'" : "", + devname ? devname : "[[default]]", + devname ? "'" : ""); + + devid_in = SDL_OpenAudioDevice(argv[1], SDL_TRUE, &spec, &spec, 0); + if (!devid_in) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for capture: %s!\n", SDL_GetError()); + SDL_Quit(); + exit(1); + } + + SDL_Log("Ready! Hold down mouse or finger to record!\n"); + +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(loop, 0, 1); +#else + while (1) { loop(); SDL_Delay(16); } +#endif + + return 0; +} + diff --git a/3rdparty/sdl2-2.0.4/test/testaudiohotplug.c b/3rdparty/sdl2-2.0.9/test/testaudiohotplug.c similarity index 78% rename from 3rdparty/sdl2-2.0.4/test/testaudiohotplug.c rename to 3rdparty/sdl2-2.0.9/test/testaudiohotplug.c index e13868ec2e..374cbb27b7 100644 --- a/3rdparty/sdl2-2.0.4/test/testaudiohotplug.c +++ b/3rdparty/sdl2-2.0.9/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -74,6 +74,12 @@ poked(int sig) done = 1; } +static const char* +devtypestr(int iscapture) +{ + return iscapture ? "capture" : "output"; +} + static void iteration() { @@ -82,10 +88,21 @@ iteration() while (SDL_PollEvent(&e)) { if (e.type == SDL_QUIT) { done = 1; + } else if (e.type == SDL_KEYUP) { + if (e.key.keysym.sym == SDLK_ESCAPE) + done = 1; } else if (e.type == SDL_AUDIODEVICEADDED) { - const char *name = SDL_GetAudioDeviceName(e.adevice.which, 0); - SDL_Log("New %s audio device: %s\n", e.adevice.iscapture ? "capture" : "output", name); - if (!e.adevice.iscapture) { + int index = e.adevice.which; + int iscapture = e.adevice.iscapture; + const char *name = SDL_GetAudioDeviceName(index, iscapture); + if (name != NULL) + SDL_Log("New %s audio device at index %u: %s\n", devtypestr(iscapture), (unsigned int) index, name); + else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Got new %s device at index %u, but failed to get the name: %s\n", + devtypestr(iscapture), (unsigned int) index, SDL_GetError()); + continue; + } + if (!iscapture) { positions[posindex] = 0; spec.userdata = &positions[posindex++]; spec.callback = fillerup; @@ -99,7 +116,7 @@ iteration() } } else if (e.type == SDL_AUDIODEVICEREMOVED) { dev = (SDL_AudioDeviceID) e.adevice.which; - SDL_Log("%s device %u removed.\n", e.adevice.iscapture ? "capture" : "output", (unsigned int) dev); + SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int) dev); SDL_CloseAudioDevice(dev); } } @@ -163,6 +180,7 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } + SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n"); SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); #ifdef __EMSCRIPTEN__ @@ -175,6 +193,8 @@ main(int argc, char *argv[]) #endif /* Clean up on signal */ + /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ + SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_FreeWAV(sound); SDL_Quit(); return (0); diff --git a/3rdparty/sdl2-2.0.4/test/testaudioinfo.c b/3rdparty/sdl2-2.0.9/test/testaudioinfo.c similarity index 75% rename from 3rdparty/sdl2-2.0.4/test/testaudioinfo.c rename to 3rdparty/sdl2-2.0.9/test/testaudioinfo.c index 53bf0f5e2f..adecce9b72 100644 --- a/3rdparty/sdl2-2.0.4/test/testaudioinfo.c +++ b/3rdparty/sdl2-2.0.9/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,7 +18,7 @@ print_devices(int iscapture) const char *typestr = ((iscapture) ? "capture" : "output"); int n = SDL_GetNumAudioDevices(iscapture); - SDL_Log("%s devices:\n", typestr); + SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : ""); if (n == -1) SDL_Log(" Driver can't detect specific %s devices.\n\n", typestr); @@ -27,7 +27,11 @@ print_devices(int iscapture) else { int i; for (i = 0; i < n; i++) { - SDL_Log(" %s\n", SDL_GetAudioDeviceName(i, iscapture)); + const char *name = SDL_GetAudioDeviceName(i, iscapture); + if (name != NULL) + SDL_Log(" %d: %s\n", i, name); + else + SDL_Log(" %d Error: %s\n", i, SDL_GetError()); } SDL_Log("\n"); } @@ -55,9 +59,9 @@ main(int argc, char **argv) int i; SDL_Log("Built-in audio drivers:\n"); for (i = 0; i < n; ++i) { - SDL_Log(" %s\n", SDL_GetAudioDriver(i)); + SDL_Log(" %d: %s\n", i, SDL_GetAudioDriver(i)); } - SDL_Log("\n"); + SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n"); } SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver()); diff --git a/3rdparty/sdl2-2.0.4/test/testautomation.c b/3rdparty/sdl2-2.0.9/test/testautomation.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testautomation.c rename to 3rdparty/sdl2-2.0.9/test/testautomation.c index eea74b3b86..bb799ea43b 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_audio.c b/3rdparty/sdl2-2.0.9/test/testautomation_audio.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testautomation_audio.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_audio.c index bef838dde0..be0f15e3dd 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_audio.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_audio.c @@ -46,7 +46,7 @@ int _audio_testCallbackLength; /* Test callback function */ -void _audio_testCallback(void *userdata, Uint8 *stream, int len) +void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len) { /* track that callback was called */ _audio_testCallbackCounter++; diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_clipboard.c b/3rdparty/sdl2-2.0.9/test/testautomation_clipboard.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testautomation_clipboard.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_clipboard.c index f943ffee79..417d957465 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_clipboard.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_clipboard.c @@ -121,7 +121,7 @@ clipboard_testClipboardTextFunctions(void *arg) SDLTest_AssertCheck( charResult[0] == '\0', "Verify SDL_GetClipboardText returned string with length 0, got length %i", - SDL_strlen(charResult)); + (int) SDL_strlen(charResult)); intResult = SDL_SetClipboardText((const char *)text); SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); SDLTest_AssertCheck( diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_events.c b/3rdparty/sdl2-2.0.9/test/testautomation_events.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testautomation_events.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_events.c index f9eb5bb9e8..09004da52a 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_events.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_events.c @@ -25,7 +25,7 @@ int _userdataValue1 = 1; int _userdataValue2 = 2; /* Event filter that sets some flags and optionally checks userdata */ -int _events_sampleNullEventFilter(void *userdata, SDL_Event *event) +int SDLCALL _events_sampleNullEventFilter(void *userdata, SDL_Event *event) { _eventFilterCalled = 1; @@ -87,7 +87,7 @@ events_addDelEventWatch(void *arg) /* Create user event */ event.type = SDL_USEREVENT; - event.user.code = SDLTest_RandomSint32();; + event.user.code = SDLTest_RandomSint32(); event.user.data1 = (void *)&_userdataValue1; event.user.data2 = (void *)&_userdataValue2; @@ -137,7 +137,7 @@ events_addDelEventWatchWithUserdata(void *arg) /* Create user event */ event.type = SDL_USEREVENT; - event.user.code = SDLTest_RandomSint32();; + event.user.code = SDLTest_RandomSint32(); event.user.data1 = (void *)&_userdataValue1; event.user.data2 = (void *)&_userdataValue2; diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_hints.c b/3rdparty/sdl2-2.0.9/test/testautomation_hints.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testautomation_hints.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_hints.c diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_keyboard.c b/3rdparty/sdl2-2.0.9/test/testautomation_keyboard.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testautomation_keyboard.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_keyboard.c index 453832e256..6f25bb76cb 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_keyboard.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_keyboard.c @@ -312,7 +312,7 @@ keyboard_getSetModState(void *arg) /* Get state, cache for later reset */ result = SDL_GetModState(); SDLTest_AssertPass("Call to SDL_GetModState()"); - SDLTest_AssertCheck(result >=0 && result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); + SDLTest_AssertCheck(/*result >= 0 &&*/ result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); currentState = result; /* Set random state */ @@ -401,8 +401,8 @@ keyboard_setTextInputRect(void *arg) SDL_Rect refRect; /* Normal visible refRect, origin inside */ - refRect.x = SDLTest_RandomIntegerInRange(1, 50);; - refRect.y = SDLTest_RandomIntegerInRange(1, 50);; + refRect.x = SDLTest_RandomIntegerInRange(1, 50); + refRect.y = SDLTest_RandomIntegerInRange(1, 50); refRect.w = SDLTest_RandomIntegerInRange(10, 50); refRect.h = SDLTest_RandomIntegerInRange(10, 50); _testSetTextInputRect(refRect); @@ -415,8 +415,8 @@ keyboard_setTextInputRect(void *arg) _testSetTextInputRect(refRect); /* 1Pixel refRect */ - refRect.x = SDLTest_RandomIntegerInRange(10, 50);; - refRect.y = SDLTest_RandomIntegerInRange(10, 50);; + refRect.x = SDLTest_RandomIntegerInRange(10, 50); + refRect.y = SDLTest_RandomIntegerInRange(10, 50); refRect.w = 1; refRect.h = 1; _testSetTextInputRect(refRect); @@ -450,15 +450,15 @@ keyboard_setTextInputRect(void *arg) _testSetTextInputRect(refRect); /* negative refRect */ - refRect.x = SDLTest_RandomIntegerInRange(-200, -100);; - refRect.y = SDLTest_RandomIntegerInRange(-200, -100);; + refRect.x = SDLTest_RandomIntegerInRange(-200, -100); + refRect.y = SDLTest_RandomIntegerInRange(-200, -100); refRect.w = 50; refRect.h = 50; _testSetTextInputRect(refRect); /* oversized refRect */ - refRect.x = SDLTest_RandomIntegerInRange(1, 50);; - refRect.y = SDLTest_RandomIntegerInRange(1, 50);; + refRect.x = SDLTest_RandomIntegerInRange(1, 50); + refRect.y = SDLTest_RandomIntegerInRange(1, 50); refRect.w = 5000; refRect.h = 5000; _testSetTextInputRect(refRect); diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_main.c b/3rdparty/sdl2-2.0.9/test/testautomation_main.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testautomation_main.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_main.c index ef8f19e9e7..ae060cdd1a 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_main.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_main.c @@ -137,7 +137,7 @@ static const SDLTest_TestCaseReference mainTest3 = static const SDLTest_TestCaseReference mainTest4 = { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED}; -/* Sequence of Platform test cases */ +/* Sequence of Main test cases */ static const SDLTest_TestCaseReference *mainTests[] = { &mainTest1, &mainTest2, @@ -146,7 +146,7 @@ static const SDLTest_TestCaseReference *mainTests[] = { NULL }; -/* Platform test suite (global) */ +/* Main test suite (global) */ SDLTest_TestSuiteReference mainTestSuite = { "Main", NULL, diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_mouse.c b/3rdparty/sdl2-2.0.9/test/testautomation_mouse.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testautomation_mouse.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_mouse.c index 57cadee2eb..ed30f2604b 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_mouse.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_mouse.c @@ -447,11 +447,23 @@ mouse_warpMouseInWindow(void *arg) { const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT; int numPositions = 6; - int xPositions[] = {-1, 0, 1, w-1, w, w+1 }; - int yPositions[] = {-1, 0, 1, h-1, h, h+1 }; + int xPositions[6]; + int yPositions[6]; int x, y, i, j; SDL_Window *window; + xPositions[0] = -1; + xPositions[1] = 0; + xPositions[2] = 1; + xPositions[3] = w-1; + xPositions[4] = w; + xPositions[5] = w+1; + yPositions[0] = -1; + yPositions[1] = 0; + yPositions[2] = 1; + yPositions[3] = h-1; + yPositions[4] = h; + yPositions[5] = h+1; /* Create test window */ window = _createMouseSuiteTestWindow(); if (window == NULL) return TEST_ABORTED; diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_pixels.c b/3rdparty/sdl2-2.0.9/test/testautomation_pixels.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testautomation_pixels.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_pixels.c diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_platform.c b/3rdparty/sdl2-2.0.9/test/testautomation_platform.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/test/testautomation_platform.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_platform.c index 5211a4a70c..7cc732a7bd 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_platform.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_platform.c @@ -112,7 +112,7 @@ int platform_testGetFunctions (void *arg) char *platform; char *revision; int ret; - int len; + size_t len; platform = (char *)SDL_GetPlatform(); SDLTest_AssertPass("SDL_GetPlatform()"); @@ -122,7 +122,7 @@ int platform_testGetFunctions (void *arg) SDLTest_AssertCheck(len > 0, "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i", platform, - len); + (int) len); } ret = SDL_GetCPUCount(); @@ -282,7 +282,7 @@ int platform_testGetSetClearError(void *arg) int result; const char *testError = "Testing"; char *lastError; - int len; + size_t len; SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); @@ -295,7 +295,7 @@ int platform_testGetSetClearError(void *arg) { len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, - "SDL_GetError(): no message expected, len: %i", len); + "SDL_GetError(): no message expected, len: %i", (int) len); } result = SDL_SetError("%s", testError); @@ -309,8 +309,8 @@ int platform_testGetSetClearError(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message %s, was message: %s", testError, @@ -334,7 +334,7 @@ int platform_testSetErrorEmptyInput(void *arg) int result; const char *testError = ""; char *lastError; - int len; + size_t len; result = SDL_SetError("%s", testError); SDLTest_AssertPass("SDL_SetError()"); @@ -347,8 +347,8 @@ int platform_testSetErrorEmptyInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", testError, @@ -373,14 +373,14 @@ int platform_testSetErrorInvalidInput(void *arg) const char *invalidError = NULL; const char *probeError = "Testing"; char *lastError; - int len; + size_t len; /* Reset */ SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -391,16 +391,16 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Set */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError('%s')", probeError); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError(NULL)"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -411,7 +411,7 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Reset */ @@ -419,7 +419,7 @@ int platform_testSetErrorInvalidInput(void *arg) SDLTest_AssertPass("SDL_ClearError()"); /* Set and check */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -430,8 +430,8 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(probeError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(probeError), - len); + (int) SDL_strlen(probeError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", probeError, diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_rect.c b/3rdparty/sdl2-2.0.9/test/testautomation_rect.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testautomation_rect.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_rect.c diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_render.c b/3rdparty/sdl2-2.0.9/test/testautomation_render.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testautomation_render.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_render.c diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_rwops.c b/3rdparty/sdl2-2.0.9/test/testautomation_rwops.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/test/testautomation_rwops.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_rwops.c index 16f2161fec..9a1a29a720 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_rwops.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_rwops.c @@ -32,9 +32,9 @@ static const char RWopsAlphabetString[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void RWopsSetUp(void *arg) { - int fileLen; + size_t fileLen; FILE *handle; - int writtenLen; + size_t writtenLen; int result; /* Clean up from previous runs (if any); ignore errors */ @@ -49,8 +49,8 @@ RWopsSetUp(void *arg) /* Write some known text into it */ fileLen = SDL_strlen(RWopsHelloWorldTestString); - writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -61,8 +61,8 @@ RWopsSetUp(void *arg) /* Write alphabet text into it */ fileLen = SDL_strlen(RWopsAlphabetString); - writtenLen = (int)fwrite(RWopsAlphabetString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsAlphabetString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -111,10 +111,10 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1); SDLTest_AssertPass("Call to SDL_RWwrite succeeded"); if (write) { - SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", s); + SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int) s); } else { - SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", s); + SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int) s); } /* Test seek to random position */ @@ -133,8 +133,8 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertCheck( s == (size_t)(sizeof(RWopsHelloWorldTestString)-1), "Verify result from SDL_RWread, expected %i, got %i", - sizeof(RWopsHelloWorldTestString)-1, - s); + (int) (sizeof(RWopsHelloWorldTestString)-1), + (int) s); SDLTest_AssertCheck( SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0, "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf); @@ -144,25 +144,25 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-5), - "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-5, - i); + "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-5), + (int) i); i = SDL_RWseek( rw, -1, RW_SEEK_END ); SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-2), - "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-2, - i); + "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-2), + (int) i); /* Invalid whence seek */ i = SDL_RWseek( rw, 0, 999 ); SDLTest_AssertPass("Call to SDL_RWseek(...,0,invalid_whence) succeeded"); SDLTest_AssertCheck( i == (Sint64)(-1), - "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %"SDL_PRIs64, - i); + "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %i", + (int) i); } /* ! @@ -559,8 +559,8 @@ rwops_testCompareRWFromMemWithRWFromFile(void) SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result); /* Compare */ - SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", rv_mem, rv_file); - SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%"SDL_PRIu64" sv_file=%"SDL_PRIu64, sv_mem, sv_file); + SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", (int) rv_mem, (int) rv_file); + SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%d sv_file=%d", (int) sv_mem, (int) sv_file); SDLTest_AssertCheck(buffer_mem[slen] == 0, "Verify mem buffer termination; expected: 0, got: %d", buffer_mem[slen]); SDLTest_AssertCheck(buffer_file[slen] == 0, "Verify file buffer termination; expected: 0, got: %d", buffer_file[slen]); SDLTest_AssertCheck( @@ -648,27 +648,27 @@ rwops_testFileWriteReadEndian(void) /* Write test data */ objectsWritten = SDL_WriteBE16(rw, BE16value); SDLTest_AssertPass("Call to SDL_WriteBE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE32(rw, BE32value); SDLTest_AssertPass("Call to SDL_WriteBE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE64(rw, BE64value); SDLTest_AssertPass("Call to SDL_WriteBE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE16(rw, LE16value); SDLTest_AssertPass("Call to SDL_WriteLE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE32(rw, LE32value); SDLTest_AssertPass("Call to SDL_WriteLE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE64(rw, LE64value); SDLTest_AssertPass("Call to SDL_WriteLE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); /* Test seek to start */ result = SDL_RWseek( rw, 0, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %"SDL_PRIs64, result); + SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", (int) result); /* Read test data */ BE16test = SDL_ReadBE16(rw); diff --git a/3rdparty/sdl2-2.0.4/test/testautomation_sdltest.c b/3rdparty/sdl2-2.0.9/test/testautomation_sdltest.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testautomation_sdltest.c rename to 3rdparty/sdl2-2.0.9/test/testautomation_sdltest.c index ec1da8a50e..979756adc7 100644 --- a/3rdparty/sdl2-2.0.4/test/testautomation_sdltest.c +++ b/3rdparty/sdl2-2.0.9/test/testautomation_sdltest.c @@ -2,17 +2,20 @@ * SDL_test test suite */ +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else #include #endif + #include -#include #include #include @@ -31,7 +34,8 @@ int sdltest_generateRunSeed(void *arg) { char* result; - int i, l; + size_t i, l; + int j; for (i = 1; i <= 10; i += 3) { result = SDLTest_GenerateRunSeed((const int)i); @@ -39,14 +43,14 @@ sdltest_generateRunSeed(void *arg) SDLTest_AssertCheck(result != NULL, "Verify returned value is not NULL"); if (result != NULL) { l = SDL_strlen(result); - SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", i, l); + SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", (int) i, (int) l); SDL_free(result); } } /* Negative cases */ - for (i = -2; i <= 0; i++) { - result = SDLTest_GenerateRunSeed((const int)i); + for (j = -2; j <= 0; j++) { + result = SDLTest_GenerateRunSeed((const int)j); SDLTest_AssertPass("Call to SDLTest_GenerateRunSeed()"); SDLTest_AssertCheck(result == NULL, "Verify returned value is not NULL"); } @@ -988,38 +992,38 @@ sdltest_randomBoundaryNumberSint64(void *arg) "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN, 99, SDL_FALSE) returns 100 */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, 99, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, 99, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( sresult == 100, "Validate result value for parameters (LLONG_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE) returns LLONG_MIN (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN + 1, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX - 1, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MAX, - "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MAX, sresult); + sresult == INT64_MAX, + "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MAX, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -1093,7 +1097,7 @@ sdltest_randomIntegerInRange(void *arg) SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); /* Range with max at integer limit */ - min = long_min - (Sint32)SDLTest_RandomSint16();; + min = long_min - (Sint32)SDLTest_RandomSint16(); max = long_max; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)"); @@ -1116,16 +1120,16 @@ int sdltest_randomAsciiString(void *arg) { char* result; - int len; + size_t len; int nonAsciiCharacters; - int i; + size_t i; result = SDLTest_RandomAsciiString(); SDLTest_AssertPass("Call to SDLTest_RandomAsciiString()"); SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL"); if (result != NULL) { len = SDL_strlen(result); - SDLTest_AssertCheck(len >= 0 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", len); + SDLTest_AssertCheck(len >= 1 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", (int) len); nonAsciiCharacters = 0; for (i=0; i= 0 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", targetLen, len); + SDLTest_AssertCheck(len >= 1 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", (int) targetLen, (int) len); nonAsciiCharacters = 0; for (i=0; i + + 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. +*/ + +#include "SDL.h" + +int main(int argc, char **argv) +{ + int total, i; + + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError()); + return 1; + } + + total = SDL_GetNumVideoDisplays(); + for (i = 0; i < total; i++) { + SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 }; + SDL_GetDisplayBounds(i, &bounds); + SDL_GetDisplayUsableBounds(i, &usable); + SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}", + i, SDL_GetDisplayName(i), + bounds.x, bounds.y, bounds.w, bounds.h, + usable.x, usable.y, usable.w, usable.h); + } + + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.9/test/testcustomcursor.c b/3rdparty/sdl2-2.0.9/test/testcustomcursor.c new file mode 100644 index 0000000000..4694498185 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testcustomcursor.c @@ -0,0 +1,259 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include +#include + +#ifdef __EMSCRIPTEN__ +#include +#endif + +#include "SDL_test_common.h" + +/* Stolen from the mailing list */ +/* Creates a new mouse cursor from an XPM */ + + +/* XPM */ +static const char *arrow[] = { + /* width height num_colors chars_per_pixel */ + " 32 32 3 1", + /* colors */ + "X c #000000", + ". c #ffffff", + " c None", + /* pixels */ + "X ", + "XX ", + "X.X ", + "X..X ", + "X...X ", + "X....X ", + "X.....X ", + "X......X ", + "X.......X ", + "X........X ", + "X.....XXXXX ", + "X..X..X ", + "X.X X..X ", + "XX X..X ", + "X X..X ", + " X..X ", + " X..X ", + " X..X ", + " XX ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "0,0" +}; + +static SDL_Cursor* +init_color_cursor(const char *file) +{ + SDL_Cursor *cursor = NULL; + SDL_Surface *surface = SDL_LoadBMP(file); + if (surface) { + if (surface->format->palette) { + SDL_SetColorKey(surface, 1, *(Uint8 *) surface->pixels); + } else { + switch (surface->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(surface, 1, *(Uint16 *)surface->pixels); + break; + case 24: + SDL_SetColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(surface, 1, *(Uint32 *)surface->pixels); + break; + } + } + cursor = SDL_CreateColorCursor(surface, 0, 0); + SDL_FreeSurface(surface); + } + return cursor; +} + +static SDL_Cursor* +init_system_cursor(const char *image[]) +{ + int i, row, col; + Uint8 data[4*32]; + Uint8 mask[4*32]; + int hot_x, hot_y; + + i = -1; + for (row=0; row<32; ++row) { + for (col=0; col<32; ++col) { + if (col % 8) { + data[i] <<= 1; + mask[i] <<= 1; + } else { + ++i; + data[i] = mask[i] = 0; + } + switch (image[4+row][col]) { + case 'X': + data[i] |= 0x01; + mask[i] |= 0x01; + break; + case '.': + mask[i] |= 0x01; + break; + case ' ': + break; + } + } + } + sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); + return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); +} + +static SDLTest_CommonState *state; +int done; +static SDL_Cursor *cursors[1+SDL_NUM_SYSTEM_CURSORS]; +static int current_cursor; +static int show_cursor; + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void +quit(int rc) +{ + SDLTest_CommonQuit(state); + exit(rc); +} + +void +loop() +{ + int i; + SDL_Event event; + /* Check for events */ + while (SDL_PollEvent(&event)) { + SDLTest_CommonEvent(state, &event, &done); + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.button == SDL_BUTTON_LEFT) { + ++current_cursor; + if (current_cursor == SDL_arraysize(cursors)) { + current_cursor = 0; + } + SDL_SetCursor(cursors[current_cursor]); + } else { + show_cursor = !show_cursor; + SDL_ShowCursor(show_cursor); + } + } + } + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + } +#ifdef __EMSCRIPTEN__ + if (done) { + emscripten_cancel_main_loop(); + } +#endif +} + +int +main(int argc, char *argv[]) +{ + int i; + const char *color_cursor = NULL; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return 1; + } + for (i = 1; i < argc;) { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if (consumed == 0) { + color_cursor = argv[i]; + break; + } + if (consumed < 0) { + SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + quit(1); + } + i += consumed; + } + + if (!SDLTest_CommonInit(state)) { + quit(2); + } + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + + if (color_cursor) { + cursors[0] = init_color_cursor(color_cursor); + } else { + cursors[0] = init_system_cursor(arrow); + } + if (!cursors[0]) { + SDL_Log("Error, couldn't create cursor\n"); + quit(2); + } + for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { + cursors[1+i] = SDL_CreateSystemCursor((SDL_SystemCursor)i); + if (!cursors[1+i]) { + SDL_Log("Error, couldn't create system cursor %d\n", i); + quit(2); + } + } + SDL_SetCursor(cursors[0]); + + /* Main render loop */ + done = 0; +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(loop, 0, 1); +#else + while (!done) { + loop(); + } +#endif + + for (i = 0; i < SDL_arraysize(cursors); ++i) { + SDL_FreeCursor(cursors[i]); + } + quit(0); + + /* keep the compiler happy ... */ + return(0); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/testdisplayinfo.c b/3rdparty/sdl2-2.0.9/test/testdisplayinfo.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/test/testdisplayinfo.c rename to 3rdparty/sdl2-2.0.9/test/testdisplayinfo.c index c228eb6b2d..0cc5fbdd74 100644 --- a/3rdparty/sdl2-2.0.4/test/testdisplayinfo.c +++ b/3rdparty/sdl2-2.0.9/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,11 +51,18 @@ main(int argc, char *argv[]) for (dpy = 0; dpy < num_displays; dpy++) { const int num_modes = SDL_GetNumDisplayModes(dpy); SDL_Rect rect = { 0, 0, 0, 0 }; + float ddpi, hdpi, vdpi; int m; SDL_GetDisplayBounds(dpy, &rect); SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes); + if (SDL_GetDisplayDPI(dpy, &ddpi, &hdpi, &vdpi) == -1) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DPI: failed to query (%s)\n", SDL_GetError()); + } else { + SDL_Log(" DPI: ddpi=%f; hdpi=%f; vdpi=%f\n", ddpi, hdpi, vdpi); + } + if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); } else { diff --git a/3rdparty/sdl2-2.0.4/test/testdraw2.c b/3rdparty/sdl2-2.0.9/test/testdraw2.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testdraw2.c rename to 3rdparty/sdl2-2.0.9/test/testdraw2.c index 77bd8c1fe6..91ee7eea2c 100644 --- a/3rdparty/sdl2-2.0.4/test/testdraw2.c +++ b/3rdparty/sdl2-2.0.9/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testdrawchessboard.c b/3rdparty/sdl2-2.0.9/test/testdrawchessboard.c similarity index 82% rename from 3rdparty/sdl2-2.0.4/test/testdrawchessboard.c rename to 3rdparty/sdl2-2.0.9/test/testdrawchessboard.c index f2a1469d47..3dd78e1ac6 100644 --- a/3rdparty/sdl2-2.0.4/test/testdrawchessboard.c +++ b/3rdparty/sdl2-2.0.9/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ SDL_Window *window; SDL_Renderer *renderer; +SDL_Surface *surface; int done; void @@ -59,7 +60,20 @@ loop() { SDL_Event e; while (SDL_PollEvent(&e)) { - if (e.type == SDL_QUIT) { + + /* Re-create when window has been resized */ + if ((e.type == SDL_WINDOWEVENT) && (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)) { + + SDL_DestroyRenderer(renderer); + + surface = SDL_GetWindowSurface(window); + renderer = SDL_CreateSoftwareRenderer(surface); + /* Clear the rendering surface with the specified color */ + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + SDL_RenderClear(renderer); + } + + if (e.type == SDL_QUIT) { done = 1; #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); @@ -86,8 +100,6 @@ loop() int main(int argc, char *argv[]) { - SDL_Surface *surface; - /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -100,7 +112,7 @@ main(int argc, char *argv[]) /* Create window and renderer for given surface */ - window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN); + window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE); if(!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError()); diff --git a/3rdparty/sdl2-2.0.4/test/testdropfile.c b/3rdparty/sdl2-2.0.9/test/testdropfile.c similarity index 77% rename from 3rdparty/sdl2-2.0.4/test/testdropfile.c rename to 3rdparty/sdl2-2.0.9/test/testdropfile.c index b7f215ee81..1c2a3f0e64 100644 --- a/3rdparty/sdl2-2.0.4/test/testdropfile.c +++ b/3rdparty/sdl2-2.0.9/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,9 +77,14 @@ main(int argc, char *argv[]) while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); - if (event.type == SDL_DROPFILE) { + if (event.type == SDL_DROPBEGIN) { + SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); + } else if (event.type == SDL_DROPCOMPLETE) { + SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID); + } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) { + const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; char *dropped_filedir = event.drop.file; - SDL_Log("File dropped on window: %s", dropped_filedir); + SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); SDL_free(dropped_filedir); } } diff --git a/3rdparty/sdl2-2.0.4/test/testerror.c b/3rdparty/sdl2-2.0.9/test/testerror.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/test/testerror.c rename to 3rdparty/sdl2-2.0.9/test/testerror.c index b5fa3fbc08..87fcab21b3 100644 --- a/3rdparty/sdl2-2.0.4/test/testerror.c +++ b/3rdparty/sdl2-2.0.9/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" diff --git a/3rdparty/sdl2-2.0.4/test/testfile.c b/3rdparty/sdl2-2.0.9/test/testfile.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testfile.c rename to 3rdparty/sdl2-2.0.9/test/testfile.c index b45795f630..e563d77bee 100644 --- a/3rdparty/sdl2-2.0.4/test/testfile.c +++ b/3rdparty/sdl2-2.0.9/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testfilesystem.c b/3rdparty/sdl2-2.0.9/test/testfilesystem.c similarity index 76% rename from 3rdparty/sdl2-2.0.4/test/testfilesystem.c rename to 3rdparty/sdl2-2.0.9/test/testfilesystem.c index abd301c0e0..ada4e864ce 100644 --- a/3rdparty/sdl2-2.0.4/test/testfilesystem.c +++ b/3rdparty/sdl2-2.0.9/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,9 +32,8 @@ main(int argc, char *argv[]) if(base_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", SDL_GetError()); - return 0; + return 1; } - SDL_Log("base path: '%s'\n", base_path); SDL_free(base_path); @@ -42,7 +41,16 @@ main(int argc, char *argv[]) if(pref_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", SDL_GetError()); - return 0; + return 1; + } + SDL_Log("pref path: '%s'\n", pref_path); + SDL_free(pref_path); + + pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); + if(pref_path == NULL){ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", + SDL_GetError()); + return 1; } SDL_Log("pref path: '%s'\n", pref_path); SDL_free(pref_path); diff --git a/3rdparty/sdl2-2.0.4/test/testgamecontroller.c b/3rdparty/sdl2-2.0.9/test/testgamecontroller.c similarity index 84% rename from 3rdparty/sdl2-2.0.4/test/testgamecontroller.c rename to 3rdparty/sdl2-2.0.9/test/testgamecontroller.c index ec1dfd3229..c8616d7cd2 100644 --- a/3rdparty/sdl2-2.0.4/test/testgamecontroller.c +++ b/3rdparty/sdl2-2.0.9/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #define SCREEN_HEIGHT 320 #else #define SCREEN_WIDTH 512 -#define SCREEN_HEIGHT 317 +#define SCREEN_HEIGHT 320 #endif /* This is indexed by SDL_GameControllerButton. */ @@ -53,12 +53,12 @@ static const struct { int x; int y; } button_positions[] = { /* This is indexed by SDL_GameControllerAxis. */ static const struct { int x; int y; double angle; } axis_positions[] = { - {75, 154, 0.0}, /* LEFTX */ - {75, 154, 90.0}, /* LEFTY */ - {305, 230, 0.0}, /* RIGHTX */ - {305, 230, 90.0}, /* RIGHTY */ - {91, 0, 90.0}, /* TRIGGERLEFT */ - {375, 0, 90.0}, /* TRIGGERRIGHT */ + {74, 153, 270.0}, /* LEFTX */ + {74, 153, 0.0}, /* LEFTY */ + {306, 231, 270.0}, /* RIGHTX */ + {306, 231, 0.0}, /* RIGHTY */ + {91, -20, 0.0}, /* TRIGGERLEFT */ + {375, -20, 0.0}, /* TRIGGERRIGHT */ }; SDL_Renderer *screen = NULL; @@ -67,7 +67,7 @@ SDL_bool done = SDL_FALSE; SDL_Texture *background, *button, *axis; static SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) { SDL_Surface *temp = NULL; SDL_Texture *texture = NULL; @@ -80,10 +80,6 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) if (transparent) { if (temp->format->BytesPerPixel == 1) { SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); - } else { - SDL_assert(!temp->format->palette); - SDL_assert(temp->format->BitsPerPixel == 24); - SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF); } } @@ -112,6 +108,18 @@ loop(void *arg) while (SDL_PollEvent(&event)) { switch (event.type) { + case SDL_CONTROLLERAXISMOTION: + SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); + break; + case SDL_CONTROLLERBUTTONDOWN: + case SDL_CONTROLLERBUTTONUP: + SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + /* First button triggers a 0.5 second full strength rumble */ + if (event.type == SDL_CONTROLLERBUTTONDOWN && + event.cbutton.button == SDL_CONTROLLER_BUTTON_A) { + SDL_GameControllerRumble(gamecontroller, 0xFFFF, 0xFFFF, 500); + } + break; case SDL_KEYDOWN: if (event.key.keysym.sym != SDLK_ESCAPE) { break; @@ -129,7 +137,7 @@ loop(void *arg) for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) { if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 }; - SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, 0); + SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE); } } @@ -139,11 +147,11 @@ loop(void *arg) if (value < -deadzone) { const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 }; const double angle = axis_positions[i].angle; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0); + SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } else if (value > deadzone) { const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 }; const double angle = axis_positions[i].angle + 180.0; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0); + SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } } @@ -181,6 +189,8 @@ WatchGameController(SDL_GameController * gamecontroller) window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); + SDL_free(title); + title = NULL; if (window == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; @@ -257,6 +267,19 @@ main(int argc, char *argv[]) SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt"); + /* Print information about the mappings */ + if (!argv[1]) { + SDL_Log("Supported mappings:\n"); + for (i = 0; i < SDL_GameControllerNumMappings(); ++i) { + char *mapping = SDL_GameControllerMappingForIndex(i); + if (mapping) { + SDL_Log("\t%s\n", mapping); + SDL_free(mapping); + } + } + SDL_Log("\n"); + } + /* Print information about the controller */ for (i = 0; i < SDL_NumJoysticks(); ++i) { const char *name; @@ -274,7 +297,9 @@ main(int argc, char *argv[]) name = SDL_JoystickNameForIndex(i); description = "Joystick"; } - SDL_Log("%s %d: %s (guid %s)\n", description, i, name ? name : "Unknown", guid); + SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x)\n", + description, i, name ? name : "Unknown", guid, + SDL_JoystickGetDeviceVendor(i), SDL_JoystickGetDeviceProduct(i)); } SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", nController, SDL_NumJoysticks()); @@ -346,3 +371,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/testgesture.c b/3rdparty/sdl2-2.0.9/test/testgesture.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testgesture.c rename to 3rdparty/sdl2-2.0.9/test/testgesture.c index a289ce133a..f4b254a65b 100644 --- a/3rdparty/sdl2-2.0.4/test/testgesture.c +++ b/3rdparty/sdl2-2.0.9/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,6 @@ #define WIDTH 640 #define HEIGHT 480 #define BPP 4 -#define DEPTH 32 /* MUST BE A POWER OF 2! */ #define EVENT_BUF_SIZE 256 diff --git a/3rdparty/sdl2-2.0.4/test/testgl2.c b/3rdparty/sdl2-2.0.9/test/testgl2.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testgl2.c rename to 3rdparty/sdl2-2.0.9/test/testgl2.c index 74147f9fb9..dd01d0e291 100644 --- a/3rdparty/sdl2-2.0.4/test/testgl2.c +++ b/3rdparty/sdl2-2.0.9/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,7 @@ static int LoadContext(GL_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ diff --git a/3rdparty/sdl2-2.0.4/test/testgles.c b/3rdparty/sdl2-2.0.9/test/testgles.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testgles.c rename to 3rdparty/sdl2-2.0.9/test/testgles.c index 291661a09d..96895da0f7 100644 --- a/3rdparty/sdl2-2.0.4/test/testgles.c +++ b/3rdparty/sdl2-2.0.9/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -173,7 +173,7 @@ main(int argc, char *argv[]) quit(2); } - context = SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); if (context == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); diff --git a/3rdparty/sdl2-2.0.4/test/testgles2.c b/3rdparty/sdl2-2.0.9/test/testgles2.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testgles2.c rename to 3rdparty/sdl2-2.0.9/test/testgles2.c index af5962ba48..c4578a5cc7 100644 --- a/3rdparty/sdl2-2.0.4/test/testgles2.c +++ b/3rdparty/sdl2-2.0.9/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (r) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,8 @@ #include "SDL_test_common.h" -#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) +#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \ + || defined(__WINDOWS__) || defined(__LINUX__) #define HAVE_OPENGLES2 #endif @@ -58,7 +59,7 @@ static int LoadContext(GLES2_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -546,7 +547,7 @@ main(int argc, char *argv[]) return 0; } - context = SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); if (context == NULL) { SDL_Log("Out of memory!\n"); quit(2); @@ -640,7 +641,7 @@ main(int argc, char *argv[]) } } - datas = SDL_calloc(state->num_windows, sizeof(shader_data)); + datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data)); /* Set rendering settings for each context */ for (i = 0; i < state->num_windows; ++i) { diff --git a/3rdparty/sdl2-2.0.4/test/testhaptic.c b/3rdparty/sdl2-2.0.9/test/testhaptic.c similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testhaptic.c rename to 3rdparty/sdl2-2.0.9/test/testhaptic.c diff --git a/3rdparty/sdl2-2.0.4/test/testhittesting.c b/3rdparty/sdl2-2.0.9/test/testhittesting.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testhittesting.c rename to 3rdparty/sdl2-2.0.9/test/testhittesting.c index 5e32be42d0..c5223a9839 100644 --- a/3rdparty/sdl2-2.0.4/test/testhittesting.c +++ b/3rdparty/sdl2-2.0.9/test/testhittesting.c @@ -14,7 +14,7 @@ const SDL_Rect drag_areas[] = { static const SDL_Rect *areas = drag_areas; static int numareas = SDL_arraysize(drag_areas); -static SDL_HitTestResult +static SDL_HitTestResult SDLCALL hitTest(SDL_Window *window, const SDL_Point *pt, void *data) { int i; diff --git a/3rdparty/sdl2-2.0.4/test/testhotplug.c b/3rdparty/sdl2-2.0.9/test/testhotplug.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testhotplug.c rename to 3rdparty/sdl2-2.0.9/test/testhotplug.c index 1fa9637548..72c90e8d97 100644 --- a/3rdparty/sdl2-2.0.4/test/testhotplug.c +++ b/3rdparty/sdl2-2.0.9/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testiconv.c b/3rdparty/sdl2-2.0.9/test/testiconv.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testiconv.c rename to 3rdparty/sdl2-2.0.9/test/testiconv.c index 79efec8aaa..47e8c377ac 100644 --- a/3rdparty/sdl2-2.0.4/test/testiconv.c +++ b/3rdparty/sdl2-2.0.9/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/test/testime.c b/3rdparty/sdl2-2.0.9/test/testime.c new file mode 100644 index 0000000000..77bb869628 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testime.c @@ -0,0 +1,801 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +/* A simple program to test the Input Method support in the SDL library (2.0+) + If you build without SDL_ttf, you can use the GNU Unifont hex file instead. + Download at http://unifoundry.com/unifont.html */ + +#include +#include +#include + +#include "SDL.h" +#ifdef HAVE_SDL_TTF +#include "SDL_ttf.h" +#endif + +#include "SDL_test_common.h" + +#define DEFAULT_PTSIZE 30 +#ifdef HAVE_SDL_TTF +#ifdef __MACOSX__ +#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" +#elif __WIN32__ +/* Some japanese font present on at least Windows 8.1. */ +#define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf" +#else +#define DEFAULT_FONT "NoDefaultFont.ttf" +#endif +#else +#define DEFAULT_FONT "unifont-9.0.02.hex" +#endif +#define MAX_TEXT_LENGTH 256 + +static SDLTest_CommonState *state; +static SDL_Rect textRect, markedRect; +static SDL_Color lineColor = {0,0,0,255}; +static SDL_Color backColor = {255,255,255,255}; +static SDL_Color textColor = {0,0,0,255}; +static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; +static int cursor = 0; +#ifdef HAVE_SDL_TTF +static TTF_Font *font; +#else +#define UNIFONT_MAX_CODEPOINT 0x1ffff +#define UNIFONT_NUM_GLYPHS 0x20000 +/* Using 512x512 textures that are supported everywhere. */ +#define UNIFONT_TEXTURE_WIDTH 512 +#define UNIFONT_GLYPHS_IN_ROW (UNIFONT_TEXTURE_WIDTH / 16) +#define UNIFONT_GLYPHS_IN_TEXTURE (UNIFONT_GLYPHS_IN_ROW * UNIFONT_GLYPHS_IN_ROW) +#define UNIFONT_NUM_TEXTURES ((UNIFONT_NUM_GLYPHS + UNIFONT_GLYPHS_IN_TEXTURE - 1) / UNIFONT_GLYPHS_IN_TEXTURE) +#define UNIFONT_TEXTURE_SIZE (UNIFONT_TEXTURE_WIDTH * UNIFONT_TEXTURE_WIDTH * 4) +#define UNIFONT_TEXTURE_PITCH (UNIFONT_TEXTURE_WIDTH * 4) +#define UNIFONT_DRAW_SCALE 2 +struct UnifontGlyph { + Uint8 width; + Uint8 data[32]; +} *unifontGlyph; +static SDL_Texture **unifontTexture; +static Uint8 unifontTextureLoaded[UNIFONT_NUM_TEXTURES] = {0}; + +/* Unifont loading code start */ + +static Uint8 dehex(char c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + else if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return 255; +} + +static Uint8 dehex2(char c1, char c2) +{ + return (dehex(c1) << 4) | dehex(c2); +} + +static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np) +{ + Uint32 n = 0; + for (; len > 0; cp++, len--) + { + Uint8 c = dehex(*cp); + if (c == 255) + return 0; + n = (n << 4) | c; + } + if (np != NULL) + *np = n; + return 1; +} + +static int unifont_init(const char *fontname) +{ + Uint8 hexBuffer[65]; + Uint32 numGlyphs = 0; + int lineNumber = 1; + size_t bytesRead; + SDL_RWops *hexFile; + const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph); + const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *); + + /* Allocate memory for the glyph data so the file can be closed after initialization. */ + unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); + if (unifontGlyph == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); + return -1; + } + SDL_memset(unifontGlyph, 0, unifontGlyphSize); + + /* Allocate memory for texture pointers for all renderers. */ + unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize); + if (unifontTexture == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); + return -1; + } + SDL_memset(unifontTexture, 0, unifontTextureSize); + + hexFile = SDL_RWFromFile(fontname, "rb"); + if (hexFile == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); + return -1; + } + + /* Read all the glyph data into memory to make it accessible later when textures are created. */ + do { + int i, codepointHexSize; + size_t bytesOverread; + Uint8 glyphWidth; + Uint32 codepoint; + + bytesRead = SDL_RWread(hexFile, hexBuffer, 1, 9); + if (numGlyphs > 0 && bytesRead == 0) + break; /* EOF */ + if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + return -1; + } + + /* Looking for the colon that separates the codepoint and glyph data at position 2, 4, 6 and 8. */ + if (hexBuffer[2] == ':') + codepointHexSize = 2; + else if (hexBuffer[4] == ':') + codepointHexSize = 4; + else if (hexBuffer[6] == ':') + codepointHexSize = 6; + else if (hexBuffer[8] == ':') + codepointHexSize = 8; + else + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber); + return -1; + } + + if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber); + return -1; + } + if (codepoint > UNIFONT_MAX_CODEPOINT) + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT); + + /* If there was glyph data read in the last file read, move it to the front of the buffer. */ + bytesOverread = 8 - codepointHexSize; + if (codepointHexSize < 8) + SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread); + bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 1, 33 - bytesOverread); + if (bytesRead < (33 - bytesOverread)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + return -1; + } + if (hexBuffer[32] == '\n') + glyphWidth = 8; + else + { + glyphWidth = 16; + bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 1, 32); + if (bytesRead < 32) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + return -1; + } + } + + if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber); + return -1; + } + + if (codepoint <= UNIFONT_MAX_CODEPOINT) + { + if (unifontGlyph[codepoint].width > 0) + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08x in hex file on line %d.\n", codepoint, lineNumber); + else + { + unifontGlyph[codepoint].width = glyphWidth; + /* Pack the hex data into a more compact form. */ + for (i = 0; i < glyphWidth * 2; i++) + unifontGlyph[codepoint].data[i] = dehex2(hexBuffer[i * 2], hexBuffer[i * 2 + 1]); + numGlyphs++; + } + } + + lineNumber++; + } while (bytesRead > 0); + + SDL_RWclose(hexFile); + SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); + return 0; +} + +static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) +{ + int i, j; + Uint8 *row = dst; + + for (i = 0; i < width * 2; i++) + { + Uint8 data = src[i]; + for (j = 0; j < 8; j++) + { + if (data & 0x80) + { + row[0] = textColor.r; + row[1] = textColor.g; + row[2] = textColor.b; + row[3] = textColor.a; + } + else + { + row[0] = 0; + row[1] = 0; + row[2] = 0; + row[3] = 0; + } + data <<= 1; + row += 4; + } + + if (width == 8 || (width == 16 && i % 2 == 1)) + { + dst += UNIFONT_TEXTURE_PITCH; + row = dst; + } + } +} + +static int unifont_load_texture(Uint32 textureID) +{ + int i; + Uint8 * textureRGBA; + + if (textureID >= UNIFONT_NUM_TEXTURES) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); + return -1; + } + + textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); + if (textureRGBA == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); + return -1; + } + SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE); + + /* Copy the glyphs into memory in RGBA format. */ + for (i = 0; i < UNIFONT_GLYPHS_IN_TEXTURE; i++) + { + Uint32 codepoint = UNIFONT_GLYPHS_IN_TEXTURE * textureID + i; + if (unifontGlyph[codepoint].width > 0) + { + const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE; + const size_t offset = (cInTex / UNIFONT_GLYPHS_IN_ROW) * UNIFONT_TEXTURE_PITCH * 16 + (cInTex % UNIFONT_GLYPHS_IN_ROW) * 16 * 4; + unifont_make_rgba(unifontGlyph[codepoint].data, textureRGBA + offset, unifontGlyph[codepoint].width); + } + } + + /* Create textures and upload the RGBA data from above. */ + for (i = 0; i < state->num_windows; ++i) + { + SDL_Renderer *renderer = state->renderers[i]; + SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID]; + if (state->windows[i] == NULL || renderer == NULL || tex != NULL) + continue; + tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH); + if (tex == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); + return -1; + } + unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; + SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); + if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0) + { + SDL_Log("unifont error: Failed to update texture %u data for renderer %d.\n", textureID, i); + } + } + + SDL_free(textureRGBA); + unifontTextureLoaded[textureID] = 1; + return 0; +} + +static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect) +{ + SDL_Texture *texture; + const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE; + SDL_Rect srcrect; + srcrect.w = srcrect.h = 16; + if (codepoint > UNIFONT_MAX_CODEPOINT) { + return 0; + } + if (!unifontTextureLoaded[textureID]) { + if (unifont_load_texture(textureID) < 0) { + return 0; + } + } + texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID]; + if (texture != NULL) + { + const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE; + srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16; + srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16; + SDL_RenderCopy(state->renderers[rendererID], texture, &srcrect, dstrect); + } + return unifontGlyph[codepoint].width; +} + +static void unifont_cleanup() +{ + int i, j; + for (i = 0; i < state->num_windows; ++i) + { + SDL_Renderer *renderer = state->renderers[i]; + if (state->windows[i] == NULL || renderer == NULL) + continue; + for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) + { + SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j]; + if (tex != NULL) + SDL_DestroyTexture(tex); + } + } + + for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) + unifontTextureLoaded[j] = 0; + + SDL_free(unifontTexture); + SDL_free(unifontGlyph); +} + +/* Unifont code end */ +#endif + +size_t utf8_length(unsigned char c) +{ + c = (unsigned char)(0xff & c); + if (c < 0x80) + return 1; + else if ((c >> 5) ==0x6) + return 2; + else if ((c >> 4) == 0xe) + return 3; + else if ((c >> 3) == 0x1e) + return 4; + else + return 0; +} + +char *utf8_next(char *p) +{ + size_t len = utf8_length(*p); + size_t i = 0; + if (!len) + return 0; + + for (; i < len; ++i) + { + ++p; + if (!*p) + return 0; + } + return p; +} + +char *utf8_advance(char *p, size_t distance) +{ + size_t i = 0; + for (; i < distance && p; ++i) + { + p = utf8_next(p); + } + return p; +} + +Uint32 utf8_decode(char *p, size_t len) +{ + Uint32 codepoint = 0; + size_t i = 0; + if (!len) + return 0; + + for (; i < len; ++i) + { + if (i == 0) + codepoint = (0xff >> len) & *p; + else + { + codepoint <<= 6; + codepoint |= 0x3f & *p; + } + if (!*p) + return 0; + p++; + } + + return codepoint; +} + +void usage() +{ + SDL_Log("usage: testime [--font fontfile]\n"); +} + +void InitInput() +{ + /* Prepare a rect for text input */ + textRect.x = textRect.y = 100; + textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x; + textRect.h = 50; + + text[0] = 0; + markedRect = textRect; + markedText[0] = 0; + + SDL_StartTextInput(); +} + +void CleanupVideo() +{ + SDL_StopTextInput(); +#ifdef HAVE_SDL_TTF + TTF_CloseFont(font); + TTF_Quit(); +#else + unifont_cleanup(); +#endif +} + +void _Redraw(int rendererID) +{ + SDL_Renderer * renderer = state->renderers[rendererID]; + SDL_Rect drawnTextRect, cursorRect, underlineRect; + drawnTextRect = textRect; + drawnTextRect.w = 0; + + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); + SDL_RenderFillRect(renderer,&textRect); + + if (*text) + { +#ifdef HAVE_SDL_TTF + SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); + SDL_Texture *texture; + + /* Vertically center text */ + drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.w = textSur->w; + drawnTextRect.h = textSur->h; + + texture = SDL_CreateTextureFromSurface(renderer,textSur); + SDL_FreeSurface(textSur); + + SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect); + SDL_DestroyTexture(texture); +#else + char *utext = text; + Uint32 codepoint; + size_t len; + SDL_Rect dstrect; + + dstrect.x = textRect.x; + dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2; + dstrect.w = 16 * UNIFONT_DRAW_SCALE; + dstrect.h = 16 * UNIFONT_DRAW_SCALE; + drawnTextRect.y = dstrect.y; + drawnTextRect.h = dstrect.h; + + while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) + { + Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE; + dstrect.x += advance; + drawnTextRect.w += advance; + utext += len; + } +#endif + } + + markedRect.x = textRect.x + drawnTextRect.w; + markedRect.w = textRect.w - drawnTextRect.w; + if (markedRect.w < 0) + { + /* Stop text input because we cannot hold any more characters */ + SDL_StopTextInput(); + return; + } + else + { + SDL_StartTextInput(); + } + + cursorRect = drawnTextRect; + cursorRect.x += cursorRect.w; + cursorRect.w = 2; + cursorRect.h = drawnTextRect.h; + + drawnTextRect.x += drawnTextRect.w; + drawnTextRect.w = 0; + + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); + SDL_RenderFillRect(renderer,&markedRect); + + if (markedText[0]) + { +#ifdef HAVE_SDL_TTF + SDL_Surface *textSur; + SDL_Texture *texture; + if (cursor) + { + char *p = utf8_advance(markedText, cursor); + char c = 0; + if (!p) + p = &markedText[SDL_strlen(markedText)]; + + c = *p; + *p = 0; + TTF_SizeUTF8(font, markedText, &drawnTextRect.w, NULL); + cursorRect.x += drawnTextRect.w; + *p = c; + } + textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); + /* Vertically center text */ + drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.w = textSur->w; + drawnTextRect.h = textSur->h; + + texture = SDL_CreateTextureFromSurface(renderer,textSur); + SDL_FreeSurface(textSur); + + SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect); + SDL_DestroyTexture(texture); +#else + int i = 0; + char *utext = markedText; + Uint32 codepoint; + size_t len; + SDL_Rect dstrect; + + dstrect.x = drawnTextRect.x; + dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2; + dstrect.w = 16 * UNIFONT_DRAW_SCALE; + dstrect.h = 16 * UNIFONT_DRAW_SCALE; + drawnTextRect.y = dstrect.y; + drawnTextRect.h = dstrect.h; + + while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) + { + Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE; + dstrect.x += advance; + drawnTextRect.w += advance; + if (i < cursor) + cursorRect.x += advance; + i++; + utext += len; + } +#endif + + if (cursor > 0) + { + cursorRect.y = drawnTextRect.y; + cursorRect.h = drawnTextRect.h; + } + + underlineRect = markedRect; + underlineRect.y = drawnTextRect.y + drawnTextRect.h - 2; + underlineRect.h = 2; + underlineRect.w = drawnTextRect.w; + + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); + SDL_RenderFillRect(renderer, &underlineRect); + } + + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); + SDL_RenderFillRect(renderer,&cursorRect); + + SDL_SetTextInputRect(&markedRect); +} + +void Redraw() +{ + int i; + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + if (state->windows[i] == NULL) + continue; + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); + SDL_RenderClear(renderer); + + /* Sending in the window id to let the font renderers know which one we're working with. */ + _Redraw(i); + + SDL_RenderPresent(renderer); + } +} + +int main(int argc, char *argv[]) +{ + int i, done; + SDL_Event event; + const char *fontname = DEFAULT_FONT; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return 1; + } + for (i = 1; i < argc;i++) { + SDLTest_CommonArg(state, i); + } + for (argc--, argv++; argc > 0; argc--, argv++) + { + if (strcmp(argv[0], "--help") == 0) { + usage(); + return 0; + } + + else if (strcmp(argv[0], "--font") == 0) + { + argc--; + argv++; + + if (argc > 0) + fontname = argv[0]; + else { + usage(); + return 0; + } + } + } + + if (!SDLTest_CommonInit(state)) { + return 2; + } + + +#ifdef HAVE_SDL_TTF + /* Initialize fonts */ + TTF_Init(); + + font = TTF_OpenFont(fontname, DEFAULT_PTSIZE); + if (! font) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); + return -1; + } +#else + if (unifont_init(fontname) < 0) { + return -1; + } +#endif + + SDL_Log("Using font: %s\n", fontname); + + InitInput(); + /* Create the windows and initialize the renderers */ + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + Redraw(); + /* Main render loop */ + done = 0; + while (!done) { + /* Check for events */ + while (SDL_PollEvent(&event)) { + SDLTest_CommonEvent(state, &event, &done); + switch(event.type) { + case SDL_KEYDOWN: { + switch (event.key.keysym.sym) + { + case SDLK_RETURN: + text[0]=0x00; + Redraw(); + break; + case SDLK_BACKSPACE: + /* Only delete text if not in editing mode. */ + if (!markedText[0]) + { + size_t textlen = SDL_strlen(text); + + do { + if (textlen==0) + { + break; + } + if ((text[textlen-1] & 0x80) == 0x00) + { + /* One byte */ + text[textlen-1]=0x00; + break; + } + if ((text[textlen-1] & 0xC0) == 0x80) + { + /* Byte from the multibyte sequence */ + text[textlen-1]=0x00; + textlen--; + } + if ((text[textlen-1] & 0xC0) == 0xC0) + { + /* First byte of multibyte sequence */ + text[textlen-1]=0x00; + break; + } + } while(1); + + Redraw(); + } + break; + } + + if (done) + { + break; + } + + SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n", + event.key.keysym.scancode, + SDL_GetScancodeName(event.key.keysym.scancode), + event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym)); + break; + + case SDL_TEXTINPUT: + if (event.text.text[0] == '\0' || event.text.text[0] == '\n' || + markedRect.w < 0) + break; + + SDL_Log("Keyboard: text input \"%s\"\n", event.text.text); + + if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text)) + SDL_strlcat(text, event.text.text, sizeof(text)); + + SDL_Log("text inputed: %s\n", text); + + /* After text inputed, we can clear up markedText because it */ + /* is committed */ + markedText[0] = 0; + Redraw(); + break; + + case SDL_TEXTEDITING: + SDL_Log("text editing \"%s\", selected range (%d, %d)\n", + event.edit.text, event.edit.start, event.edit.length); + + SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE); + cursor = event.edit.start; + Redraw(); + break; + } + break; + + } + } + } + CleanupVideo(); + SDLTest_CommonQuit(state); + return 0; +} + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/testintersections.c b/3rdparty/sdl2-2.0.9/test/testintersections.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testintersections.c rename to 3rdparty/sdl2-2.0.9/test/testintersections.c index 82aae63388..619df0640e 100644 --- a/3rdparty/sdl2-2.0.4/test/testintersections.c +++ b/3rdparty/sdl2-2.0.9/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testjoystick.c b/3rdparty/sdl2-2.0.9/test/testjoystick.c similarity index 87% rename from 3rdparty/sdl2-2.0.4/test/testjoystick.c rename to 3rdparty/sdl2-2.0.9/test/testjoystick.c index bed27212e1..bca7492440 100644 --- a/3rdparty/sdl2-2.0.4/test/testjoystick.c +++ b/3rdparty/sdl2-2.0.9/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,6 +90,10 @@ loop(void *arg) case SDL_JOYBUTTONDOWN: SDL_Log("Joystick %d button %d down\n", event.jbutton.which, event.jbutton.button); + /* First button triggers a 0.5 second full strength rumble */ + if (event.jbutton.button == 0) { + SDL_JoystickRumble(joystick, 0xFFFF, 0xFFFF, 500); + } break; case SDL_JOYBUTTONUP: SDL_Log("Joystick %d button %d up\n", @@ -239,7 +243,7 @@ WatchJoystick(SDL_Joystick * joystick) int main(int argc, char *argv[]) { - const char *name; + const char *name, *type; int i; SDL_Joystick *joystick; @@ -268,12 +272,46 @@ main(int argc, char *argv[]) SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), guid, sizeof (guid)); + switch (SDL_JoystickGetType(joystick)) { + case SDL_JOYSTICK_TYPE_GAMECONTROLLER: + type = "Game Controller"; + break; + case SDL_JOYSTICK_TYPE_WHEEL: + type = "Wheel"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_STICK: + type = "Arcade Stick"; + break; + case SDL_JOYSTICK_TYPE_FLIGHT_STICK: + type = "Flight Stick"; + break; + case SDL_JOYSTICK_TYPE_DANCE_PAD: + type = "Dance Pad"; + break; + case SDL_JOYSTICK_TYPE_GUITAR: + type = "Guitar"; + break; + case SDL_JOYSTICK_TYPE_DRUM_KIT: + type = "Drum Kit"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_PAD: + type = "Arcade Pad"; + break; + case SDL_JOYSTICK_TYPE_THROTTLE: + type = "Throttle"; + break; + default: + type = "Unknown"; + break; + } + SDL_Log(" type: %s\n", type); SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick)); SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); } } @@ -320,6 +358,7 @@ main(int argc, char *argv[]) || (event.type == SDL_MOUSEBUTTONDOWN)) { keepGoing = SDL_FALSE; } else if (event.type == SDL_JOYDEVICEADDED) { + device = event.jdevice.which; joystick = SDL_JoystickOpen(device); if (joystick != NULL) { SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); @@ -344,3 +383,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.4/test/testkeys.c b/3rdparty/sdl2-2.0.9/test/testkeys.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/test/testkeys.c rename to 3rdparty/sdl2-2.0.9/test/testkeys.c index aea496caaf..73f880e13a 100644 --- a/3rdparty/sdl2-2.0.4/test/testkeys.c +++ b/3rdparty/sdl2-2.0.9/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testloadso.c b/3rdparty/sdl2-2.0.9/test/testloadso.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testloadso.c rename to 3rdparty/sdl2-2.0.9/test/testloadso.c index fb87fbed7a..c6fa33106f 100644 --- a/3rdparty/sdl2-2.0.4/test/testloadso.c +++ b/3rdparty/sdl2-2.0.9/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testlock.c b/3rdparty/sdl2-2.0.9/test/testlock.c similarity index 90% rename from 3rdparty/sdl2-2.0.4/test/testlock.c rename to 3rdparty/sdl2-2.0.9/test/testlock.c index 1106ec3bf0..8299a9a675 100644 --- a/3rdparty/sdl2-2.0.4/test/testlock.c +++ b/3rdparty/sdl2-2.0.9/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ static SDL_mutex *mutex = NULL; static SDL_threadID mainthread; static SDL_Thread *threads[6]; -static volatile int doterminate = 0; +static SDL_atomic_t doterminate; /* * SDL_Quit() shouldn't be used with atexit() directly because @@ -45,7 +45,7 @@ void terminate(int sig) { signal(SIGINT, terminate); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); } void @@ -54,7 +54,7 @@ closemutex(int sig) SDL_threadID id = SDL_ThreadID(); int i; SDL_Log("Process %lu: Cleaning up...\n", id == mainthread ? 0 : id); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); for (i = 0; i < 6; ++i) SDL_WaitThread(threads[i], NULL); SDL_DestroyMutex(mutex); @@ -66,7 +66,7 @@ Run(void *data) { if (SDL_ThreadID() == mainthread) signal(SIGTERM, closemutex); - while (!doterminate) { + while (!SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu ready to work\n", SDL_ThreadID()); if (SDL_LockMutex(mutex) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError()); @@ -82,7 +82,7 @@ Run(void *data) /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); } - if (SDL_ThreadID() == mainthread && doterminate) { + if (SDL_ThreadID() == mainthread && SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu: raising SIGTERM\n", SDL_ThreadID()); raise(SIGTERM); } @@ -105,6 +105,8 @@ main(int argc, char *argv[]) } atexit(SDL_Quit_Wrapper); + SDL_AtomicSet(&doterminate, 0); + if ((mutex = SDL_CreateMutex()) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); diff --git a/3rdparty/sdl2-2.0.4/test/testmessage.c b/3rdparty/sdl2-2.0.9/test/testmessage.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testmessage.c rename to 3rdparty/sdl2-2.0.9/test/testmessage.c index 91968c322c..8488d8eda6 100644 --- a/3rdparty/sdl2-2.0.4/test/testmessage.c +++ b/3rdparty/sdl2-2.0.9/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" @@ -26,7 +25,7 @@ quit(int rc) exit(rc); } -static int +static int SDLCALL button_messagebox(void *eventNumber) { const SDL_MessageBoxButtonData buttons[] = { @@ -47,12 +46,13 @@ button_messagebox(void *eventNumber) "Custom MessageBox", "This is a custom messagebox", 2, - buttons, + NULL,/* buttons */ NULL /* Default color scheme */ }; int button = -1; int success = 0; + data.buttons = buttons; if (eventNumber) { data.message = "This is a custom messagebox from a background thread."; } diff --git a/3rdparty/sdl2-2.0.4/test/testmultiaudio.c b/3rdparty/sdl2-2.0.9/test/testmultiaudio.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/test/testmultiaudio.c rename to 3rdparty/sdl2-2.0.9/test/testmultiaudio.c index 117ef2696c..52a4cac7d9 100644 --- a/3rdparty/sdl2-2.0.4/test/testmultiaudio.c +++ b/3rdparty/sdl2-2.0.9/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ typedef struct { SDL_AudioDeviceID dev; int soundpos; - volatile int done; + SDL_atomic_t done; } callback_data; callback_data cbd[64]; @@ -46,14 +46,14 @@ play_through_once(void *arg, Uint8 * stream, int len) if (len > 0) { stream += cpy; SDL_memset(stream, spec.silence, len); - cbd->done++; + SDL_AtomicSet(&cbd->done, 1); } } void loop() { - if(cbd[0].done) { + if (SDL_AtomicGet(&cbd[0].done)) { #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #endif @@ -100,8 +100,7 @@ test_multi_audio(int devcount) #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!cbd[0].done) - { + while (!SDL_AtomicGet(&cbd[0].done)) { #ifdef __ANDROID__ /* Empty queue, some application events would prevent pause. */ while (SDL_PollEvent(&event)){} @@ -136,7 +135,7 @@ test_multi_audio(int devcount) while (keep_going) { keep_going = 0; for (i = 0; i < devcount; i++) { - if ((cbd[i].dev) && (!cbd[i].done)) { + if ((cbd[i].dev) && (!SDL_AtomicGet(&cbd[i].done))) { keep_going = 1; } } diff --git a/3rdparty/sdl2-2.0.4/test/testnative.c b/3rdparty/sdl2-2.0.9/test/testnative.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testnative.c rename to 3rdparty/sdl2-2.0.9/test/testnative.c index 049c4c83e9..674d9d3b4d 100644 --- a/3rdparty/sdl2-2.0.4/test/testnative.c +++ b/3rdparty/sdl2-2.0.9/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testnative.h b/3rdparty/sdl2-2.0.9/test/testnative.h similarity index 95% rename from 3rdparty/sdl2-2.0.4/test/testnative.h rename to 3rdparty/sdl2-2.0.9/test/testnative.h index ed2bf7e52c..29d85fb325 100644 --- a/3rdparty/sdl2-2.0.4/test/testnative.h +++ b/3rdparty/sdl2-2.0.9/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testnativecocoa.m b/3rdparty/sdl2-2.0.9/test/testnativecocoa.m similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/testnativecocoa.m rename to 3rdparty/sdl2-2.0.9/test/testnativecocoa.m diff --git a/3rdparty/sdl2-2.0.4/test/testnativew32.c b/3rdparty/sdl2-2.0.9/test/testnativew32.c similarity index 97% rename from 3rdparty/sdl2-2.0.4/test/testnativew32.c rename to 3rdparty/sdl2-2.0.9/test/testnativew32.c index aaea267d26..7e96bc697a 100644 --- a/3rdparty/sdl2-2.0.4/test/testnativew32.c +++ b/3rdparty/sdl2-2.0.9/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testnativex11.c b/3rdparty/sdl2-2.0.9/test/testnativex11.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/test/testnativex11.c rename to 3rdparty/sdl2-2.0.9/test/testnativex11.c index 69fa37bbf1..386c25e9ec 100644 --- a/3rdparty/sdl2-2.0.4/test/testnativex11.c +++ b/3rdparty/sdl2-2.0.9/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testoverlay2.c b/3rdparty/sdl2-2.0.9/test/testoverlay2.c similarity index 63% rename from 3rdparty/sdl2-2.0.4/test/testoverlay2.c rename to 3rdparty/sdl2-2.0.9/test/testoverlay2.c index 453f0f443a..daf07d3e94 100644 --- a/3rdparty/sdl2-2.0.4/test/testoverlay2.c +++ b/3rdparty/sdl2-2.0.9/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -16,16 +16,14 @@ * * ********************************************************************************/ -#include -#include -#include - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" +#include "testyuv_cvt.h" + #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -33,110 +31,110 @@ #define MOOSEFRAMES_COUNT 10 SDL_Color MooseColors[84] = { - {49, 49, 49} - , {66, 24, 0} - , {66, 33, 0} - , {66, 66, 66} + {49, 49, 49, SDL_ALPHA_OPAQUE} + , {66, 24, 0, SDL_ALPHA_OPAQUE} + , {66, 33, 0, SDL_ALPHA_OPAQUE} + , {66, 66, 66, SDL_ALPHA_OPAQUE} , - {66, 115, 49} - , {74, 33, 0} - , {74, 41, 16} - , {82, 33, 8} + {66, 115, 49, SDL_ALPHA_OPAQUE} + , {74, 33, 0, SDL_ALPHA_OPAQUE} + , {74, 41, 16, SDL_ALPHA_OPAQUE} + , {82, 33, 8, SDL_ALPHA_OPAQUE} , - {82, 41, 8} - , {82, 49, 16} - , {82, 82, 82} - , {90, 41, 8} + {82, 41, 8, SDL_ALPHA_OPAQUE} + , {82, 49, 16, SDL_ALPHA_OPAQUE} + , {82, 82, 82, SDL_ALPHA_OPAQUE} + , {90, 41, 8, SDL_ALPHA_OPAQUE} , - {90, 41, 16} - , {90, 57, 24} - , {99, 49, 16} - , {99, 66, 24} + {90, 41, 16, SDL_ALPHA_OPAQUE} + , {90, 57, 24, SDL_ALPHA_OPAQUE} + , {99, 49, 16, SDL_ALPHA_OPAQUE} + , {99, 66, 24, SDL_ALPHA_OPAQUE} , - {99, 66, 33} - , {99, 74, 33} - , {107, 57, 24} - , {107, 82, 41} + {99, 66, 33, SDL_ALPHA_OPAQUE} + , {99, 74, 33, SDL_ALPHA_OPAQUE} + , {107, 57, 24, SDL_ALPHA_OPAQUE} + , {107, 82, 41, SDL_ALPHA_OPAQUE} , - {115, 57, 33} - , {115, 66, 33} - , {115, 66, 41} - , {115, 74, 0} + {115, 57, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 41, SDL_ALPHA_OPAQUE} + , {115, 74, 0, SDL_ALPHA_OPAQUE} , - {115, 90, 49} - , {115, 115, 115} - , {123, 82, 0} - , {123, 99, 57} + {115, 90, 49, SDL_ALPHA_OPAQUE} + , {115, 115, 115, SDL_ALPHA_OPAQUE} + , {123, 82, 0, SDL_ALPHA_OPAQUE} + , {123, 99, 57, SDL_ALPHA_OPAQUE} , - {132, 66, 41} - , {132, 74, 41} - , {132, 90, 8} - , {132, 99, 33} + {132, 66, 41, SDL_ALPHA_OPAQUE} + , {132, 74, 41, SDL_ALPHA_OPAQUE} + , {132, 90, 8, SDL_ALPHA_OPAQUE} + , {132, 99, 33, SDL_ALPHA_OPAQUE} , - {132, 99, 66} - , {132, 107, 66} - , {140, 74, 49} - , {140, 99, 16} + {132, 99, 66, SDL_ALPHA_OPAQUE} + , {132, 107, 66, SDL_ALPHA_OPAQUE} + , {140, 74, 49, SDL_ALPHA_OPAQUE} + , {140, 99, 16, SDL_ALPHA_OPAQUE} , - {140, 107, 74} - , {140, 115, 74} - , {148, 107, 24} - , {148, 115, 82} + {140, 107, 74, SDL_ALPHA_OPAQUE} + , {140, 115, 74, SDL_ALPHA_OPAQUE} + , {148, 107, 24, SDL_ALPHA_OPAQUE} + , {148, 115, 82, SDL_ALPHA_OPAQUE} , - {148, 123, 74} - , {148, 123, 90} - , {156, 115, 33} - , {156, 115, 90} + {148, 123, 74, SDL_ALPHA_OPAQUE} + , {148, 123, 90, SDL_ALPHA_OPAQUE} + , {156, 115, 33, SDL_ALPHA_OPAQUE} + , {156, 115, 90, SDL_ALPHA_OPAQUE} , - {156, 123, 82} - , {156, 132, 82} - , {156, 132, 99} - , {156, 156, 156} + {156, 123, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 99, SDL_ALPHA_OPAQUE} + , {156, 156, 156, SDL_ALPHA_OPAQUE} , - {165, 123, 49} - , {165, 123, 90} - , {165, 132, 82} - , {165, 132, 90} + {165, 123, 49, SDL_ALPHA_OPAQUE} + , {165, 123, 90, SDL_ALPHA_OPAQUE} + , {165, 132, 82, SDL_ALPHA_OPAQUE} + , {165, 132, 90, SDL_ALPHA_OPAQUE} , - {165, 132, 99} - , {165, 140, 90} - , {173, 132, 57} - , {173, 132, 99} + {165, 132, 99, SDL_ALPHA_OPAQUE} + , {165, 140, 90, SDL_ALPHA_OPAQUE} + , {173, 132, 57, SDL_ALPHA_OPAQUE} + , {173, 132, 99, SDL_ALPHA_OPAQUE} , - {173, 140, 107} - , {173, 140, 115} - , {173, 148, 99} - , {173, 173, 173} + {173, 140, 107, SDL_ALPHA_OPAQUE} + , {173, 140, 115, SDL_ALPHA_OPAQUE} + , {173, 148, 99, SDL_ALPHA_OPAQUE} + , {173, 173, 173, SDL_ALPHA_OPAQUE} , - {181, 140, 74} - , {181, 148, 115} - , {181, 148, 123} - , {181, 156, 107} + {181, 140, 74, SDL_ALPHA_OPAQUE} + , {181, 148, 115, SDL_ALPHA_OPAQUE} + , {181, 148, 123, SDL_ALPHA_OPAQUE} + , {181, 156, 107, SDL_ALPHA_OPAQUE} , - {189, 148, 123} - , {189, 156, 82} - , {189, 156, 123} - , {189, 156, 132} + {189, 148, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 82, SDL_ALPHA_OPAQUE} + , {189, 156, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 132, SDL_ALPHA_OPAQUE} , - {189, 189, 189} - , {198, 156, 123} - , {198, 165, 132} - , {206, 165, 99} + {189, 189, 189, SDL_ALPHA_OPAQUE} + , {198, 156, 123, SDL_ALPHA_OPAQUE} + , {198, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 165, 99, SDL_ALPHA_OPAQUE} , - {206, 165, 132} - , {206, 173, 140} - , {206, 206, 206} - , {214, 173, 115} + {206, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 173, 140, SDL_ALPHA_OPAQUE} + , {206, 206, 206, SDL_ALPHA_OPAQUE} + , {214, 173, 115, SDL_ALPHA_OPAQUE} , - {214, 173, 140} - , {222, 181, 148} - , {222, 189, 132} - , {222, 189, 156} + {214, 173, 140, SDL_ALPHA_OPAQUE} + , {222, 181, 148, SDL_ALPHA_OPAQUE} + , {222, 189, 132, SDL_ALPHA_OPAQUE} + , {222, 189, 156, SDL_ALPHA_OPAQUE} , - {222, 222, 222} - , {231, 198, 165} - , {231, 231, 231} - , {239, 206, 173} + {222, 222, 222, SDL_ALPHA_OPAQUE} + , {231, 198, 165, SDL_ALPHA_OPAQUE} + , {231, 231, 231, SDL_ALPHA_OPAQUE} + , {239, 206, 173, SDL_ALPHA_OPAQUE} }; Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE*2]; @@ -149,8 +147,7 @@ SDL_Renderer *renderer; int paused = 0; int i; SDL_bool done = SDL_FALSE; -Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -int fpsdelay; +static int fpsdelay; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -160,91 +157,6 @@ quit(int rc) exit(rc); } -/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */ - -/* NOTE: These RGB conversion functions are not intended for speed, - only as examples. -*/ - -void -RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) -{ - if (monochrome) { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = 128; - yuv[2] = 128; -#else - yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128; - yuv[2] = 128; -#endif - } else { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); - yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); -#else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); -#endif - } - - if (luminance != 100) { - yuv[0] = yuv[0] * luminance / 100; - if (yuv[0] > 255) - yuv[0] = 255; - } -} - -void -ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[3]; - - op[0] = out; - op[1] = op[0] + w*h; - op[2] = op[1] + w*h/4; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[2]; - *(op[2]++) = yuv[1]; - } - rgb += 3; - } - } -} - -void -ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[2]; - - op[0] = out; - op[1] = op[0] + w*h; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[1]; - *(op[1]++) = yuv[2]; - } - rgb += 3; - } - } -} - static void PrintUsage(char *argv0) { @@ -307,7 +219,7 @@ loop() if (!paused) { i = (i + 1) % MOOSEFRAMES_COUNT; - SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format)); + SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W); } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect); @@ -328,13 +240,7 @@ main(int argc, char **argv) SDL_Window *window; int j; int fps = 12; - int fpsdelay; int nodelay = 0; -#ifdef TEST_NV12 - Uint32 pixel_format = SDL_PIXELFORMAT_NV12; -#else - Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -#endif int scale = 5; /* Enable standard application logging */ @@ -348,7 +254,7 @@ main(int argc, char **argv) while (argc > 1) { if (strcmp(argv[1], "-fps") == 0) { if (argv[2]) { - fps = atoi(argv[2]); + fps = SDL_atoi(argv[2]); if (fps == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); @@ -372,7 +278,7 @@ main(int argc, char **argv) argc -= 1; } else if (strcmp(argv[1], "-scale") == 0) { if (argv[2]) { - scale = atoi(argv[2]); + scale = SDL_atoi(argv[2]); if (scale == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -scale option requires an argument [from 1 to 50], default is 5.\n"); @@ -404,7 +310,6 @@ main(int argc, char **argv) RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); if (RawMooseData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); - free(RawMooseData); quit(1); } @@ -441,7 +346,7 @@ main(int argc, char **argv) quit(4); } - MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); free(RawMooseData); @@ -463,17 +368,9 @@ main(int argc, char **argv) rgb[2] = MooseColors[frame[j]].b; rgb += 3; } - switch (pixel_format) { - case SDL_PIXELFORMAT_YV12: - ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - case SDL_PIXELFORMAT_NV12: - ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - default: - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n"); - break; - } + ConvertRGBtoYUV(SDL_PIXELFORMAT_YV12, MooseFrameRGB, MOOSEPIC_W*3, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, + SDL_GetYUVConversionModeForResolution(MOOSEPIC_W, MOOSEPIC_H), + 0, 100); } free(RawMooseData); diff --git a/3rdparty/sdl2-2.0.9/test/testplatform.c b/3rdparty/sdl2-2.0.9/test/testplatform.c new file mode 100644 index 0000000000..1c1d2dcd83 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testplatform.c @@ -0,0 +1,442 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include + +#include "SDL.h" + +/* + * Watcom C flags these as Warning 201: "Unreachable code" if you just + * compare them directly, so we push it through a function to keep the + * compiler quiet. --ryan. + */ +static int +badsize(size_t sizeoftype, size_t hardcodetype) +{ + return sizeoftype != hardcodetype; +} + +int +TestTypes(SDL_bool verbose) +{ + int error = 0; + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); + + if (badsize(sizeof(Uint8), 1)) { + if (verbose) + SDL_Log("sizeof(Uint8) != 1, instead = %u\n", + (unsigned int)sizeof(Uint8)); + ++error; + } + if (badsize(sizeof(Uint16), 2)) { + if (verbose) + SDL_Log("sizeof(Uint16) != 2, instead = %u\n", + (unsigned int)sizeof(Uint16)); + ++error; + } + if (badsize(sizeof(Uint32), 4)) { + if (verbose) + SDL_Log("sizeof(Uint32) != 4, instead = %u\n", + (unsigned int)sizeof(Uint32)); + ++error; + } + if (badsize(sizeof(Uint64), 8)) { + if (verbose) + SDL_Log("sizeof(Uint64) != 8, instead = %u\n", + (unsigned int)sizeof(Uint64)); + ++error; + } + if (verbose && !error) + SDL_Log("All data types are the expected size.\n"); + + return (error ? 1 : 0); +} + +int +TestEndian(SDL_bool verbose) +{ + int error = 0; + Uint16 value = 0x1234; + int real_byteorder; + Uint16 value16 = 0xCDAB; + Uint16 swapped16 = 0xABCD; + Uint32 value32 = 0xEFBEADDE; + Uint32 swapped32 = 0xDEADBEEF; + Uint64 value64, swapped64; + + value64 = 0xEFBEADDE; + value64 <<= 32; + value64 |= 0xCDAB3412; + swapped64 = 0x1234ABCD; + swapped64 <<= 32; + swapped64 |= 0xDEADBEEF; + + if (verbose) { + SDL_Log("Detected a %s endian machine.\n", + (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big"); + } + if ((*((char *) &value) >> 4) == 0x1) { + real_byteorder = SDL_BIG_ENDIAN; + } else { + real_byteorder = SDL_LIL_ENDIAN; + } + if (real_byteorder != SDL_BYTEORDER) { + if (verbose) { + SDL_Log("Actually a %s endian machine!\n", + (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big"); + } + ++error; + } + if (verbose) { + SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16, + SDL_Swap16(value16)); + } + if (SDL_Swap16(value16) != swapped16) { + if (verbose) { + SDL_Log("16 bit value swapped incorrectly!\n"); + } + ++error; + } + if (verbose) { + SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32, + SDL_Swap32(value32)); + } + if (SDL_Swap32(value32) != swapped32) { + if (verbose) { + SDL_Log("32 bit value swapped incorrectly!\n"); + } + ++error; + } + if (verbose) { + SDL_Log("Value 64 = 0x%"SDL_PRIX64", swapped = 0x%"SDL_PRIX64"\n", value64, + SDL_Swap64(value64)); + } + if (SDL_Swap64(value64) != swapped64) { + if (verbose) { + SDL_Log("64 bit value swapped incorrectly!\n"); + } + ++error; + } + return (error ? 1 : 0); +} + +static int TST_allmul (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) * (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_alldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) / (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_allrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) % (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_ualldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) / (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_uallrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) % (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) << arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) << arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) >> arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) >> arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + + +typedef int (*LL_Intrinsic)(void *a, void *b, int arg, void *result, void *expected); + +typedef struct { + const char *operation; + LL_Intrinsic routine; + unsigned long long a, b; + int arg; + unsigned long long expected_result; +} LL_Test; + +static LL_Test LL_Tests[] = +{ + /* UNDEFINED {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allshr", &TST_allshr, 0xAAAAAAAA55555555ll, 0ll, 63, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0xFFFFFFFFFFFFFFFFll}, */ + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 1, 0x2FAFAFAFAFAFAFAFll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 32, 0x000000005F5F5F5Fll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 33, 0x000000002FAFAFAFll}, + + /* UNDEFINED {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + /* UNDEFINED {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0x7FFFFFFFFFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0x00000000FFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0x000000007FFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000000ll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x0000000000000001ll, 0x000000000FFFFFFFll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000000000010ll, 0x000000000FFFFFFFll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000100ll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000010000000ll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x0000000010000000ll, 0x000000000FFFFFFFll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000080000000ll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0x000000000FFFFFFFll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000008ll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000080000008ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x00000000FFFFFFFFll, 0x00000000FFFFFFFFll, 0, 0xFFFFFFFE00000001ll}, + + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xC000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_allrem", &TST_allrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_allrem", &TST_allrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFFFFFFFFFEll}, + {"_allrem", &TST_allrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x00000001FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_uallrem", &TST_uallrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_uallrem", &TST_uallrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x000000007FFFFFFEll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x7FFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + {NULL} +}; + +int +Test64Bit (SDL_bool verbose) +{ + LL_Test *t; + int failed = 0; + + for (t = LL_Tests; t->routine != NULL; t++) { + unsigned long long result = 0; + unsigned int *al = (unsigned int *)&t->a; + unsigned int *bl = (unsigned int *)&t->b; + unsigned int *el = (unsigned int *)&t->expected_result; + unsigned int *rl = (unsigned int *)&result; + + if (!t->routine(&t->a, &t->b, t->arg, &result, &t->expected_result)) { + if (verbose) + SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n", + t->operation, al[1], al[0], bl[1], bl[0], t->arg, rl[1], rl[0], el[1], el[0]); + ++failed; + } + } + if (verbose && (failed == 0)) + SDL_Log("All 64bit instrinsic tests passed\n"); + return (failed ? 1 : 0); +} + +int +TestCPUInfo(SDL_bool verbose) +{ + if (verbose) { + SDL_Log("CPU count: %d\n", SDL_GetCPUCount()); + SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize()); + SDL_Log("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected"); + SDL_Log("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected"); + SDL_Log("MMX %s\n", SDL_HasMMX()? "detected" : "not detected"); + SDL_Log("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected"); + SDL_Log("SSE %s\n", SDL_HasSSE()? "detected" : "not detected"); + SDL_Log("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected"); + SDL_Log("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected"); + SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected"); + SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); + SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected"); + SDL_Log("AVX2 %s\n", SDL_HasAVX2()? "detected" : "not detected"); + SDL_Log("AVX-512F %s\n", SDL_HasAVX512F()? "detected" : "not detected"); + SDL_Log("NEON %s\n", SDL_HasNEON()? "detected" : "not detected"); + SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); + } + return (0); +} + +int +TestAssertions(SDL_bool verbose) +{ + SDL_assert(1); + SDL_assert_release(1); + SDL_assert_paranoid(1); + SDL_assert(0 || 1); + SDL_assert_release(0 || 1); + SDL_assert_paranoid(0 || 1); + +#if 0 /* enable this to test assertion failures. */ + SDL_assert_release(1 == 2); + SDL_assert_release(5 < 4); + SDL_assert_release(0 && "This is a test"); +#endif + + { + const SDL_AssertData *item = SDL_GetAssertionReport(); + while (item) { + SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + item->condition, item->function, item->filename, + item->linenum, item->trigger_count, + item->always_ignore ? "yes" : "no"); + item = item->next; + } + } + return (0); +} + +int +main(int argc, char *argv[]) +{ + SDL_bool verbose = SDL_TRUE; + int status = 0; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + if (argv[1] && (SDL_strcmp(argv[1], "-q") == 0)) { + verbose = SDL_FALSE; + } + if (verbose) { + SDL_Log("This system is running %s\n", SDL_GetPlatform()); + } + + status += TestTypes(verbose); + status += TestEndian(verbose); + status += Test64Bit(verbose); + status += TestCPUInfo(verbose); + status += TestAssertions(verbose); + + return status; +} diff --git a/3rdparty/sdl2-2.0.4/test/testpower.c b/3rdparty/sdl2-2.0.9/test/testpower.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/test/testpower.c rename to 3rdparty/sdl2-2.0.9/test/testpower.c index 300d21a24d..adb58832ac 100644 --- a/3rdparty/sdl2-2.0.4/test/testpower.c +++ b/3rdparty/sdl2-2.0.9/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/test/testqsort.c b/3rdparty/sdl2-2.0.9/test/testqsort.c new file mode 100644 index 0000000000..e83b0731e5 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testqsort.c @@ -0,0 +1,108 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL_test.h" + +static int +num_compare(const void *_a, const void *_b) +{ + const int a = *((const int *) _a); + const int b = *((const int *) _b); + return (a < b) ? -1 : ((a > b) ? 1 : 0); +} + +static void +test_sort(const char *desc, int *nums, const int arraylen) +{ + int i; + int prev; + + SDL_Log("test: %s arraylen=%d", desc, arraylen); + + SDL_qsort(nums, arraylen, sizeof (nums[0]), num_compare); + + prev = nums[0]; + for (i = 1; i < arraylen; i++) { + const int val = nums[i]; + if (val < prev) { + SDL_Log("sort is broken!"); + return; + } + prev = val; + } +} + +int +main(int argc, char *argv[]) +{ + static int nums[1024 * 100]; + static const int itervals[] = { SDL_arraysize(nums), 12 }; + int iteration; + SDLTest_RandomContext rndctx; + + if (argc > 1) + { + int success; + Uint64 seed = 0; + if (argv[1][0] == '0' && argv[1][1] == 'x') + success = SDL_sscanf(argv[1] + 2, "%llx", &seed); + else + success = SDL_sscanf(argv[1], "%llu", &seed); + if (!success) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number.\n"); + return 1; + } + if (seed <= 0xffffffff) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Seed must be equal or greater than 0x100000000.\n"); + return 1; + } + SDLTest_RandomInit(&rndctx, (unsigned int)(seed >> 32), (unsigned int)(seed & 0xffffffff)); + } + else + { + SDLTest_RandomInitTime(&rndctx); + } + SDL_Log("Using random seed 0x%08x%08x\n", rndctx.x, rndctx.c); + + for (iteration = 0; iteration < SDL_arraysize(itervals); iteration++) { + const int arraylen = itervals[iteration]; + int i; + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + test_sort("already sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + nums[arraylen-1] = -1; + test_sort("already sorted except last element", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = (arraylen-1) - i; + } + test_sort("reverse sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = SDLTest_RandomInt(&rndctx); + } + test_sort("random sorted", nums, arraylen); + } + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/3rdparty/sdl2-2.0.4/test/testrelative.c b/3rdparty/sdl2-2.0.9/test/testrelative.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testrelative.c rename to 3rdparty/sdl2-2.0.9/test/testrelative.c index 59d23f6388..816329ff56 100644 --- a/3rdparty/sdl2-2.0.4/test/testrelative.c +++ b/3rdparty/sdl2-2.0.9/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testrendercopyex.c b/3rdparty/sdl2-2.0.9/test/testrendercopyex.c similarity index 96% rename from 3rdparty/sdl2-2.0.4/test/testrendercopyex.c rename to 3rdparty/sdl2-2.0.9/test/testrendercopyex.c index 856abf7d0b..209a351576 100644 --- a/3rdparty/sdl2-2.0.4/test/testrendercopyex.c +++ b/3rdparty/sdl2-2.0.9/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ quit(int rc) } SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) { SDL_Surface *temp; SDL_Texture *texture; @@ -126,7 +126,7 @@ Draw(DrawState *s) s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2; s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2; - SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, s->scale_direction); + SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, (SDL_RendererFlip)s->scale_direction); SDL_SetRenderTarget(s->renderer, NULL); SDL_RenderCopy(s->renderer, target, NULL, NULL); diff --git a/3rdparty/sdl2-2.0.4/test/testrendertarget.c b/3rdparty/sdl2-2.0.9/test/testrendertarget.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testrendertarget.c rename to 3rdparty/sdl2-2.0.9/test/testrendertarget.c index c5e1dce05b..7d24d8aeae 100644 --- a/3rdparty/sdl2-2.0.4/test/testrendertarget.c +++ b/3rdparty/sdl2-2.0.9/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testresample.c b/3rdparty/sdl2-2.0.9/test/testresample.c similarity index 86% rename from 3rdparty/sdl2-2.0.4/test/testresample.c rename to 3rdparty/sdl2-2.0.9/test/testresample.c index 0e92bbe11a..4234d9e454 100644 --- a/3rdparty/sdl2-2.0.4/test/testresample.c +++ b/3rdparty/sdl2-2.0.9/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ main(int argc, char **argv) Uint32 len = 0; Uint8 *data = NULL; int cvtfreq = 0; + int cvtchans = 0; int bitsize = 0; int blockalign = 0; int avgbytes = 0; @@ -28,12 +29,13 @@ main(int argc, char **argv) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - if (argc != 4) { - SDL_Log("USAGE: %s in.wav out.wav newfreq\n", argv[0]); + if (argc != 5) { + SDL_Log("USAGE: %s in.wav out.wav newfreq newchans\n", argv[0]); return 1; } cvtfreq = SDL_atoi(argv[3]); + cvtchans = SDL_atoi(argv[4]); if (SDL_Init(SDL_INIT_AUDIO) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); @@ -47,7 +49,7 @@ main(int argc, char **argv) } if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq, - spec.format, spec.channels, cvtfreq) == -1) { + spec.format, cvtchans, cvtfreq) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError()); SDL_FreeWAV(data); SDL_Quit(); @@ -83,16 +85,16 @@ main(int argc, char **argv) } bitsize = SDL_AUDIO_BITSIZE(spec.format); - blockalign = (bitsize / 8) * spec.channels; + blockalign = (bitsize / 8) * cvtchans; avgbytes = cvtfreq * blockalign; SDL_WriteLE32(io, 0x46464952); /* RIFF */ - SDL_WriteLE32(io, len * cvt.len_mult + 36); + SDL_WriteLE32(io, cvt.len_cvt + 36); SDL_WriteLE32(io, 0x45564157); /* WAVE */ SDL_WriteLE32(io, 0x20746D66); /* fmt */ SDL_WriteLE32(io, 16); /* chunk size */ - SDL_WriteLE16(io, 1); /* uncompressed */ - SDL_WriteLE16(io, spec.channels); /* channels */ + SDL_WriteLE16(io, SDL_AUDIO_ISFLOAT(spec.format) ? 3 : 1); /* uncompressed */ + SDL_WriteLE16(io, cvtchans); /* channels */ SDL_WriteLE32(io, cvtfreq); /* sample rate */ SDL_WriteLE32(io, avgbytes); /* average bytes per second */ SDL_WriteLE16(io, blockalign); /* block align */ diff --git a/3rdparty/sdl2-2.0.4/test/testrumble.c b/3rdparty/sdl2-2.0.9/test/testrumble.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/test/testrumble.c rename to 3rdparty/sdl2-2.0.9/test/testrumble.c index ea7466d2da..908a6aafb4 100644 --- a/3rdparty/sdl2-2.0.4/test/testrumble.c +++ b/3rdparty/sdl2-2.0.9/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ main(int argc, char **argv) name = NULL; index = -1; if (argc > 1) { + size_t l; name = argv[1]; if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) { SDL_Log("USAGE: %s [device]\n" @@ -63,9 +64,9 @@ main(int argc, char **argv) return 0; } - i = strlen(name); - if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) { - index = atoi(name); + l = SDL_strlen(name); + if ((l < 3) && SDL_isdigit(name[0]) && ((l == 1) || SDL_isdigit(name[1]))) { + index = SDL_atoi(name); name = NULL; } } diff --git a/3rdparty/sdl2-2.0.4/test/testscale.c b/3rdparty/sdl2-2.0.9/test/testscale.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testscale.c rename to 3rdparty/sdl2-2.0.9/test/testscale.c index 9f5fdbff10..e1b46fcc8d 100644 --- a/3rdparty/sdl2-2.0.4/test/testscale.c +++ b/3rdparty/sdl2-2.0.9/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testsem.c b/3rdparty/sdl2-2.0.9/test/testsem.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testsem.c rename to 3rdparty/sdl2-2.0.9/test/testsem.c index b8d3b27491..884763e6a3 100644 --- a/3rdparty/sdl2-2.0.4/test/testsem.c +++ b/3rdparty/sdl2-2.0.9/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/test/testsensor.c b/3rdparty/sdl2-2.0.9/test/testsensor.c new file mode 100644 index 0000000000..00bfd137de --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testsensor.c @@ -0,0 +1,117 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* Simple test of the SDL sensor code */ + +#include "SDL.h" + +static const char *GetSensorTypeString(SDL_SensorType type) +{ + static char unknown_type[64]; + + switch (type) + { + case SDL_SENSOR_INVALID: + return "SDL_SENSOR_INVALID"; + case SDL_SENSOR_UNKNOWN: + return "SDL_SENSOR_UNKNOWN"; + case SDL_SENSOR_ACCEL: + return "SDL_SENSOR_ACCEL"; + case SDL_SENSOR_GYRO: + return "SDL_SENSOR_GYRO"; + default: + SDL_snprintf(unknown_type, sizeof(unknown_type), "UNKNOWN (%d)", type); + return unknown_type; + } +} + +static void HandleSensorEvent(SDL_SensorEvent *event) +{ + SDL_Sensor *sensor = SDL_SensorFromInstanceID(event->which); + if (!sensor) { + SDL_Log("Couldn't get sensor for sensor event\n"); + return; + } + + switch (SDL_SensorGetType(sensor)) { + case SDL_SENSOR_ACCEL: + SDL_Log("Accelerometer update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + break; + case SDL_SENSOR_GYRO: + SDL_Log("Gyro update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + break; + default: + SDL_Log("Sensor update for sensor type %s\n", GetSensorTypeString(SDL_SensorGetType(sensor))); + break; + } +} + +int +main(int argc, char **argv) +{ + int i; + int num_sensors, num_opened; + + /* Load the SDL library */ + if (SDL_Init(SDL_INIT_SENSOR) < 0) { + SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError()); + return (1); + } + + num_sensors = SDL_NumSensors(); + num_opened = 0; + + SDL_Log("There are %d sensors available\n", num_sensors); + for (i = 0; i < num_sensors; ++i) { + SDL_Log("Sensor %d: %s, type %s, platform type %d\n", + SDL_SensorGetDeviceInstanceID(i), + SDL_SensorGetDeviceName(i), + GetSensorTypeString(SDL_SensorGetDeviceType(i)), + SDL_SensorGetDeviceNonPortableType(i)); + + if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) { + SDL_Sensor *sensor = SDL_SensorOpen(i); + if (sensor == NULL) { + SDL_Log("Couldn't open sensor %d: %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); + } else { + ++num_opened; + } + } + } + SDL_Log("Opened %d sensors\n", num_opened); + + if (num_opened > 0) { + SDL_bool done = SDL_FALSE; + SDL_Event event; + + SDL_CreateWindow("Sensor Test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP); + while (!done) { + while (SDL_PollEvent(&event) > 0) { + switch (event.type) { + case SDL_SENSORUPDATE: + HandleSensorEvent(&event.sensor); + break; + case SDL_MOUSEBUTTONUP: + case SDL_KEYUP: + case SDL_QUIT: + done = SDL_TRUE; + break; + default: + break; + } + } + } + } + + SDL_Quit(); + return (0); +} diff --git a/3rdparty/sdl2-2.0.4/test/testshader.c b/3rdparty/sdl2-2.0.9/test/testshader.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testshader.c rename to 3rdparty/sdl2-2.0.9/test/testshader.c index fc6da29875..ee0ccdad20 100644 --- a/3rdparty/sdl2-2.0.4/test/testshader.c +++ b/3rdparty/sdl2-2.0.9/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testshape.c b/3rdparty/sdl2-2.0.9/test/testshape.c similarity index 94% rename from 3rdparty/sdl2-2.0.4/test/testshape.c rename to 3rdparty/sdl2-2.0.9/test/testshape.c index 00750a9708..7e451e667b 100644 --- a/3rdparty/sdl2-2.0.4/test/testshape.c +++ b/3rdparty/sdl2-2.0.9/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,7 +48,6 @@ int main(int argc,char** argv) SDL_Renderer *renderer; SDL_Color black = {0,0,0,0xff}; SDL_Event event; - int event_pending = 0; int should_exit = 0; unsigned int current_picture; int button_down; @@ -71,13 +70,16 @@ int main(int argc,char** argv) num_pictures = argc - 1; pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures); + if (!pictures) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory."); + exit(1); + } for(i=0;i + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,12 @@ LoadSprite(const char *file) SDL_FreeSurface(temp); return (-1); } - SDL_SetTextureBlendMode(sprites[i], blendMode); + if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + SDL_DestroyTexture(sprites[i]); + return (-1); + } } SDL_FreeSurface(temp); @@ -295,6 +300,9 @@ main(int argc, char *argv[]) } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) { blendMode = SDL_BLENDMODE_MOD; consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "sub") == 0) { + blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); + consumed = 2; } } } else if (SDL_strcasecmp(argv[i], "--iterations") == 0) { diff --git a/3rdparty/sdl2-2.0.4/test/testspriteminimal.c b/3rdparty/sdl2-2.0.9/test/testspriteminimal.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testspriteminimal.c rename to 3rdparty/sdl2-2.0.9/test/testspriteminimal.c index 05f97309c0..92560002ac 100644 --- a/3rdparty/sdl2-2.0.4/test/testspriteminimal.c +++ b/3rdparty/sdl2-2.0.9/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/teststreaming.c b/3rdparty/sdl2-2.0.9/test/teststreaming.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/teststreaming.c rename to 3rdparty/sdl2-2.0.9/test/teststreaming.c index 86cc13917b..7ec6891062 100644 --- a/3rdparty/sdl2-2.0.4/test/teststreaming.c +++ b/3rdparty/sdl2-2.0.9/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testthread.c b/3rdparty/sdl2-2.0.9/test/testthread.c similarity index 72% rename from 3rdparty/sdl2-2.0.4/test/testthread.c rename to 3rdparty/sdl2-2.0.9/test/testthread.c index 90e2c60c58..4555a1e945 100644 --- a/3rdparty/sdl2-2.0.4/test/testthread.c +++ b/3rdparty/sdl2-2.0.9/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ static SDL_TLSID tls; static int alive = 0; +static int testprio = 0; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -29,14 +30,37 @@ quit(int rc) exit(rc); } +static const char * +getprioritystr(SDL_ThreadPriority priority) +{ + switch(priority) + { + case SDL_THREAD_PRIORITY_LOW: return "SDL_THREAD_PRIORITY_LOW"; + case SDL_THREAD_PRIORITY_NORMAL: return "SDL_THREAD_PRIORITY_NORMAL"; + case SDL_THREAD_PRIORITY_HIGH: return "SDL_THREAD_PRIORITY_HIGH"; + case SDL_THREAD_PRIORITY_TIME_CRITICAL: return "SDL_THREAD_PRIORITY_TIME_CRITICAL"; + } + + return "???"; +} + int SDLCALL ThreadFunc(void *data) { + SDL_ThreadPriority prio = SDL_THREAD_PRIORITY_NORMAL; + SDL_TLSSet(tls, "baby thread", NULL); SDL_Log("Started thread %s: My thread id is %lu, thread data = %s\n", (char *) data, SDL_ThreadID(), (const char *)SDL_TLSGet(tls)); while (alive) { SDL_Log("Thread '%s' is alive!\n", (char *) data); + + if (testprio) { + SDL_Log("SDL_SetThreadPriority(%s):%d\n", getprioritystr(prio), SDL_SetThreadPriority(prio)); + if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL) + prio = SDL_THREAD_PRIORITY_LOW; + } + SDL_Delay(1 * 1000); } SDL_Log("Thread '%s' exiting!\n", (char *) data); @@ -55,6 +79,7 @@ killed(int sig) int main(int argc, char *argv[]) { + int arg = 1; SDL_Thread *thread; /* Enable standard application logging */ @@ -66,6 +91,13 @@ main(int argc, char *argv[]) return (1); } + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--prio") == 0) { + testprio = 1; + } + ++arg; + } + tls = SDL_TLSCreate(); SDL_assert(tls); SDL_TLSSet(tls, "main thread", NULL); diff --git a/3rdparty/sdl2-2.0.4/test/testtimer.c b/3rdparty/sdl2-2.0.9/test/testtimer.c similarity index 98% rename from 3rdparty/sdl2-2.0.4/test/testtimer.c rename to 3rdparty/sdl2-2.0.9/test/testtimer.c index 32b7490982..34764c1c96 100644 --- a/3rdparty/sdl2-2.0.4/test/testtimer.c +++ b/3rdparty/sdl2-2.0.9/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testver.c b/3rdparty/sdl2-2.0.9/test/testver.c similarity index 95% rename from 3rdparty/sdl2-2.0.4/test/testver.c rename to 3rdparty/sdl2-2.0.9/test/testver.c index f0e3bcf3c2..1ae0083457 100644 --- a/3rdparty/sdl2-2.0.4/test/testver.c +++ b/3rdparty/sdl2-2.0.9/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.4/test/testviewport.c b/3rdparty/sdl2-2.0.9/test/testviewport.c similarity index 99% rename from 3rdparty/sdl2-2.0.4/test/testviewport.c rename to 3rdparty/sdl2-2.0.9/test/testviewport.c index 7ed4e6ec35..4b8d20e76d 100644 --- a/3rdparty/sdl2-2.0.4/test/testviewport.c +++ b/3rdparty/sdl2-2.0.9/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/3rdparty/sdl2-2.0.9/test/testvulkan.c b/3rdparty/sdl2-2.0.9/test/testvulkan.c new file mode 100644 index 0000000000..cd682af1f6 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testvulkan.c @@ -0,0 +1,1201 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include +#include + +#include "SDL_test_common.h" + +#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) + +int main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Vulkan support on this system\n"); + return 1; +} + +#else + +#define VK_NO_PROTOTYPES +#ifdef HAVE_VULKAN_H +#include +#else +/* SDL includes a copy for building on systems without the Vulkan SDK */ +#include "../src/video/khronos/vulkan/vulkan.h" +#endif +#include "SDL_vulkan.h" + +#ifndef UINT64_MAX /* VS2008 */ +#define UINT64_MAX 18446744073709551615 +#endif + +#define VULKAN_FUNCTIONS() \ + VULKAN_DEVICE_FUNCTION(vkAcquireNextImageKHR) \ + VULKAN_DEVICE_FUNCTION(vkAllocateCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkBeginCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkCmdClearColorImage) \ + VULKAN_DEVICE_FUNCTION(vkCmdPipelineBarrier) \ + VULKAN_DEVICE_FUNCTION(vkCreateCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkCreateFence) \ + VULKAN_DEVICE_FUNCTION(vkCreateImageView) \ + VULKAN_DEVICE_FUNCTION(vkCreateSemaphore) \ + VULKAN_DEVICE_FUNCTION(vkCreateSwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDestroyCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkDestroyDevice) \ + VULKAN_DEVICE_FUNCTION(vkDestroyFence) \ + VULKAN_DEVICE_FUNCTION(vkDestroyImageView) \ + VULKAN_DEVICE_FUNCTION(vkDestroySemaphore) \ + VULKAN_DEVICE_FUNCTION(vkDestroySwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDeviceWaitIdle) \ + VULKAN_DEVICE_FUNCTION(vkEndCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkFreeCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkGetDeviceQueue) \ + VULKAN_DEVICE_FUNCTION(vkGetFenceStatus) \ + VULKAN_DEVICE_FUNCTION(vkGetSwapchainImagesKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueuePresentKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueueSubmit) \ + VULKAN_DEVICE_FUNCTION(vkResetCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkResetFences) \ + VULKAN_DEVICE_FUNCTION(vkWaitForFences) \ + VULKAN_GLOBAL_FUNCTION(vkCreateInstance) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceExtensionProperties) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceLayerProperties) \ + VULKAN_INSTANCE_FUNCTION(vkCreateDevice) \ + VULKAN_INSTANCE_FUNCTION(vkDestroyInstance) \ + VULKAN_INSTANCE_FUNCTION(vkDestroySurfaceKHR) \ + VULKAN_INSTANCE_FUNCTION(vkEnumerateDeviceExtensionProperties) \ + VULKAN_INSTANCE_FUNCTION(vkEnumeratePhysicalDevices) \ + VULKAN_INSTANCE_FUNCTION(vkGetDeviceProcAddr) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceFeatures) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceQueueFamilyProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR) + +#define VULKAN_DEVICE_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_GLOBAL_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_INSTANCE_FUNCTION(name) static PFN_##name name = NULL; +VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +static PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + +/* Based on the headers found in + * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers + */ +#if VK_HEADER_VERSION < 22 +enum +{ + VK_ERROR_FRAGMENTED_POOL = -12, +}; +#endif +#if VK_HEADER_VERSION < 38 +enum { + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000 +}; +#endif + +static const char *getVulkanResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +typedef struct VulkanContext +{ + VkInstance instance; + VkDevice device; + VkSurfaceKHR surface; + VkSwapchainKHR swapchain; + VkPhysicalDeviceProperties physicalDeviceProperties; + VkPhysicalDeviceFeatures physicalDeviceFeatures; + uint32_t graphicsQueueFamilyIndex; + uint32_t presentQueueFamilyIndex; + VkPhysicalDevice physicalDevice; + VkQueue graphicsQueue; + VkQueue presentQueue; + VkSemaphore imageAvailableSemaphore; + VkSemaphore renderingFinishedSemaphore; + VkSurfaceCapabilitiesKHR surfaceCapabilities; + VkSurfaceFormatKHR *surfaceFormats; + uint32_t surfaceFormatsAllocatedCount; + uint32_t surfaceFormatsCount; + uint32_t swapchainDesiredImageCount; + VkSurfaceFormatKHR surfaceFormat; + VkExtent2D swapchainSize; + VkCommandPool commandPool; + uint32_t swapchainImageCount; + VkImage *swapchainImages; + VkCommandBuffer *commandBuffers; + VkFence *fences; +} VulkanContext; + +static SDLTest_CommonState *state; +static VulkanContext vulkanContext = {0}; + +static void shutdownVulkan(void); + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void quit(int rc) +{ + shutdownVulkan(); + SDLTest_CommonQuit(state); + exit(rc); +} + +static void loadGlobalFunctions(void) +{ + vkGetInstanceProcAddr = SDL_Vulkan_GetVkGetInstanceProcAddr(); + if(!vkGetInstanceProcAddr) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n", + SDL_GetError()); + quit(2); + } + +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(VK_NULL_HANDLE, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(VK_NULL_HANDLE, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createInstance(void) +{ + VkApplicationInfo appInfo = {0}; + VkInstanceCreateInfo instanceCreateInfo = {0}; + const char **extensions = NULL; + unsigned extensionCount = 0; + VkResult result; + + + appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appInfo.apiVersion = VK_API_VERSION_1_0; + instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + instanceCreateInfo.pApplicationInfo = &appInfo; + if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + extensions = SDL_malloc(sizeof(const char *) * extensionCount); + if(!extensions) + { + SDL_OutOfMemory(); + quit(2); + } + if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, extensions)) + { + SDL_free((void*)extensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + instanceCreateInfo.enabledExtensionCount = extensionCount; + instanceCreateInfo.ppEnabledExtensionNames = extensions; + result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext.instance); + SDL_free((void*)extensions); + if(result != VK_SUCCESS) + { + vulkanContext.instance = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateInstance(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void loadInstanceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(vulkanContext.instance, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(instance, \"" #name "\") failed\n"); \ + quit(2); \ + } + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createSurface(void) +{ + if(!SDL_Vulkan_CreateSurface(state->windows[0], + vulkanContext.instance, + &vulkanContext.surface)) + { + vulkanContext.surface = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_CreateSurface(): %s\n", SDL_GetError()); + quit(2); + } +} + +static void findPhysicalDevice(void) +{ + uint32_t physicalDeviceCount = 0; + VkPhysicalDevice *physicalDevices; + VkQueueFamilyProperties *queueFamiliesProperties = NULL; + uint32_t queueFamiliesPropertiesAllocatedSize = 0; + VkExtensionProperties *deviceExtensions = NULL; + uint32_t deviceExtensionsAllocatedSize = 0; + uint32_t physicalDeviceIndex; + + VkResult result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, NULL); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(physicalDeviceCount == 0) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): no physical devices\n"); + quit(2); + } + physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); + if(!physicalDevices) + { + SDL_OutOfMemory(); + quit(2); + } + result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, physicalDevices); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.physicalDevice = NULL; + for(physicalDeviceIndex = 0; physicalDeviceIndex < physicalDeviceCount; + physicalDeviceIndex++) + { + uint32_t queueFamiliesCount = 0; + uint32_t queueFamilyIndex; + uint32_t deviceExtensionCount = 0; + SDL_bool hasSwapchainExtension = SDL_FALSE; + uint32_t i; + + + VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex]; + vkGetPhysicalDeviceProperties(physicalDevice, &vulkanContext.physicalDeviceProperties); + if(VK_VERSION_MAJOR(vulkanContext.physicalDeviceProperties.apiVersion) < 1) + continue; + vkGetPhysicalDeviceFeatures(physicalDevice, &vulkanContext.physicalDeviceFeatures); + vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamiliesCount, NULL); + if(queueFamiliesCount == 0) + continue; + if(queueFamiliesPropertiesAllocatedSize < queueFamiliesCount) + { + SDL_free(queueFamiliesProperties); + queueFamiliesPropertiesAllocatedSize = queueFamiliesCount; + queueFamiliesProperties = + SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize); + if(!queueFamiliesProperties) + { + SDL_free(physicalDevices); + SDL_free(deviceExtensions); + SDL_OutOfMemory(); + quit(2); + } + } + vkGetPhysicalDeviceQueueFamilyProperties( + physicalDevice, &queueFamiliesCount, queueFamiliesProperties); + vulkanContext.graphicsQueueFamilyIndex = queueFamiliesCount; + vulkanContext.presentQueueFamilyIndex = queueFamiliesCount; + for(queueFamilyIndex = 0; queueFamilyIndex < queueFamiliesCount; + queueFamilyIndex++) + { + VkBool32 supported = 0; + + if(queueFamiliesProperties[queueFamilyIndex].queueCount == 0) + continue; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + vulkanContext.graphicsQueueFamilyIndex = queueFamilyIndex; + result = vkGetPhysicalDeviceSurfaceSupportKHR( + physicalDevice, queueFamilyIndex, vulkanContext.surface, &supported); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceSupportKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(supported) + { + vulkanContext.presentQueueFamilyIndex = queueFamilyIndex; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + break; // use this queue because it can present and do graphics + } + } + if(vulkanContext.graphicsQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + if(vulkanContext.presentQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + result = + vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &deviceExtensionCount, NULL); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(deviceExtensionCount == 0) + continue; + if(deviceExtensionsAllocatedSize < deviceExtensionCount) + { + SDL_free(deviceExtensions); + deviceExtensionsAllocatedSize = deviceExtensionCount; + deviceExtensions = + SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize); + if(!deviceExtensions) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_OutOfMemory(); + quit(2); + } + } + result = vkEnumerateDeviceExtensionProperties( + physicalDevice, NULL, &deviceExtensionCount, deviceExtensions); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + for(i = 0; i < deviceExtensionCount; i++) + { + if(0 == SDL_strcmp(deviceExtensions[i].extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME)) + { + hasSwapchainExtension = SDL_TRUE; + break; + } + } + if(!hasSwapchainExtension) + continue; + vulkanContext.physicalDevice = physicalDevice; + break; + } + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + if(!vulkanContext.physicalDevice) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Vulkan: no viable physical devices found"); + quit(2); + } +} + +static void createDevice(void) +{ + VkDeviceQueueCreateInfo deviceQueueCreateInfo[1] = {0}; + static const float queuePriority[] = {1.0f}; + VkDeviceCreateInfo deviceCreateInfo = {0}; + static const char *const deviceExtensionNames[] = { + VK_KHR_SWAPCHAIN_EXTENSION_NAME, + }; + VkResult result; + + deviceQueueCreateInfo->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + deviceQueueCreateInfo->queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + deviceQueueCreateInfo->queueCount = 1; + deviceQueueCreateInfo->pQueuePriorities = &queuePriority[0]; + + deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + deviceCreateInfo.queueCreateInfoCount = 1; + deviceCreateInfo.pQueueCreateInfos = deviceQueueCreateInfo; + deviceCreateInfo.pEnabledFeatures = NULL; + deviceCreateInfo.enabledExtensionCount = SDL_arraysize(deviceExtensionNames); + deviceCreateInfo.ppEnabledExtensionNames = deviceExtensionNames; + result = vkCreateDevice( + vulkanContext.physicalDevice, &deviceCreateInfo, NULL, &vulkanContext.device); + if(result != VK_SUCCESS) + { + vulkanContext.device = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkCreateDevice(): %s\n", getVulkanResultString(result)); + quit(2); + } +} + +static void loadDeviceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) \ + name = (PFN_##name)vkGetDeviceProcAddr(vulkanContext.device, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +#undef VULKAN_FUNCTIONS + +static void getQueues(void) +{ + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.graphicsQueueFamilyIndex, + 0, + &vulkanContext.graphicsQueue); + if(vulkanContext.graphicsQueueFamilyIndex != vulkanContext.presentQueueFamilyIndex) + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.presentQueueFamilyIndex, + 0, + &vulkanContext.presentQueue); + else + vulkanContext.presentQueue = vulkanContext.graphicsQueue; +} + +static void createSemaphore(VkSemaphore *semaphore) +{ + VkResult result; + + VkSemaphoreCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + result = vkCreateSemaphore(vulkanContext.device, &createInfo, NULL, semaphore); + if(result != VK_SUCCESS) + { + *semaphore = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSemaphore(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createSemaphores(void) +{ + createSemaphore(&vulkanContext.imageAvailableSemaphore); + createSemaphore(&vulkanContext.renderingFinishedSemaphore); +} + +static void getSurfaceCaps(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + vulkanContext.physicalDevice, vulkanContext.surface, &vulkanContext.surfaceCapabilities); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + + // check surface usage + if(!(vulkanContext.surfaceCapabilities.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Vulkan surface doesn't support VK_IMAGE_USAGE_TRANSFER_DST_BIT\n"); + quit(2); + } +} + +static void getSurfaceFormats(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + NULL); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(vulkanContext.surfaceFormatsCount > vulkanContext.surfaceFormatsAllocatedCount) + { + vulkanContext.surfaceFormatsAllocatedCount = vulkanContext.surfaceFormatsCount; + SDL_free(vulkanContext.surfaceFormats); + vulkanContext.surfaceFormats = + SDL_malloc(sizeof(VkSurfaceFormatKHR) * vulkanContext.surfaceFormatsAllocatedCount); + if(!vulkanContext.surfaceFormats) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_OutOfMemory(); + quit(2); + } + } + result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + vulkanContext.surfaceFormats); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void getSwapchainImages(void) +{ + VkResult result; + + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + result = vkGetSwapchainImagesKHR( + vulkanContext.device, vulkanContext.swapchain, &vulkanContext.swapchainImageCount, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.swapchainImages = SDL_malloc(sizeof(VkImage) * vulkanContext.swapchainImageCount); + if(!vulkanContext.swapchainImages) + { + SDL_OutOfMemory(); + quit(2); + } + result = vkGetSwapchainImagesKHR(vulkanContext.device, + vulkanContext.swapchain, + &vulkanContext.swapchainImageCount, + vulkanContext.swapchainImages); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static SDL_bool createSwapchain(void) +{ + uint32_t i; + int w, h; + VkSwapchainCreateInfoKHR createInfo = {0}; + VkResult result; + + // pick an image count + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.minImageCount + 1; + if(vulkanContext.swapchainDesiredImageCount > vulkanContext.surfaceCapabilities.maxImageCount + && vulkanContext.surfaceCapabilities.maxImageCount > 0) + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.maxImageCount; + + // pick a format + if(vulkanContext.surfaceFormatsCount == 1 + && vulkanContext.surfaceFormats[0].format == VK_FORMAT_UNDEFINED) + { + // aren't any preferred formats, so we pick + vulkanContext.surfaceFormat.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; + vulkanContext.surfaceFormat.format = VK_FORMAT_R8G8B8A8_UNORM; + } + else + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[0]; + for(i = 0; i < vulkanContext.surfaceFormatsCount; i++) + { + if(vulkanContext.surfaceFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM) + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[i]; + break; + } + } + } + + // get size + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + vulkanContext.swapchainSize.width = w; + vulkanContext.swapchainSize.height = h; + if(w == 0 || h == 0) + return SDL_FALSE; + + createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + createInfo.surface = vulkanContext.surface; + createInfo.minImageCount = vulkanContext.swapchainDesiredImageCount; + createInfo.imageFormat = vulkanContext.surfaceFormat.format; + createInfo.imageColorSpace = vulkanContext.surfaceFormat.colorSpace; + createInfo.imageExtent = vulkanContext.swapchainSize; + createInfo.imageArrayLayers = 1; + createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; + createInfo.preTransform = vulkanContext.surfaceCapabilities.currentTransform; + createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + createInfo.presentMode = VK_PRESENT_MODE_FIFO_KHR; + createInfo.clipped = VK_TRUE; + createInfo.oldSwapchain = vulkanContext.swapchain; + result = + vkCreateSwapchainKHR(vulkanContext.device, &createInfo, NULL, &vulkanContext.swapchain); + if(createInfo.oldSwapchain) + vkDestroySwapchainKHR(vulkanContext.device, createInfo.oldSwapchain, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSwapchainKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + getSwapchainImages(); + return SDL_TRUE; +} + +static void destroySwapchain(void) +{ + if(vulkanContext.swapchain) + vkDestroySwapchainKHR(vulkanContext.device, vulkanContext.swapchain, NULL); + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; +} + +static void destroyCommandBuffers(void) +{ + if(vulkanContext.commandBuffers) + vkFreeCommandBuffers(vulkanContext.device, + vulkanContext.commandPool, + vulkanContext.swapchainImageCount, + vulkanContext.commandBuffers); + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; +} + +static void destroyCommandPool(void) +{ + if(vulkanContext.commandPool) + vkDestroyCommandPool(vulkanContext.device, vulkanContext.commandPool, NULL); + vulkanContext.commandPool = VK_NULL_HANDLE; +} + +static void createCommandPool(void) +{ + VkResult result; + + VkCommandPoolCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + createInfo.flags = + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; + createInfo.queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + result = + vkCreateCommandPool(vulkanContext.device, &createInfo, NULL, &vulkanContext.commandPool); + if(result != VK_SUCCESS) + { + vulkanContext.commandPool = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateCommandPool(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createCommandBuffers(void) +{ + VkResult result; + + VkCommandBufferAllocateInfo allocateInfo = {0}; + allocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + allocateInfo.commandPool = vulkanContext.commandPool; + allocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + allocateInfo.commandBufferCount = vulkanContext.swapchainImageCount; + vulkanContext.commandBuffers = + SDL_malloc(sizeof(VkCommandBuffer) * vulkanContext.swapchainImageCount); + result = + vkAllocateCommandBuffers(vulkanContext.device, &allocateInfo, vulkanContext.commandBuffers); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAllocateCommandBuffers(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createFences(void) +{ + uint32_t i; + + vulkanContext.fences = SDL_malloc(sizeof(VkFence) * vulkanContext.swapchainImageCount); + if(!vulkanContext.fences) + { + SDL_OutOfMemory(); + quit(2); + } + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + VkResult result; + + VkFenceCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; + createInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; + result = + vkCreateFence(vulkanContext.device, &createInfo, NULL, &vulkanContext.fences[i]); + if(result != VK_SUCCESS) + { + for(; i > 0; i--) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i - 1], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateFence(): %s\n", + getVulkanResultString(result)); + quit(2); + } + } +} + +static void destroyFences(void) +{ + uint32_t i; + + if(!vulkanContext.fences) + return; + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; +} + +static void recordPipelineImageBarrier(VkCommandBuffer commandBuffer, + VkAccessFlags sourceAccessMask, + VkAccessFlags destAccessMask, + VkImageLayout sourceLayout, + VkImageLayout destLayout, + VkImage image) +{ + VkImageMemoryBarrier barrier = {0}; + barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barrier.srcAccessMask = sourceAccessMask; + barrier.dstAccessMask = destAccessMask; + barrier.oldLayout = sourceLayout; + barrier.newLayout = destLayout; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.image = image; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.baseMipLevel = 0; + barrier.subresourceRange.levelCount = 1; + barrier.subresourceRange.baseArrayLayer = 0; + barrier.subresourceRange.layerCount = 1; + vkCmdPipelineBarrier(commandBuffer, + VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, + 0, + 0, + NULL, + 0, + NULL, + 1, + &barrier); +} + +static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue *clearColor) +{ + VkCommandBuffer commandBuffer = vulkanContext.commandBuffers[frameIndex]; + VkImage image = vulkanContext.swapchainImages[frameIndex]; + VkCommandBufferBeginInfo beginInfo = {0}; + VkImageSubresourceRange clearRange = {0}; + + VkResult result = vkResetCommandBuffer(commandBuffer, 0); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkResetCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; + result = vkBeginCommandBuffer(commandBuffer, &beginInfo); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkBeginCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + recordPipelineImageBarrier(commandBuffer, + 0, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + image); + clearRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + clearRange.baseMipLevel = 0; + clearRange.levelCount = 1; + clearRange.baseArrayLayer = 0; + clearRange.layerCount = 1; + vkCmdClearColorImage( + commandBuffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, clearColor, 1, &clearRange); + recordPipelineImageBarrier(commandBuffer, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, + image); + result = vkEndCommandBuffer(commandBuffer); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEndCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void destroySwapchainAndSwapchainSpecificStuff(SDL_bool doDestroySwapchain) +{ + destroyFences(); + destroyCommandBuffers(); + destroyCommandPool(); + if(doDestroySwapchain) + destroySwapchain(); +} + +static SDL_bool createNewSwapchainAndSwapchainSpecificStuff(void) +{ + destroySwapchainAndSwapchainSpecificStuff(SDL_FALSE); + getSurfaceCaps(); + getSurfaceFormats(); + if(!createSwapchain()) + return SDL_FALSE; + createCommandPool(); + createCommandBuffers(); + createFences(); + return SDL_TRUE; +} + +static void initVulkan(void) +{ + SDL_Vulkan_LoadLibrary(NULL); + SDL_memset(&vulkanContext, 0, sizeof(VulkanContext)); + loadGlobalFunctions(); + createInstance(); + loadInstanceFunctions(); + createSurface(); + findPhysicalDevice(); + createDevice(); + loadDeviceFunctions(); + getQueues(); + createSemaphores(); + createNewSwapchainAndSwapchainSpecificStuff(); +} + +static void shutdownVulkan(void) +{ + if(vulkanContext.device && vkDeviceWaitIdle) + vkDeviceWaitIdle(vulkanContext.device); + destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE); + if(vulkanContext.imageAvailableSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.imageAvailableSemaphore, NULL); + if(vulkanContext.renderingFinishedSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.renderingFinishedSemaphore, NULL); + if(vulkanContext.device && vkDestroyDevice) + vkDestroyDevice(vulkanContext.device, NULL); + if(vulkanContext.surface && vkDestroySurfaceKHR) + vkDestroySurfaceKHR(vulkanContext.instance, vulkanContext.surface, NULL); + if(vulkanContext.instance && vkDestroyInstance) + vkDestroyInstance(vulkanContext.instance, NULL); + SDL_free(vulkanContext.surfaceFormats); + SDL_Vulkan_UnloadLibrary(); +} + +static SDL_bool render(void) +{ + uint32_t frameIndex; + VkResult result; + double currentTime; + VkClearColorValue clearColor = {0}; + VkPipelineStageFlags waitDestStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; + VkSubmitInfo submitInfo = {0}; + VkPresentInfoKHR presentInfo = {0}; + int w, h; + + if(!vulkanContext.swapchain) + { + SDL_bool retval = createNewSwapchainAndSwapchainSpecificStuff(); + if(!retval) + SDL_Delay(100); + return retval; + } + result = vkAcquireNextImageKHR(vulkanContext.device, + vulkanContext.swapchain, + UINT64_MAX, + vulkanContext.imageAvailableSemaphore, + VK_NULL_HANDLE, + &frameIndex); + if(result == VK_ERROR_OUT_OF_DATE_KHR) + return createNewSwapchainAndSwapchainSpecificStuff(); + if(result != VK_SUBOPTIMAL_KHR && result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAcquireNextImageKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + result = vkWaitForFences( + vulkanContext.device, 1, &vulkanContext.fences[frameIndex], VK_FALSE, UINT64_MAX); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkWaitForFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + result = vkResetFences(vulkanContext.device, 1, &vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkResetFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); + clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime)); + clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 2 / 3)); + clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 4 / 3)); + clearColor.float32[3] = 1; + rerecordCommandBuffer(frameIndex, &clearColor); + submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; + submitInfo.waitSemaphoreCount = 1; + submitInfo.pWaitSemaphores = &vulkanContext.imageAvailableSemaphore; + submitInfo.pWaitDstStageMask = &waitDestStageMask; + submitInfo.commandBufferCount = 1; + submitInfo.pCommandBuffers = &vulkanContext.commandBuffers[frameIndex]; + submitInfo.signalSemaphoreCount = 1; + submitInfo.pSignalSemaphores = &vulkanContext.renderingFinishedSemaphore; + result = vkQueueSubmit( + vulkanContext.graphicsQueue, 1, &submitInfo, vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkQueueSubmit(): %s\n", getVulkanResultString(result)); + quit(2); + } + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + presentInfo.waitSemaphoreCount = 1; + presentInfo.pWaitSemaphores = &vulkanContext.renderingFinishedSemaphore; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = &vulkanContext.swapchain; + presentInfo.pImageIndices = &frameIndex; + result = vkQueuePresentKHR(vulkanContext.presentQueue, &presentInfo); + if(result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkQueuePresentKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + if(w != (int)vulkanContext.swapchainSize.width || h != (int)vulkanContext.swapchainSize.height) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + return SDL_TRUE; +} + +int main(int argc, char *argv[]) +{ + int fsaa, accel; + int i, done; + SDL_DisplayMode mode; + SDL_Event event; + Uint32 then, now, frames; + int dw, dh; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize parameters */ + fsaa = 0; + accel = -1; + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if(!state) + { + return 1; + } + for(i = 1; i < argc;) + { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if(consumed < 0) + { + SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + quit(1); + } + i += consumed; + } + + /* Set Vulkan parameters */ + state->window_flags |= SDL_WINDOW_VULKAN; + state->num_windows = 1; + state->skip_renderer = 1; + + if(!SDLTest_CommonInit(state)) + { + quit(2); + } + + SDL_GetCurrentDisplayMode(0, &mode); + SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); + SDL_GetWindowSize(state->windows[0], &dw, &dh); + SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh); + SDL_Log("Draw Size : %d,%d\n", dw, dh); + SDL_Log("\n"); + + initVulkan(); + + /* Main render loop */ + frames = 0; + then = SDL_GetTicks(); + done = 0; + while(!done) + { + /* Check for events */ + ++frames; + while(SDL_PollEvent(&event)) + { + SDLTest_CommonEvent(state, &event, &done); + } + + if(!done) + render(); + } + + /* Print out some timing information */ + now = SDL_GetTicks(); + if(now > then) + { + SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); + } + quit(0); + return 0; +} + +#endif diff --git a/3rdparty/sdl2-2.0.4/test/testwm2.c b/3rdparty/sdl2-2.0.9/test/testwm2.c similarity index 88% rename from 3rdparty/sdl2-2.0.4/test/testwm2.c rename to 3rdparty/sdl2-2.0.9/test/testwm2.c index 94ba513bed..5da3873094 100644 --- a/3rdparty/sdl2-2.0.4/test/testwm2.c +++ b/3rdparty/sdl2-2.0.9/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,7 @@ quit(int rc) void loop() { + int i; SDL_Event event; /* Check for events */ while (SDL_PollEvent(&event)) { @@ -100,6 +101,12 @@ loop() } } } + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + } #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); @@ -122,7 +129,6 @@ main(int argc, char *argv[]) if (!state) { return 1; } - state->skip_renderer = SDL_TRUE; for (i = 1; i < argc;) { int consumed; @@ -140,6 +146,15 @@ main(int argc, char *argv[]) quit(2); } + SDL_EventState(SDL_DROPFILE, SDL_ENABLE); + SDL_EventState(SDL_DROPTEXT, SDL_ENABLE); + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + /* Main render loop */ done = 0; #ifdef __EMSCRIPTEN__ diff --git a/3rdparty/sdl2-2.0.9/test/testyuv.bmp b/3rdparty/sdl2-2.0.9/test/testyuv.bmp new file mode 100644 index 0000000000..af32034b6b Binary files /dev/null and b/3rdparty/sdl2-2.0.9/test/testyuv.bmp differ diff --git a/3rdparty/sdl2-2.0.9/test/testyuv.c b/3rdparty/sdl2-2.0.9/test/testyuv.c new file mode 100644 index 0000000000..f52ab9f72e --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testyuv.c @@ -0,0 +1,455 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include + +#include "SDL.h" +#include "SDL_test_font.h" +#include "testyuv_cvt.h" + + +/* 422 (YUY2, etc) formats are the largest */ +#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2) + + +/* Return true if the YUV format is packed pixels */ +static SDL_bool is_packed_yuv_format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +/* Create a surface with a good pattern for verifying YUV conversion */ +static SDL_Surface *generate_test_pattern(int pattern_size) +{ + SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24); + + if (pattern) { + int i, x, y; + Uint8 *p, c; + const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */ + + /* R, G, B in alternating horizontal bands */ + for (y = 0; y < pattern->h; y += thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3); + for (x = 0; x < pattern->w; ++x) { + *p = 0xFF; + p += 3; + } + } + } + + /* Black and white in alternating vertical bands */ + c = 0xFF; + for (x = 1*thickness; x < pattern->w; x += 2*thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (x + i)*3; + for (y = 0; y < pattern->h; ++y) { + SDL_memset(p, c, 3); + p += pattern->pitch; + } + } + if (c) { + c = 0x00; + } else { + c = 0xFF; + } + } + } + return pattern; +} + +static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface) +{ + const int tolerance = 20; + const int size = (surface->h * surface->pitch); + Uint8 *rgb; + SDL_bool result = SDL_FALSE; + + rgb = (Uint8 *)SDL_malloc(size); + if (!rgb) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); + return SDL_FALSE; + } + + if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) { + int x, y; + result = SDL_TRUE; + for (y = 0; y < surface->h; ++y) { + const Uint8 *actual = rgb + y * surface->pitch; + const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch; + for (x = 0; x < surface->w; ++x) { + int deltaR = (int)actual[0] - expected[0]; + int deltaG = (int)actual[1] - expected[1]; + int deltaB = (int)actual[2] - expected[2]; + int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); + if (distance > tolerance) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); + result = SDL_FALSE; + } + actual += 3; + expected += 3; + } + } + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError()); + } + SDL_free(rgb); + + return result; +} + +static int run_automated_tests(int pattern_size, int extra_pitch) +{ + const Uint32 formats[] = { + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21, + SDL_PIXELFORMAT_YUY2, + SDL_PIXELFORMAT_UYVY, + SDL_PIXELFORMAT_YVYU + }; + int i, j; + SDL_Surface *pattern = generate_test_pattern(pattern_size); + const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch); + Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len); + Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len); + int yuv1_pitch, yuv2_pitch; + int result = -1; + + if (!pattern || !yuv1 || !yuv2) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces"); + goto done; + } + + /* Verify conversion from YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w); + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion to YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion between YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + /* Verify conversion between YUV formats in-place */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) { + /* Can't change plane vs packed pixel layout in-place */ + continue; + } + + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + + result = 0; + +done: + SDL_free(yuv1); + SDL_free(yuv2); + SDL_FreeSurface(pattern); + return result; +} + +int +main(int argc, char **argv) +{ + struct { + SDL_bool enable_intrinsics; + int pattern_size; + int extra_pitch; + } automated_test_params[] = { + /* Test: even width and height */ + { SDL_FALSE, 2, 0 }, + { SDL_FALSE, 4, 0 }, + /* Test: odd width and height */ + { SDL_FALSE, 1, 0 }, + { SDL_FALSE, 3, 0 }, + /* Test: even width and height, extra pitch */ + { SDL_FALSE, 2, 3 }, + { SDL_FALSE, 4, 3 }, + /* Test: odd width and height, extra pitch */ + { SDL_FALSE, 1, 3 }, + { SDL_FALSE, 3, 3 }, + /* Test: even width and height with intrinsics */ + { SDL_TRUE, 32, 0 }, + /* Test: odd width and height with intrinsics */ + { SDL_TRUE, 33, 0 }, + { SDL_TRUE, 37, 0 }, + /* Test: even width and height with intrinsics, extra pitch */ + { SDL_TRUE, 32, 3 }, + /* Test: odd width and height with intrinsics, extra pitch */ + { SDL_TRUE, 33, 3 }, + { SDL_TRUE, 37, 3 }, + }; + int arg = 1; + const char *filename; + SDL_Surface *original; + SDL_Surface *converted; + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *output[3]; + const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" }; + char title[128]; + const char *yuv_name; + const char *yuv_mode; + Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888; + Uint32 yuv_format = SDL_PIXELFORMAT_YV12; + int current = 0; + int pitch; + Uint8 *raw_yuv; + Uint32 then, now, i, iterations = 100; + SDL_bool should_run_automated_tests = SDL_FALSE; + + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--jpeg") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG); + } else if (SDL_strcmp(argv[arg], "--bt601") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601); + } else if (SDL_strcmp(argv[arg], "--bt709") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709); + } else if (SDL_strcmp(argv[arg], "--auto") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC); + } else if (SDL_strcmp(argv[arg], "--yv12") == 0) { + yuv_format = SDL_PIXELFORMAT_YV12; + } else if (SDL_strcmp(argv[arg], "--iyuv") == 0) { + yuv_format = SDL_PIXELFORMAT_IYUV; + } else if (SDL_strcmp(argv[arg], "--yuy2") == 0) { + yuv_format = SDL_PIXELFORMAT_YUY2; + } else if (SDL_strcmp(argv[arg], "--uyvy") == 0) { + yuv_format = SDL_PIXELFORMAT_UYVY; + } else if (SDL_strcmp(argv[arg], "--yvyu") == 0) { + yuv_format = SDL_PIXELFORMAT_YVYU; + } else if (SDL_strcmp(argv[arg], "--nv12") == 0) { + yuv_format = SDL_PIXELFORMAT_NV12; + } else if (SDL_strcmp(argv[arg], "--nv21") == 0) { + yuv_format = SDL_PIXELFORMAT_NV21; + } else if (SDL_strcmp(argv[arg], "--rgb555") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB555; + } else if (SDL_strcmp(argv[arg], "--rgb565") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB565; + } else if (SDL_strcmp(argv[arg], "--rgb24") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB24; + } else if (SDL_strcmp(argv[arg], "--argb") == 0) { + rgb_format = SDL_PIXELFORMAT_ARGB8888; + } else if (SDL_strcmp(argv[arg], "--abgr") == 0) { + rgb_format = SDL_PIXELFORMAT_ABGR8888; + } else if (SDL_strcmp(argv[arg], "--rgba") == 0) { + rgb_format = SDL_PIXELFORMAT_RGBA8888; + } else if (SDL_strcmp(argv[arg], "--bgra") == 0) { + rgb_format = SDL_PIXELFORMAT_BGRA8888; + } else if (SDL_strcmp(argv[arg], "--automated") == 0) { + should_run_automated_tests = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]); + return 1; + } + ++arg; + } + + /* Run automated tests */ + if (should_run_automated_tests) { + for (i = 0; i < SDL_arraysize(automated_test_params); ++i) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n", + automated_test_params[i].pattern_size, + automated_test_params[i].extra_pitch, + automated_test_params[i].enable_intrinsics ? "enabled" : "disabled"); + if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) { + return 2; + } + } + return 0; + } + + if (argv[arg]) { + filename = argv[arg]; + } else { + filename = "testyuv.bmp"; + } + original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0); + if (!original) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + return 3; + } + + raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0)); + ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h, + SDL_GetYUVConversionModeForResolution(original->w, original->h), + 0, 100); + pitch = CalculateYUVPitch(yuv_format, original->w); + + converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format); + if (!converted) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); + return 3; + } + + then = SDL_GetTicks(); + for ( i = 0; i < iterations; ++i ) { + SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); + } + now = SDL_GetTicks(); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); + + window = SDL_CreateWindow("YUV test", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + original->w, original->h, + 0); + if (!window) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + return 4; + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + return 4; + } + + output[0] = SDL_CreateTextureFromSurface(renderer, original); + output[1] = SDL_CreateTextureFromSurface(renderer, converted); + output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h); + if (!output[0] || !output[1] || !output[2]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + return 5; + } + SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch); + + yuv_name = SDL_GetPixelFormatName(yuv_format); + if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) { + yuv_name += 16; + } + + switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) { + case SDL_YUV_CONVERSION_JPEG: + yuv_mode = "JPEG"; + break; + case SDL_YUV_CONVERSION_BT601: + yuv_mode = "BT.601"; + break; + case SDL_YUV_CONVERSION_BT709: + yuv_mode = "BT.709"; + break; + default: + yuv_mode = "UNKNOWN"; + break; + } + + { int done = 0; + while ( !done ) + { + SDL_Event event; + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if (event.type == SDL_KEYDOWN) { + if (event.key.keysym.sym == SDLK_ESCAPE) { + done = 1; + } else if (event.key.keysym.sym == SDLK_LEFT) { + --current; + } else if (event.key.keysym.sym == SDLK_RIGHT) { + ++current; + } + } + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.x < (original->w/2)) { + --current; + } else { + ++current; + } + } + } + + /* Handle wrapping */ + if (current < 0) { + current += SDL_arraysize(output); + } + if (current >= SDL_arraysize(output)) { + current -= SDL_arraysize(output); + } + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, output[current], NULL, NULL); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + if (current == 0) { + SDLTest_DrawString(renderer, 4, 4, titles[current]); + } else { + SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode); + SDLTest_DrawString(renderer, 4, 4, title); + } + SDL_RenderPresent(renderer); + SDL_Delay(10); + } + } + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/test/testyuv_cvt.c b/3rdparty/sdl2-2.0.9/test/testyuv_cvt.c new file mode 100644 index 0000000000..553a3fa185 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testyuv_cvt.c @@ -0,0 +1,300 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +#include "testyuv_cvt.h" + + +static float clip3(float x, float y, float z) +{ + return ((z < x) ? x : ((z > y) ? y : z)); +} + +static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + if (mode == SDL_YUV_CONVERSION_JPEG) { + /* Full range YUV */ + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); + } else { + // This formula is from Microsoft's documentation: + // https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx + // L = Kr * R + Kb * B + (1 - Kr - Kb) * G + // Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5); + // U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5)); + // V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5)); + float S, Z, R, G, B, L, Kr, Kb, Y, U, V; + + if (mode == SDL_YUV_CONVERSION_BT709) { + /* BT.709 */ + Kr = 0.2126f; + Kb = 0.0722f; + } else { + /* BT.601 */ + Kr = 0.299f; + Kb = 0.114f; + } + + S = 255.0f; + Z = 0.0f; + R = rgb[0]; + G = rgb[1]; + B = rgb[2]; + L = Kr * R + Kb * B + (1 - Kr - Kb) * G; + Y = (Uint8)SDL_floorf((219*(L-Z)/S + 16) + 0.5f); + U = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(B-L) / ((1.0f-Kb)*S) + 128) + 0.5f)); + V = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(R-L) / ((1.0f-Kr)*S) + 128) + 0.5f)); + + yuv[0] = (Uint8)Y; + yuv[1] = (Uint8)U; + yuv[2] = (Uint8)V; + } + + if (monochrome) { + yuv[1] = 128; + yuv[2] = 128; + } + + if (luminance != 100) { + yuv[0] = yuv[0] * luminance / 100; + if (yuv[0] > 255) + yuv[0] = 255; + } +} + +static void ConvertRGBtoPlanar2x2(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[4][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb1, *rgb2; + int rgb_row_advance = (pitch - w*3) + pitch; + int UV_advance; + + rgb1 = src; + rgb2 = src + pitch; + + Y1 = out; + Y2 = Y1 + w; + switch (format) { + case SDL_PIXELFORMAT_YV12: + V = (Y1 + h * w); + U = V + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_IYUV: + U = (Y1 + h * w); + V = U + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_NV12: + U = (Y1 + h * w); + V = U + 1; + UV_advance = 2; + break; + case SDL_PIXELFORMAT_NV21: + V = (Y1 + h * w); + U = V + 1; + UV_advance = 2; + break; + default: + SDL_assert(!"Unsupported planar YUV format"); + return; + } + + for (y = 0; y < (h - 1); y += 2) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + RGBtoYUV(rgb2, yuv[3], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[3][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1])/4.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2])/4.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[2][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[2][2])/2.0f + 0.5f); + V += UV_advance; + } + Y1 += w; + Y2 += w; + rgb1 += rgb_row_advance; + rgb2 += rgb_row_advance; + } + /* Last row */ + if (y == (h - 1)) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + *Y1++ = (Uint8)yuv[0][0]; + + *U = (Uint8)yuv[0][1]; + U += UV_advance; + + *V = (Uint8)yuv[0][2]; + V += UV_advance; + } + } +} + +static void ConvertRGBtoPacked4(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[2][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb; + int rgb_row_advance = (pitch - w*3); + + rgb = src; + + switch (format) { + case SDL_PIXELFORMAT_YUY2: + Y1 = out; + U = out+1; + Y2 = out+2; + V = out+3; + break; + case SDL_PIXELFORMAT_UYVY: + U = out; + Y1 = out+1; + V = out+2; + Y2 = out+3; + break; + case SDL_PIXELFORMAT_YVYU: + Y1 = out; + V = out+1; + Y2 = out+2; + U = out+3; + break; + default: + SDL_assert(!"Unsupported packed YUV format"); + return; + } + + for (y = 0; y < h; ++y) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + + RGBtoYUV(rgb, yuv[1], mode, monochrome, luminance); + rgb += 3; + *Y2 = (Uint8)yuv[1][0]; + Y2 += 4; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += 4; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += 4; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y2 = *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + Y2 += 4; + + *U = (Uint8)yuv[0][1]; + U += 4; + + *V = (Uint8)yuv[0][2]; + V += 4; + } + rgb += rgb_row_advance; + } +} + +SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + ConvertRGBtoPlanar2x2(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + ConvertRGBtoPacked4(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + default: + return SDL_FALSE; + } +} + +int CalculateYUVPitch(Uint32 format, int width) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + return width; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + return 4*((width + 1)/2); + default: + return 0; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/3rdparty/sdl2-2.0.9/test/testyuv_cvt.h b/3rdparty/sdl2-2.0.9/test/testyuv_cvt.h new file mode 100644 index 0000000000..bd845878f4 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/test/testyuv_cvt.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* These functions are designed for testing correctness, not for speed */ + +extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance); +extern int CalculateYUVPitch(Uint32 format, int width); diff --git a/3rdparty/sdl2-2.0.4/test/torturethread.c b/3rdparty/sdl2-2.0.9/test/torturethread.c similarity index 89% rename from 3rdparty/sdl2-2.0.4/test/torturethread.c rename to 3rdparty/sdl2-2.0.9/test/torturethread.c index 5719a71950..9b1a407eea 100644 --- a/3rdparty/sdl2-2.0.4/test/torturethread.c +++ b/3rdparty/sdl2-2.0.9/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #define NUMTHREADS 10 -static char volatile time_for_threads_to_die[NUMTHREADS]; +static SDL_atomic_t time_for_threads_to_die[NUMTHREADS]; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -58,7 +58,7 @@ ThreadFunc(void *data) } SDL_Log("Thread '%d' waiting for signal\n", tid); - while (time_for_threads_to_die[tid] != 1) { + while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) { ; /* do nothing */ } @@ -92,7 +92,7 @@ main(int argc, char *argv[]) for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i); - time_for_threads_to_die[i] = 0; + SDL_AtomicSet(&time_for_threads_to_die[i], 0); threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i); if (threads[i] == NULL) { @@ -102,7 +102,7 @@ main(int argc, char *argv[]) } for (i = 0; i < NUMTHREADS; i++) { - time_for_threads_to_die[i] = 1; + SDL_AtomicSet(&time_for_threads_to_die[i], 1); } for (i = 0; i < NUMTHREADS; i++) { diff --git a/3rdparty/sdl2-2.0.4/test/utf8.txt b/3rdparty/sdl2-2.0.9/test/utf8.txt similarity index 100% rename from 3rdparty/sdl2-2.0.4/test/utf8.txt rename to 3rdparty/sdl2-2.0.9/test/utf8.txt diff --git a/3rdparty/sdl2-2.0.9/wayland-protocols/pointer-constraints-unstable-v1.xml b/3rdparty/sdl2-2.0.9/wayland-protocols/pointer-constraints-unstable-v1.xml new file mode 100644 index 0000000000..4e67a13c98 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/wayland-protocols/pointer-constraints-unstable-v1.xml @@ -0,0 +1,339 @@ + + + + + Copyright © 2014 Jonas Ådahl + Copyright © 2015 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a set of interfaces used for adding constraints to + the motion of a pointer. Possible constraints include confining pointer + motions to a given region, or locking it to its current position. + + In order to constrain the pointer, a client must first bind the global + interface "wp_pointer_constraints" which, if a compositor supports pointer + constraints, is exposed by the registry. Using the bound global object, the + client uses the request that corresponds to the type of constraint it wants + to make. See wp_pointer_constraints for more details. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + The global interface exposing pointer constraining functionality. It + exposes two requests: lock_pointer for locking the pointer to its + position, and confine_pointer for locking the pointer to a region. + + The lock_pointer and confine_pointer requests create the objects + wp_locked_pointer and wp_confined_pointer respectively, and the client can + use these objects to interact with the lock. + + For any surface, only one lock or confinement may be active across all + wl_pointer objects of the same seat. If a lock or confinement is requested + when another lock or confinement is active or requested on the same surface + and with any of the wl_pointer objects of the same seat, an + 'already_constrained' error will be raised. + + + + + These errors can be emitted in response to wp_pointer_constraints + requests. + + + + + + + These values represent different lifetime semantics. They are passed + as arguments to the factory requests to specify how the constraint + lifetimes should be managed. + + + + A oneshot pointer constraint will never reactivate once it has been + deactivated. See the corresponding deactivation event + (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for + details. + + + + + A persistent pointer constraint may again reactivate once it has + been deactivated. See the corresponding deactivation event + (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for + details. + + + + + + + Used by the client to notify the server that it will no longer use this + pointer constraints object. + + + + + + The lock_pointer request lets the client request to disable movements of + the virtual pointer (i.e. the cursor), effectively locking the pointer + to a position. This request may not take effect immediately; in the + future, when the compositor deems implementation-specific constraints + are satisfied, the pointer lock will be activated and the compositor + sends a locked event. + + The protocol provides no guarantee that the constraints are ever + satisfied, and does not require the compositor to send an error if the + constraints cannot ever be satisfied. It is thus possible to request a + lock that will never activate. + + There may not be another pointer constraint of any kind requested or + active on the surface for any of the wl_pointer objects of the seat of + the passed pointer when requesting a lock. If there is, an error will be + raised. See general pointer lock documentation for more details. + + The intersection of the region passed with this request and the input + region of the surface is used to determine where the pointer must be + in order for the lock to activate. It is up to the compositor whether to + warp the pointer or require some kind of user interaction for the lock + to activate. If the region is null the surface input region is used. + + A surface may receive pointer focus without the lock being activated. + + The request creates a new object wp_locked_pointer which is used to + interact with the lock as well as receive updates about its state. See + the the description of wp_locked_pointer for further information. + + Note that while a pointer is locked, the wl_pointer objects of the + corresponding seat will not emit any wl_pointer.motion events, but + relative motion events will still be emitted via wp_relative_pointer + objects of the same seat. wl_pointer.axis and wl_pointer.button events + are unaffected. + + + + + + + + + + + The confine_pointer request lets the client request to confine the + pointer cursor to a given region. This request may not take effect + immediately; in the future, when the compositor deems implementation- + specific constraints are satisfied, the pointer confinement will be + activated and the compositor sends a confined event. + + The intersection of the region passed with this request and the input + region of the surface is used to determine where the pointer must be + in order for the confinement to activate. It is up to the compositor + whether to warp the pointer or require some kind of user interaction for + the confinement to activate. If the region is null the surface input + region is used. + + The request will create a new object wp_confined_pointer which is used + to interact with the confinement as well as receive updates about its + state. See the the description of wp_confined_pointer for further + information. + + + + + + + + + + + + The wp_locked_pointer interface represents a locked pointer state. + + While the lock of this object is active, the wl_pointer objects of the + associated seat will not emit any wl_pointer.motion events. + + This object will send the event 'locked' when the lock is activated. + Whenever the lock is activated, it is guaranteed that the locked surface + will already have received pointer focus and that the pointer will be + within the region passed to the request creating this object. + + To unlock the pointer, send the destroy request. This will also destroy + the wp_locked_pointer object. + + If the compositor decides to unlock the pointer the unlocked event is + sent. See wp_locked_pointer.unlock for details. + + When unlocking, the compositor may warp the cursor position to the set + cursor position hint. If it does, it will not result in any relative + motion events emitted via wp_relative_pointer. + + If the surface the lock was requested on is destroyed and the lock is not + yet activated, the wp_locked_pointer object is now defunct and must be + destroyed. + + + + + Destroy the locked pointer object. If applicable, the compositor will + unlock the pointer. + + + + + + Set the cursor position hint relative to the top left corner of the + surface. + + If the client is drawing its own cursor, it should update the position + hint to the position of its own cursor. A compositor may use this + information to warp the pointer upon unlock in order to avoid pointer + jumps. + + The cursor position hint is double buffered. The new hint will only take + effect when the associated surface gets it pending state applied. See + wl_surface.commit for details. + + + + + + + + Set a new region used to lock the pointer. + + The new lock region is double-buffered. The new lock region will + only take effect when the associated surface gets its pending state + applied. See wl_surface.commit for details. + + For details about the lock region, see wp_locked_pointer. + + + + + + + Notification that the pointer lock of the seat's pointer is activated. + + + + + + Notification that the pointer lock of the seat's pointer is no longer + active. If this is a oneshot pointer lock (see + wp_pointer_constraints.lifetime) this object is now defunct and should + be destroyed. If this is a persistent pointer lock (see + wp_pointer_constraints.lifetime) this pointer lock may again + reactivate in the future. + + + + + + + The wp_confined_pointer interface represents a confined pointer state. + + This object will send the event 'confined' when the confinement is + activated. Whenever the confinement is activated, it is guaranteed that + the surface the pointer is confined to will already have received pointer + focus and that the pointer will be within the region passed to the request + creating this object. It is up to the compositor to decide whether this + requires some user interaction and if the pointer will warp to within the + passed region if outside. + + To unconfine the pointer, send the destroy request. This will also destroy + the wp_confined_pointer object. + + If the compositor decides to unconfine the pointer the unconfined event is + sent. The wp_confined_pointer object is at this point defunct and should + be destroyed. + + + + + Destroy the confined pointer object. If applicable, the compositor will + unconfine the pointer. + + + + + + Set a new region used to confine the pointer. + + The new confine region is double-buffered. The new confine region will + only take effect when the associated surface gets its pending state + applied. See wl_surface.commit for details. + + If the confinement is active when the new confinement region is applied + and the pointer ends up outside of newly applied region, the pointer may + warped to a position within the new confinement region. If warped, a + wl_pointer.motion event will be emitted, but no + wp_relative_pointer.relative_motion event. + + The compositor may also, instead of using the new region, unconfine the + pointer. + + For details about the confine region, see wp_confined_pointer. + + + + + + + Notification that the pointer confinement of the seat's pointer is + activated. + + + + + + Notification that the pointer confinement of the seat's pointer is no + longer active. If this is a oneshot pointer confinement (see + wp_pointer_constraints.lifetime) this object is now defunct and should + be destroyed. If this is a persistent pointer confinement (see + wp_pointer_constraints.lifetime) this pointer confinement may again + reactivate in the future. + + + + + diff --git a/3rdparty/sdl2-2.0.9/wayland-protocols/relative-pointer-unstable-v1.xml b/3rdparty/sdl2-2.0.9/wayland-protocols/relative-pointer-unstable-v1.xml new file mode 100644 index 0000000000..ca6f81d12a --- /dev/null +++ b/3rdparty/sdl2-2.0.9/wayland-protocols/relative-pointer-unstable-v1.xml @@ -0,0 +1,136 @@ + + + + + Copyright © 2014 Jonas Ådahl + Copyright © 2015 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a set of interfaces used for making clients able to + receive relative pointer events not obstructed by barriers (such as the + monitor edge or other pointer barriers). + + To start receiving relative pointer events, a client must first bind the + global interface "wp_relative_pointer_manager" which, if a compositor + supports relative pointer motion events, is exposed by the registry. After + having created the relative pointer manager proxy object, the client uses + it to create the actual relative pointer object using the + "get_relative_pointer" request given a wl_pointer. The relative pointer + motion events will then, when applicable, be transmitted via the proxy of + the newly created relative pointer object. See the documentation of the + relative pointer interface for more details. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + A global interface used for getting the relative pointer object for a + given pointer. + + + + + Used by the client to notify the server that it will no longer use this + relative pointer manager object. + + + + + + Create a relative pointer interface given a wl_pointer object. See the + wp_relative_pointer interface for more details. + + + + + + + + + A wp_relative_pointer object is an extension to the wl_pointer interface + used for emitting relative pointer events. It shares the same focus as + wl_pointer objects of the same seat and will only emit events when it has + focus. + + + + + + + + + Relative x/y pointer motion from the pointer of the seat associated with + this object. + + A relative motion is in the same dimension as regular wl_pointer motion + events, except they do not represent an absolute position. For example, + moving a pointer from (x, y) to (x', y') would have the equivalent + relative motion (x' - x, y' - y). If a pointer motion caused the + absolute pointer position to be clipped by for example the edge of the + monitor, the relative motion is unaffected by the clipping and will + represent the unclipped motion. + + This event also contains non-accelerated motion deltas. The + non-accelerated delta is, when applicable, the regular pointer motion + delta as it was before having applied motion acceleration and other + transformations such as normalization. + + Note that the non-accelerated delta does not represent 'raw' events as + they were read from some device. Pointer motion acceleration is device- + and configuration-specific and non-accelerated deltas and accelerated + deltas may have the same value on some devices. + + Relative motions are not coupled to wl_pointer.motion events, and can be + sent in combination with such events, but also independently. There may + also be scenarios where wl_pointer.motion is sent, but there is no + relative motion. The order of an absolute and relative motion event + originating from the same physical motion is not guaranteed. + + If the client needs button events or focus state, it can receive them + from a wl_pointer object of the same seat that the wp_relative_pointer + object is associated with. + + + + + + + + + + + diff --git a/3rdparty/sdl2-2.0.9/wayland-protocols/wayland.xml b/3rdparty/sdl2-2.0.9/wayland-protocols/wayland.xml new file mode 100644 index 0000000000..29b63be7dc --- /dev/null +++ b/3rdparty/sdl2-2.0.9/wayland-protocols/wayland.xml @@ -0,0 +1,2746 @@ + + + + + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + Copyright © 2012-2013 Collabora, Ltd. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + + + + The core global object. This is a special singleton object. It + is used for internal Wayland protocol features. + + + + + The sync request asks the server to emit the 'done' event + on the returned wl_callback object. Since requests are + handled in-order and events are delivered in-order, this can + be used as a barrier to ensure all previous requests and the + resulting events have been handled. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. + + The callback_data passed in the callback is the event serial. + + + + + + + This request creates a registry object that allows the client + to list and bind the global objects available from the + compositor. + + + + + + + The error event is sent out when a fatal (non-recoverable) + error has occurred. The object_id argument is the object + where the error occurred, most often in response to a request + to that object. The code identifies the error and is defined + by the object interface. As such, each interface defines its + own set of error codes. The message is a brief description + of the error, for (debugging) convenience. + + + + + + + + + These errors are global and can be emitted in response to any + server request. + + + + + + + + + This event is used internally by the object ID management + logic. When a client deletes an object, the server will send + this event to acknowledge that it has seen the delete request. + When the client receives this event, it will know that it can + safely reuse the object ID. + + + + + + + + The singleton global registry object. The server has a number of + global objects that are available to all clients. These objects + typically represent an actual object in the server (for example, + an input device) or they are singleton objects that provide + extension functionality. + + When a client creates a registry object, the registry object + will emit a global event for each global currently in the + registry. Globals come and go as a result of device or + monitor hotplugs, reconfiguration or other events, and the + registry will send out global and global_remove events to + keep the client up to date with the changes. To mark the end + of the initial burst of events, the client can use the + wl_display.sync request immediately after calling + wl_display.get_registry. + + A client can bind to a global object by using the bind + request. This creates a client-side handle that lets the object + emit events to the client and lets the client invoke requests on + the object. + + + + + Binds a new, client-created object to the server using the + specified name as the identifier. + + + + + + + + Notify the client of global objects. + + The event notifies the client that a global object with + the given name is now available, and it implements the + given version of the given interface. + + + + + + + + + Notify the client of removed global objects. + + This event notifies the client that the global identified + by name is no longer available. If the client bound to + the global using the bind request, the client should now + destroy that object. + + The object remains valid and requests to the object will be + ignored until the client destroys it, to avoid races between + the global going away and a client sending a request to it. + + + + + + + + Clients can handle the 'done' event to get notified when + the related request is done. + + + + + Notify the client when the related request is done. + + + + + + + + A compositor. This object is a singleton global. The + compositor is in charge of combining the contents of multiple + surfaces into one displayable output. + + + + + Ask the compositor to create a new surface. + + + + + + + Ask the compositor to create a new region. + + + + + + + + The wl_shm_pool object encapsulates a piece of memory shared + between the compositor and client. Through the wl_shm_pool + object, the client can allocate shared memory wl_buffer objects. + All objects created through the same pool share the same + underlying mapped memory. Reusing the mapped memory avoids the + setup/teardown overhead and is useful when interactively resizing + a surface or for many small buffers. + + + + + Create a wl_buffer object from the pool. + + The buffer is created offset bytes into the pool and has + width and height as specified. The stride argument specifies + the number of bytes from the beginning of one row to the beginning + of the next. The format is the pixel format of the buffer and + must be one of those advertised through the wl_shm.format event. + + A buffer will keep a reference to the pool it was created from + so it is valid to destroy the pool immediately after creating + a buffer from it. + + + + + + + + + + + + Destroy the shared memory pool. + + The mmapped memory will be released when all + buffers that have been created from this pool + are gone. + + + + + + This request will cause the server to remap the backing memory + for the pool from the file descriptor passed when the pool was + created, but using the new size. This request can only be + used to make the pool bigger. + + + + + + + + A singleton global object that provides support for shared + memory. + + Clients can create wl_shm_pool objects using the create_pool + request. + + At connection setup time, the wl_shm object emits one or more + format events to inform clients about the valid pixel formats + that can be used for buffers. + + + + + These errors can be emitted in response to wl_shm requests. + + + + + + + + + This describes the memory layout of an individual pixel. + + All renderers should support argb8888 and xrgb8888 but any other + formats are optional and may not be supported by the particular + renderer in use. + + The drm format codes match the macros defined in drm_fourcc.h. + The formats actually supported by the compositor will be + reported by the format event. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a new wl_shm_pool object. + + The pool can be used to create shared memory based buffer + objects. The server will mmap size bytes of the passed file + descriptor, to use as backing memory for the pool. + + + + + + + + + Informs the client about a valid pixel format that + can be used for buffers. Known formats include + argb8888 and xrgb8888. + + + + + + + + A buffer provides the content for a wl_surface. Buffers are + created through factory interfaces such as wl_drm, wl_shm or + similar. It has a width and a height and can be attached to a + wl_surface, but the mechanism by which a client provides and + updates the contents is defined by the buffer factory interface. + + + + + Destroy a buffer. If and how you need to release the backing + storage is defined by the buffer factory interface. + + For possible side-effects to a surface, see wl_surface.attach. + + + + + + Sent when this wl_buffer is no longer used by the compositor. + The client is now free to reuse or destroy this buffer and its + backing storage. + + If a client receives a release event before the frame callback + requested in the same wl_surface.commit that attaches this + wl_buffer to a surface, then the client is immediately free to + reuse the buffer and its backing storage, and does not need a + second buffer for the next surface content update. Typically + this is possible, when the compositor maintains a copy of the + wl_surface contents, e.g. as a GL texture. This is an important + optimization for GL(ES) compositors with wl_shm clients. + + + + + + + A wl_data_offer represents a piece of data offered for transfer + by another client (the source client). It is used by the + copy-and-paste and drag-and-drop mechanisms. The offer + describes the different mime types that the data can be + converted to and provides the mechanism for transferring the + data directly from the source client. + + + + + + + + + + + + Indicate that the client can accept the given mime type, or + NULL for not accepted. + + For objects of version 2 or older, this request is used by the + client to give feedback whether the client can receive the given + mime type, or NULL if none is accepted; the feedback does not + determine whether the drag-and-drop operation succeeds or not. + + For objects of version 3 or newer, this request determines the + final result of the drag-and-drop operation. If the end result + is that no mime types were accepted, the drag-and-drop operation + will be cancelled and the corresponding drag source will receive + wl_data_source.cancelled. Clients may still use this event in + conjunction with wl_data_source.action for feedback. + + + + + + + + To transfer the offered data, the client issues this request + and indicates the mime type it wants to receive. The transfer + happens through the passed file descriptor (typically created + with the pipe system call). The source client writes the data + in the mime type representation requested and then closes the + file descriptor. + + The receiving client reads from the read end of the pipe until + EOF and then closes its end, at which point the transfer is + complete. + + This request may happen multiple times for different mime types, + both before and after wl_data_device.drop. Drag-and-drop destination + clients may preemptively fetch data or examine it more closely to + determine acceptance. + + + + + + + + Destroy the data offer. + + + + + + Sent immediately after creating the wl_data_offer object. One + event per offered mime type. + + + + + + + + + Notifies the compositor that the drag destination successfully + finished the drag-and-drop operation. + + Upon receiving this request, the compositor will emit + wl_data_source.dnd_finished on the drag source client. + + It is a client error to perform other requests than + wl_data_offer.destroy after this one. It is also an error to perform + this request after a NULL mime type has been set in + wl_data_offer.accept or no action was received through + wl_data_offer.action. + + + + + + Sets the actions that the destination side client supports for + this operation. This request may trigger the emission of + wl_data_source.action and wl_data_offer.action events if the compositor + needs to change the selected action. + + This request can be called multiple times throughout the + drag-and-drop operation, typically in response to wl_data_device.enter + or wl_data_device.motion events. + + This request determines the final result of the drag-and-drop + operation. If the end result is that no action is accepted, + the drag source will receive wl_drag_source.cancelled. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, and the preferred_action + argument must only contain one of those values set, otherwise it + will result in a protocol error. + + While managing an "ask" action, the destination drag-and-drop client + may perform further wl_data_offer.receive requests, and is expected + to perform one last wl_data_offer.set_actions request with a preferred + action other than "ask" (and optionally wl_data_offer.accept) before + requesting wl_data_offer.finish, in order to convey the action selected + by the user. If the preferred action is not in the + wl_data_offer.source_actions mask, an error will be raised. + + If the "ask" action is dismissed (e.g. user cancellation), the client + is expected to perform wl_data_offer.destroy right away. + + This request can only be made on drag-and-drop offers, a protocol error + will be raised otherwise. + + + + + + + + This event indicates the actions offered by the data source. It + will be sent right after wl_data_device.enter, or anytime the source + side changes its offered actions through wl_data_source.set_actions. + + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation in response to destination side action changes through + wl_data_offer.set_actions. + + This event will no longer be emitted after wl_data_device.drop + happened on the drag-and-drop destination, the client must + honor the last action received, or the last preferred one set + through wl_data_offer.set_actions when handling an "ask" action. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. Prior to + receiving wl_data_device.drop, the chosen action may change (e.g. + due to keyboard modifiers being pressed). At the time of receiving + wl_data_device.drop the drag-and-drop destination must honor the + last action received. + + Action changes may still happen after wl_data_device.drop, + especially on "ask" actions, where the drag-and-drop destination + may choose another action afterwards. Action changes happening + at this stage are always the result of inter-client negotiation, the + compositor shall no longer be able to induce a different action. + + Upon "ask" actions, it is expected that the drag-and-drop destination + may potentially choose a different action and/or mime type, + based on wl_data_offer.source_actions and finally chosen by the + user (e.g. popping up a menu with the available options). The + final wl_data_offer.set_actions and wl_data_offer.accept requests + must happen before the call to wl_data_offer.finish. + + + + + + + + The wl_data_source object is the source side of a wl_data_offer. + It is created by the source client in a data transfer and + provides a way to describe the offered data and a way to respond + to requests to transfer the data. + + + + + + + + + + This request adds a mime type to the set of mime types + advertised to targets. Can be called several times to offer + multiple types. + + + + + + + Destroy the data source. + + + + + + Sent when a target accepts pointer_focus or motion events. If + a target does not accept any of the offered types, type is NULL. + + Used for feedback during drag-and-drop. + + + + + + + Request for data from the client. Send the data as the + specified mime type over the passed file descriptor, then + close it. + + + + + + + + This data source is no longer valid. There are several reasons why + this could happen: + + - The data source has been replaced by another data source. + - The drag-and-drop operation was performed, but the drop destination + did not accept any of the mime types offered through + wl_data_source.target. + - The drag-and-drop operation was performed, but the drop destination + did not select any of the actions present in the mask offered through + wl_data_source.action. + - The drag-and-drop operation was performed but didn't happen over a + surface. + - The compositor cancelled the drag-and-drop operation (e.g. compositor + dependent timeouts to avoid stale drag-and-drop transfers). + + The client should clean up and destroy this data source. + + For objects of version 2 or older, wl_data_source.cancelled will + only be emitted if the data source was replaced by another data + source. + + + + + + + + Sets the actions that the source side client supports for this + operation. This request may trigger wl_data_source.action and + wl_data_offer.action events if the compositor needs to change the + selected action. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, otherwise it will result + in a protocol error. + + This request must be made once only, and can only be made on sources + used in drag-and-drop, so it must be performed before + wl_data_device.start_drag. Attempting to use the source other than + for drag-and-drop will raise a protocol error. + + + + + + + The user performed the drop action. This event does not indicate + acceptance, wl_data_source.cancelled may still be emitted afterwards + if the drop destination does not accept any mime type. + + However, this event might however not be received if the compositor + cancelled the drag-and-drop operation before this event could happen. + + Note that the data_source may still be used in the future and should + not be destroyed here. + + + + + + The drop destination finished interoperating with this data + source, so the client is now free to destroy this data source and + free all associated data. + + If the action used to perform the operation was "move", the + source can now delete the transferred data. + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation, mainly in response to destination side changes through + wl_data_offer.set_actions, and as the data device enters/leaves + surfaces. + + It is only possible to receive this event after + wl_data_source.dnd_drop_performed if the drag-and-drop operation + ended in an "ask" action, in which case the final wl_data_source.action + event will happen immediately before wl_data_source.dnd_finished. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. The chosen + action may change alongside negotiation (e.g. an "ask" action can turn + into a "move" operation), so the effects of the final action must + always be applied in wl_data_offer.dnd_finished. + + Clients can trigger cursor surface changes from this point, so + they reflect the current action. + + + + + + + + There is one wl_data_device per seat which can be obtained + from the global wl_data_device_manager singleton. + + A wl_data_device provides access to inter-client data transfer + mechanisms such as copy-and-paste and drag-and-drop. + + + + + + + + + This request asks the compositor to start a drag-and-drop + operation on behalf of the client. + + The source argument is the data source that provides the data + for the eventual data transfer. If source is NULL, enter, leave + and motion events are sent only to the client that initiated the + drag and the client is expected to handle the data passing + internally. + + The origin surface is the surface where the drag originates and + the client must have an active implicit grab that matches the + serial. + + The icon surface is an optional (can be NULL) surface that + provides an icon to be moved around with the cursor. Initially, + the top-left corner of the icon surface is placed at the cursor + hotspot, but subsequent wl_surface.attach request can move the + relative position. Attach requests must be confirmed with + wl_surface.commit as usual. The icon surface is given the role of + a drag-and-drop icon. If the icon surface already has another role, + it raises a protocol error. + + The current and pending input regions of the icon wl_surface are + cleared, and wl_surface.set_input_region is ignored until the + wl_surface is no longer used as the icon surface. When the use + as an icon ends, the current and pending input regions become + undefined, and the wl_surface is unmapped. + + + + + + + + + + This request asks the compositor to set the selection + to the data from the source on behalf of the client. + + To unset the selection, set the source to NULL. + + + + + + + + The data_offer event introduces a new wl_data_offer object, + which will subsequently be used in either the + data_device.enter event (for drag-and-drop) or the + data_device.selection event (for selections). Immediately + following the data_device_data_offer event, the new data_offer + object will send out data_offer.offer events to describe the + mime types it offers. + + + + + + + This event is sent when an active drag-and-drop pointer enters + a surface owned by the client. The position of the pointer at + enter time is provided by the x and y arguments, in surface-local + coordinates. + + + + + + + + + + + This event is sent when the drag-and-drop pointer leaves the + surface and the session ends. The client must destroy the + wl_data_offer introduced at enter time at this point. + + + + + + This event is sent when the drag-and-drop pointer moves within + the currently focused surface. The new position of the pointer + is provided by the x and y arguments, in surface-local + coordinates. + + + + + + + + + The event is sent when a drag-and-drop operation is ended + because the implicit grab is removed. + + The drag-and-drop destination is expected to honor the last action + received through wl_data_offer.action, if the resulting action is + "copy" or "move", the destination can still perform + wl_data_offer.receive requests, and is expected to end all + transfers with a wl_data_offer.finish request. + + If the resulting action is "ask", the action will not be considered + final. The drag-and-drop destination is expected to perform one last + wl_data_offer.set_actions request, or wl_data_offer.destroy in order + to cancel the operation. + + + + + + The selection event is sent out to notify the client of a new + wl_data_offer for the selection for this device. The + data_device.data_offer and the data_offer.offer events are + sent out immediately before this event to introduce the data + offer object. The selection event is sent to a client + immediately before receiving keyboard focus and when a new + selection is set while the client has keyboard focus. The + data_offer is valid until a new data_offer or NULL is received + or until the client loses keyboard focus. The client must + destroy the previous selection data_offer, if any, upon receiving + this event. + + + + + + + + + This request destroys the data device. + + + + + + + The wl_data_device_manager is a singleton global object that + provides access to inter-client data transfer mechanisms such as + copy-and-paste and drag-and-drop. These mechanisms are tied to + a wl_seat and this interface lets a client get a wl_data_device + corresponding to a wl_seat. + + Depending on the version bound, the objects created from the bound + wl_data_device_manager object will have different requirements for + functioning properly. See wl_data_source.set_actions, + wl_data_offer.accept and wl_data_offer.finish for details. + + + + + Create a new data source. + + + + + + + Create a new data device for a given seat. + + + + + + + + + + This is a bitmask of the available/preferred actions in a + drag-and-drop operation. + + In the compositor, the selected action is a result of matching the + actions offered by the source and destination sides. "action" events + with a "none" action will be sent to both source and destination if + there is no match. All further checks will effectively happen on + (source actions ∩ destination actions). + + In addition, compositors may also pick different actions in + reaction to key modifiers being pressed. One common design that + is used in major toolkits (and the behavior recommended for + compositors) is: + + - If no modifiers are pressed, the first match (in bit order) + will be used. + - Pressing Shift selects "move", if enabled in the mask. + - Pressing Control selects "copy", if enabled in the mask. + + Behavior beyond that is considered implementation-dependent. + Compositors may for example bind other modifiers (like Alt/Meta) + or drags initiated with other buttons than BTN_LEFT to specific + actions (e.g. "ask"). + + + + + + + + + + + This interface is implemented by servers that provide + desktop-style user interfaces. + + It allows clients to associate a wl_shell_surface with + a basic surface. + + + + + + + + + Create a shell surface for an existing surface. This gives + the wl_surface the role of a shell surface. If the wl_surface + already has another role, it raises a protocol error. + + Only one shell surface can be associated with a given surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides requests to treat surfaces like toplevel, fullscreen + or popup windows, move, resize or maximize them, associate + metadata like title and class, etc. + + On the server side the object is automatically destroyed when + the related wl_surface is destroyed. On the client side, + wl_shell_surface_destroy() must be called before destroying + the wl_surface object. + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + + + + + Start a pointer-driven move of the surface. + + This request must be used in response to a button press event. + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. The server may + use this information to adapt its behavior, e.g. choose + an appropriate cursor image. + + + + + + + + + + + + + + + Start a pointer-driven resizing of the surface. + + This request must be used in response to a button press event. + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + + Map the surface as a toplevel surface. + + A toplevel surface is not fullscreen, maximized or transient. + + + + + + These flags specify details of the expected behaviour + of transient surfaces. Used in the set_transient request. + + + + + + + Map the surface relative to an existing surface. + + The x and y arguments specify the location of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface-local coordinates. + + The flags argument controls details of the transient behaviour. + + + + + + + + + + Hints to indicate to the compositor how to deal with a conflict + between the dimensions of the surface and the dimensions of the + output. The compositor is free to ignore this parameter. + + + + + + + + + + Map the surface as a fullscreen surface. + + If an output parameter is given then the surface will be made + fullscreen on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. + + The client may specify a method to resolve a size conflict + between the output size and the surface size - this is provided + through the method parameter. + + The framerate parameter is used only when the method is set + to "driver", to indicate the preferred framerate. A value of 0 + indicates that the client does not care about framerate. The + framerate is specified in mHz, that is framerate of 60000 is 60Hz. + + A method of "scale" or "driver" implies a scaling operation of + the surface, either via a direct scaling operation or a change of + the output mode. This will override any kind of output scaling, so + that mapping a surface with a buffer size equal to the mode can + fill the screen independent of buffer_scale. + + A method of "fill" means we don't scale up the buffer, however + any output scale is applied. This means that you may run into + an edge case where the application maps a buffer with the same + size of the output mode but buffer_scale 1 (thus making a + surface larger than the output). In this case it is allowed to + downscale the results to fit the screen. + + The compositor must reply to this request with a configure event + with the dimensions for the output on which the surface will + be made fullscreen. + + + + + + + + + Map the surface as a popup. + + A popup surface is a transient surface with an added pointer + grab. + + An existing implicit grab will be changed to owner-events mode, + and the popup grab will continue after the implicit grab ends + (i.e. releasing the mouse button does not cause the popup to + be unmapped). + + The popup grab continues until the window is destroyed or a + mouse button is pressed in any other client's window. A click + in any of the client's surfaces is reported as normal, however, + clicks in other clients' surfaces will be discarded and trigger + the callback. + + The x and y arguments specify the location of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface-local coordinates. + + + + + + + + + + + + Map the surface as a maximized surface. + + If an output parameter is given then the surface will be + maximized on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. + + The compositor will reply with a configure event telling + the expected new surface size. The operation is completed + on the next buffer attach to this surface. + + A maximized surface typically fills the entire output it is + bound to, except for desktop elements such as panels. This is + the main difference between a maximized shell surface and a + fullscreen shell surface. + + The details depend on the compositor implementation. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set a class for the surface. + + The surface class identifies the general class of applications + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class. + + + + + + + Ping a client to check if it is receiving events and sending + requests. A client is expected to reply with a pong request. + + + + + + + The configure event asks the client to resize its surface. + + The size is a hint, in the sense that the client is free to + ignore it if it doesn't resize, pick a smaller size (to + satisfy aspect ratio or resize in steps of NxM pixels). + + The edges parameter provides a hint about how the surface + was resized. The client may use this information to decide + how to adjust its content to the new size (e.g. a scrolling + area might adjust its content position to leave the viewable + content unmoved). + + The client is free to dismiss all but the last configure + event it received. + + The width and height arguments specify the size of the window + in surface-local coordinates. + + + + + + + + + The popup_done event is sent out when a popup grab is broken, + that is, when the user clicks a surface that doesn't belong + to the client owning the popup surface. + + + + + + + A surface is a rectangular area that is displayed on the screen. + It has a location, size and pixel contents. + + The size of a surface (and relative positions on it) is described + in surface-local coordinates, which may differ from the buffer + coordinates of the pixel content, in case a buffer_transform + or a buffer_scale is used. + + A surface without a "role" is fairly useless: a compositor does + not know where, when or how to present it. The role is the + purpose of a wl_surface. Examples of roles are a cursor for a + pointer (as set by wl_pointer.set_cursor), a drag icon + (wl_data_device.start_drag), a sub-surface + (wl_subcompositor.get_subsurface), and a window as defined by a + shell protocol (e.g. wl_shell.get_shell_surface). + + A surface can have only one role at a time. Initially a + wl_surface does not have a role. Once a wl_surface is given a + role, it is set permanently for the whole lifetime of the + wl_surface object. Giving the current role again is allowed, + unless explicitly forbidden by the relevant interface + specification. + + Surface roles are given by requests in other interfaces such as + wl_pointer.set_cursor. The request should explicitly mention + that this request gives a role to a wl_surface. Often, this + request also creates a new protocol object that represents the + role and adds additional functionality to wl_surface. When a + client wants to destroy a wl_surface, they must destroy this 'role + object' before the wl_surface. + + Destroying the role object does not remove the role from the + wl_surface, but it may stop the wl_surface from "playing the role". + For instance, if a wl_subsurface object is destroyed, the wl_surface + it was created for will be unmapped and forget its position and + z-order. It is allowed to create a wl_subsurface for the same + wl_surface again, but it is not allowed to use the wl_surface as + a cursor (cursor is a different role than sub-surface, and role + switching is not allowed). + + + + + These errors can be emitted in response to wl_surface requests. + + + + + + + + Deletes the surface and invalidates its object ID. + + + + + + Set a buffer as the content of this surface. + + The new size of the surface is calculated based on the buffer + size transformed by the inverse buffer_transform and the + inverse buffer_scale. This means that the supplied buffer + must be an integer multiple of the buffer_scale. + + The x and y arguments specify the location of the new pending + buffer's upper left corner, relative to the current buffer's upper + left corner, in surface-local coordinates. In other words, the + x and y, combined with the new surface size define in which + directions the surface's size changes. + + Surface contents are double-buffered state, see wl_surface.commit. + + The initial surface contents are void; there is no content. + wl_surface.attach assigns the given wl_buffer as the pending + wl_buffer. wl_surface.commit makes the pending wl_buffer the new + surface contents, and the size of the surface becomes the size + calculated from the wl_buffer, as described above. After commit, + there is no pending buffer until the next attach. + + Committing a pending wl_buffer allows the compositor to read the + pixels in the wl_buffer. The compositor may access the pixels at + any time after the wl_surface.commit request. When the compositor + will not access the pixels anymore, it will send the + wl_buffer.release event. Only after receiving wl_buffer.release, + the client may reuse the wl_buffer. A wl_buffer that has been + attached and then replaced by another attach instead of committed + will not receive a release event, and is not used by the + compositor. + + Destroying the wl_buffer after wl_buffer.release does not change + the surface contents. However, if the client destroys the + wl_buffer before receiving the wl_buffer.release event, the surface + contents become undefined immediately. + + If wl_surface.attach is sent with a NULL wl_buffer, the + following wl_surface.commit will remove the surface content. + + + + + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in surface-local coordinates, + where x and y specify the upper left corner of the damage rectangle. + + The initial value for pending damage is empty: no damage. + wl_surface.damage adds pending damage: the new pending damage + is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + Alternatively, damage can be posted with wl_surface.damage_buffer + which uses buffer coordinates instead of surface coordinates, + and is probably the preferred and intuitive way of doing this. + + + + + + + + + + Request a notification when it is a good time to start drawing a new + frame, by creating a frame callback. This is useful for throttling + redrawing operations, and driving animations. + + When a client is animating on a wl_surface, it can use the 'frame' + request to get notified when it is a good time to draw and commit the + next frame of animation. If the client commits an update earlier than + that, it is likely that some updates will not make it to the display, + and the client is wasting resources by drawing too often. + + The frame request will take effect on the next wl_surface.commit. + The notification will only be posted for one frame unless + requested again. For a wl_surface, the notifications are posted in + the order the frame requests were committed. + + The server must send the notifications so that a client + will not send excessive updates, while still allowing + the highest possible update rate for clients that wait for the reply + before drawing again. The server should give some time for the client + to draw and commit after sending the frame callback events to let it + hit the next output refresh. + + A server should avoid signaling the frame callbacks if the + surface is not visible in any way, e.g. the surface is off-screen, + or completely obscured by other opaque surfaces. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. + + The callback_data passed in the callback is the current time, in + milliseconds, with an undefined base. + + + + + + + This request sets the region of the surface that contains + opaque content. + + The opaque region is an optimization hint for the compositor + that lets it optimize the redrawing of content behind opaque + regions. Setting an opaque region is not required for correct + behaviour, but marking transparent content as opaque will result + in repaint artifacts. + + The opaque region is specified in surface-local coordinates. + + The compositor ignores the parts of the opaque region that fall + outside of the surface. + + Opaque region is double-buffered state, see wl_surface.commit. + + wl_surface.set_opaque_region changes the pending opaque region. + wl_surface.commit copies the pending region to the current region. + Otherwise, the pending and current regions are never changed. + + The initial value for an opaque region is empty. Setting the pending + opaque region has copy semantics, and the wl_region object can be + destroyed immediately. A NULL wl_region causes the pending opaque + region to be set to empty. + + + + + + + This request sets the region of the surface that can receive + pointer and touch events. + + Input events happening outside of this region will try the next + surface in the server surface stack. The compositor ignores the + parts of the input region that fall outside of the surface. + + The input region is specified in surface-local coordinates. + + Input region is double-buffered state, see wl_surface.commit. + + wl_surface.set_input_region changes the pending input region. + wl_surface.commit copies the pending region to the current region. + Otherwise the pending and current regions are never changed, + except cursor and icon surfaces are special cases, see + wl_pointer.set_cursor and wl_data_device.start_drag. + + The initial value for an input region is infinite. That means the + whole surface will accept input. Setting the pending input region + has copy semantics, and the wl_region object can be destroyed + immediately. A NULL wl_region causes the input region to be set + to infinite. + + + + + + + Surface state (input, opaque, and damage regions, attached buffers, + etc.) is double-buffered. Protocol requests modify the pending state, + as opposed to the current state in use by the compositor. A commit + request atomically applies all pending state, replacing the current + state. After commit, the new pending state is as documented for each + related request. + + On commit, a pending wl_buffer is applied first, and all other state + second. This means that all coordinates in double-buffered state are + relative to the new wl_buffer coming into use, except for + wl_surface.attach itself. If there is no pending wl_buffer, the + coordinates are relative to the current surface contents. + + All requests that need a commit to become effective are documented + to affect double-buffered state. + + Other interfaces may add further double-buffered surface state. + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in some part of it being within the scanout region of an + output. + + Note that a surface may be overlapping with zero or more outputs. + + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in it no longer having any part of it within the scanout region + of an output. + + + + + + + + + This request sets an optional transformation on how the compositor + interprets the contents of the buffer attached to the surface. The + accepted values for the transform parameter are the values for + wl_output.transform. + + Buffer transform is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer transformation set to normal. + + wl_surface.set_buffer_transform changes the pending buffer + transformation. wl_surface.commit copies the pending buffer + transformation to the current one. Otherwise, the pending and current + values are never changed. + + The purpose of this request is to allow clients to render content + according to the output transform, thus permitting the compositor to + use certain optimizations even if the display is rotated. Using + hardware overlays and scanning out a client buffer for fullscreen + surfaces are examples of such optimizations. Those optimizations are + highly dependent on the compositor implementation, so the use of this + request should be considered on a case-by-case basis. + + Note that if the transform value includes 90 or 270 degree rotation, + the width of the buffer will become the surface height and the height + of the buffer will become the surface width. + + If transform is not one of the values from the + wl_output.transform enum the invalid_transform protocol error + is raised. + + + + + + + + + This request sets an optional scaling factor on how the compositor + interprets the contents of the buffer attached to the window. + + Buffer scale is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer scale set to 1. + + wl_surface.set_buffer_scale changes the pending buffer scale. + wl_surface.commit copies the pending buffer scale to the current one. + Otherwise, the pending and current values are never changed. + + The purpose of this request is to allow clients to supply higher + resolution buffer data for use on high resolution outputs. It is + intended that you pick the same buffer scale as the scale of the + output that the surface is displayed on. This means the compositor + can avoid scaling when rendering the surface on that output. + + Note that if the scale is larger than 1, then you have to attach + a buffer that is larger (by a factor of scale in each dimension) + than the desired surface size. + + If scale is not positive the invalid_scale protocol error is + raised. + + + + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in buffer coordinates, + where x and y specify the upper left corner of the damage rectangle. + + The initial value for pending damage is empty: no damage. + wl_surface.damage_buffer adds pending damage: the new pending + damage is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + This request differs from wl_surface.damage in only one way - it + takes damage in buffer coordinates instead of surface-local + coordinates. While this generally is more intuitive than surface + coordinates, it is especially desirable when using wp_viewport + or when a drawing library (like EGL) is unaware of buffer scale + and buffer transform. + + Note: Because buffer transformation changes and damage requests may + be interleaved in the protocol stream, it is impossible to determine + the actual mapping between surface and buffer damage until + wl_surface.commit time. Therefore, compositors wishing to take both + kinds of damage into account will have to accumulate damage from the + two requests separately and only transform from one to the other + after receiving the wl_surface.commit. + + + + + + + + + + + A seat is a group of keyboards, pointer and touch devices. This + object is published as a global during start up, or when such a + device is hot plugged. A seat typically has a pointer and + maintains a keyboard focus and a pointer focus. + + + + + This is a bitmask of capabilities this seat has; if a member is + set, then it is present on the seat. + + + + + + + + + This is emitted whenever a seat gains or loses the pointer, + keyboard or touch capabilities. The argument is a capability + enum containing the complete set of capabilities this seat has. + + When the pointer capability is added, a client may create a + wl_pointer object using the wl_seat.get_pointer request. This object + will receive pointer events until the capability is removed in the + future. + + When the pointer capability is removed, a client should destroy the + wl_pointer objects associated with the seat where the capability was + removed, using the wl_pointer.release request. No further pointer + events will be received on these objects. + + In some compositors, if a seat regains the pointer capability and a + client has a previously obtained wl_pointer object of version 4 or + less, that object may start sending pointer events again. This + behavior is considered a misinterpretation of the intended behavior + and must not be relied upon by the client. wl_pointer objects of + version 5 or later must not send events if created before the most + recent event notifying the client of an added pointer capability. + + The above behavior also applies to wl_keyboard and wl_touch with the + keyboard and touch capabilities, respectively. + + + + + + + The ID provided will be initialized to the wl_pointer interface + for this seat. + + This request only takes effect if the seat has the pointer + capability, or has had the pointer capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the pointer capability. + + + + + + + The ID provided will be initialized to the wl_keyboard interface + for this seat. + + This request only takes effect if the seat has the keyboard + capability, or has had the keyboard capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the keyboard capability. + + + + + + + The ID provided will be initialized to the wl_touch interface + for this seat. + + This request only takes effect if the seat has the touch + capability, or has had the touch capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the touch capability. + + + + + + + + + In a multiseat configuration this can be used by the client to help + identify which physical devices the seat represents. Based on + the seat configuration used by the compositor. + + + + + + + + + Using this request a client can tell the server that it is not going to + use the seat object anymore. + + + + + + + + The wl_pointer interface represents one or more input devices, + such as mice, which control the pointer location and pointer_focus + of a seat. + + The wl_pointer interface generates motion, enter and leave + events for the surfaces that the pointer is located over, + and button and axis events for button presses, button releases + and scrolling. + + + + + + + + + Set the pointer surface, i.e., the surface that contains the + pointer image (cursor). This request gives the surface the role + of a cursor. If the surface already has another role, it raises + a protocol error. + + The cursor actually changes only if the pointer + focus for this device is one of the requesting client's surfaces + or the surface parameter is the current pointer surface. If + there was a previous surface set with this request it is + replaced. If surface is NULL, the pointer image is hidden. + + The parameters hotspot_x and hotspot_y define the position of + the pointer surface relative to the pointer location. Its + top-left corner is always at (x, y) - (hotspot_x, hotspot_y), + where (x, y) are the coordinates of the pointer location, in + surface-local coordinates. + + On surface.attach requests to the pointer surface, hotspot_x + and hotspot_y are decremented by the x and y parameters + passed to the request. Attach must be confirmed by + wl_surface.commit as usual. + + The hotspot can also be updated by passing the currently set + pointer surface to this request with new values for hotspot_x + and hotspot_y. + + The current and pending input regions of the wl_surface are + cleared, and wl_surface.set_input_region is ignored until the + wl_surface is no longer used as the cursor. When the use as a + cursor ends, the current and pending input regions become + undefined, and the wl_surface is unmapped. + + + + + + + + + + Notification that this seat's pointer is focused on a certain + surface. + + When a seat's focus enters a surface, the pointer image + is undefined and a client should respond to this event by setting + an appropriate pointer image with the set_cursor request. + + + + + + + + + + Notification that this seat's pointer is no longer focused on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + + + + + + + Notification of pointer location change. The arguments + surface_x and surface_y are the location relative to the + focused surface. + + + + + + + + + Describes the physical state of a button that produced the button + event. + + + + + + + + Mouse button click and release notifications. + + The location of the click is given by the last motion or + enter event. + The time argument is a timestamp with millisecond + granularity, with an undefined base. + + The button is a button code as defined in the Linux kernel's + linux/input-event-codes.h header file, e.g. BTN_LEFT. + + Any 16-bit button code value is reserved for future additions to the + kernel's event code list. All other button codes above 0xFFFF are + currently undefined but may be used in future versions of this + protocol. + + + + + + + + + + Describes the axis types of scroll events. + + + + + + + + Scroll and other axis notifications. + + For scroll events (vertical and horizontal scroll axes), the + value parameter is the length of a vector along the specified + axis in a coordinate space identical to those of motion events, + representing a relative movement along the specified axis. + + For devices that support movements non-parallel to axes multiple + axis events will be emitted. + + When applicable, for example for touch pads, the server can + choose to emit scroll events where the motion vector is + equivalent to a motion event vector. + + When applicable, a client can transform its content relative to the + scroll distance. + + + + + + + + + + + Using this request a client can tell the server that it is not going to + use the pointer object anymore. + + This request destroys the pointer proxy object, so clients must not call + wl_pointer_destroy() after using this request. + + + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + All wl_pointer events before a wl_pointer.frame event belong + logically together. For example, in a diagonal scroll motion the + compositor will send an optional wl_pointer.axis_source event, two + wl_pointer.axis events (horizontal and vertical) and finally a + wl_pointer.frame event. The client may use this information to + calculate a diagonal vector for scrolling. + + When multiple wl_pointer.axis events occur within the same frame, + the motion vector is the combined motion of all events. + When a wl_pointer.axis and a wl_pointer.axis_stop event occur within + the same frame, this indicates that axis movement in one axis has + stopped but continues in the other axis. + When multiple wl_pointer.axis_stop events occur within the same + frame, this indicates that these axes stopped in the same instance. + + A wl_pointer.frame event is sent for every logical event group, + even if the group only contains a single wl_pointer event. + Specifically, a client may get a sequence: motion, frame, button, + frame, axis, frame, axis_stop, frame. + + The wl_pointer.enter and wl_pointer.leave events are logical events + generated by the compositor and not the hardware. These events are + also grouped by a wl_pointer.frame. When a pointer moves from one + surface to another, a compositor should group the + wl_pointer.leave event within the same wl_pointer.frame. + However, a client must not rely on wl_pointer.leave and + wl_pointer.enter being in the same wl_pointer.frame. + Compositor-specific policies may require the wl_pointer.leave and + wl_pointer.enter event being split across multiple wl_pointer.frame + groups. + + + + + + Describes the source types for axis events. This indicates to the + client how an axis event was physically generated; a client may + adjust the user interface accordingly. For example, scroll events + from a "finger" source may be in a smooth coordinate space with + kinetic scrolling whereas a "wheel" source may be in discrete steps + of a number of lines. + + The "continuous" axis source is a device generating events in a + continuous coordinate space, but using something other than a + finger. One example for this source is button-based scrolling where + the vertical motion of a device is converted to scroll events while + a button is held down. + + The "wheel tilt" axis source indicates that the actual device is a + wheel but the scroll event is not caused by a rotation but a + (usually sideways) tilt of the wheel. + + + + + + + + + + Source information for scroll and other axes. + + This event does not occur on its own. It is sent before a + wl_pointer.frame event and carries the source information for + all events within that frame. + + The source specifies how this event was generated. If the source is + wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be + sent when the user lifts the finger off the device. + + If the source is wl_pointer.axis_source.wheel, + wl_pointer.axis_source.wheel_tilt or + wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may + or may not be sent. Whether a compositor sends an axis_stop event + for these sources is hardware-specific and implementation-dependent; + clients must not rely on receiving an axis_stop event for these + scroll sources and should treat scroll sequences from these scroll + sources as unterminated by default. + + This event is optional. If the source is unknown for a particular + axis event sequence, no event is sent. + Only one wl_pointer.axis_source event is permitted per frame. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + Stop notification for scroll and other axes. + + For some wl_pointer.axis_source types, a wl_pointer.axis_stop event + is sent to notify a client that the axis sequence has terminated. + This enables the client to implement kinetic scrolling. + See the wl_pointer.axis_source documentation for information on when + this event may be generated. + + Any wl_pointer.axis events with the same axis_source after this + event should be considered as the start of a new axis motion. + + The timestamp is to be interpreted identical to the timestamp in the + wl_pointer.axis event. The timestamp value may be the same as a + preceding wl_pointer.axis event. + + + + + + + + Discrete step information for scroll and other axes. + + This event carries the axis value of the wl_pointer.axis event in + discrete steps (e.g. mouse wheel clicks). + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value on a + continuous scale. The protocol guarantees that each axis_discrete + event is always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_discrete and + its coupled axis event, including other axis_discrete or axis + events. + + This event is optional; continuous scrolling devices + like two-finger scrolling on touchpads do not have discrete + steps and do not generate this event. + + The discrete value carries the directional information. e.g. a value + of -2 is two steps towards the negative direction of this axis. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + + + The wl_keyboard interface represents one or more keyboards + associated with a seat. + + + + + This specifies the format of the keymap provided to the + client with the wl_keyboard.keymap event. + + + + + + + + This event provides a file descriptor to the client which can be + memory-mapped to provide a keyboard mapping description. + + + + + + + + + Notification that this seat's keyboard focus is on a certain + surface. + + + + + + + + + Notification that this seat's keyboard focus is no longer on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + + + + + + + Describes the physical state of a key that produced the key event. + + + + + + + + A key was pressed or released. + The time argument is a timestamp with millisecond + granularity, with an undefined base. + + + + + + + + + + Notifies clients that the modifier and/or group state has + changed, and it should update its local state. + + + + + + + + + + + + + + + + + + + Informs the client about the keyboard's repeat rate and delay. + + This event is sent as soon as the wl_keyboard object has been created, + and is guaranteed to be received by the client before any key press + event. + + Negative values for either rate or delay are illegal. A rate of zero + will disable any repeating (regardless of the value of delay). + + This event can be sent later on as well with a new value if necessary, + so clients should continue listening for the event past the creation + of wl_keyboard. + + + + + + + + + The wl_touch interface represents a touchscreen + associated with a seat. + + Touch interactions can consist of one or more contacts. + For each contact, a series of events is generated, starting + with a down event, followed by zero or more motion events, + and ending with an up event. Events relating to the same + contact point can be identified by the ID of the sequence. + + + + + A new touch point has appeared on the surface. This touch point is + assigned a unique ID. Future events from this touch point reference + this ID. The ID ceases to be valid after a touch up event and may be + reused in the future. + + + + + + + + + + + + The touch point has disappeared. No further events will be sent for + this touch point and the touch point's ID is released and may be + reused in a future touch down event. + + + + + + + + + A touch point has changed coordinates. + + + + + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + A wl_touch.frame terminates at least one event but otherwise no + guarantee is provided about the set of events within a frame. A client + must assume that any state not updated in a frame is unchanged from the + previously known state. + + + + + + Sent if the compositor decides the touch stream is a global + gesture. No further events are sent to the clients from that + particular gesture. Touch cancellation applies to all touch points + currently active on this client's surface. The client is + responsible for finalizing the touch points, future touch points on + this surface may reuse the touch point ID. + + + + + + + + + + + + + + Sent when a touchpoint has changed its shape. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.orientation may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.shape event for this touch ID but both events may occur within + the same wl_touch.frame. + + A touchpoint shape is approximated by an ellipse through the major and + minor axis length. The major axis length describes the longer diameter + of the ellipse, while the minor axis length describes the shorter + diameter. Major and minor are orthogonal and both are specified in + surface-local coordinates. The center of the ellipse is always at the + touchpoint location as reported by wl_touch.down or wl_touch.move. + + This event is only sent by the compositor if the touch device supports + shape reports. The client has to make reasonable assumptions about the + shape if it did not receive this event. + + + + + + + + + Sent when a touchpoint has changed its orientation. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.shape may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.orientation event for this touch ID but both events may occur + within the same wl_touch.frame. + + The orientation describes the clockwise angle of a touchpoint's major + axis to the positive surface y-axis and is normalized to the -180 to + +180 degree range. The granularity of orientation depends on the touch + device, some devices only support binary rotation values between 0 and + 90 degrees. + + This event is only sent by the compositor if the touch device supports + orientation reports. + + + + + + + + + An output describes part of the compositor geometry. The + compositor works in the 'compositor coordinate system' and an + output corresponds to a rectangular area in that space that is + actually visible. This typically corresponds to a monitor that + displays part of the compositor space. This object is published + as global during start up, or when a monitor is hotplugged. + + + + + This enumeration describes how the physical + pixels on an output are laid out. + + + + + + + + + + + + This describes the transform that a compositor will apply to a + surface to compensate for the rotation or mirroring of an + output device. + + The flipped values correspond to an initial flip around a + vertical axis followed by rotation. + + The purpose is mainly to allow clients to render accordingly and + tell the compositor, so that for fullscreen surfaces, the + compositor will still be able to scan out directly from client + surfaces. + + + + + + + + + + + + + + The geometry event describes geometric properties of the output. + The event is sent when binding to the output object and whenever + any of the properties change. + + + + + + + + + + + + + + These flags describe properties of an output mode. + They are used in the flags bitfield of the mode event. + + + + + + + + The mode event describes an available mode for the output. + + The event is sent when binding to the output object and there + will always be one mode, the current mode. The event is sent + again if an output changes mode, for the mode that is now + current. In other words, the current mode is always the last + mode that was received with the current flag set. + + The size of a mode is given in physical hardware units of + the output device. This is not necessarily the same as + the output size in the global compositor space. For instance, + the output may be scaled, as described in wl_output.scale, + or transformed, as described in wl_output.transform. + + + + + + + + + + + + This event is sent after all other properties have been + sent after binding to the output object and after any + other property changes done after that. This allows + changes to the output properties to be seen as + atomic, even if they happen via multiple events. + + + + + + This event contains scaling geometry information + that is not in the geometry event. It may be sent after + binding the output object or if the output scale changes + later. If it is not sent, the client should assume a + scale of 1. + + A scale larger than 1 means that the compositor will + automatically scale surface buffers by this amount + when rendering. This is used for very high resolution + displays where applications rendering at the native + resolution would be too small to be legible. + + It is intended that scaling aware clients track the + current output of a surface, and if it is on a scaled + output it should use wl_surface.set_buffer_scale with + the scale of the output. That way the compositor can + avoid scaling the surface, and the client can supply + a higher detail image. + + + + + + + + + Using this request a client can tell the server that it is not going to + use the output object anymore. + + + + + + + A region object describes an area. + + Region objects are used to describe the opaque and input + regions of a surface. + + + + + Destroy the region. This will invalidate the object ID. + + + + + + Add the specified rectangle to the region. + + + + + + + + + + Subtract the specified rectangle from the region. + + + + + + + + + + + The global interface exposing sub-surface compositing capabilities. + A wl_surface, that has sub-surfaces associated, is called the + parent surface. Sub-surfaces can be arbitrarily nested and create + a tree of sub-surfaces. + + The root surface in a tree of sub-surfaces is the main + surface. The main surface cannot be a sub-surface, because + sub-surfaces must always have a parent. + + A main surface with its sub-surfaces forms a (compound) window. + For window management purposes, this set of wl_surface objects is + to be considered as a single window, and it should also behave as + such. + + The aim of sub-surfaces is to offload some of the compositing work + within a window from clients to the compositor. A prime example is + a video player with decorations and video in separate wl_surface + objects. This should allow the compositor to pass YUV video buffer + processing to dedicated overlay hardware when possible. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other + objects, wl_subsurface objects included. + + + + + + + + + + Create a sub-surface interface for the given surface, and + associate it with the given parent surface. This turns a + plain wl_surface into a sub-surface. + + The to-be sub-surface must not already have another role, and it + must not have an existing wl_subsurface object. Otherwise a protocol + error is raised. + + + + + + + + + + An additional interface to a wl_surface object, which has been + made a sub-surface. A sub-surface has one parent surface. A + sub-surface's size and position are not limited to that of the parent. + Particularly, a sub-surface is not automatically clipped to its + parent's area. + + A sub-surface becomes mapped, when a non-NULL wl_buffer is applied + and the parent surface is mapped. The order of which one happens + first is irrelevant. A sub-surface is hidden if the parent becomes + hidden, or if a NULL wl_buffer is applied. These rules apply + recursively through the tree of surfaces. + + The behaviour of a wl_surface.commit request on a sub-surface + depends on the sub-surface's mode. The possible modes are + synchronized and desynchronized, see methods + wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized + mode caches the wl_surface state to be applied when the parent's + state gets applied, and desynchronized mode applies the pending + wl_surface state directly. A sub-surface is initially in the + synchronized mode. + + Sub-surfaces have also other kind of state, which is managed by + wl_subsurface requests, as opposed to wl_surface requests. This + state includes the sub-surface position relative to the parent + surface (wl_subsurface.set_position), and the stacking order of + the parent and its sub-surfaces (wl_subsurface.place_above and + .place_below). This state is applied when the parent surface's + wl_surface state is applied, regardless of the sub-surface's mode. + As the exception, set_sync and set_desync are effective immediately. + + The main surface can be thought to be always in desynchronized mode, + since it does not have a parent in the sub-surfaces sense. + + Even if a sub-surface is in desynchronized mode, it will behave as + in synchronized mode, if its parent surface behaves as in + synchronized mode. This rule is applied recursively throughout the + tree of surfaces. This means, that one can set a sub-surface into + synchronized mode, and then assume that all its child and grand-child + sub-surfaces are synchronized, too, without explicitly setting them. + + If the wl_surface associated with the wl_subsurface is destroyed, the + wl_subsurface object becomes inert. Note, that destroying either object + takes effect immediately. If you need to synchronize the removal + of a sub-surface to the parent surface update, unmap the sub-surface + first by attaching a NULL wl_buffer, update parent, and then destroy + the sub-surface. + + If the parent wl_surface object is destroyed, the sub-surface is + unmapped. + + + + + The sub-surface interface is removed from the wl_surface object + that was turned into a sub-surface with a + wl_subcompositor.get_subsurface request. The wl_surface's association + to the parent is deleted, and the wl_surface loses its role as + a sub-surface. The wl_surface is unmapped. + + + + + + + + + + This schedules a sub-surface position change. + The sub-surface will be moved so that its origin (top left + corner pixel) will be at the location x, y of the parent surface + coordinate system. The coordinates are not restricted to the parent + surface area. Negative values are allowed. + + The scheduled coordinates will take effect whenever the state of the + parent surface is applied. When this happens depends on whether the + parent surface is in synchronized mode or not. See + wl_subsurface.set_sync and wl_subsurface.set_desync for details. + + If more than one set_position request is invoked by the client before + the commit of the parent surface, the position of a new request always + replaces the scheduled position from any previous request. + + The initial position is 0, 0. + + + + + + + + This sub-surface is taken from the stack, and put back just + above the reference surface, changing the z-order of the sub-surfaces. + The reference surface must be one of the sibling surfaces, or the + parent surface. Using any other surface, including this sub-surface, + will cause a protocol error. + + The z-order is double-buffered. Requests are handled in order and + applied immediately to a pending state. The final pending state is + copied to the active state the next time the state of the parent + surface is applied. When this happens depends on whether the parent + surface is in synchronized mode or not. See wl_subsurface.set_sync and + wl_subsurface.set_desync for details. + + A new sub-surface is initially added as the top-most in the stack + of its siblings and parent. + + + + + + + The sub-surface is placed just below the reference surface. + See wl_subsurface.place_above. + + + + + + + Change the commit behaviour of the sub-surface to synchronized + mode, also described as the parent dependent mode. + + In synchronized mode, wl_surface.commit on a sub-surface will + accumulate the committed state in a cache, but the state will + not be applied and hence will not change the compositor output. + The cached state is applied to the sub-surface immediately after + the parent surface's state is applied. This ensures atomic + updates of the parent and all its synchronized sub-surfaces. + Applying the cached state will invalidate the cache, so further + parent surface commits do not (re-)apply old state. + + See wl_subsurface for the recursive effect of this mode. + + + + + + Change the commit behaviour of the sub-surface to desynchronized + mode, also described as independent or freely running mode. + + In desynchronized mode, wl_surface.commit on a sub-surface will + apply the pending state directly, without caching, as happens + normally with a wl_surface. Calling wl_surface.commit on the + parent surface has no effect on the sub-surface's wl_surface + state. This mode allows a sub-surface to be updated on its own. + + If cached state exists when wl_surface.commit is called in + desynchronized mode, the pending state is added to the cached + state, and applied as a whole. This invalidates the cache. + + Note: even if a sub-surface is set to desynchronized, a parent + sub-surface may override it to behave as synchronized. For details, + see wl_subsurface. + + If a surface's parent surface behaves as desynchronized, then + the cached state is applied on set_desync. + + + + + diff --git a/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell-unstable-v6.xml b/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell-unstable-v6.xml new file mode 100644 index 0000000000..1c0f92452b --- /dev/null +++ b/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell-unstable-v6.xml @@ -0,0 +1,1044 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + xdg_shell allows clients to turn a wl_surface into a "real window" + which can be dragged, resized, stacked, and moved around by the + user. Everything about this interface is suited towards traditional + desktop environments. + + + + + + + + + + + + + + Destroy this xdg_shell object. + + Destroying a bound xdg_shell object while there are surfaces + still alive created by this xdg_shell object instance is illegal + and will result in a protocol error. + + + + + + Create a positioner object. A positioner object is used to position + surfaces relative to some parent surface. See the interface description + and xdg_surface.get_popup for details. + + + + + + + This creates an xdg_surface for the given surface. While xdg_surface + itself is not a role, the corresponding surface may only be assigned + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. + + This creates an xdg_surface for the given surface. An xdg_surface is + used as basis to define a role to a given surface, such as xdg_toplevel + or xdg_popup. It also manages functionality shared between xdg_surface + based surface roles. + + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. + + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. See xdg_shell.ping. + + + + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. See xdg_shell.ping. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_shell object it created. + + + + + + + + The xdg_positioner provides a collection of rules for the placement of a + child surface relative to a parent surface. Rules can be defined to ensure + the child surface remains within the visible area's borders, and to + specify how the child surface changes its position, such as sliding along + an axis, or flipping around a rectangle. These positioner-created rules are + constrained by the requirement that a child surface must intersect with or + be at least partially adjacent to its parent surface. + + See the various requests for details about possible rules. + + At the time of the request, the compositor makes a copy of the rules + specified by the xdg_positioner. Thus, after the request is complete the + xdg_positioner object can be destroyed or reused; further changes to the + object will have no effect on previous usages. + + For an xdg_positioner object to be considered complete, it must have a + non-zero size set by set_size, and a non-zero anchor rectangle set by + set_anchor_rect. Passing an incomplete xdg_positioner object when + positioning a surface raises an error. + + + + + + + + + Notify the compositor that the xdg_positioner will no longer be used. + + + + + + Set the size of the surface that is to be positioned with the positioner + object. The size is in surface-local coordinates and corresponds to the + window geometry. See xdg_surface.set_window_geometry. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + Specify the anchor rectangle within the parent surface that the child + surface will be placed relative to. The rectangle is relative to the + window geometry as defined by xdg_surface.set_window_geometry of the + parent surface. The rectangle must be at least 1x1 large. + + When the xdg_positioner object is used to position a child surface, the + anchor rectangle may not extend outside the window geometry of the + positioned child's parent surface. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + + + + + + + + + + + Defines a set of edges for the anchor rectangle. These are used to + derive an anchor point that the child surface will be positioned + relative to. If two orthogonal edges are specified (e.g. 'top' and + 'left'), then the anchor point will be the intersection of the edges + (e.g. the top left position of the rectangle); otherwise, the derived + anchor point will be centered on the specified edge, or in the center of + the anchor rectangle if no edge is specified. + + If two parallel anchor edges are specified (e.g. 'left' and 'right'), + the invalid_input error is raised. + + + + + + + + + + + + + + + Defines in what direction a surface should be positioned, relative to + the anchor point of the parent surface. If two orthogonal gravities are + specified (e.g. 'bottom' and 'right'), then the child surface will be + placed in the specified direction; otherwise, the child surface will be + centered over the anchor point on any axis that had no gravity + specified. + + If two parallel gravities are specified (e.g. 'left' and 'right'), the + invalid_input error is raised. + + + + + + + The constraint adjustment value define ways the compositor will adjust + the position of the surface, if the unadjusted position would result + in the surface being partly constrained. + + Whether a surface is considered 'constrained' is left to the compositor + to determine. For example, the surface may be partly outside the + compositor's defined 'work area', thus necessitating the child surface's + position be adjusted until it is entirely inside the work area. + + The adjustments can be combined, according to a defined precedence: 1) + Flip, 2) Slide, 3) Resize. + + + + Don't alter the surface position even if it is constrained on some + axis, for example partially outside the edge of a monitor. + + + + + Slide the surface along the x axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the x axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + x axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Slide the surface along the y axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the y axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + y axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Invert the anchor and gravity on the x axis if the surface is + constrained on the x axis. For example, if the left edge of the + surface is constrained, the gravity is 'left' and the anchor is + 'left', change the gravity to 'right' and the anchor to 'right'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_x adjustment will be the one before the + adjustment. + + + + + Invert the anchor and gravity on the y axis if the surface is + constrained on the y axis. For example, if the bottom edge of the + surface is constrained, the gravity is 'bottom' and the anchor is + 'bottom', change the gravity to 'top' and the anchor to 'top'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_y adjustment will be the one before the + adjustment. + + + + + Resize the surface horizontally so that it is completely + unconstrained. + + + + + Resize the surface vertically so that it is completely unconstrained. + + + + + + + Specify how the window should be positioned if the originally intended + position caused the surface to be constrained, meaning at least + partially outside positioning boundaries set by the compositor. The + adjustment is set by constructing a bitmask describing the adjustment to + be made when the surface is constrained on that axis. + + If no bit for one axis is set, the compositor will assume that the child + surface should not change its position on that axis when constrained. + + If more than one bit for one axis is set, the order of how adjustments + are applied is specified in the corresponding adjustment descriptions. + + The default adjustment is none. + + + + + + + Specify the surface position offset relative to the position of the + anchor on the anchor rectangle and the anchor on the surface. For + example if the anchor of the anchor rectangle is at (x, y), the surface + has the gravity bottom|right, and the offset is (ox, oy), the calculated + surface position will be (x + ox, y + oy). The offset position of the + surface is the one used for constraint testing. See + set_constraint_adjustment. + + An example use case is placing a popup menu on top of a user interface + element, while aligning the user interface element of the parent surface + with some user interface element placed somewhere in the popup surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides a base set of functionality required to construct user + interface elements requiring management by the compositor, such as + toplevel windows, menus, etc. The types of functionality are split into + xdg_surface roles. + + Creating an xdg_surface does not set the role for a wl_surface. In order + to map an xdg_surface, the client must create a role-specific object + using, e.g., get_toplevel, get_popup. The wl_surface for any given + xdg_surface can have at most one role, and may not be assigned any role + not based on xdg_surface. + + A role must be assigned before any other requests are made to the + xdg_surface object. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. + + Creating an xdg_surface from a wl_surface which has a buffer attached or + committed is a client error, and any attempts by a client to attach or + manipulate a buffer prior to the first xdg_surface.configure call must + also be treated as errors. + + For a surface to be mapped by the compositor, the following conditions + must be met: (1) the client has assigned a xdg_surface based role to the + surface, (2) the client has set and committed the xdg_surface state and + the role dependent state to the surface and (3) the client has committed a + buffer to the surface. + + + + + + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed + after its role object has been destroyed. + + + + + + This creates an xdg_toplevel object for the given xdg_surface and gives + the associated wl_surface the xdg_toplevel role. + + See the documentation of xdg_toplevel for more details about what an + xdg_toplevel is and how it is used. + + + + + + + This creates an xdg_popup object for the given xdg_surface and gives the + associated wl_surface the xdg_popup role. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. + + + + + + + + + The window geometry of a surface is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + Once the window geometry of the surface is set, it is not possible to + unset it, and it will remain the same until set_window_geometry is + called again, even if a new subsurface or buffer is attached. + + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset is meant for extremely simple clients. + + The arguments are given in the surface-local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. Setting an invalid size + will raise an error. When applied, the effective window geometry will be + the set window geometry clamped to the bounding rectangle of the + combined geometry of the surface of the xdg_surface and the associated + subsurfaces. + + + + + + + + + + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. + + For instance, for toplevel surfaces the compositor might use this + information to move a surface to the top left only when the client has + drawn itself for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + A client may send multiple ack_configure requests before committing, but + only the last request sent before a commit indicates which configure + event the client really is responding to. + + + + + + + The configure event marks the end of a configure sequence. A configure + sequence is a set of one or more events configuring the state of the + xdg_surface, including the final xdg_surface.configure event. + + Where applicable, xdg_surface surface roles will during a configure + sequence extend this event as a latched state sent as events before the + xdg_surface.configure event. Such events should be considered to make up + a set of atomically applied configuration states, where the + xdg_surface.configure commits the accumulated state. + + Clients should arrange their surface for the new states, and then send + an ack_configure request with the serial sent in this configure event at + some point before committing the new surface. + + If the client receives multiple configure events before it can respond + to one, it is free to discard all but the last event it received. + + + + + + + + This interface defines an xdg_surface role which allows a surface to, + among other things, set window-like properties such as maximize, + fullscreen, and minimize, set application-specific metadata like title and + id, and well as trigger user interactive operations such as interactive + resize and move. + + + + + Unmap and destroy the window. The window will be effectively + hidden from the user's point of view, and all state like + maximization, fullscreen, and so on, will be lost. + + + + + + Set the "parent" of this surface. This window should be stacked + above a parent. The parent surface must be mapped as long as this + surface is mapped. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an application identifier for the surface. + + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. + + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ + + + + + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + + + + + + + + + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). + + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. + + + + + + + + + + + + + + + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). + + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, + and is one of the values of the resize_edge enum. The compositor + may use this information to update the surface position for + example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an + appropriate cursor image. + + + + + + + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + configure event to ensure that both the client and the compositor + setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is fullscreen. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + + + + + + + Set a maximum size for the window. + + The client can specify a maximum size so that the compositor does + not try to configure the window beyond this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the maximum + size. The compositor may decide to ignore the values set by the + client and request a larger size. + + If never set, or a value of zero in the request, means that the + client has no expected maximum size in the given dimension. + As a result, a client wishing to reset the maximum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a maximum size to be smaller than the minimum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Set a minimum size for the window. + + The client can specify a minimum size so that the compositor does + not try to configure the window below this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the minimum + size. The compositor may decide to ignore the values set by the + client and request a smaller size. + + If never set, or a value of zero in the request, means that the + client has no expected minimum size in the given dimension. + As a result, a client wishing to reset the minimum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a minimum size to be larger than the maximum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + request. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + + + + + Make the surface fullscreen. + + You can specify an output that you would prefer to be fullscreen. + If this value is NULL, it's up to the compositor to choose which + display will be used to map this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + black borders filling the rest of the output. + + + + + + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + + + + + This configure event asks the client to resize its toplevel surface or + to change its state. The configured state should not be applied + immediately. See xdg_surface.configure for details. + + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. + + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor needs to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients must send an ack_configure in response to this event. See + xdg_surface.configure and xdg_surface.ack_configure for details. + + + + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any. + + This is only a request that the user intends to close the + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data, etc. + + + + + + + A popup surface is a short-lived, temporary surface. It can be used to + implement for example menus, popovers, tooltips and other similar user + interface concepts. + + A popup can be made to take an explicit grab. See xdg_popup.grab for + details. + + When the popup is dismissed, a popup_done event will be sent out, and at + the same time the surface will be unmapped. See the xdg_popup.popup_done + event for details. + + Explicitly destroying the xdg_popup object will also dismiss the popup and + unmap the surface. Clients that want to dismiss the popup when another + surface of their own is clicked should dismiss the popup using the destroy + request. + + The parent surface must have either the xdg_toplevel or xdg_popup surface + role. + + A newly created xdg_popup will be stacked on top of all previously created + xdg_popup surfaces associated with the same xdg_toplevel. + + The parent of an xdg_popup must be mapped (see the xdg_surface + description) before the xdg_popup itself. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_surface.get_popup. An xdg_popup must intersect with or be at least + partially adjacent to its parent surface. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + + + + + + + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. + + + + + + This request makes the created popup take an explicit grab. An explicit + grab will be dismissed when the user dismisses the popup, or when the + client destroys the xdg_popup. This can be done by the user clicking + outside the surface, using the keyboard, or even locking the screen + through closing the lid or a timeout. + + If the compositor denies the grab, the popup will be immediately + dismissed. + + This request must be used in response to some sort of user action like a + button press, key press, or touch down event. The serial number of the + event should be passed as 'serial'. + + The parent of a grabbing popup must either be an xdg_toplevel surface or + another xdg_popup with an explicit grab. If the parent is another + xdg_popup it means that the popups are nested, with this popup now being + the topmost popup. + + Nested popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times is the + topmost one. + + When compositors choose to dismiss a popup, they may dismiss every + nested grabbing popup as well. When a compositor dismisses popups, it + will follow the same dismissing order as required from the client. + + The parent of a grabbing popup must either be another xdg_popup with an + active explicit grab, or an xdg_popup or xdg_toplevel, if there are no + explicit grabs already taken. + + If the topmost grabbing popup is destroyed, the grab will be returned to + the parent of the popup, if that parent previously had an explicit grab. + + If the parent is a grabbing popup which has already been dismissed, this + popup will be immediately dismissed. If the parent is a popup that did + not take an explicit grab, an error will be raised. + + During a popup grab, the client owning the grab will receive pointer + and touch events for all their surfaces as normal (similar to an + "owner-events" grab in X11 parlance), while the top most grabbing popup + will always have keyboard focus. + + + + + + + + This event asks the popup surface to configure itself given the + configuration. The configured state should not be applied immediately. + See xdg_surface.configure for details. + + The x and y arguments represent the position the popup was placed at + given the xdg_positioner rule, relative to the upper left corner of the + window geometry of the parent surface. + + + + + + + + + + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. + + + + + diff --git a/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell.xml b/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell.xml new file mode 100644 index 0000000000..d524ea9e27 --- /dev/null +++ b/3rdparty/sdl2-2.0.9/wayland-protocols/xdg-shell.xml @@ -0,0 +1,1120 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + Copyright © 2015-2017 Samsung Electronics Co., Ltd + Copyright © 2015-2017 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + The xdg_wm_base interface is exposed as a global object enabling clients + to turn their wl_surfaces into windows in a desktop environment. It + defines the basic functionality needed for clients and the compositor to + create windows that can be dragged, resized, maximized, etc, as well as + creating transient windows such as popup menus. + + + + + + + + + + + + + + Destroy this xdg_wm_base object. + + Destroying a bound xdg_wm_base object while there are surfaces + still alive created by this xdg_wm_base object instance is illegal + and will result in a protocol error. + + + + + + Create a positioner object. A positioner object is used to position + surfaces relative to some parent surface. See the interface description + and xdg_surface.get_popup for details. + + + + + + + This creates an xdg_surface for the given surface. While xdg_surface + itself is not a role, the corresponding surface may only be assigned + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. + + This creates an xdg_surface for the given surface. An xdg_surface is + used as basis to define a role to a given surface, such as xdg_toplevel + or xdg_popup. It also manages functionality shared between xdg_surface + based surface roles. + + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. + + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. See xdg_wm_base.ping. + + + + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. See xdg_wm_base.ping. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_wm_base object it created. + + + + + + + + The xdg_positioner provides a collection of rules for the placement of a + child surface relative to a parent surface. Rules can be defined to ensure + the child surface remains within the visible area's borders, and to + specify how the child surface changes its position, such as sliding along + an axis, or flipping around a rectangle. These positioner-created rules are + constrained by the requirement that a child surface must intersect with or + be at least partially adjacent to its parent surface. + + See the various requests for details about possible rules. + + At the time of the request, the compositor makes a copy of the rules + specified by the xdg_positioner. Thus, after the request is complete the + xdg_positioner object can be destroyed or reused; further changes to the + object will have no effect on previous usages. + + For an xdg_positioner object to be considered complete, it must have a + non-zero size set by set_size, and a non-zero anchor rectangle set by + set_anchor_rect. Passing an incomplete xdg_positioner object when + positioning a surface raises an error. + + + + + + + + + Notify the compositor that the xdg_positioner will no longer be used. + + + + + + Set the size of the surface that is to be positioned with the positioner + object. The size is in surface-local coordinates and corresponds to the + window geometry. See xdg_surface.set_window_geometry. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + Specify the anchor rectangle within the parent surface that the child + surface will be placed relative to. The rectangle is relative to the + window geometry as defined by xdg_surface.set_window_geometry of the + parent surface. + + When the xdg_positioner object is used to position a child surface, the + anchor rectangle may not extend outside the window geometry of the + positioned child's parent surface. + + If a negative size is set the invalid_input error is raised. + + + + + + + + + + + + + + + + + + + + + + Defines the anchor point for the anchor rectangle. The specified anchor + is used derive an anchor point that the child surface will be + positioned relative to. If a corner anchor is set (e.g. 'top_left' or + 'bottom_right'), the anchor point will be at the specified corner; + otherwise, the derived anchor point will be centered on the specified + edge, or in the center of the anchor rectangle if no edge is specified. + + + + + + + + + + + + + + + + + + + Defines in what direction a surface should be positioned, relative to + the anchor point of the parent surface. If a corner gravity is + specified (e.g. 'bottom_right' or 'top_left'), then the child surface + will be placed towards the specified gravity; otherwise, the child + surface will be centered over the anchor point on any axis that had no + gravity specified. + + + + + + + The constraint adjustment value define ways the compositor will adjust + the position of the surface, if the unadjusted position would result + in the surface being partly constrained. + + Whether a surface is considered 'constrained' is left to the compositor + to determine. For example, the surface may be partly outside the + compositor's defined 'work area', thus necessitating the child surface's + position be adjusted until it is entirely inside the work area. + + The adjustments can be combined, according to a defined precedence: 1) + Flip, 2) Slide, 3) Resize. + + + + Don't alter the surface position even if it is constrained on some + axis, for example partially outside the edge of an output. + + + + + Slide the surface along the x axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the x axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + x axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Slide the surface along the y axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the y axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + y axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Invert the anchor and gravity on the x axis if the surface is + constrained on the x axis. For example, if the left edge of the + surface is constrained, the gravity is 'left' and the anchor is + 'left', change the gravity to 'right' and the anchor to 'right'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_x adjustment will be the one before the + adjustment. + + + + + Invert the anchor and gravity on the y axis if the surface is + constrained on the y axis. For example, if the bottom edge of the + surface is constrained, the gravity is 'bottom' and the anchor is + 'bottom', change the gravity to 'top' and the anchor to 'top'. + + The adjusted position is calculated given the original anchor + rectangle and offset, but with the new flipped anchor and gravity + values. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_y adjustment will be the one before the + adjustment. + + + + + Resize the surface horizontally so that it is completely + unconstrained. + + + + + Resize the surface vertically so that it is completely unconstrained. + + + + + + + Specify how the window should be positioned if the originally intended + position caused the surface to be constrained, meaning at least + partially outside positioning boundaries set by the compositor. The + adjustment is set by constructing a bitmask describing the adjustment to + be made when the surface is constrained on that axis. + + If no bit for one axis is set, the compositor will assume that the child + surface should not change its position on that axis when constrained. + + If more than one bit for one axis is set, the order of how adjustments + are applied is specified in the corresponding adjustment descriptions. + + The default adjustment is none. + + + + + + + Specify the surface position offset relative to the position of the + anchor on the anchor rectangle and the anchor on the surface. For + example if the anchor of the anchor rectangle is at (x, y), the surface + has the gravity bottom|right, and the offset is (ox, oy), the calculated + surface position will be (x + ox, y + oy). The offset position of the + surface is the one used for constraint testing. See + set_constraint_adjustment. + + An example use case is placing a popup menu on top of a user interface + element, while aligning the user interface element of the parent surface + with some user interface element placed somewhere in the popup surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides a base set of functionality required to construct user + interface elements requiring management by the compositor, such as + toplevel windows, menus, etc. The types of functionality are split into + xdg_surface roles. + + Creating an xdg_surface does not set the role for a wl_surface. In order + to map an xdg_surface, the client must create a role-specific object + using, e.g., get_toplevel, get_popup. The wl_surface for any given + xdg_surface can have at most one role, and may not be assigned any role + not based on xdg_surface. + + A role must be assigned before any other requests are made to the + xdg_surface object. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. + + Creating an xdg_surface from a wl_surface which has a buffer attached or + committed is a client error, and any attempts by a client to attach or + manipulate a buffer prior to the first xdg_surface.configure call must + also be treated as errors. + + Mapping an xdg_surface-based role surface is defined as making it + possible for the surface to be shown by the compositor. Note that + a mapped surface is not guaranteed to be visible once it is mapped. + + For an xdg_surface to be mapped by the compositor, the following + conditions must be met: + (1) the client has assigned an xdg_surface-based role to the surface + (2) the client has set and committed the xdg_surface state and the + role-dependent state to the surface + (3) the client has committed a buffer to the surface + + A newly-unmapped surface is considered to have met condition (1) out + of the 3 required conditions for mapping a surface if its role surface + has not been destroyed. + + + + + + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed + after its role object has been destroyed. + + + + + + This creates an xdg_toplevel object for the given xdg_surface and gives + the associated wl_surface the xdg_toplevel role. + + See the documentation of xdg_toplevel for more details about what an + xdg_toplevel is and how it is used. + + + + + + + This creates an xdg_popup object for the given xdg_surface and gives + the associated wl_surface the xdg_popup role. + + If null is passed as a parent, a parent surface must be specified using + some other protocol, before committing the initial state. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. + + + + + + + + + The window geometry of a surface is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + When maintaining a position, the compositor should treat the (x, y) + coordinate of the window geometry as the top left corner of the window. + A client changing the (x, y) window geometry coordinate should in + general not alter the position of the window. + + Once the window geometry of the surface is set, it is not possible to + unset it, and it will remain the same until set_window_geometry is + called again, even if a new subsurface or buffer is attached. + + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset is meant for extremely simple clients. + + The arguments are given in the surface-local coordinate space of + the wl_surface associated with this xdg_surface. + + The width and height must be greater than zero. Setting an invalid size + will raise an error. When applied, the effective window geometry will be + the set window geometry clamped to the bounding rectangle of the + combined geometry of the surface of the xdg_surface and the associated + subsurfaces. + + + + + + + + + + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. + + For instance, for toplevel surfaces the compositor might use this + information to move a surface to the top left only when the client has + drawn itself for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + A client may send multiple ack_configure requests before committing, but + only the last request sent before a commit indicates which configure + event the client really is responding to. + + + + + + + The configure event marks the end of a configure sequence. A configure + sequence is a set of one or more events configuring the state of the + xdg_surface, including the final xdg_surface.configure event. + + Where applicable, xdg_surface surface roles will during a configure + sequence extend this event as a latched state sent as events before the + xdg_surface.configure event. Such events should be considered to make up + a set of atomically applied configuration states, where the + xdg_surface.configure commits the accumulated state. + + Clients should arrange their surface for the new states, and then send + an ack_configure request with the serial sent in this configure event at + some point before committing the new surface. + + If the client receives multiple configure events before it can respond + to one, it is free to discard all but the last event it received. + + + + + + + + This interface defines an xdg_surface role which allows a surface to, + among other things, set window-like properties such as maximize, + fullscreen, and minimize, set application-specific metadata like title and + id, and well as trigger user interactive operations such as interactive + resize and move. + + Unmapping an xdg_toplevel means that the surface cannot be shown + by the compositor until it is explicitly mapped again. + All active operations (e.g., move, resize) are canceled and all + attributes (e.g. title, state, stacking, ...) are discarded for + an xdg_toplevel surface when it is unmapped. + + Attaching a null buffer to a toplevel unmaps the surface. + + + + + This request destroys the role surface and unmaps the surface; + see "Unmapping" behavior in interface section for details. + + + + + + Set the "parent" of this surface. This surface should be stacked + above the parent surface and all other ancestor surfaces. + + Parent windows should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. + + Setting a null parent for a child window removes any parent-child + relationship for the child. Setting a null parent for a window which + currently has no parent is a no-op. + + If the parent is unmapped then its children are managed as + though the parent of the now-unmapped parent has become the + parent of this surface. If no parent exists for the now-unmapped + parent then the children are managed as though they have no + parent surface. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an application identifier for the surface. + + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. + + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] http://standards.freedesktop.org/desktop-entry-spec/ + + + + + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + + + + + + + + + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). + + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. + + + + + + + + + + + + + + + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). + + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, + and is one of the values of the resize_edge enum. The compositor + may use this information to update the surface position for + example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an + appropriate cursor image. + + + + + + + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + configure event to ensure that both the client and the compositor + setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client. + + + + + The surface is fullscreen. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. For + a surface to cover the whole fullscreened area, the geometry + dimensions must be obeyed by the client. For more details, see + xdg_toplevel.set_fullscreen. + + + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + + + + + + + Set a maximum size for the window. + + The client can specify a maximum size so that the compositor does + not try to configure the window beyond this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the maximum + size. The compositor may decide to ignore the values set by the + client and request a larger size. + + If never set, or a value of zero in the request, means that the + client has no expected maximum size in the given dimension. + As a result, a client wishing to reset the maximum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a maximum size to be smaller than the minimum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Set a minimum size for the window. + + The client can specify a minimum size so that the compositor does + not try to configure the window below this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the minimum + size. The compositor may decide to ignore the values set by the + client and request a smaller size. + + If never set, or a value of zero in the request, means that the + client has no expected minimum size in the given dimension. + As a result, a client wishing to reset the minimum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a minimum size to be larger than the maximum size of + a surface is illegal and will result in a protocol error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + protocol error. + + + + + + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event with the "maximized" state + and the required window geometry. The client should then update its + content, drawing it in a maximized state, i.e. without shadow or other + decoration outside of the window geometry. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It will alter the state the surface is returned to when + unmaximized if not overridden by the compositor. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event without the "maximized" + state. If available, the compositor will include the window geometry + dimensions the window had prior to being maximized in the configure + event. The client must then update its content, drawing it in a + regular state, i.e. potentially with shadow, etc. The client must also + acknowledge the configure when committing the new content (see + ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It will alter the state the surface is returned to when + unmaximized if not overridden by the compositor. + + + + + + Make the surface fullscreen. + + After requesting that the surface should be fullscreened, the + compositor will respond by emitting a configure event with the + "fullscreen" state and the fullscreen window geometry. The client must + also acknowledge the configure when committing the new content (see + ack_configure). + + The output passed by the request indicates the client's preference as + to which display it should be set fullscreen on. If this value is NULL, + it's up to the compositor to choose which display will be used to map + this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + with border fill covering the rest of the output. The content of the + border fill is undefined, but should be assumed to be in some way that + attempts to blend into the surrounding area (e.g. solid black). + + If the fullscreened surface is not opaque, the compositor must make + sure that other screen content not part of the same surface tree (made + up of subsurfaces, popups or similarly coupled surfaces) are not + visible below the fullscreened surface. + + + + + + + Make the surface no longer fullscreen. + + After requesting that the surface should be unfullscreened, the + compositor will respond by emitting a configure event without the + "fullscreen" state. + + Making a surface unfullscreen sets states for the surface based on the following: + * the state(s) it may have had before becoming fullscreen + * any state(s) decided by the compositor + * any state(s) requested by the client while the surface was fullscreen + + The compositor may include the previous window geometry dimensions in + the configure event, if applicable. + + The client must also acknowledge the configure when committing the new + content (see ack_configure). + + + + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + + + + + This configure event asks the client to resize its toplevel surface or + to change its state. The configured state should not be applied + immediately. See xdg_surface.configure for details. + + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. + + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor needs to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients must send an ack_configure in response to this event. See + xdg_surface.configure and xdg_surface.ack_configure for details. + + + + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any. + + This is only a request that the user intends to close the + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data, etc. + + + + + + + A popup surface is a short-lived, temporary surface. It can be used to + implement for example menus, popovers, tooltips and other similar user + interface concepts. + + A popup can be made to take an explicit grab. See xdg_popup.grab for + details. + + When the popup is dismissed, a popup_done event will be sent out, and at + the same time the surface will be unmapped. See the xdg_popup.popup_done + event for details. + + Explicitly destroying the xdg_popup object will also dismiss the popup and + unmap the surface. Clients that want to dismiss the popup when another + surface of their own is clicked should dismiss the popup using the destroy + request. + + The parent surface must have either the xdg_toplevel or xdg_popup surface + role. + + A newly created xdg_popup will be stacked on top of all previously created + xdg_popup surfaces associated with the same xdg_toplevel. + + The parent of an xdg_popup must be mapped (see the xdg_surface + description) before the xdg_popup itself. + + The x and y arguments passed when creating the popup object specify + where the top left of the popup should be placed, relative to the + local surface coordinates of the parent surface. See + xdg_surface.get_popup. An xdg_popup must intersect with or be at least + partially adjacent to its parent surface. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + + + + + + + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, a protocol error + will be sent. + + + + + + This request makes the created popup take an explicit grab. An explicit + grab will be dismissed when the user dismisses the popup, or when the + client destroys the xdg_popup. This can be done by the user clicking + outside the surface, using the keyboard, or even locking the screen + through closing the lid or a timeout. + + If the compositor denies the grab, the popup will be immediately + dismissed. + + This request must be used in response to some sort of user action like a + button press, key press, or touch down event. The serial number of the + event should be passed as 'serial'. + + The parent of a grabbing popup must either be an xdg_toplevel surface or + another xdg_popup with an explicit grab. If the parent is another + xdg_popup it means that the popups are nested, with this popup now being + the topmost popup. + + Nested popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times is the + topmost one. + + When compositors choose to dismiss a popup, they may dismiss every + nested grabbing popup as well. When a compositor dismisses popups, it + will follow the same dismissing order as required from the client. + + The parent of a grabbing popup must either be another xdg_popup with an + active explicit grab, or an xdg_popup or xdg_toplevel, if there are no + explicit grabs already taken. + + If the topmost grabbing popup is destroyed, the grab will be returned to + the parent of the popup, if that parent previously had an explicit grab. + + If the parent is a grabbing popup which has already been dismissed, this + popup will be immediately dismissed. If the parent is a popup that did + not take an explicit grab, an error will be raised. + + During a popup grab, the client owning the grab will receive pointer + and touch events for all their surfaces as normal (similar to an + "owner-events" grab in X11 parlance), while the top most grabbing popup + will always have keyboard focus. + + + + + + + + This event asks the popup surface to configure itself given the + configuration. The configured state should not be applied immediately. + See xdg_surface.configure for details. + + The x and y arguments represent the position the popup was placed at + given the xdg_positioner rule, relative to the upper left corner of the + window geometry of the parent surface. + + + + + + + + + + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. + + + + + diff --git a/xcode/libmoai/libmoai.xcodeproj/project.pbxproj b/xcode/libmoai/libmoai.xcodeproj/project.pbxproj index b38c40962b..5a2868c200 100644 --- a/xcode/libmoai/libmoai.xcodeproj/project.pbxproj +++ b/xcode/libmoai/libmoai.xcodeproj/project.pbxproj @@ -1088,6 +1088,316 @@ CD1D85E21E1F14480089FFAD /* ZLBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD1D85E11E1F14480089FFAD /* ZLBounds.cpp */; }; CD1D85E31E1F14480089FFAD /* ZLBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD1D85E11E1F14480089FFAD /* ZLBounds.cpp */; }; CD1D85EA1E1F36560089FFAD /* MOAIDeckProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD67B45E1B264C9C004298CF /* MOAIDeckProxy.cpp */; }; + CD273C7521B1EB96006C4D84 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7321B1EB96006C4D84 /* SDL_atomic.c */; }; + CD273C7621B1EB96006C4D84 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7421B1EB96006C4D84 /* SDL_spinlock.c */; }; + CD273C8121B1EBAA006C4D84 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C7721B1EBAA006C4D84 /* SDL_audio_c.h */; }; + CD273C8221B1EBAA006C4D84 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7821B1EBAA006C4D84 /* SDL_audio.c */; }; + CD273C8321B1EBAA006C4D84 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7921B1EBAA006C4D84 /* SDL_audiocvt.c */; }; + CD273C8421B1EBAA006C4D84 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C7A21B1EBAA006C4D84 /* SDL_audiodev_c.h */; }; + CD273C8521B1EBAA006C4D84 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7B21B1EBAA006C4D84 /* SDL_audiodev.c */; }; + CD273C8621B1EBAA006C4D84 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7C21B1EBAA006C4D84 /* SDL_audiotypecvt.c */; }; + CD273C8721B1EBAA006C4D84 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7D21B1EBAA006C4D84 /* SDL_mixer.c */; }; + CD273C8821B1EBAA006C4D84 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C7E21B1EBAA006C4D84 /* SDL_sysaudio.h */; }; + CD273C8921B1EBAA006C4D84 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C7F21B1EBAA006C4D84 /* SDL_wave.c */; }; + CD273C8A21B1EBAA006C4D84 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C8021B1EBAA006C4D84 /* SDL_wave.h */; }; + CD273C8D21B1EBB2006C4D84 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C8B21B1EBB2006C4D84 /* SDL_diskaudio.c */; }; + CD273C8E21B1EBB2006C4D84 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C8C21B1EBB2006C4D84 /* SDL_diskaudio.h */; }; + CD273C9121B1EBB9006C4D84 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C8F21B1EBB9006C4D84 /* SDL_dummyaudio.c */; }; + CD273C9221B1EBB9006C4D84 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9021B1EBB9006C4D84 /* SDL_dummyaudio.h */; }; + CD273C9521B1EBC4006C4D84 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9321B1EBC4006C4D84 /* SDL_coreaudio.h */; }; + CD273C9621B1EBC4006C4D84 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273C9421B1EBC4006C4D84 /* SDL_coreaudio.m */; }; + CD273C9921B1EBDE006C4D84 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C9721B1EBDE006C4D84 /* SDL_cpuinfo.c */; }; + CD273C9A21B1EBDE006C4D84 /* SDL_simd.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9821B1EBDE006C4D84 /* SDL_simd.h */; }; + CD273C9F21B1EBE8006C4D84 /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9B21B1EBE8006C4D84 /* SDL_dynapi_overrides.h */; }; + CD273CA021B1EBE8006C4D84 /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9C21B1EBE8006C4D84 /* SDL_dynapi_procs.h */; }; + CD273CA121B1EBE8006C4D84 /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273C9D21B1EBE8006C4D84 /* SDL_dynapi.c */; }; + CD273CA221B1EBE8006C4D84 /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273C9E21B1EBE8006C4D84 /* SDL_dynapi.h */; }; + CD273CBD21B1EBF5006C4D84 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA321B1EBF5006C4D84 /* blank_cursor.h */; }; + CD273CBE21B1EBF5006C4D84 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA421B1EBF5006C4D84 /* default_cursor.h */; }; + CD273CBF21B1EBF5006C4D84 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA521B1EBF5006C4D84 /* scancodes_darwin.h */; }; + CD273CC021B1EBF5006C4D84 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA621B1EBF5006C4D84 /* scancodes_linux.h */; }; + CD273CC121B1EBF5006C4D84 /* scancodes_windows.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA721B1EBF5006C4D84 /* scancodes_windows.h */; }; + CD273CC221B1EBF5006C4D84 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA821B1EBF5006C4D84 /* scancodes_xfree86.h */; }; + CD273CC321B1EBF5006C4D84 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CA921B1EBF5006C4D84 /* SDL_clipboardevents_c.h */; }; + CD273CC421B1EBF5006C4D84 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CAA21B1EBF5006C4D84 /* SDL_clipboardevents.c */; }; + CD273CC521B1EBF5006C4D84 /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CAB21B1EBF5006C4D84 /* SDL_displayevents_c.h */; }; + CD273CC621B1EBF5006C4D84 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CAC21B1EBF5006C4D84 /* SDL_displayevents.c */; }; + CD273CC721B1EBF5006C4D84 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CAD21B1EBF5006C4D84 /* SDL_dropevents_c.h */; }; + CD273CC821B1EBF5006C4D84 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CAE21B1EBF5006C4D84 /* SDL_dropevents.c */; }; + CD273CC921B1EBF5006C4D84 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CAF21B1EBF5006C4D84 /* SDL_events_c.h */; }; + CD273CCA21B1EBF5006C4D84 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CB021B1EBF5006C4D84 /* SDL_events.c */; }; + CD273CCB21B1EBF5006C4D84 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CB121B1EBF5006C4D84 /* SDL_gesture_c.h */; }; + CD273CCC21B1EBF5006C4D84 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CB221B1EBF5006C4D84 /* SDL_gesture.c */; }; + CD273CCD21B1EBF5006C4D84 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CB321B1EBF5006C4D84 /* SDL_keyboard_c.h */; }; + CD273CCE21B1EBF5006C4D84 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CB421B1EBF5006C4D84 /* SDL_keyboard.c */; }; + CD273CCF21B1EBF5006C4D84 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CB521B1EBF5006C4D84 /* SDL_mouse_c.h */; }; + CD273CD021B1EBF5006C4D84 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CB621B1EBF5006C4D84 /* SDL_mouse.c */; }; + CD273CD121B1EBF5006C4D84 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CB721B1EBF5006C4D84 /* SDL_quit.c */; }; + CD273CD221B1EBF5006C4D84 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CB821B1EBF5006C4D84 /* SDL_sysevents.h */; }; + CD273CD321B1EBF5006C4D84 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CB921B1EBF5006C4D84 /* SDL_touch_c.h */; }; + CD273CD421B1EBF5006C4D84 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CBA21B1EBF5006C4D84 /* SDL_touch.c */; }; + CD273CD521B1EBF5006C4D84 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CBB21B1EBF5006C4D84 /* SDL_windowevents_c.h */; }; + CD273CD621B1EBF5006C4D84 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CBC21B1EBF5006C4D84 /* SDL_windowevents.c */; }; + CD273CD821B1EC10006C4D84 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CD721B1EC10006C4D84 /* SDL_rwops.c */; }; + CD273CDB21B1EC19006C4D84 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CD921B1EC19006C4D84 /* SDL_rwopsbundlesupport.h */; }; + CD273CDC21B1EC19006C4D84 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273CDA21B1EC19006C4D84 /* SDL_rwopsbundlesupport.m */; }; + CD273CDE21B1EC28006C4D84 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273CDD21B1EC28006C4D84 /* SDL_sysfilesystem.m */; }; + CD273CE221B1EC42006C4D84 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CDF21B1EC42006C4D84 /* SDL_haptic_c.h */; }; + CD273CE321B1EC42006C4D84 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CE021B1EC42006C4D84 /* SDL_haptic.c */; }; + CD273CE421B1EC42006C4D84 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CE121B1EC42006C4D84 /* SDL_syshaptic.h */; }; + CD273CE721B1EC4A006C4D84 /* SDL_syshaptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CE521B1EC4A006C4D84 /* SDL_syshaptic_c.h */; }; + CD273CE821B1EC4A006C4D84 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CE621B1EC4A006C4D84 /* SDL_syshaptic.c */; }; + CD273CEA21B1EC58006C4D84 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CE921B1EC58006C4D84 /* hid.c */; }; + CD273CF021B1EC69006C4D84 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CEB21B1EC69006C4D84 /* SDL_gamecontroller.c */; }; + CD273CF121B1EC69006C4D84 /* SDL_gamecontrollerdb.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CEC21B1EC69006C4D84 /* SDL_gamecontrollerdb.h */; }; + CD273CF221B1EC69006C4D84 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CED21B1EC69006C4D84 /* SDL_joystick_c.h */; }; + CD273CF321B1EC69006C4D84 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CEE21B1EC69006C4D84 /* SDL_joystick.c */; }; + CD273CF421B1EC69006C4D84 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CEF21B1EC69006C4D84 /* SDL_sysjoystick.h */; }; + CD273CFB21B1EC78006C4D84 /* SDL_hidapi_ps4.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CF521B1EC78006C4D84 /* SDL_hidapi_ps4.c */; }; + CD273CFC21B1EC78006C4D84 /* SDL_hidapi_switch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CF621B1EC78006C4D84 /* SDL_hidapi_switch.c */; }; + CD273CFD21B1EC78006C4D84 /* SDL_hidapi_xbox360.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CF721B1EC78006C4D84 /* SDL_hidapi_xbox360.c */; }; + CD273CFE21B1EC78006C4D84 /* SDL_hidapi_xboxone.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CF821B1EC78006C4D84 /* SDL_hidapi_xboxone.c */; }; + CD273CFF21B1EC78006C4D84 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273CF921B1EC78006C4D84 /* SDL_hidapijoystick_c.h */; }; + CD273D0021B1EC78006C4D84 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273CFA21B1EC78006C4D84 /* SDL_hidapijoystick.c */; }; + CD273D0321B1EC84006C4D84 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D0121B1EC84006C4D84 /* SDL_sysjoystick_c.h */; }; + CD273D0421B1EC84006C4D84 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D0221B1EC84006C4D84 /* SDL_sysjoystick.c */; }; + CD273D0621B1EC98006C4D84 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D0521B1EC98006C4D84 /* SDL_sysloadso.c */; }; + CD273D0921B1ECCD006C4D84 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D0721B1ECCD006C4D84 /* SDL_power.c */; }; + CD273D0A21B1ECCD006C4D84 /* SDL_syspower.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D0821B1ECCD006C4D84 /* SDL_syspower.h */; }; + CD273D0C21B1ECD6006C4D84 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D0B21B1ECD6006C4D84 /* SDL_syspower.c */; }; + CD273D0F21B1ECF1006C4D84 /* SDL_render_metal.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D0D21B1ECF1006C4D84 /* SDL_render_metal.m */; }; + CD273D1021B1ECF1006C4D84 /* SDL_shaders_metal_osx.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D0E21B1ECF1006C4D84 /* SDL_shaders_metal_osx.h */; }; + CD273D1521B1ECFA006C4D84 /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D1121B1ECFA006C4D84 /* SDL_glfuncs.h */; }; + CD273D1621B1ECFA006C4D84 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D1221B1ECFA006C4D84 /* SDL_render_gl.c */; }; + CD273D1721B1ECFA006C4D84 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D1321B1ECFA006C4D84 /* SDL_shaders_gl.c */; }; + CD273D1821B1ECFA006C4D84 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D1421B1ECFA006C4D84 /* SDL_shaders_gl.h */; }; + CD273D1D21B1ED05006C4D84 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D1921B1ED05006C4D84 /* SDL_gles2funcs.h */; }; + CD273D1E21B1ED05006C4D84 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D1A21B1ED05006C4D84 /* SDL_render_gles2.c */; }; + CD273D1F21B1ED05006C4D84 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D1B21B1ED05006C4D84 /* SDL_shaders_gles2.c */; }; + CD273D2021B1ED05006C4D84 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D1C21B1ED05006C4D84 /* SDL_shaders_gles2.h */; }; + CD273D3021B1ED11006C4D84 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2121B1ED11006C4D84 /* SDL_blendfillrect.c */; }; + CD273D3121B1ED11006C4D84 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2221B1ED11006C4D84 /* SDL_blendfillrect.h */; }; + CD273D3221B1ED11006C4D84 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2321B1ED11006C4D84 /* SDL_blendline.c */; }; + CD273D3321B1ED11006C4D84 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2421B1ED11006C4D84 /* SDL_blendline.h */; }; + CD273D3421B1ED11006C4D84 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2521B1ED11006C4D84 /* SDL_blendpoint.c */; }; + CD273D3521B1ED11006C4D84 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2621B1ED11006C4D84 /* SDL_blendpoint.h */; }; + CD273D3621B1ED11006C4D84 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2721B1ED11006C4D84 /* SDL_draw.h */; }; + CD273D3721B1ED11006C4D84 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2821B1ED11006C4D84 /* SDL_drawline.c */; }; + CD273D3821B1ED11006C4D84 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2921B1ED11006C4D84 /* SDL_drawline.h */; }; + CD273D3921B1ED11006C4D84 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2A21B1ED11006C4D84 /* SDL_drawpoint.c */; }; + CD273D3A21B1ED11006C4D84 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2B21B1ED11006C4D84 /* SDL_drawpoint.h */; }; + CD273D3B21B1ED11006C4D84 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2C21B1ED11006C4D84 /* SDL_render_sw_c.h */; }; + CD273D3C21B1ED11006C4D84 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2D21B1ED11006C4D84 /* SDL_render_sw.c */; }; + CD273D3D21B1ED11006C4D84 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D2E21B1ED11006C4D84 /* SDL_rotate.c */; }; + CD273D3E21B1ED11006C4D84 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D2F21B1ED11006C4D84 /* SDL_rotate.h */; }; + CD273D4521B1ED1B006C4D84 /* SDL_d3dmath.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D3F21B1ED1B006C4D84 /* SDL_d3dmath.c */; }; + CD273D4621B1ED1B006C4D84 /* SDL_d3dmath.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D4021B1ED1B006C4D84 /* SDL_d3dmath.h */; }; + CD273D4721B1ED1B006C4D84 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D4121B1ED1B006C4D84 /* SDL_render.c */; }; + CD273D4821B1ED1B006C4D84 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D4221B1ED1B006C4D84 /* SDL_sysrender.h */; }; + CD273D4921B1ED1B006C4D84 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D4321B1ED1B006C4D84 /* SDL_yuv_sw_c.h */; }; + CD273D4A21B1ED1B006C4D84 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D4421B1ED1B006C4D84 /* SDL_yuv_sw.c */; }; + CD273D4E21B1ED2D006C4D84 /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D4B21B1ED2D006C4D84 /* SDL_sensor_c.h */; }; + CD273D4F21B1ED2D006C4D84 /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D4C21B1ED2D006C4D84 /* SDL_sensor.c */; }; + CD273D5021B1ED2D006C4D84 /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D4D21B1ED2D006C4D84 /* SDL_syssensor.h */; }; + CD273D5321B1ED36006C4D84 /* SDL_dummysensor.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5121B1ED36006C4D84 /* SDL_dummysensor.c */; }; + CD273D5421B1ED36006C4D84 /* SDL_dummysensor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D5221B1ED36006C4D84 /* SDL_dummysensor.h */; }; + CD273D5B21B1ED44006C4D84 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5521B1ED44006C4D84 /* SDL_getenv.c */; }; + CD273D5C21B1ED44006C4D84 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5621B1ED44006C4D84 /* SDL_iconv.c */; }; + CD273D5D21B1ED44006C4D84 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5721B1ED44006C4D84 /* SDL_malloc.c */; }; + CD273D5E21B1ED44006C4D84 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5821B1ED44006C4D84 /* SDL_qsort.c */; }; + CD273D5F21B1ED44006C4D84 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5921B1ED44006C4D84 /* SDL_stdlib.c */; }; + CD273D6021B1ED44006C4D84 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D5A21B1ED44006C4D84 /* SDL_string.c */; }; + CD273D6421B1ED53006C4D84 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D6121B1ED53006C4D84 /* SDL_systhread.h */; }; + CD273D6521B1ED53006C4D84 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D6221B1ED53006C4D84 /* SDL_thread_c.h */; }; + CD273D6621B1ED53006C4D84 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6321B1ED53006C4D84 /* SDL_thread.c */; }; + CD273D6E21B1ED5C006C4D84 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6721B1ED5C006C4D84 /* SDL_syscond.c */; }; + CD273D6F21B1ED5C006C4D84 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D6821B1ED5C006C4D84 /* SDL_sysmutex_c.h */; }; + CD273D7021B1ED5C006C4D84 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6921B1ED5C006C4D84 /* SDL_sysmutex.c */; }; + CD273D7121B1ED5C006C4D84 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6A21B1ED5C006C4D84 /* SDL_syssem.c */; }; + CD273D7221B1ED5C006C4D84 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D6B21B1ED5C006C4D84 /* SDL_systhread_c.h */; }; + CD273D7321B1ED5C006C4D84 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6C21B1ED5C006C4D84 /* SDL_systhread.c */; }; + CD273D7421B1ED5C006C4D84 /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D6D21B1ED5C006C4D84 /* SDL_systls.c */; }; + CD273D7721B1ED6B006C4D84 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D7521B1ED6B006C4D84 /* SDL_timer_c.h */; }; + CD273D7821B1ED6B006C4D84 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D7621B1ED6B006C4D84 /* SDL_timer.c */; }; + CD273D7A21B1ED74006C4D84 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273D7921B1ED74006C4D84 /* SDL_systimer.c */; }; + CD273D9721B1ED8A006C4D84 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D7B21B1ED8A006C4D84 /* SDL_cocoaclipboard.h */; }; + CD273D9821B1ED8A006C4D84 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D7C21B1ED8A006C4D84 /* SDL_cocoaclipboard.m */; }; + CD273D9921B1ED8A006C4D84 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D7D21B1ED8A006C4D84 /* SDL_cocoaevents.h */; }; + CD273D9A21B1ED8A006C4D84 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D7E21B1ED8A006C4D84 /* SDL_cocoaevents.m */; }; + CD273D9B21B1ED8A006C4D84 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D7F21B1ED8A006C4D84 /* SDL_cocoakeyboard.h */; }; + CD273D9C21B1ED8A006C4D84 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8021B1ED8A006C4D84 /* SDL_cocoakeyboard.m */; }; + CD273D9D21B1ED8A006C4D84 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8121B1ED8A006C4D84 /* SDL_cocoamessagebox.h */; }; + CD273D9E21B1ED8A006C4D84 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8221B1ED8A006C4D84 /* SDL_cocoamessagebox.m */; }; + CD273D9F21B1ED8A006C4D84 /* SDL_cocoametalview.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8321B1ED8A006C4D84 /* SDL_cocoametalview.h */; }; + CD273DA021B1ED8A006C4D84 /* SDL_cocoametalview.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8421B1ED8A006C4D84 /* SDL_cocoametalview.m */; }; + CD273DA121B1ED8A006C4D84 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8521B1ED8A006C4D84 /* SDL_cocoamodes.h */; }; + CD273DA221B1ED8A006C4D84 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8621B1ED8A006C4D84 /* SDL_cocoamodes.m */; }; + CD273DA321B1ED8A006C4D84 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8721B1ED8A006C4D84 /* SDL_cocoamouse.h */; }; + CD273DA421B1ED8A006C4D84 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8821B1ED8A006C4D84 /* SDL_cocoamouse.m */; }; + CD273DA521B1ED8A006C4D84 /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8921B1ED8A006C4D84 /* SDL_cocoamousetap.h */; }; + CD273DA621B1ED8A006C4D84 /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8A21B1ED8A006C4D84 /* SDL_cocoamousetap.m */; }; + CD273DA721B1ED8A006C4D84 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8B21B1ED8A006C4D84 /* SDL_cocoaopengl.h */; }; + CD273DA821B1ED8A006C4D84 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8C21B1ED8A006C4D84 /* SDL_cocoaopengl.m */; }; + CD273DA921B1ED8A006C4D84 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8D21B1ED8A006C4D84 /* SDL_cocoaopengles.h */; }; + CD273DAA21B1ED8A006C4D84 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D8E21B1ED8A006C4D84 /* SDL_cocoaopengles.m */; }; + CD273DAB21B1ED8A006C4D84 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D8F21B1ED8A006C4D84 /* SDL_cocoashape.h */; }; + CD273DAC21B1ED8A006C4D84 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D9021B1ED8A006C4D84 /* SDL_cocoashape.m */; }; + CD273DAD21B1ED8A006C4D84 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D9121B1ED8A006C4D84 /* SDL_cocoavideo.h */; }; + CD273DAE21B1ED8A006C4D84 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D9221B1ED8A006C4D84 /* SDL_cocoavideo.m */; }; + CD273DAF21B1ED8A006C4D84 /* SDL_cocoavulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D9321B1ED8A006C4D84 /* SDL_cocoavulkan.h */; }; + CD273DB021B1ED8A006C4D84 /* SDL_cocoavulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D9421B1ED8A006C4D84 /* SDL_cocoavulkan.m */; }; + CD273DB121B1ED8A006C4D84 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273D9521B1ED8A006C4D84 /* SDL_cocoawindow.h */; }; + CD273DB221B1ED8A006C4D84 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = CD273D9621B1ED8A006C4D84 /* SDL_cocoawindow.m */; }; + CD273DB921B1ED93006C4D84 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DB321B1ED93006C4D84 /* SDL_nullevents_c.h */; }; + CD273DBA21B1ED93006C4D84 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DB421B1ED93006C4D84 /* SDL_nullevents.c */; }; + CD273DBB21B1ED93006C4D84 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DB521B1ED93006C4D84 /* SDL_nullframebuffer_c.h */; }; + CD273DBC21B1ED93006C4D84 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DB621B1ED93006C4D84 /* SDL_nullframebuffer.c */; }; + CD273DBD21B1ED93006C4D84 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DB721B1ED93006C4D84 /* SDL_nullvideo.c */; }; + CD273DBE21B1ED93006C4D84 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DB821B1ED93006C4D84 /* SDL_nullvideo.h */; }; + CD273DE421B1EDA6006C4D84 /* edid-parse.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DBF21B1EDA6006C4D84 /* edid-parse.c */; }; + CD273DE521B1EDA6006C4D84 /* edid.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DC021B1EDA6006C4D84 /* edid.h */; }; + CD273DE621B1EDA6006C4D84 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DC121B1EDA6006C4D84 /* imKStoUCS.c */; }; + CD273DE721B1EDA6006C4D84 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DC221B1EDA6006C4D84 /* imKStoUCS.h */; }; + CD273DE821B1EDA6006C4D84 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DC321B1EDA6006C4D84 /* SDL_x11clipboard.c */; }; + CD273DE921B1EDA6006C4D84 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DC421B1EDA6006C4D84 /* SDL_x11clipboard.h */; }; + CD273DEA21B1EDA6006C4D84 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DC521B1EDA6006C4D84 /* SDL_x11dyn.c */; }; + CD273DEB21B1EDA6006C4D84 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DC621B1EDA6006C4D84 /* SDL_x11dyn.h */; }; + CD273DEC21B1EDA6006C4D84 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DC721B1EDA6006C4D84 /* SDL_x11events.c */; }; + CD273DED21B1EDA6006C4D84 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DC821B1EDA6006C4D84 /* SDL_x11events.h */; }; + CD273DEE21B1EDA6006C4D84 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DC921B1EDA6006C4D84 /* SDL_x11framebuffer.c */; }; + CD273DEF21B1EDA6006C4D84 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DCA21B1EDA6006C4D84 /* SDL_x11framebuffer.h */; }; + CD273DF021B1EDA6006C4D84 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DCB21B1EDA6006C4D84 /* SDL_x11keyboard.c */; }; + CD273DF121B1EDA6006C4D84 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DCC21B1EDA6006C4D84 /* SDL_x11keyboard.h */; }; + CD273DF221B1EDA6006C4D84 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DCD21B1EDA6006C4D84 /* SDL_x11messagebox.c */; }; + CD273DF321B1EDA6006C4D84 /* SDL_x11messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DCE21B1EDA6006C4D84 /* SDL_x11messagebox.h */; }; + CD273DF421B1EDA6006C4D84 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DCF21B1EDA6006C4D84 /* SDL_x11modes.c */; }; + CD273DF521B1EDA6006C4D84 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD021B1EDA6006C4D84 /* SDL_x11modes.h */; }; + CD273DF621B1EDA6006C4D84 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DD121B1EDA6006C4D84 /* SDL_x11mouse.c */; }; + CD273DF721B1EDA6006C4D84 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD221B1EDA6006C4D84 /* SDL_x11mouse.h */; }; + CD273DF821B1EDA6006C4D84 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DD321B1EDA6006C4D84 /* SDL_x11opengl.c */; }; + CD273DF921B1EDA6006C4D84 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD421B1EDA6006C4D84 /* SDL_x11opengl.h */; }; + CD273DFA21B1EDA6006C4D84 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DD521B1EDA6006C4D84 /* SDL_x11opengles.c */; }; + CD273DFB21B1EDA6006C4D84 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD621B1EDA6006C4D84 /* SDL_x11opengles.h */; }; + CD273DFC21B1EDA6006C4D84 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DD721B1EDA6006C4D84 /* SDL_x11shape.c */; }; + CD273DFD21B1EDA6006C4D84 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD821B1EDA6006C4D84 /* SDL_x11shape.h */; }; + CD273DFE21B1EDA6006C4D84 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DD921B1EDA6006C4D84 /* SDL_x11sym.h */; }; + CD273DFF21B1EDA6006C4D84 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DDA21B1EDA6006C4D84 /* SDL_x11touch.c */; }; + CD273E0021B1EDA6006C4D84 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DDB21B1EDA6006C4D84 /* SDL_x11touch.h */; }; + CD273E0121B1EDA6006C4D84 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DDC21B1EDA6006C4D84 /* SDL_x11video.c */; }; + CD273E0221B1EDA6006C4D84 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DDD21B1EDA6006C4D84 /* SDL_x11video.h */; }; + CD273E0321B1EDA6006C4D84 /* SDL_x11vulkan.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DDE21B1EDA6006C4D84 /* SDL_x11vulkan.c */; }; + CD273E0421B1EDA6006C4D84 /* SDL_x11vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DDF21B1EDA6006C4D84 /* SDL_x11vulkan.h */; }; + CD273E0521B1EDA6006C4D84 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DE021B1EDA6006C4D84 /* SDL_x11window.c */; }; + CD273E0621B1EDA6006C4D84 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DE121B1EDA6006C4D84 /* SDL_x11window.h */; }; + CD273E0721B1EDA6006C4D84 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273DE221B1EDA6006C4D84 /* SDL_x11xinput2.c */; }; + CD273E0821B1EDA6006C4D84 /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273DE321B1EDA6006C4D84 /* SDL_x11xinput2.h */; }; + CD273E0F21B1EDB9006C4D84 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E0B21B1EDB9006C4D84 /* yuv_rgb.c */; }; + CD273E1021B1EDB9006C4D84 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E0C21B1EDB9006C4D84 /* yuv_rgb.h */; }; + CD273E3221B1EDD2006C4D84 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1121B1EDD2006C4D84 /* SDL_blit_0.c */; }; + CD273E3321B1EDD2006C4D84 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1221B1EDD2006C4D84 /* SDL_blit_1.c */; }; + CD273E3421B1EDD2006C4D84 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1321B1EDD2006C4D84 /* SDL_blit_A.c */; }; + CD273E3521B1EDD2006C4D84 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1421B1EDD2006C4D84 /* SDL_blit_auto.c */; }; + CD273E3621B1EDD2006C4D84 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E1521B1EDD2006C4D84 /* SDL_blit_auto.h */; }; + CD273E3721B1EDD2006C4D84 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1621B1EDD2006C4D84 /* SDL_blit_copy.c */; }; + CD273E3821B1EDD2006C4D84 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E1721B1EDD2006C4D84 /* SDL_blit_copy.h */; }; + CD273E3921B1EDD2006C4D84 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1821B1EDD2006C4D84 /* SDL_blit_N.c */; }; + CD273E3A21B1EDD2006C4D84 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1921B1EDD2006C4D84 /* SDL_blit_slow.c */; }; + CD273E3B21B1EDD2006C4D84 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E1A21B1EDD2006C4D84 /* SDL_blit_slow.h */; }; + CD273E3C21B1EDD2006C4D84 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1B21B1EDD2006C4D84 /* SDL_blit.c */; }; + CD273E3D21B1EDD2006C4D84 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E1C21B1EDD2006C4D84 /* SDL_blit.h */; }; + CD273E3E21B1EDD2006C4D84 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1D21B1EDD2006C4D84 /* SDL_bmp.c */; }; + CD273E3F21B1EDD2006C4D84 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E1E21B1EDD2006C4D84 /* SDL_clipboard.c */; }; + CD273E4021B1EDD2006C4D84 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E1F21B1EDD2006C4D84 /* SDL_egl_c.h */; }; + CD273E4121B1EDD2006C4D84 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2021B1EDD2006C4D84 /* SDL_egl.c */; }; + CD273E4221B1EDD2006C4D84 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2121B1EDD2006C4D84 /* SDL_fillrect.c */; }; + CD273E4321B1EDD2006C4D84 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2221B1EDD2006C4D84 /* SDL_pixels_c.h */; }; + CD273E4421B1EDD2006C4D84 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2321B1EDD2006C4D84 /* SDL_pixels.c */; }; + CD273E4521B1EDD2006C4D84 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2421B1EDD2006C4D84 /* SDL_rect_c.h */; }; + CD273E4621B1EDD2006C4D84 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2521B1EDD2006C4D84 /* SDL_rect.c */; }; + CD273E4721B1EDD2006C4D84 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2621B1EDD2006C4D84 /* SDL_RLEaccel_c.h */; }; + CD273E4821B1EDD2006C4D84 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2721B1EDD2006C4D84 /* SDL_RLEaccel.c */; }; + CD273E4921B1EDD2006C4D84 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2821B1EDD2006C4D84 /* SDL_shape_internals.h */; }; + CD273E4A21B1EDD2006C4D84 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2921B1EDD2006C4D84 /* SDL_shape.c */; }; + CD273E4B21B1EDD2006C4D84 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2A21B1EDD2006C4D84 /* SDL_stretch.c */; }; + CD273E4C21B1EDD2006C4D84 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2B21B1EDD2006C4D84 /* SDL_surface.c */; }; + CD273E4D21B1EDD2006C4D84 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2C21B1EDD2006C4D84 /* SDL_sysvideo.h */; }; + CD273E4E21B1EDD2006C4D84 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2D21B1EDD2006C4D84 /* SDL_video.c */; }; + CD273E4F21B1EDD2006C4D84 /* SDL_vulkan_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E2E21B1EDD2006C4D84 /* SDL_vulkan_internal.h */; }; + CD273E5021B1EDD2006C4D84 /* SDL_vulkan_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E2F21B1EDD2006C4D84 /* SDL_vulkan_utils.c */; }; + CD273E5121B1EDD2006C4D84 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E3021B1EDD2006C4D84 /* SDL_yuv_c.h */; }; + CD273E5221B1EDD2006C4D84 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E3121B1EDD2006C4D84 /* SDL_yuv.c */; }; + CD273E5D21B1EDE2006C4D84 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E5321B1EDE2006C4D84 /* SDL_assert_c.h */; }; + CD273E5E21B1EDE2006C4D84 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5421B1EDE2006C4D84 /* SDL_assert.c */; }; + CD273E5F21B1EDE2006C4D84 /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5521B1EDE2006C4D84 /* SDL_dataqueue.c */; }; + CD273E6021B1EDE2006C4D84 /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E5621B1EDE2006C4D84 /* SDL_dataqueue.h */; }; + CD273E6121B1EDE2006C4D84 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E5721B1EDE2006C4D84 /* SDL_error_c.h */; }; + CD273E6221B1EDE2006C4D84 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5821B1EDE2006C4D84 /* SDL_error.c */; }; + CD273E6321B1EDE2006C4D84 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5921B1EDE2006C4D84 /* SDL_hints.c */; }; + CD273E6421B1EDE2006C4D84 /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E5A21B1EDE2006C4D84 /* SDL_internal.h */; }; + CD273E6521B1EDE2006C4D84 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5B21B1EDE2006C4D84 /* SDL_log.c */; }; + CD273E6621B1EDE2006C4D84 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = CD273E5C21B1EDE2006C4D84 /* SDL.c */; }; + CD273EB021B1EE03006C4D84 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6721B1EE03006C4D84 /* begin_code.h */; }; + CD273EB121B1EE03006C4D84 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6821B1EE03006C4D84 /* close_code.h */; }; + CD273EB221B1EE03006C4D84 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6921B1EE03006C4D84 /* SDL_assert.h */; }; + CD273EB321B1EE03006C4D84 /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6A21B1EE03006C4D84 /* SDL_atomic.h */; }; + CD273EB421B1EE03006C4D84 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6B21B1EE03006C4D84 /* SDL_audio.h */; }; + CD273EB521B1EE03006C4D84 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6C21B1EE03006C4D84 /* SDL_bits.h */; }; + CD273EB621B1EE03006C4D84 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6D21B1EE03006C4D84 /* SDL_blendmode.h */; }; + CD273EB721B1EE03006C4D84 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E6E21B1EE03006C4D84 /* SDL_clipboard.h */; }; + CD273EBA21B1EE03006C4D84 /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7121B1EE03006C4D84 /* SDL_config_macosx.h */; }; + CD273EC221B1EE03006C4D84 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7921B1EE03006C4D84 /* SDL_config.h */; }; + CD273EC321B1EE03006C4D84 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7C21B1EE03006C4D84 /* SDL_copying.h */; }; + CD273EC421B1EE03006C4D84 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7D21B1EE03006C4D84 /* SDL_cpuinfo.h */; }; + CD273EC521B1EE03006C4D84 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7E21B1EE03006C4D84 /* SDL_egl.h */; }; + CD273EC621B1EE03006C4D84 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E7F21B1EE03006C4D84 /* SDL_endian.h */; }; + CD273EC721B1EE03006C4D84 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8021B1EE03006C4D84 /* SDL_error.h */; }; + CD273EC821B1EE03006C4D84 /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8121B1EE03006C4D84 /* SDL_events.h */; }; + CD273EC921B1EE03006C4D84 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8221B1EE03006C4D84 /* SDL_filesystem.h */; }; + CD273ECA21B1EE03006C4D84 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8321B1EE03006C4D84 /* SDL_gamecontroller.h */; }; + CD273ECB21B1EE03006C4D84 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8421B1EE03006C4D84 /* SDL_gesture.h */; }; + CD273ECC21B1EE03006C4D84 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8521B1EE03006C4D84 /* SDL_haptic.h */; }; + CD273ECD21B1EE03006C4D84 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8621B1EE03006C4D84 /* SDL_hints.h */; }; + CD273ECE21B1EE03006C4D84 /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8721B1EE03006C4D84 /* SDL_joystick.h */; }; + CD273ECF21B1EE03006C4D84 /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8821B1EE03006C4D84 /* SDL_keyboard.h */; }; + CD273ED021B1EE03006C4D84 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8921B1EE03006C4D84 /* SDL_keycode.h */; }; + CD273ED121B1EE03006C4D84 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8A21B1EE03006C4D84 /* SDL_loadso.h */; }; + CD273ED221B1EE03006C4D84 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8B21B1EE03006C4D84 /* SDL_log.h */; }; + CD273ED321B1EE03006C4D84 /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8C21B1EE03006C4D84 /* SDL_main.h */; }; + CD273ED421B1EE03006C4D84 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8D21B1EE03006C4D84 /* SDL_messagebox.h */; }; + CD273ED521B1EE03006C4D84 /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8E21B1EE03006C4D84 /* SDL_mouse.h */; }; + CD273ED621B1EE03006C4D84 /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E8F21B1EE03006C4D84 /* SDL_mutex.h */; }; + CD273ED721B1EE03006C4D84 /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9021B1EE03006C4D84 /* SDL_name.h */; }; + CD273ED821B1EE03006C4D84 /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9121B1EE03006C4D84 /* SDL_opengl_glext.h */; }; + CD273ED921B1EE03006C4D84 /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9221B1EE03006C4D84 /* SDL_opengl.h */; }; + CD273EDA21B1EE03006C4D84 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9321B1EE03006C4D84 /* SDL_opengles.h */; }; + CD273EDB21B1EE03006C4D84 /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9421B1EE03006C4D84 /* SDL_opengles2_gl2.h */; }; + CD273EDC21B1EE03006C4D84 /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9521B1EE03006C4D84 /* SDL_opengles2_gl2ext.h */; }; + CD273EDD21B1EE03006C4D84 /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9621B1EE03006C4D84 /* SDL_opengles2_gl2platform.h */; }; + CD273EDE21B1EE03006C4D84 /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9721B1EE03006C4D84 /* SDL_opengles2_khrplatform.h */; }; + CD273EDF21B1EE03006C4D84 /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9821B1EE03006C4D84 /* SDL_opengles2.h */; }; + CD273EE021B1EE03006C4D84 /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9921B1EE03006C4D84 /* SDL_pixels.h */; }; + CD273EE121B1EE03006C4D84 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9A21B1EE03006C4D84 /* SDL_platform.h */; }; + CD273EE221B1EE03006C4D84 /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9B21B1EE03006C4D84 /* SDL_power.h */; }; + CD273EE321B1EE03006C4D84 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9C21B1EE03006C4D84 /* SDL_quit.h */; }; + CD273EE421B1EE03006C4D84 /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9D21B1EE03006C4D84 /* SDL_rect.h */; }; + CD273EE521B1EE03006C4D84 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9E21B1EE03006C4D84 /* SDL_render.h */; }; + CD273EE621B1EE03006C4D84 /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273E9F21B1EE03006C4D84 /* SDL_revision.h */; }; + CD273EE721B1EE03006C4D84 /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA021B1EE03006C4D84 /* SDL_rwops.h */; }; + CD273EE821B1EE03006C4D84 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA121B1EE03006C4D84 /* SDL_scancode.h */; }; + CD273EE921B1EE03006C4D84 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA221B1EE03006C4D84 /* SDL_sensor.h */; }; + CD273EEA21B1EE03006C4D84 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA321B1EE03006C4D84 /* SDL_shape.h */; }; + CD273EEB21B1EE03006C4D84 /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA421B1EE03006C4D84 /* SDL_stdinc.h */; }; + CD273EEC21B1EE03006C4D84 /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA521B1EE03006C4D84 /* SDL_surface.h */; }; + CD273EED21B1EE03006C4D84 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA621B1EE03006C4D84 /* SDL_system.h */; }; + CD273EEE21B1EE03006C4D84 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA721B1EE03006C4D84 /* SDL_syswm.h */; }; + CD273EEF21B1EE03006C4D84 /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA821B1EE03006C4D84 /* SDL_thread.h */; }; + CD273EF021B1EE03006C4D84 /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EA921B1EE03006C4D84 /* SDL_timer.h */; }; + CD273EF121B1EE03006C4D84 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAA21B1EE03006C4D84 /* SDL_touch.h */; }; + CD273EF221B1EE03006C4D84 /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAB21B1EE03006C4D84 /* SDL_types.h */; }; + CD273EF321B1EE03006C4D84 /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAC21B1EE03006C4D84 /* SDL_version.h */; }; + CD273EF421B1EE03006C4D84 /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAD21B1EE03006C4D84 /* SDL_video.h */; }; + CD273EF521B1EE03006C4D84 /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAE21B1EE03006C4D84 /* SDL_vulkan.h */; }; + CD273EF621B1EE03006C4D84 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = CD273EAF21B1EE03006C4D84 /* SDL.h */; }; CD27718019C8CE940079A731 /* assert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27717F19C8CE940079A731 /* assert.cpp */; }; CD27718119C8CE940079A731 /* assert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27717F19C8CE940079A731 /* assert.cpp */; }; CD2BA7961B2A16B00010C399 /* MOAIGfxStateCPUCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD2BA7941B2A16B00010C399 /* MOAIGfxStateCPUCache.cpp */; }; @@ -1491,202 +1801,6 @@ CD32B48D19F9EDD10059D019 /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = CD490070141AB6EC00913D80 /* lvm.c */; }; CD32B48E19F9EDD10059D019 /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD490072141AB6EC00913D80 /* lzio.c */; }; CD32B48F19F9EDD10059D019 /* print.c in Sources */ = {isa = PBXBuildFile; fileRef = CD490074141AB6EC00913D80 /* print.c */; }; - CD32B50E19F9EE1C0059D019 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E5C17F08689006AEB47 /* SDL_atomic.c */; }; - CD32B50F19F9EE1C0059D019 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E5D17F08689006AEB47 /* SDL_spinlock.c */; }; - CD32B51019F9EE210059D019 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E5817F0867B006AEB47 /* SDL_diskaudio.c */; }; - CD32B51119F9EE210059D019 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E5917F0867B006AEB47 /* SDL_diskaudio.h */; }; - CD32B51219F9EE260059D019 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E5417F08675006AEB47 /* SDL_dummyaudio.c */; }; - CD32B51319F9EE260059D019 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E5517F08675006AEB47 /* SDL_dummyaudio.h */; }; - CD32B51419F9EE2E0059D019 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E5017F0866D006AEB47 /* SDL_coreaudio.c */; }; - CD32B51519F9EE2E0059D019 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E5117F0866D006AEB47 /* SDL_coreaudio.h */; }; - CD32B51619F9EE340059D019 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E3A17F08667006AEB47 /* SDL_audio.c */; }; - CD32B51719F9EE340059D019 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E3B17F08667006AEB47 /* SDL_audio_c.h */; }; - CD32B51819F9EE340059D019 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E3C17F08667006AEB47 /* SDL_audiocvt.c */; }; - CD32B51919F9EE340059D019 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E3D17F08667006AEB47 /* SDL_audiodev.c */; }; - CD32B51A19F9EE340059D019 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E3E17F08667006AEB47 /* SDL_audiodev_c.h */; }; - CD32B51B19F9EE340059D019 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E3F17F08667006AEB47 /* SDL_audiomem.h */; }; - CD32B51C19F9EE340059D019 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E4017F08667006AEB47 /* SDL_audiotypecvt.c */; }; - CD32B51D19F9EE340059D019 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E4117F08667006AEB47 /* SDL_mixer.c */; }; - CD32B51E19F9EE340059D019 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E4217F08667006AEB47 /* SDL_sysaudio.h */; }; - CD32B51F19F9EE340059D019 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E4317F08667006AEB47 /* SDL_wave.c */; }; - CD32B52019F9EE340059D019 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E4417F08667006AEB47 /* SDL_wave.h */; }; - CD32B52119F9EE390059D019 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E3517F0863E006AEB47 /* SDL_cpuinfo.c */; }; - CD32B52219F9EE3F0059D019 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0717F08638006AEB47 /* blank_cursor.h */; }; - CD32B52319F9EE3F0059D019 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0817F08638006AEB47 /* default_cursor.h */; }; - CD32B52419F9EE3F0059D019 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0917F08638006AEB47 /* scancodes_darwin.h */; }; - CD32B52519F9EE3F0059D019 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0A17F08638006AEB47 /* scancodes_linux.h */; }; - CD32B52619F9EE3F0059D019 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0B17F08638006AEB47 /* scancodes_xfree86.h */; }; - CD32B52719F9EE3F0059D019 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E0C17F08638006AEB47 /* SDL_clipboardevents.c */; }; - CD32B52819F9EE3F0059D019 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0D17F08638006AEB47 /* SDL_clipboardevents_c.h */; }; - CD32B52919F9EE3F0059D019 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0E17F08638006AEB47 /* SDL_dropevents_c.h */; }; - CD32B52A19F9EE3F0059D019 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E0F17F08638006AEB47 /* SDL_dropevents.c */; }; - CD32B52B19F9EE3F0059D019 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1017F08638006AEB47 /* SDL_events.c */; }; - CD32B52C19F9EE3F0059D019 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1117F08638006AEB47 /* SDL_events_c.h */; }; - CD32B52D19F9EE3F0059D019 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1217F08638006AEB47 /* SDL_gesture.c */; }; - CD32B52E19F9EE3F0059D019 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1317F08638006AEB47 /* SDL_gesture_c.h */; }; - CD32B52F19F9EE3F0059D019 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1417F08638006AEB47 /* SDL_keyboard.c */; }; - CD32B53019F9EE3F0059D019 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1517F08638006AEB47 /* SDL_keyboard_c.h */; }; - CD32B53119F9EE3F0059D019 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1617F08638006AEB47 /* SDL_mouse.c */; }; - CD32B53219F9EE3F0059D019 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1717F08638006AEB47 /* SDL_mouse_c.h */; }; - CD32B53319F9EE3F0059D019 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1817F08638006AEB47 /* SDL_quit.c */; }; - CD32B53419F9EE3F0059D019 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1917F08638006AEB47 /* SDL_sysevents.h */; }; - CD32B53519F9EE3F0059D019 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1A17F08638006AEB47 /* SDL_touch.c */; }; - CD32B53619F9EE3F0059D019 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1B17F08638006AEB47 /* SDL_touch_c.h */; }; - CD32B53719F9EE3F0059D019 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E1C17F08638006AEB47 /* SDL_windowevents.c */; }; - CD32B53819F9EE3F0059D019 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E1D17F08638006AEB47 /* SDL_windowevents_c.h */; }; - CD32B53919F9EE4A0059D019 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795E0317F0862D006AEB47 /* SDL_rwopsbundlesupport.h */; }; - CD32B53A19F9EE4A0059D019 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795E0417F0862D006AEB47 /* SDL_rwopsbundlesupport.m */; }; - CD32B53B19F9EE4A0059D019 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795E0117F08627006AEB47 /* SDL_rwops.c */; }; - CD32B53C19F9EE550059D019 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DFE17F08606006AEB47 /* SDL_syshaptic.c */; }; - CD32B53D19F9EE550059D019 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DF817F085FD006AEB47 /* SDL_haptic.c */; }; - CD32B53E19F9EE550059D019 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DF917F085FD006AEB47 /* SDL_haptic_c.h */; }; - CD32B53F19F9EE550059D019 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DFA17F085FD006AEB47 /* SDL_syshaptic.h */; }; - CD32B54019F9EE610059D019 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DF317F085E9006AEB47 /* SDL_sysjoystick.c */; }; - CD32B54119F9EE610059D019 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DF417F085E9006AEB47 /* SDL_sysjoystick_c.h */; }; - CD32B54219F9EE610059D019 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DEB17F085E3006AEB47 /* SDL_joystick.c */; }; - CD32B54319F9EE610059D019 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DEC17F085E3006AEB47 /* SDL_joystick_c.h */; }; - CD32B54419F9EE610059D019 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DED17F085E3006AEB47 /* SDL_gamecontroller.c */; }; - CD32B54519F9EE610059D019 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DEE17F085E3006AEB47 /* SDL_sysjoystick.h */; }; - CD32B54619F9EEBA0059D019 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DE817F085D2006AEB47 /* SDL_sysloadso.c */; }; - CD32B54719F9EEC10059D019 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DE517F085C1006AEB47 /* SDL_syspower.c */; }; - CD32B54819F9EEC10059D019 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DE317F085BB006AEB47 /* SDL_power.c */; }; - CD32B54919F9EED00059D019 /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DDA17F085A5006AEB47 /* SDL_glfuncs.h */; }; - CD32B54A19F9EED00059D019 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DDB17F085A5006AEB47 /* SDL_render_gl.c */; }; - CD32B54B19F9EED00059D019 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DDC17F085A5006AEB47 /* SDL_shaders_gl.c */; }; - CD32B54C19F9EED00059D019 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DDD17F085A5006AEB47 /* SDL_shaders_gl.h */; }; - CD32B54D19F9EEDC0059D019 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DBC17F0859D006AEB47 /* SDL_blendfillrect.c */; }; - CD32B54E19F9EEDC0059D019 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DBD17F0859D006AEB47 /* SDL_blendfillrect.h */; }; - CD32B54F19F9EEDC0059D019 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DBE17F0859D006AEB47 /* SDL_blendline.c */; }; - CD32B55019F9EEDC0059D019 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DBF17F0859D006AEB47 /* SDL_blendline.h */; }; - CD32B55119F9EEDC0059D019 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DC017F0859D006AEB47 /* SDL_blendpoint.c */; }; - CD32B55219F9EEDC0059D019 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DC117F0859D006AEB47 /* SDL_blendpoint.h */; }; - CD32B55319F9EEDC0059D019 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DC217F0859D006AEB47 /* SDL_draw.h */; }; - CD32B55419F9EEDC0059D019 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DC317F0859D006AEB47 /* SDL_drawline.c */; }; - CD32B55519F9EEDC0059D019 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DC417F0859D006AEB47 /* SDL_drawline.h */; }; - CD32B55619F9EEDC0059D019 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DC517F0859D006AEB47 /* SDL_drawpoint.c */; }; - CD32B55719F9EEDC0059D019 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DC617F0859D006AEB47 /* SDL_drawpoint.h */; }; - CD32B55819F9EEDC0059D019 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DC717F0859D006AEB47 /* SDL_render_sw.c */; }; - CD32B55919F9EEDC0059D019 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DC817F0859D006AEB47 /* SDL_render_sw_c.h */; }; - CD32B55A19F9EEDC0059D019 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DC917F0859D006AEB47 /* SDL_rotate.c */; }; - CD32B55B19F9EEDC0059D019 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DCA17F0859D006AEB47 /* SDL_rotate.h */; }; - CD32B56119F9EEE50059D019 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DB017F08591006AEB47 /* mmx.h */; }; - CD32B56219F9EEE50059D019 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DB117F08591006AEB47 /* SDL_render.c */; }; - CD32B56319F9EEE50059D019 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DB217F08591006AEB47 /* SDL_sysrender.h */; }; - CD32B56419F9EEE50059D019 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DB317F08591006AEB47 /* SDL_yuv_mmx.c */; }; - CD32B56519F9EEE50059D019 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795DB417F08591006AEB47 /* SDL_yuv_sw_c.h */; }; - CD32B56619F9EEE50059D019 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DB517F08591006AEB47 /* SDL_yuv_sw.c */; }; - CD32B56719F9EEF60059D019 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA217F08574006AEB47 /* SDL_getenv.c */; }; - CD32B56819F9EEF60059D019 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA317F08574006AEB47 /* SDL_iconv.c */; }; - CD32B56919F9EEF60059D019 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA417F08574006AEB47 /* SDL_malloc.c */; }; - CD32B56A19F9EEF60059D019 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA517F08574006AEB47 /* SDL_qsort.c */; }; - CD32B56B19F9EEF60059D019 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA617F08574006AEB47 /* SDL_stdlib.c */; }; - CD32B56C19F9EEF60059D019 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795DA717F08574006AEB47 /* SDL_string.c */; }; - CD32B56D19F9EF000059D019 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D9417F08569006AEB47 /* SDL_syscond.c */; }; - CD32B56E19F9EF000059D019 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D9517F08569006AEB47 /* SDL_sysmutex.c */; }; - CD32B56F19F9EF000059D019 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D9617F08569006AEB47 /* SDL_sysmutex_c.h */; }; - CD32B57019F9EF000059D019 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D9717F08569006AEB47 /* SDL_syssem.c */; }; - CD32B57119F9EF000059D019 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D9817F08569006AEB47 /* SDL_systhread.c */; }; - CD32B57219F9EF000059D019 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D9917F08569006AEB47 /* SDL_systhread_c.h */; }; - CD32B57319F9EF000059D019 /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D9A17F08569006AEB47 /* SDL_systls.c */; }; - CD32B57419F9EF000059D019 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D8E17F08560006AEB47 /* SDL_systhread.h */; }; - CD32B57519F9EF000059D019 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D8F17F08560006AEB47 /* SDL_thread.c */; }; - CD32B57619F9EF000059D019 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D9017F08560006AEB47 /* SDL_thread_c.h */; }; - CD32B57719F9EF090059D019 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D8B17F0854D006AEB47 /* SDL_systimer.c */; }; - CD32B57819F9EF090059D019 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D8717F08548006AEB47 /* SDL_timer.c */; }; - CD32B57919F9EF090059D019 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D8817F08548006AEB47 /* SDL_timer_c.h */; }; - CD32B57A19F9EF140059D019 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D5A17F08532006AEB47 /* SDL_cocoaclipboard.h */; }; - CD32B57B19F9EF140059D019 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D5B17F08532006AEB47 /* SDL_cocoaclipboard.m */; }; - CD32B57C19F9EF140059D019 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D5C17F08532006AEB47 /* SDL_cocoaevents.h */; }; - CD32B57D19F9EF140059D019 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D5D17F08532006AEB47 /* SDL_cocoaevents.m */; }; - CD32B57E19F9EF140059D019 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D5E17F08532006AEB47 /* SDL_cocoakeyboard.h */; }; - CD32B57F19F9EF140059D019 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D5F17F08532006AEB47 /* SDL_cocoakeyboard.m */; }; - CD32B58019F9EF140059D019 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6017F08532006AEB47 /* SDL_cocoamessagebox.h */; }; - CD32B58119F9EF140059D019 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6117F08532006AEB47 /* SDL_cocoamessagebox.m */; }; - CD32B58219F9EF140059D019 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6217F08532006AEB47 /* SDL_cocoamodes.h */; }; - CD32B58319F9EF140059D019 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6317F08532006AEB47 /* SDL_cocoamodes.m */; }; - CD32B58419F9EF140059D019 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6417F08532006AEB47 /* SDL_cocoamouse.h */; }; - CD32B58519F9EF140059D019 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6517F08532006AEB47 /* SDL_cocoamouse.m */; }; - CD32B58619F9EF140059D019 /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6617F08532006AEB47 /* SDL_cocoamousetap.h */; }; - CD32B58719F9EF140059D019 /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6717F08532006AEB47 /* SDL_cocoamousetap.m */; }; - CD32B58819F9EF140059D019 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6817F08532006AEB47 /* SDL_cocoaopengl.h */; }; - CD32B58919F9EF140059D019 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6917F08532006AEB47 /* SDL_cocoaopengl.m */; }; - CD32B58A19F9EF140059D019 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6A17F08532006AEB47 /* SDL_cocoashape.h */; }; - CD32B58B19F9EF140059D019 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6B17F08532006AEB47 /* SDL_cocoashape.m */; }; - CD32B58C19F9EF140059D019 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6C17F08532006AEB47 /* SDL_cocoavideo.h */; }; - CD32B58D19F9EF140059D019 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6D17F08532006AEB47 /* SDL_cocoavideo.m */; }; - CD32B58E19F9EF140059D019 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D6E17F08532006AEB47 /* SDL_cocoawindow.h */; }; - CD32B58F19F9EF140059D019 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = CD795D6F17F08532006AEB47 /* SDL_cocoawindow.m */; }; - CD32B59019F9EF1A0059D019 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D4E17F0852B006AEB47 /* SDL_nullevents.c */; }; - CD32B59119F9EF1A0059D019 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D4F17F0852B006AEB47 /* SDL_nullevents_c.h */; }; - CD32B59219F9EF1A0059D019 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D5017F0852B006AEB47 /* SDL_nullframebuffer_c.h */; }; - CD32B59319F9EF1A0059D019 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D5117F0852B006AEB47 /* SDL_nullframebuffer.c */; }; - CD32B59419F9EF1A0059D019 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D5217F0852B006AEB47 /* SDL_nullvideo.c */; }; - CD32B59519F9EF1A0059D019 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D5317F0852B006AEB47 /* SDL_nullvideo.h */; }; - CD32B59619F9EF200059D019 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D0E17F08522006AEB47 /* imKStoUCS.c */; }; - CD32B59719F9EF200059D019 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D0F17F08522006AEB47 /* imKStoUCS.h */; }; - CD32B59819F9EF200059D019 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1017F08522006AEB47 /* SDL_x11clipboard.c */; }; - CD32B59919F9EF200059D019 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1117F08522006AEB47 /* SDL_x11clipboard.h */; }; - CD32B59A19F9EF200059D019 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1217F08522006AEB47 /* SDL_x11dyn.c */; }; - CD32B59B19F9EF200059D019 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1317F08522006AEB47 /* SDL_x11dyn.h */; }; - CD32B59C19F9EF200059D019 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1417F08522006AEB47 /* SDL_x11events.c */; }; - CD32B59D19F9EF200059D019 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1517F08522006AEB47 /* SDL_x11events.h */; }; - CD32B59E19F9EF200059D019 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1617F08522006AEB47 /* SDL_x11framebuffer.c */; }; - CD32B59F19F9EF200059D019 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1717F08522006AEB47 /* SDL_x11framebuffer.h */; }; - CD32B5A019F9EF200059D019 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1817F08522006AEB47 /* SDL_x11keyboard.c */; }; - CD32B5A119F9EF200059D019 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1917F08522006AEB47 /* SDL_x11keyboard.h */; }; - CD32B5A219F9EF200059D019 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1A17F08522006AEB47 /* SDL_x11messagebox.c */; }; - CD32B5A319F9EF200059D019 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1B17F08522006AEB47 /* SDL_x11modes.c */; }; - CD32B5A419F9EF200059D019 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1C17F08522006AEB47 /* SDL_x11modes.h */; }; - CD32B5A519F9EF200059D019 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1D17F08522006AEB47 /* SDL_x11mouse.c */; }; - CD32B5A619F9EF200059D019 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D1E17F08522006AEB47 /* SDL_x11mouse.h */; }; - CD32B5A719F9EF200059D019 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D1F17F08522006AEB47 /* SDL_x11opengl.c */; }; - CD32B5A819F9EF200059D019 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2017F08522006AEB47 /* SDL_x11opengl.h */; }; - CD32B5A919F9EF200059D019 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2117F08522006AEB47 /* SDL_x11opengles.c */; }; - CD32B5AA19F9EF200059D019 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2217F08522006AEB47 /* SDL_x11opengles.h */; }; - CD32B5AB19F9EF200059D019 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2317F08522006AEB47 /* SDL_x11shape.c */; }; - CD32B5AC19F9EF200059D019 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2417F08522006AEB47 /* SDL_x11shape.h */; }; - CD32B5AD19F9EF200059D019 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2517F08522006AEB47 /* SDL_x11sym.h */; }; - CD32B5AE19F9EF200059D019 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2617F08522006AEB47 /* SDL_x11touch.c */; }; - CD32B5AF19F9EF200059D019 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2717F08522006AEB47 /* SDL_x11touch.h */; }; - CD32B5B019F9EF200059D019 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2817F08522006AEB47 /* SDL_x11video.c */; }; - CD32B5B119F9EF200059D019 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2917F08522006AEB47 /* SDL_x11video.h */; }; - CD32B5B219F9EF200059D019 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2A17F08522006AEB47 /* SDL_x11window.c */; }; - CD32B5B319F9EF200059D019 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2B17F08522006AEB47 /* SDL_x11window.h */; }; - CD32B5B419F9EF200059D019 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795D2C17F08522006AEB47 /* SDL_x11xinput2.c */; }; - CD32B5B519F9EF200059D019 /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795D2D17F08522006AEB47 /* SDL_x11xinput2.h */; }; - CD32B5B619F9EF260059D019 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CDA17F0850F006AEB47 /* SDL_blit.c */; }; - CD32B5B719F9EF260059D019 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CDB17F0850F006AEB47 /* SDL_blit.h */; }; - CD32B5B819F9EF260059D019 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CDC17F0850F006AEB47 /* SDL_blit_0.c */; }; - CD32B5B919F9EF260059D019 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CDD17F0850F006AEB47 /* SDL_blit_1.c */; }; - CD32B5BA19F9EF260059D019 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CDE17F0850F006AEB47 /* SDL_blit_A.c */; }; - CD32B5BB19F9EF260059D019 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CDF17F0850F006AEB47 /* SDL_blit_auto.c */; }; - CD32B5BC19F9EF260059D019 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CE017F0850F006AEB47 /* SDL_blit_auto.h */; }; - CD32B5BD19F9EF260059D019 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE117F0850F006AEB47 /* SDL_blit_copy.c */; }; - CD32B5BE19F9EF260059D019 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CE217F0850F006AEB47 /* SDL_blit_copy.h */; }; - CD32B5BF19F9EF260059D019 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE317F0850F006AEB47 /* SDL_blit_N.c */; }; - CD32B5C019F9EF260059D019 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE417F0850F006AEB47 /* SDL_blit_slow.c */; }; - CD32B5C119F9EF260059D019 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CE517F0850F006AEB47 /* SDL_blit_slow.h */; }; - CD32B5C219F9EF260059D019 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE617F0850F006AEB47 /* SDL_bmp.c */; }; - CD32B5C319F9EF260059D019 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE717F0850F006AEB47 /* SDL_clipboard.c */; }; - CD32B5C419F9EF260059D019 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE817F0850F006AEB47 /* SDL_fillrect.c */; }; - CD32B5C519F9EF260059D019 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CE917F0850F006AEB47 /* SDL_pixels.c */; }; - CD32B5C619F9EF260059D019 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CEA17F0850F006AEB47 /* SDL_pixels_c.h */; }; - CD32B5C719F9EF260059D019 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CEB17F0850F006AEB47 /* SDL_rect.c */; }; - CD32B5C819F9EF260059D019 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CEC17F0850F006AEB47 /* SDL_RLEaccel.c */; }; - CD32B5C919F9EF260059D019 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CED17F0850F006AEB47 /* SDL_RLEaccel_c.h */; }; - CD32B5CA19F9EF260059D019 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CEE17F0850F006AEB47 /* SDL_shape.c */; }; - CD32B5CB19F9EF260059D019 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CEF17F0850F006AEB47 /* SDL_shape_internals.h */; }; - CD32B5CC19F9EF260059D019 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CF017F0850F006AEB47 /* SDL_stretch.c */; }; - CD32B5CD19F9EF260059D019 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CF117F0850F006AEB47 /* SDL_surface.c */; }; - CD32B5CE19F9EF260059D019 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CF217F0850F006AEB47 /* SDL_sysvideo.h */; }; - CD32B5CF19F9EF260059D019 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CF317F0850F006AEB47 /* SDL_video.c */; }; - CD32B5D019F9EF2E0059D019 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CBB17F08459006AEB47 /* SDL_assert_c.h */; }; - CD32B5D119F9EF2E0059D019 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CBC17F08459006AEB47 /* SDL_assert.c */; }; - CD32B5D219F9EF2E0059D019 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = CD795CBD17F08459006AEB47 /* SDL_error_c.h */; }; - CD32B5D319F9EF2E0059D019 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CBE17F08459006AEB47 /* SDL_error.c */; }; - CD32B5D419F9EF2E0059D019 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CBF17F08459006AEB47 /* SDL_hints.c */; }; - CD32B5D519F9EF2E0059D019 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CC017F08459006AEB47 /* SDL_log.c */; }; - CD32B5D619F9EF2E0059D019 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = CD795CC117F08459006AEB47 /* SDL.c */; }; CD3371B01CAF8E56008B8BC7 /* bucketalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = CD3371A21CAF8E56008B8BC7 /* bucketalloc.c */; }; CD3371B11CAF8E56008B8BC7 /* bucketalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = CD3371A21CAF8E56008B8BC7 /* bucketalloc.c */; }; CD3371B21CAF8E56008B8BC7 /* bucketalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3371A31CAF8E56008B8BC7 /* bucketalloc.h */; }; @@ -4294,91 +4408,6 @@ CDEFD57B181ECB3E0058D772 /* MOAIVectorRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEFD564181ECB3E0058D772 /* MOAIVectorRect.cpp */; }; CDEFD57C181ECB3E0058D772 /* MOAIVectorRect.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEFD565181ECB3E0058D772 /* MOAIVectorRect.h */; }; CDEFD57D181ECB3E0058D772 /* MOAIVectorRect.h in Headers */ = {isa = PBXBuildFile; fileRef = CDEFD565181ECB3E0058D772 /* MOAIVectorRect.h */; }; - CDF237811CAA70CD00A45E31 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2372F1CAA70CD00A45E31 /* begin_code.h */; }; - CDF237821CAA70CD00A45E31 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237301CAA70CD00A45E31 /* close_code.h */; }; - CDF237831CAA70CD00A45E31 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237311CAA70CD00A45E31 /* SDL_assert.h */; }; - CDF237841CAA70CD00A45E31 /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237321CAA70CD00A45E31 /* SDL_atomic.h */; }; - CDF237851CAA70CD00A45E31 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237331CAA70CD00A45E31 /* SDL_audio.h */; }; - CDF237861CAA70CD00A45E31 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237341CAA70CD00A45E31 /* SDL_bits.h */; }; - CDF237871CAA70CD00A45E31 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237351CAA70CD00A45E31 /* SDL_blendmode.h */; }; - CDF237881CAA70CD00A45E31 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237361CAA70CD00A45E31 /* SDL_clipboard.h */; }; - CDF237891CAA70CD00A45E31 /* SDL_config_android.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237371CAA70CD00A45E31 /* SDL_config_android.h */; }; - CDF2378A1CAA70CD00A45E31 /* SDL_config_iphoneos.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237381CAA70CD00A45E31 /* SDL_config_iphoneos.h */; }; - CDF2378B1CAA70CD00A45E31 /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237391CAA70CD00A45E31 /* SDL_config_macosx.h */; }; - CDF2378C1CAA70CD00A45E31 /* SDL_config_minimal.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373A1CAA70CD00A45E31 /* SDL_config_minimal.h */; }; - CDF2378D1CAA70CD00A45E31 /* SDL_config_pandora.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373B1CAA70CD00A45E31 /* SDL_config_pandora.h */; }; - CDF2378E1CAA70CD00A45E31 /* SDL_config_psp.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373C1CAA70CD00A45E31 /* SDL_config_psp.h */; }; - CDF2378F1CAA70CD00A45E31 /* SDL_config_windows.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373D1CAA70CD00A45E31 /* SDL_config_windows.h */; }; - CDF237901CAA70CD00A45E31 /* SDL_config_winrt.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373E1CAA70CD00A45E31 /* SDL_config_winrt.h */; }; - CDF237911CAA70CD00A45E31 /* SDL_config_wiz.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2373F1CAA70CD00A45E31 /* SDL_config_wiz.h */; }; - CDF237921CAA70CD00A45E31 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237401CAA70CD00A45E31 /* SDL_config.h */; }; - CDF237931CAA70CD00A45E31 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237431CAA70CD00A45E31 /* SDL_copying.h */; }; - CDF237941CAA70CD00A45E31 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237441CAA70CD00A45E31 /* SDL_cpuinfo.h */; }; - CDF237951CAA70CD00A45E31 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237451CAA70CD00A45E31 /* SDL_egl.h */; }; - CDF237961CAA70CD00A45E31 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237461CAA70CD00A45E31 /* SDL_endian.h */; }; - CDF237971CAA70CD00A45E31 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237471CAA70CD00A45E31 /* SDL_error.h */; }; - CDF237981CAA70CD00A45E31 /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237481CAA70CD00A45E31 /* SDL_events.h */; }; - CDF237991CAA70CD00A45E31 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237491CAA70CD00A45E31 /* SDL_filesystem.h */; }; - CDF2379A1CAA70CD00A45E31 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374A1CAA70CD00A45E31 /* SDL_gamecontroller.h */; }; - CDF2379B1CAA70CD00A45E31 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374B1CAA70CD00A45E31 /* SDL_gesture.h */; }; - CDF2379C1CAA70CD00A45E31 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374C1CAA70CD00A45E31 /* SDL_haptic.h */; }; - CDF2379D1CAA70CD00A45E31 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374D1CAA70CD00A45E31 /* SDL_hints.h */; }; - CDF2379E1CAA70CD00A45E31 /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374E1CAA70CD00A45E31 /* SDL_joystick.h */; }; - CDF2379F1CAA70CD00A45E31 /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2374F1CAA70CD00A45E31 /* SDL_keyboard.h */; }; - CDF237A01CAA70CD00A45E31 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237501CAA70CD00A45E31 /* SDL_keycode.h */; }; - CDF237A11CAA70CD00A45E31 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237511CAA70CD00A45E31 /* SDL_loadso.h */; }; - CDF237A21CAA70CD00A45E31 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237521CAA70CD00A45E31 /* SDL_log.h */; }; - CDF237A31CAA70CD00A45E31 /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237531CAA70CD00A45E31 /* SDL_main.h */; }; - CDF237A41CAA70CD00A45E31 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237541CAA70CD00A45E31 /* SDL_messagebox.h */; }; - CDF237A51CAA70CD00A45E31 /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237551CAA70CD00A45E31 /* SDL_mouse.h */; }; - CDF237A61CAA70CD00A45E31 /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237561CAA70CD00A45E31 /* SDL_mutex.h */; }; - CDF237A71CAA70CD00A45E31 /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237571CAA70CD00A45E31 /* SDL_name.h */; }; - CDF237A81CAA70CD00A45E31 /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237581CAA70CD00A45E31 /* SDL_opengl_glext.h */; }; - CDF237A91CAA70CD00A45E31 /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237591CAA70CD00A45E31 /* SDL_opengl.h */; }; - CDF237AA1CAA70CD00A45E31 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375A1CAA70CD00A45E31 /* SDL_opengles.h */; }; - CDF237AB1CAA70CD00A45E31 /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375B1CAA70CD00A45E31 /* SDL_opengles2_gl2.h */; }; - CDF237AC1CAA70CD00A45E31 /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375C1CAA70CD00A45E31 /* SDL_opengles2_gl2ext.h */; }; - CDF237AD1CAA70CD00A45E31 /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375D1CAA70CD00A45E31 /* SDL_opengles2_gl2platform.h */; }; - CDF237AE1CAA70CD00A45E31 /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375E1CAA70CD00A45E31 /* SDL_opengles2_khrplatform.h */; }; - CDF237AF1CAA70CD00A45E31 /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2375F1CAA70CD00A45E31 /* SDL_opengles2.h */; }; - CDF237B01CAA70CD00A45E31 /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237601CAA70CD00A45E31 /* SDL_pixels.h */; }; - CDF237B11CAA70CD00A45E31 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237611CAA70CD00A45E31 /* SDL_platform.h */; }; - CDF237B21CAA70CD00A45E31 /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237621CAA70CD00A45E31 /* SDL_power.h */; }; - CDF237B31CAA70CD00A45E31 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237631CAA70CD00A45E31 /* SDL_quit.h */; }; - CDF237B41CAA70CD00A45E31 /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237641CAA70CD00A45E31 /* SDL_rect.h */; }; - CDF237B51CAA70CD00A45E31 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237651CAA70CD00A45E31 /* SDL_render.h */; }; - CDF237B61CAA70CD00A45E31 /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237661CAA70CD00A45E31 /* SDL_revision.h */; }; - CDF237B71CAA70CD00A45E31 /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237671CAA70CD00A45E31 /* SDL_rwops.h */; }; - CDF237B81CAA70CD00A45E31 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237681CAA70CD00A45E31 /* SDL_scancode.h */; }; - CDF237B91CAA70CD00A45E31 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237691CAA70CD00A45E31 /* SDL_shape.h */; }; - CDF237BA1CAA70CD00A45E31 /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376A1CAA70CD00A45E31 /* SDL_stdinc.h */; }; - CDF237BB1CAA70CD00A45E31 /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376B1CAA70CD00A45E31 /* SDL_surface.h */; }; - CDF237BC1CAA70CD00A45E31 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376C1CAA70CD00A45E31 /* SDL_system.h */; }; - CDF237BD1CAA70CD00A45E31 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376D1CAA70CD00A45E31 /* SDL_syswm.h */; }; - CDF237BE1CAA70CD00A45E31 /* SDL_test_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376E1CAA70CD00A45E31 /* SDL_test_assert.h */; }; - CDF237BF1CAA70CD00A45E31 /* SDL_test_common.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2376F1CAA70CD00A45E31 /* SDL_test_common.h */; }; - CDF237C01CAA70CD00A45E31 /* SDL_test_compare.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237701CAA70CD00A45E31 /* SDL_test_compare.h */; }; - CDF237C11CAA70CD00A45E31 /* SDL_test_crc32.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237711CAA70CD00A45E31 /* SDL_test_crc32.h */; }; - CDF237C21CAA70CD00A45E31 /* SDL_test_font.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237721CAA70CD00A45E31 /* SDL_test_font.h */; }; - CDF237C31CAA70CD00A45E31 /* SDL_test_fuzzer.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237731CAA70CD00A45E31 /* SDL_test_fuzzer.h */; }; - CDF237C41CAA70CD00A45E31 /* SDL_test_harness.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237741CAA70CD00A45E31 /* SDL_test_harness.h */; }; - CDF237C51CAA70CD00A45E31 /* SDL_test_images.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237751CAA70CD00A45E31 /* SDL_test_images.h */; }; - CDF237C61CAA70CD00A45E31 /* SDL_test_log.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237761CAA70CD00A45E31 /* SDL_test_log.h */; }; - CDF237C71CAA70CD00A45E31 /* SDL_test_md5.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237771CAA70CD00A45E31 /* SDL_test_md5.h */; }; - CDF237C81CAA70CD00A45E31 /* SDL_test_random.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237781CAA70CD00A45E31 /* SDL_test_random.h */; }; - CDF237C91CAA70CD00A45E31 /* SDL_test.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237791CAA70CD00A45E31 /* SDL_test.h */; }; - CDF237CA1CAA70CD00A45E31 /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377A1CAA70CD00A45E31 /* SDL_thread.h */; }; - CDF237CB1CAA70CD00A45E31 /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377B1CAA70CD00A45E31 /* SDL_timer.h */; }; - CDF237CC1CAA70CD00A45E31 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377C1CAA70CD00A45E31 /* SDL_touch.h */; }; - CDF237CD1CAA70CD00A45E31 /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377D1CAA70CD00A45E31 /* SDL_types.h */; }; - CDF237CE1CAA70CD00A45E31 /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377E1CAA70CD00A45E31 /* SDL_version.h */; }; - CDF237CF1CAA70CD00A45E31 /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2377F1CAA70CD00A45E31 /* SDL_video.h */; }; - CDF237D01CAA70CD00A45E31 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237801CAA70CD00A45E31 /* SDL.h */; }; - CDF237D61CAA715000A45E31 /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237D21CAA715000A45E31 /* SDL_dynapi_overrides.h */; }; - CDF237D71CAA715000A45E31 /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237D31CAA715000A45E31 /* SDL_dynapi_procs.h */; }; - CDF237D81CAA715000A45E31 /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = CDF237D41CAA715000A45E31 /* SDL_dynapi.c */; }; - CDF237D91CAA715000A45E31 /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF237D51CAA715000A45E31 /* SDL_dynapi.h */; }; - CDF237DC1CAA71BC00A45E31 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = CDF237DB1CAA71BC00A45E31 /* SDL_sysfilesystem.m */; }; CDF2885717ED41CF00FD4F59 /* headers.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BE6930173974FD00DFE837 /* headers.h */; }; CDF2885817ED41CF00FD4F59 /* pch.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BE6932173974FD00DFE837 /* pch.h */; }; CDF2885917ED41CF00FD4F59 /* zl_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 89BE6934173974FD00DFE837 /* zl_mutex.h */; }; @@ -5756,6 +5785,316 @@ CD257BD51A62579F0057A53A /* MOAIReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MOAIReachability.m; path = "moai-apple/MOAIReachability.m"; sourceTree = ""; }; CD257BD61A62579F0057A53A /* MOAIReachabilityMgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MOAIReachabilityMgr.h; path = "moai-apple/MOAIReachabilityMgr.h"; sourceTree = ""; }; CD257BD71A62579F0057A53A /* MOAIReachabilityMgr.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MOAIReachabilityMgr.mm; path = "moai-apple/MOAIReachabilityMgr.mm"; sourceTree = ""; }; + CD273C7321B1EB96006C4D84 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_atomic.c; path = "../../3rdparty/sdl2-2.0.9/src/atomic/SDL_atomic.c"; sourceTree = ""; }; + CD273C7421B1EB96006C4D84 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_spinlock.c; path = "../../3rdparty/sdl2-2.0.9/src/atomic/SDL_spinlock.c"; sourceTree = ""; }; + CD273C7721B1EBAA006C4D84 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audio_c.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audio_c.h"; sourceTree = ""; }; + CD273C7821B1EBAA006C4D84 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audio.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audio.c"; sourceTree = ""; }; + CD273C7921B1EBAA006C4D84 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiocvt.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audiocvt.c"; sourceTree = ""; }; + CD273C7A21B1EBAA006C4D84 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audiodev_c.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev_c.h"; sourceTree = ""; }; + CD273C7B21B1EBAA006C4D84 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiodev.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audiodev.c"; sourceTree = ""; }; + CD273C7C21B1EBAA006C4D84 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiotypecvt.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_audiotypecvt.c"; sourceTree = ""; }; + CD273C7D21B1EBAA006C4D84 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_mixer.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_mixer.c"; sourceTree = ""; }; + CD273C7E21B1EBAA006C4D84 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysaudio.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_sysaudio.h"; sourceTree = ""; }; + CD273C7F21B1EBAA006C4D84 /* SDL_wave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_wave.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_wave.c"; sourceTree = ""; }; + CD273C8021B1EBAA006C4D84 /* SDL_wave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_wave.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/SDL_wave.h"; sourceTree = ""; }; + CD273C8B21B1EBB2006C4D84 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_diskaudio.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.c"; sourceTree = ""; }; + CD273C8C21B1EBB2006C4D84 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_diskaudio.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/disk/SDL_diskaudio.h"; sourceTree = ""; }; + CD273C8F21B1EBB9006C4D84 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dummyaudio.c; path = "../../3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.c"; sourceTree = ""; }; + CD273C9021B1EBB9006C4D84 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dummyaudio.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/dummy/SDL_dummyaudio.h"; sourceTree = ""; }; + CD273C9321B1EBC4006C4D84 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_coreaudio.h; path = "../../3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.h"; sourceTree = ""; }; + CD273C9421B1EBC4006C4D84 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_coreaudio.m; path = "../../3rdparty/sdl2-2.0.9/src/audio/coreaudio/SDL_coreaudio.m"; sourceTree = ""; }; + CD273C9721B1EBDE006C4D84 /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_cpuinfo.c; path = "../../3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_cpuinfo.c"; sourceTree = ""; }; + CD273C9821B1EBDE006C4D84 /* SDL_simd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_simd.h; path = "../../3rdparty/sdl2-2.0.9/src/cpuinfo/SDL_simd.h"; sourceTree = ""; }; + CD273C9B21B1EBE8006C4D84 /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = "../../3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_overrides.h"; sourceTree = ""; }; + CD273C9C21B1EBE8006C4D84 /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = "../../3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi_procs.h"; sourceTree = ""; }; + CD273C9D21B1EBE8006C4D84 /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = "../../3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.c"; sourceTree = ""; }; + CD273C9E21B1EBE8006C4D84 /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = "../../3rdparty/sdl2-2.0.9/src/dynapi/SDL_dynapi.h"; sourceTree = ""; }; + CD273CA321B1EBF5006C4D84 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blank_cursor.h; path = "../../3rdparty/sdl2-2.0.9/src/events/blank_cursor.h"; sourceTree = ""; }; + CD273CA421B1EBF5006C4D84 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = default_cursor.h; path = "../../3rdparty/sdl2-2.0.9/src/events/default_cursor.h"; sourceTree = ""; }; + CD273CA521B1EBF5006C4D84 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_darwin.h; path = "../../3rdparty/sdl2-2.0.9/src/events/scancodes_darwin.h"; sourceTree = ""; }; + CD273CA621B1EBF5006C4D84 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_linux.h; path = "../../3rdparty/sdl2-2.0.9/src/events/scancodes_linux.h"; sourceTree = ""; }; + CD273CA721B1EBF5006C4D84 /* scancodes_windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_windows.h; path = "../../3rdparty/sdl2-2.0.9/src/events/scancodes_windows.h"; sourceTree = ""; }; + CD273CA821B1EBF5006C4D84 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_xfree86.h; path = "../../3rdparty/sdl2-2.0.9/src/events/scancodes_xfree86.h"; sourceTree = ""; }; + CD273CA921B1EBF5006C4D84 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboardevents_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents_c.h"; sourceTree = ""; }; + CD273CAA21B1EBF5006C4D84 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_clipboardevents.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_clipboardevents.c"; sourceTree = ""; }; + CD273CAB21B1EBF5006C4D84 /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_displayevents_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_displayevents_c.h"; sourceTree = ""; }; + CD273CAC21B1EBF5006C4D84 /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_displayevents.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_displayevents.c"; sourceTree = ""; }; + CD273CAD21B1EBF5006C4D84 /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dropevents_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_dropevents_c.h"; sourceTree = ""; }; + CD273CAE21B1EBF5006C4D84 /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dropevents.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_dropevents.c"; sourceTree = ""; }; + CD273CAF21B1EBF5006C4D84 /* SDL_events_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_events_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_events_c.h"; sourceTree = ""; }; + CD273CB021B1EBF5006C4D84 /* SDL_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_events.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_events.c"; sourceTree = ""; }; + CD273CB121B1EBF5006C4D84 /* SDL_gesture_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_gesture_c.h"; sourceTree = ""; }; + CD273CB221B1EBF5006C4D84 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_gesture.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_gesture.c"; sourceTree = ""; }; + CD273CB321B1EBF5006C4D84 /* SDL_keyboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keyboard_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_keyboard_c.h"; sourceTree = ""; }; + CD273CB421B1EBF5006C4D84 /* SDL_keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_keyboard.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_keyboard.c"; sourceTree = ""; }; + CD273CB521B1EBF5006C4D84 /* SDL_mouse_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mouse_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_mouse_c.h"; sourceTree = ""; }; + CD273CB621B1EBF5006C4D84 /* SDL_mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_mouse.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_mouse.c"; sourceTree = ""; }; + CD273CB721B1EBF5006C4D84 /* SDL_quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_quit.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_quit.c"; sourceTree = ""; }; + CD273CB821B1EBF5006C4D84 /* SDL_sysevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysevents.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_sysevents.h"; sourceTree = ""; }; + CD273CB921B1EBF5006C4D84 /* SDL_touch_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_touch_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_touch_c.h"; sourceTree = ""; }; + CD273CBA21B1EBF5006C4D84 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_touch.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_touch.c"; sourceTree = ""; }; + CD273CBB21B1EBF5006C4D84 /* SDL_windowevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_windowevents_c.h; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_windowevents_c.h"; sourceTree = ""; }; + CD273CBC21B1EBF5006C4D84 /* SDL_windowevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_windowevents.c; path = "../../3rdparty/sdl2-2.0.9/src/events/SDL_windowevents.c"; sourceTree = ""; }; + CD273CD721B1EC10006C4D84 /* SDL_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rwops.c; path = "../../3rdparty/sdl2-2.0.9/src/file/SDL_rwops.c"; sourceTree = ""; }; + CD273CD921B1EC19006C4D84 /* SDL_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rwopsbundlesupport.h; path = "../../3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.h"; sourceTree = ""; }; + CD273CDA21B1EC19006C4D84 /* SDL_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_rwopsbundlesupport.m; path = "../../3rdparty/sdl2-2.0.9/src/file/cocoa/SDL_rwopsbundlesupport.m"; sourceTree = ""; }; + CD273CDD21B1EC28006C4D84 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = "../../3rdparty/sdl2-2.0.9/src/filesystem/cocoa/SDL_sysfilesystem.m"; sourceTree = ""; }; + CD273CDF21B1EC42006C4D84 /* SDL_haptic_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic_c.h; path = "../../3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic_c.h"; sourceTree = ""; }; + CD273CE021B1EC42006C4D84 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_haptic.c; path = "../../3rdparty/sdl2-2.0.9/src/haptic/SDL_haptic.c"; sourceTree = ""; }; + CD273CE121B1EC42006C4D84 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syshaptic.h; path = "../../3rdparty/sdl2-2.0.9/src/haptic/SDL_syshaptic.h"; sourceTree = ""; }; + CD273CE521B1EC4A006C4D84 /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syshaptic_c.h; path = "../../3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic_c.h"; sourceTree = ""; }; + CD273CE621B1EC4A006C4D84 /* SDL_syshaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syshaptic.c; path = "../../3rdparty/sdl2-2.0.9/src/haptic/darwin/SDL_syshaptic.c"; sourceTree = ""; }; + CD273CE921B1EC58006C4D84 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hid.c; path = "../../3rdparty/sdl2-2.0.9/src/hidapi/mac/hid.c"; sourceTree = ""; }; + CD273CEB21B1EC69006C4D84 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_gamecontroller.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontroller.c"; sourceTree = ""; }; + CD273CEC21B1EC69006C4D84 /* SDL_gamecontrollerdb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gamecontrollerdb.h; path = "../../3rdparty/sdl2-2.0.9/src/joystick/SDL_gamecontrollerdb.h"; sourceTree = ""; }; + CD273CED21B1EC69006C4D84 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_joystick_c.h; path = "../../3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick_c.h"; sourceTree = ""; }; + CD273CEE21B1EC69006C4D84 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_joystick.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/SDL_joystick.c"; sourceTree = ""; }; + CD273CEF21B1EC69006C4D84 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysjoystick.h; path = "../../3rdparty/sdl2-2.0.9/src/joystick/SDL_sysjoystick.h"; sourceTree = ""; }; + CD273CF521B1EC78006C4D84 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hidapi_ps4.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_ps4.c"; sourceTree = ""; }; + CD273CF621B1EC78006C4D84 /* SDL_hidapi_switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hidapi_switch.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_switch.c"; sourceTree = ""; }; + CD273CF721B1EC78006C4D84 /* SDL_hidapi_xbox360.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hidapi_xbox360.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xbox360.c"; sourceTree = ""; }; + CD273CF821B1EC78006C4D84 /* SDL_hidapi_xboxone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hidapi_xboxone.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapi_xboxone.c"; sourceTree = ""; }; + CD273CF921B1EC78006C4D84 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hidapijoystick_c.h; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick_c.h"; sourceTree = ""; }; + CD273CFA21B1EC78006C4D84 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hidapijoystick.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/hidapi/SDL_hidapijoystick.c"; sourceTree = ""; }; + CD273D0121B1EC84006C4D84 /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysjoystick_c.h; path = "../../3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick_c.h"; sourceTree = ""; }; + CD273D0221B1EC84006C4D84 /* SDL_sysjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysjoystick.c; path = "../../3rdparty/sdl2-2.0.9/src/joystick/darwin/SDL_sysjoystick.c"; sourceTree = ""; }; + CD273D0521B1EC98006C4D84 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysloadso.c; path = "../../3rdparty/sdl2-2.0.9/src/loadso/dlopen/SDL_sysloadso.c"; sourceTree = ""; }; + CD273D0721B1ECCD006C4D84 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = "../../3rdparty/sdl2-2.0.9/src/power/SDL_power.c"; sourceTree = ""; }; + CD273D0821B1ECCD006C4D84 /* SDL_syspower.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syspower.h; path = "../../3rdparty/sdl2-2.0.9/src/power/SDL_syspower.h"; sourceTree = ""; }; + CD273D0B21B1ECD6006C4D84 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syspower.c; path = "../../3rdparty/sdl2-2.0.9/src/power/macosx/SDL_syspower.c"; sourceTree = ""; }; + CD273D0D21B1ECF1006C4D84 /* SDL_render_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_render_metal.m; path = "../../3rdparty/sdl2-2.0.9/src/render/metal/SDL_render_metal.m"; sourceTree = ""; }; + CD273D0E21B1ECF1006C4D84 /* SDL_shaders_metal_osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shaders_metal_osx.h; path = "../../3rdparty/sdl2-2.0.9/src/render/metal/SDL_shaders_metal_osx.h"; sourceTree = ""; }; + CD273D1121B1ECFA006C4D84 /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_glfuncs.h; path = "../../3rdparty/sdl2-2.0.9/src/render/opengl/SDL_glfuncs.h"; sourceTree = ""; }; + CD273D1221B1ECFA006C4D84 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render_gl.c; path = "../../3rdparty/sdl2-2.0.9/src/render/opengl/SDL_render_gl.c"; sourceTree = ""; }; + CD273D1321B1ECFA006C4D84 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_shaders_gl.c; path = "../../3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.c"; sourceTree = ""; }; + CD273D1421B1ECFA006C4D84 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shaders_gl.h; path = "../../3rdparty/sdl2-2.0.9/src/render/opengl/SDL_shaders_gl.h"; sourceTree = ""; }; + CD273D1921B1ED05006C4D84 /* SDL_gles2funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gles2funcs.h; path = "../../3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_gles2funcs.h"; sourceTree = ""; }; + CD273D1A21B1ED05006C4D84 /* SDL_render_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render_gles2.c; path = "../../3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_render_gles2.c"; sourceTree = ""; }; + CD273D1B21B1ED05006C4D84 /* SDL_shaders_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_shaders_gles2.c; path = "../../3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.c"; sourceTree = ""; }; + CD273D1C21B1ED05006C4D84 /* SDL_shaders_gles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shaders_gles2.h; path = "../../3rdparty/sdl2-2.0.9/src/render/opengles2/SDL_shaders_gles2.h"; sourceTree = ""; }; + CD273D2121B1ED11006C4D84 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendfillrect.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.c"; sourceTree = ""; }; + CD273D2221B1ED11006C4D84 /* SDL_blendfillrect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendfillrect.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendfillrect.h"; sourceTree = ""; }; + CD273D2321B1ED11006C4D84 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendline.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.c"; sourceTree = ""; }; + CD273D2421B1ED11006C4D84 /* SDL_blendline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendline.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendline.h"; sourceTree = ""; }; + CD273D2521B1ED11006C4D84 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendpoint.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.c"; sourceTree = ""; }; + CD273D2621B1ED11006C4D84 /* SDL_blendpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendpoint.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_blendpoint.h"; sourceTree = ""; }; + CD273D2721B1ED11006C4D84 /* SDL_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_draw.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_draw.h"; sourceTree = ""; }; + CD273D2821B1ED11006C4D84 /* SDL_drawline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_drawline.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.c"; sourceTree = ""; }; + CD273D2921B1ED11006C4D84 /* SDL_drawline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_drawline.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_drawline.h"; sourceTree = ""; }; + CD273D2A21B1ED11006C4D84 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_drawpoint.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.c"; sourceTree = ""; }; + CD273D2B21B1ED11006C4D84 /* SDL_drawpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_drawpoint.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_drawpoint.h"; sourceTree = ""; }; + CD273D2C21B1ED11006C4D84 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_render_sw_c.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw_c.h"; sourceTree = ""; }; + CD273D2D21B1ED11006C4D84 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render_sw.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_render_sw.c"; sourceTree = ""; }; + CD273D2E21B1ED11006C4D84 /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rotate.c; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.c"; sourceTree = ""; }; + CD273D2F21B1ED11006C4D84 /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rotate.h; path = "../../3rdparty/sdl2-2.0.9/src/render/software/SDL_rotate.h"; sourceTree = ""; }; + CD273D3F21B1ED1B006C4D84 /* SDL_d3dmath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_d3dmath.c; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.c"; sourceTree = ""; }; + CD273D4021B1ED1B006C4D84 /* SDL_d3dmath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_d3dmath.h; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_d3dmath.h"; sourceTree = ""; }; + CD273D4121B1ED1B006C4D84 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render.c; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_render.c"; sourceTree = ""; }; + CD273D4221B1ED1B006C4D84 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysrender.h; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_sysrender.h"; sourceTree = ""; }; + CD273D4321B1ED1B006C4D84 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_yuv_sw_c.h; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw_c.h"; sourceTree = ""; }; + CD273D4421B1ED1B006C4D84 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_yuv_sw.c; path = "../../3rdparty/sdl2-2.0.9/src/render/SDL_yuv_sw.c"; sourceTree = ""; }; + CD273D4B21B1ED2D006C4D84 /* SDL_sensor_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sensor_c.h; path = "../../3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor_c.h"; sourceTree = ""; }; + CD273D4C21B1ED2D006C4D84 /* SDL_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sensor.c; path = "../../3rdparty/sdl2-2.0.9/src/sensor/SDL_sensor.c"; sourceTree = ""; }; + CD273D4D21B1ED2D006C4D84 /* SDL_syssensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syssensor.h; path = "../../3rdparty/sdl2-2.0.9/src/sensor/SDL_syssensor.h"; sourceTree = ""; }; + CD273D5121B1ED36006C4D84 /* SDL_dummysensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dummysensor.c; path = "../../3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.c"; sourceTree = ""; }; + CD273D5221B1ED36006C4D84 /* SDL_dummysensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dummysensor.h; path = "../../3rdparty/sdl2-2.0.9/src/sensor/dummy/SDL_dummysensor.h"; sourceTree = ""; }; + CD273D5521B1ED44006C4D84 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_getenv.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_getenv.c"; sourceTree = ""; }; + CD273D5621B1ED44006C4D84 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_iconv.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_iconv.c"; sourceTree = ""; }; + CD273D5721B1ED44006C4D84 /* SDL_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_malloc.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_malloc.c"; sourceTree = ""; }; + CD273D5821B1ED44006C4D84 /* SDL_qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_qsort.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_qsort.c"; sourceTree = ""; }; + CD273D5921B1ED44006C4D84 /* SDL_stdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_stdlib.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_stdlib.c"; sourceTree = ""; }; + CD273D5A21B1ED44006C4D84 /* SDL_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_string.c; path = "../../3rdparty/sdl2-2.0.9/src/stdlib/SDL_string.c"; sourceTree = ""; }; + CD273D6121B1ED53006C4D84 /* SDL_systhread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_systhread.h; path = "../../3rdparty/sdl2-2.0.9/src/thread/SDL_systhread.h"; sourceTree = ""; }; + CD273D6221B1ED53006C4D84 /* SDL_thread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_thread_c.h; path = "../../3rdparty/sdl2-2.0.9/src/thread/SDL_thread_c.h"; sourceTree = ""; }; + CD273D6321B1ED53006C4D84 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/SDL_thread.c"; sourceTree = ""; }; + CD273D6721B1ED5C006C4D84 /* SDL_syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syscond.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syscond.c"; sourceTree = ""; }; + CD273D6821B1ED5C006C4D84 /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysmutex_c.h; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex_c.h"; sourceTree = ""; }; + CD273D6921B1ED5C006C4D84 /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysmutex.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_sysmutex.c"; sourceTree = ""; }; + CD273D6A21B1ED5C006C4D84 /* SDL_syssem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syssem.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_syssem.c"; sourceTree = ""; }; + CD273D6B21B1ED5C006C4D84 /* SDL_systhread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_systhread_c.h; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread_c.h"; sourceTree = ""; }; + CD273D6C21B1ED5C006C4D84 /* SDL_systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systhread.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systhread.c"; sourceTree = ""; }; + CD273D6D21B1ED5C006C4D84 /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systls.c; path = "../../3rdparty/sdl2-2.0.9/src/thread/pthread/SDL_systls.c"; sourceTree = ""; }; + CD273D7521B1ED6B006C4D84 /* SDL_timer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_timer_c.h; path = "../../3rdparty/sdl2-2.0.9/src/timer/SDL_timer_c.h"; sourceTree = ""; }; + CD273D7621B1ED6B006C4D84 /* SDL_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_timer.c; path = "../../3rdparty/sdl2-2.0.9/src/timer/SDL_timer.c"; sourceTree = ""; }; + CD273D7921B1ED74006C4D84 /* SDL_systimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systimer.c; path = "../../3rdparty/sdl2-2.0.9/src/timer/unix/SDL_systimer.c"; sourceTree = ""; }; + CD273D7B21B1ED8A006C4D84 /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaclipboard.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.h"; sourceTree = ""; }; + CD273D7C21B1ED8A006C4D84 /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaclipboard.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaclipboard.m"; sourceTree = ""; }; + CD273D7D21B1ED8A006C4D84 /* SDL_cocoaevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaevents.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.h"; sourceTree = ""; }; + CD273D7E21B1ED8A006C4D84 /* SDL_cocoaevents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaevents.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaevents.m"; sourceTree = ""; }; + CD273D7F21B1ED8A006C4D84 /* SDL_cocoakeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoakeyboard.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.h"; sourceTree = ""; }; + CD273D8021B1ED8A006C4D84 /* SDL_cocoakeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoakeyboard.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoakeyboard.m"; sourceTree = ""; }; + CD273D8121B1ED8A006C4D84 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamessagebox.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.h"; sourceTree = ""; }; + CD273D8221B1ED8A006C4D84 /* SDL_cocoamessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamessagebox.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamessagebox.m"; sourceTree = ""; }; + CD273D8321B1ED8A006C4D84 /* SDL_cocoametalview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoametalview.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.h"; sourceTree = ""; }; + CD273D8421B1ED8A006C4D84 /* SDL_cocoametalview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoametalview.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoametalview.m"; sourceTree = ""; }; + CD273D8521B1ED8A006C4D84 /* SDL_cocoamodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamodes.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.h"; sourceTree = ""; }; + CD273D8621B1ED8A006C4D84 /* SDL_cocoamodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamodes.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamodes.m"; sourceTree = ""; }; + CD273D8721B1ED8A006C4D84 /* SDL_cocoamouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamouse.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.h"; sourceTree = ""; }; + CD273D8821B1ED8A006C4D84 /* SDL_cocoamouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamouse.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamouse.m"; sourceTree = ""; }; + CD273D8921B1ED8A006C4D84 /* SDL_cocoamousetap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamousetap.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.h"; sourceTree = ""; }; + CD273D8A21B1ED8A006C4D84 /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamousetap.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoamousetap.m"; sourceTree = ""; }; + CD273D8B21B1ED8A006C4D84 /* SDL_cocoaopengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaopengl.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.h"; sourceTree = ""; }; + CD273D8C21B1ED8A006C4D84 /* SDL_cocoaopengl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaopengl.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengl.m"; sourceTree = ""; }; + CD273D8D21B1ED8A006C4D84 /* SDL_cocoaopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaopengles.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.h"; sourceTree = ""; }; + CD273D8E21B1ED8A006C4D84 /* SDL_cocoaopengles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaopengles.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoaopengles.m"; sourceTree = ""; }; + CD273D8F21B1ED8A006C4D84 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoashape.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.h"; sourceTree = ""; }; + CD273D9021B1ED8A006C4D84 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoashape.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoashape.m"; sourceTree = ""; }; + CD273D9121B1ED8A006C4D84 /* SDL_cocoavideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoavideo.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.h"; sourceTree = ""; }; + CD273D9221B1ED8A006C4D84 /* SDL_cocoavideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoavideo.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavideo.m"; sourceTree = ""; }; + CD273D9321B1ED8A006C4D84 /* SDL_cocoavulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoavulkan.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.h"; sourceTree = ""; }; + CD273D9421B1ED8A006C4D84 /* SDL_cocoavulkan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoavulkan.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoavulkan.m"; sourceTree = ""; }; + CD273D9521B1ED8A006C4D84 /* SDL_cocoawindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoawindow.h; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.h"; sourceTree = ""; }; + CD273D9621B1ED8A006C4D84 /* SDL_cocoawindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoawindow.m; path = "../../3rdparty/sdl2-2.0.9/src/video/cocoa/SDL_cocoawindow.m"; sourceTree = ""; }; + CD273DB321B1ED93006C4D84 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullevents_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents_c.h"; sourceTree = ""; }; + CD273DB421B1ED93006C4D84 /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullevents.c; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullevents.c"; sourceTree = ""; }; + CD273DB521B1ED93006C4D84 /* SDL_nullframebuffer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullframebuffer_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer_c.h"; sourceTree = ""; }; + CD273DB621B1ED93006C4D84 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullframebuffer.c; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullframebuffer.c"; sourceTree = ""; }; + CD273DB721B1ED93006C4D84 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullvideo.c; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.c"; sourceTree = ""; }; + CD273DB821B1ED93006C4D84 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullvideo.h; path = "../../3rdparty/sdl2-2.0.9/src/video/dummy/SDL_nullvideo.h"; sourceTree = ""; }; + CD273DBF21B1EDA6006C4D84 /* edid-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "edid-parse.c"; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/edid-parse.c"; sourceTree = ""; }; + CD273DC021B1EDA6006C4D84 /* edid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = edid.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/edid.h"; sourceTree = ""; }; + CD273DC121B1EDA6006C4D84 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = imKStoUCS.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.c"; sourceTree = ""; }; + CD273DC221B1EDA6006C4D84 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imKStoUCS.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/imKStoUCS.h"; sourceTree = ""; }; + CD273DC321B1EDA6006C4D84 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11clipboard.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.c"; sourceTree = ""; }; + CD273DC421B1EDA6006C4D84 /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11clipboard.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11clipboard.h"; sourceTree = ""; }; + CD273DC521B1EDA6006C4D84 /* SDL_x11dyn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11dyn.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.c"; sourceTree = ""; }; + CD273DC621B1EDA6006C4D84 /* SDL_x11dyn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11dyn.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11dyn.h"; sourceTree = ""; }; + CD273DC721B1EDA6006C4D84 /* SDL_x11events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11events.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.c"; sourceTree = ""; }; + CD273DC821B1EDA6006C4D84 /* SDL_x11events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11events.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11events.h"; sourceTree = ""; }; + CD273DC921B1EDA6006C4D84 /* SDL_x11framebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11framebuffer.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.c"; sourceTree = ""; }; + CD273DCA21B1EDA6006C4D84 /* SDL_x11framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11framebuffer.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11framebuffer.h"; sourceTree = ""; }; + CD273DCB21B1EDA6006C4D84 /* SDL_x11keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11keyboard.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.c"; sourceTree = ""; }; + CD273DCC21B1EDA6006C4D84 /* SDL_x11keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11keyboard.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11keyboard.h"; sourceTree = ""; }; + CD273DCD21B1EDA6006C4D84 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11messagebox.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.c"; sourceTree = ""; }; + CD273DCE21B1EDA6006C4D84 /* SDL_x11messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11messagebox.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11messagebox.h"; sourceTree = ""; }; + CD273DCF21B1EDA6006C4D84 /* SDL_x11modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11modes.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.c"; sourceTree = ""; }; + CD273DD021B1EDA6006C4D84 /* SDL_x11modes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11modes.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11modes.h"; sourceTree = ""; }; + CD273DD121B1EDA6006C4D84 /* SDL_x11mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11mouse.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.c"; sourceTree = ""; }; + CD273DD221B1EDA6006C4D84 /* SDL_x11mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11mouse.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11mouse.h"; sourceTree = ""; }; + CD273DD321B1EDA6006C4D84 /* SDL_x11opengl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11opengl.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.c"; sourceTree = ""; }; + CD273DD421B1EDA6006C4D84 /* SDL_x11opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11opengl.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengl.h"; sourceTree = ""; }; + CD273DD521B1EDA6006C4D84 /* SDL_x11opengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11opengles.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.c"; sourceTree = ""; }; + CD273DD621B1EDA6006C4D84 /* SDL_x11opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11opengles.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11opengles.h"; sourceTree = ""; }; + CD273DD721B1EDA6006C4D84 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11shape.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.c"; sourceTree = ""; }; + CD273DD821B1EDA6006C4D84 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11shape.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11shape.h"; sourceTree = ""; }; + CD273DD921B1EDA6006C4D84 /* SDL_x11sym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11sym.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11sym.h"; sourceTree = ""; }; + CD273DDA21B1EDA6006C4D84 /* SDL_x11touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11touch.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.c"; sourceTree = ""; }; + CD273DDB21B1EDA6006C4D84 /* SDL_x11touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11touch.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11touch.h"; sourceTree = ""; }; + CD273DDC21B1EDA6006C4D84 /* SDL_x11video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11video.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.c"; sourceTree = ""; }; + CD273DDD21B1EDA6006C4D84 /* SDL_x11video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11video.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11video.h"; sourceTree = ""; }; + CD273DDE21B1EDA6006C4D84 /* SDL_x11vulkan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11vulkan.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.c"; sourceTree = ""; }; + CD273DDF21B1EDA6006C4D84 /* SDL_x11vulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11vulkan.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11vulkan.h"; sourceTree = ""; }; + CD273DE021B1EDA6006C4D84 /* SDL_x11window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11window.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.c"; sourceTree = ""; }; + CD273DE121B1EDA6006C4D84 /* SDL_x11window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11window.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11window.h"; sourceTree = ""; }; + CD273DE221B1EDA6006C4D84 /* SDL_x11xinput2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11xinput2.c; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.c"; sourceTree = ""; }; + CD273DE321B1EDA6006C4D84 /* SDL_x11xinput2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11xinput2.h; path = "../../3rdparty/sdl2-2.0.9/src/video/x11/SDL_x11xinput2.h"; sourceTree = ""; }; + CD273E0B21B1EDB9006C4D84 /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yuv_rgb.c; path = "../../3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb.c"; sourceTree = ""; }; + CD273E0C21B1EDB9006C4D84 /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = yuv_rgb.h; path = "../../3rdparty/sdl2-2.0.9/src/video/yuv2rgb/yuv_rgb.h"; sourceTree = ""; }; + CD273E1121B1EDD2006C4D84 /* SDL_blit_0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_0.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_0.c"; sourceTree = ""; }; + CD273E1221B1EDD2006C4D84 /* SDL_blit_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_1.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_1.c"; sourceTree = ""; }; + CD273E1321B1EDD2006C4D84 /* SDL_blit_A.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_A.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_A.c"; sourceTree = ""; }; + CD273E1421B1EDD2006C4D84 /* SDL_blit_auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_auto.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.c"; sourceTree = ""; }; + CD273E1521B1EDD2006C4D84 /* SDL_blit_auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_auto.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_auto.h"; sourceTree = ""; }; + CD273E1621B1EDD2006C4D84 /* SDL_blit_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_copy.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.c"; sourceTree = ""; }; + CD273E1721B1EDD2006C4D84 /* SDL_blit_copy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_copy.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_copy.h"; sourceTree = ""; }; + CD273E1821B1EDD2006C4D84 /* SDL_blit_N.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_N.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_N.c"; sourceTree = ""; }; + CD273E1921B1EDD2006C4D84 /* SDL_blit_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_slow.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.c"; sourceTree = ""; }; + CD273E1A21B1EDD2006C4D84 /* SDL_blit_slow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_slow.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit_slow.h"; sourceTree = ""; }; + CD273E1B21B1EDD2006C4D84 /* SDL_blit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit.c"; sourceTree = ""; }; + CD273E1C21B1EDD2006C4D84 /* SDL_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_blit.h"; sourceTree = ""; }; + CD273E1D21B1EDD2006C4D84 /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_bmp.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_bmp.c"; sourceTree = ""; }; + CD273E1E21B1EDD2006C4D84 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_clipboard.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_clipboard.c"; sourceTree = ""; }; + CD273E1F21B1EDD2006C4D84 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_egl_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_egl_c.h"; sourceTree = ""; }; + CD273E2021B1EDD2006C4D84 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_egl.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_egl.c"; sourceTree = ""; }; + CD273E2121B1EDD2006C4D84 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_fillrect.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_fillrect.c"; sourceTree = ""; }; + CD273E2221B1EDD2006C4D84 /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_pixels_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_pixels_c.h"; sourceTree = ""; }; + CD273E2321B1EDD2006C4D84 /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_pixels.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_pixels.c"; sourceTree = ""; }; + CD273E2421B1EDD2006C4D84 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rect_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_rect_c.h"; sourceTree = ""; }; + CD273E2521B1EDD2006C4D84 /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rect.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_rect.c"; sourceTree = ""; }; + CD273E2621B1EDD2006C4D84 /* SDL_RLEaccel_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_RLEaccel_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel_c.h"; sourceTree = ""; }; + CD273E2721B1EDD2006C4D84 /* SDL_RLEaccel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_RLEaccel.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_RLEaccel.c"; sourceTree = ""; }; + CD273E2821B1EDD2006C4D84 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape_internals.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_shape_internals.h"; sourceTree = ""; }; + CD273E2921B1EDD2006C4D84 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_shape.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_shape.c"; sourceTree = ""; }; + CD273E2A21B1EDD2006C4D84 /* SDL_stretch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_stretch.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_stretch.c"; sourceTree = ""; }; + CD273E2B21B1EDD2006C4D84 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_surface.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_surface.c"; sourceTree = ""; }; + CD273E2C21B1EDD2006C4D84 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysvideo.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_sysvideo.h"; sourceTree = ""; }; + CD273E2D21B1EDD2006C4D84 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_video.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_video.c"; sourceTree = ""; }; + CD273E2E21B1EDD2006C4D84 /* SDL_vulkan_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_vulkan_internal.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_internal.h"; sourceTree = ""; }; + CD273E2F21B1EDD2006C4D84 /* SDL_vulkan_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_vulkan_utils.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_vulkan_utils.c"; sourceTree = ""; }; + CD273E3021B1EDD2006C4D84 /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_yuv_c.h; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_yuv_c.h"; sourceTree = ""; }; + CD273E3121B1EDD2006C4D84 /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_yuv.c; path = "../../3rdparty/sdl2-2.0.9/src/video/SDL_yuv.c"; sourceTree = ""; }; + CD273E5321B1EDE2006C4D84 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = "../../3rdparty/sdl2-2.0.9/src/SDL_assert_c.h"; sourceTree = ""; }; + CD273E5421B1EDE2006C4D84 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL_assert.c"; sourceTree = ""; }; + CD273E5521B1EDE2006C4D84 /* SDL_dataqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dataqueue.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL_dataqueue.c"; sourceTree = ""; }; + CD273E5621B1EDE2006C4D84 /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dataqueue.h; path = "../../3rdparty/sdl2-2.0.9/src/SDL_dataqueue.h"; sourceTree = ""; }; + CD273E5721B1EDE2006C4D84 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = "../../3rdparty/sdl2-2.0.9/src/SDL_error_c.h"; sourceTree = ""; }; + CD273E5821B1EDE2006C4D84 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL_error.c"; sourceTree = ""; }; + CD273E5921B1EDE2006C4D84 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL_hints.c"; sourceTree = ""; }; + CD273E5A21B1EDE2006C4D84 /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = "../../3rdparty/sdl2-2.0.9/src/SDL_internal.h"; sourceTree = ""; }; + CD273E5B21B1EDE2006C4D84 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL_log.c"; sourceTree = ""; }; + CD273E5C21B1EDE2006C4D84 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = "../../3rdparty/sdl2-2.0.9/src/SDL.c"; sourceTree = ""; }; + CD273E6721B1EE03006C4D84 /* begin_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = begin_code.h; path = "../../3rdparty/sdl2-2.0.9/include/begin_code.h"; sourceTree = ""; }; + CD273E6821B1EE03006C4D84 /* close_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = close_code.h; path = "../../3rdparty/sdl2-2.0.9/include/close_code.h"; sourceTree = ""; }; + CD273E6921B1EE03006C4D84 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_assert.h"; sourceTree = ""; }; + CD273E6A21B1EE03006C4D84 /* SDL_atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_atomic.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_atomic.h"; sourceTree = ""; }; + CD273E6B21B1EE03006C4D84 /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audio.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_audio.h"; sourceTree = ""; }; + CD273E6C21B1EE03006C4D84 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_bits.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_bits.h"; sourceTree = ""; }; + CD273E6D21B1EE03006C4D84 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_blendmode.h"; sourceTree = ""; }; + CD273E6E21B1EE03006C4D84 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_clipboard.h"; sourceTree = ""; }; + CD273E7121B1EE03006C4D84 /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_macosx.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_config_macosx.h"; sourceTree = ""; }; + CD273E7921B1EE03006C4D84 /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_config.h"; sourceTree = ""; }; + CD273E7C21B1EE03006C4D84 /* SDL_copying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_copying.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_copying.h"; sourceTree = ""; }; + CD273E7D21B1EE03006C4D84 /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cpuinfo.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_cpuinfo.h"; sourceTree = ""; }; + CD273E7E21B1EE03006C4D84 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_egl.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_egl.h"; sourceTree = ""; }; + CD273E7F21B1EE03006C4D84 /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_endian.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_endian.h"; sourceTree = ""; }; + CD273E8021B1EE03006C4D84 /* SDL_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_error.h"; sourceTree = ""; }; + CD273E8121B1EE03006C4D84 /* SDL_events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_events.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_events.h"; sourceTree = ""; }; + CD273E8221B1EE03006C4D84 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_filesystem.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_filesystem.h"; sourceTree = ""; }; + CD273E8321B1EE03006C4D84 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gamecontroller.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_gamecontroller.h"; sourceTree = ""; }; + CD273E8421B1EE03006C4D84 /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_gesture.h"; sourceTree = ""; }; + CD273E8521B1EE03006C4D84 /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_haptic.h"; sourceTree = ""; }; + CD273E8621B1EE03006C4D84 /* SDL_hints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hints.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_hints.h"; sourceTree = ""; }; + CD273E8721B1EE03006C4D84 /* SDL_joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_joystick.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_joystick.h"; sourceTree = ""; }; + CD273E8821B1EE03006C4D84 /* SDL_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keyboard.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_keyboard.h"; sourceTree = ""; }; + CD273E8921B1EE03006C4D84 /* SDL_keycode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keycode.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_keycode.h"; sourceTree = ""; }; + CD273E8A21B1EE03006C4D84 /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_loadso.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_loadso.h"; sourceTree = ""; }; + CD273E8B21B1EE03006C4D84 /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_log.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_log.h"; sourceTree = ""; }; + CD273E8C21B1EE03006C4D84 /* SDL_main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_main.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_main.h"; sourceTree = ""; }; + CD273E8D21B1EE03006C4D84 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_messagebox.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_messagebox.h"; sourceTree = ""; }; + CD273E8E21B1EE03006C4D84 /* SDL_mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mouse.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_mouse.h"; sourceTree = ""; }; + CD273E8F21B1EE03006C4D84 /* SDL_mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mutex.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_mutex.h"; sourceTree = ""; }; + CD273E9021B1EE03006C4D84 /* SDL_name.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_name.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_name.h"; sourceTree = ""; }; + CD273E9121B1EE03006C4D84 /* SDL_opengl_glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengl_glext.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengl_glext.h"; sourceTree = ""; }; + CD273E9221B1EE03006C4D84 /* SDL_opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengl.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengl.h"; sourceTree = ""; }; + CD273E9321B1EE03006C4D84 /* SDL_opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles.h"; sourceTree = ""; }; + CD273E9421B1EE03006C4D84 /* SDL_opengles2_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2.h"; sourceTree = ""; }; + CD273E9521B1EE03006C4D84 /* SDL_opengles2_gl2ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2ext.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2ext.h"; sourceTree = ""; }; + CD273E9621B1EE03006C4D84 /* SDL_opengles2_gl2platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2platform.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles2_gl2platform.h"; sourceTree = ""; }; + CD273E9721B1EE03006C4D84 /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_khrplatform.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles2_khrplatform.h"; sourceTree = ""; }; + CD273E9821B1EE03006C4D84 /* SDL_opengles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_opengles2.h"; sourceTree = ""; }; + CD273E9921B1EE03006C4D84 /* SDL_pixels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_pixels.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_pixels.h"; sourceTree = ""; }; + CD273E9A21B1EE03006C4D84 /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_platform.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_platform.h"; sourceTree = ""; }; + CD273E9B21B1EE03006C4D84 /* SDL_power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_power.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_power.h"; sourceTree = ""; }; + CD273E9C21B1EE03006C4D84 /* SDL_quit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_quit.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_quit.h"; sourceTree = ""; }; + CD273E9D21B1EE03006C4D84 /* SDL_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rect.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_rect.h"; sourceTree = ""; }; + CD273E9E21B1EE03006C4D84 /* SDL_render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_render.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_render.h"; sourceTree = ""; }; + CD273E9F21B1EE03006C4D84 /* SDL_revision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_revision.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_revision.h"; sourceTree = ""; }; + CD273EA021B1EE03006C4D84 /* SDL_rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rwops.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_rwops.h"; sourceTree = ""; }; + CD273EA121B1EE03006C4D84 /* SDL_scancode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_scancode.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_scancode.h"; sourceTree = ""; }; + CD273EA221B1EE03006C4D84 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sensor.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_sensor.h"; sourceTree = ""; }; + CD273EA321B1EE03006C4D84 /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_shape.h"; sourceTree = ""; }; + CD273EA421B1EE03006C4D84 /* SDL_stdinc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_stdinc.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_stdinc.h"; sourceTree = ""; }; + CD273EA521B1EE03006C4D84 /* SDL_surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_surface.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_surface.h"; sourceTree = ""; }; + CD273EA621B1EE03006C4D84 /* SDL_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_system.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_system.h"; sourceTree = ""; }; + CD273EA721B1EE03006C4D84 /* SDL_syswm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syswm.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_syswm.h"; sourceTree = ""; }; + CD273EA821B1EE03006C4D84 /* SDL_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_thread.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_thread.h"; sourceTree = ""; }; + CD273EA921B1EE03006C4D84 /* SDL_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_timer.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_timer.h"; sourceTree = ""; }; + CD273EAA21B1EE03006C4D84 /* SDL_touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_touch.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_touch.h"; sourceTree = ""; }; + CD273EAB21B1EE03006C4D84 /* SDL_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_types.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_types.h"; sourceTree = ""; }; + CD273EAC21B1EE03006C4D84 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_version.h"; sourceTree = ""; }; + CD273EAD21B1EE03006C4D84 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_video.h"; sourceTree = ""; }; + CD273EAE21B1EE03006C4D84 /* SDL_vulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_vulkan.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL_vulkan.h"; sourceTree = ""; }; + CD273EAF21B1EE03006C4D84 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = "../../3rdparty/sdl2-2.0.9/include/SDL.h"; sourceTree = ""; }; CD27717F19C8CE940079A731 /* assert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = assert.cpp; sourceTree = ""; }; CD2B7C3117FA56A100EBA2DB /* MOAIAppIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MOAIAppIOS.h; path = "moai-ios/MOAIAppIOS.h"; sourceTree = ""; }; CD2B7C3217FA56A100EBA2DB /* MOAIAppIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MOAIAppIOS.mm; path = "moai-ios/MOAIAppIOS.mm"; sourceTree = ""; }; @@ -6496,202 +6835,6 @@ CD792FFD1E51D73400388A4B /* host.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = host.h; path = "moai-vr/host.h"; sourceTree = ""; }; CD792FFE1E51D73400388A4B /* MOAIHeadTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MOAIHeadTransform.cpp; path = "moai-vr/MOAIHeadTransform.cpp"; sourceTree = ""; }; CD792FFF1E51D73400388A4B /* MOAIHeadTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MOAIHeadTransform.h; path = "moai-vr/MOAIHeadTransform.h"; sourceTree = ""; }; - CD795CBB17F08459006AEB47 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = "../../3rdparty/sdl2-2.0.4/src/SDL_assert_c.h"; sourceTree = ""; }; - CD795CBC17F08459006AEB47 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = "../../3rdparty/sdl2-2.0.4/src/SDL_assert.c"; sourceTree = ""; }; - CD795CBD17F08459006AEB47 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = "../../3rdparty/sdl2-2.0.4/src/SDL_error_c.h"; sourceTree = ""; }; - CD795CBE17F08459006AEB47 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = "../../3rdparty/sdl2-2.0.4/src/SDL_error.c"; sourceTree = ""; }; - CD795CBF17F08459006AEB47 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = "../../3rdparty/sdl2-2.0.4/src/SDL_hints.c"; sourceTree = ""; }; - CD795CC017F08459006AEB47 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = "../../3rdparty/sdl2-2.0.4/src/SDL_log.c"; sourceTree = ""; }; - CD795CC117F08459006AEB47 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = "../../3rdparty/sdl2-2.0.4/src/SDL.c"; sourceTree = ""; }; - CD795CDA17F0850F006AEB47 /* SDL_blit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit.c"; sourceTree = ""; }; - CD795CDB17F0850F006AEB47 /* SDL_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit.h"; sourceTree = ""; }; - CD795CDC17F0850F006AEB47 /* SDL_blit_0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_0.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_0.c"; sourceTree = ""; }; - CD795CDD17F0850F006AEB47 /* SDL_blit_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_1.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_1.c"; sourceTree = ""; }; - CD795CDE17F0850F006AEB47 /* SDL_blit_A.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_A.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_A.c"; sourceTree = ""; }; - CD795CDF17F0850F006AEB47 /* SDL_blit_auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_auto.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.c"; sourceTree = ""; }; - CD795CE017F0850F006AEB47 /* SDL_blit_auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_auto.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_auto.h"; sourceTree = ""; }; - CD795CE117F0850F006AEB47 /* SDL_blit_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_copy.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.c"; sourceTree = ""; }; - CD795CE217F0850F006AEB47 /* SDL_blit_copy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_copy.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_copy.h"; sourceTree = ""; }; - CD795CE317F0850F006AEB47 /* SDL_blit_N.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_N.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_N.c"; sourceTree = ""; }; - CD795CE417F0850F006AEB47 /* SDL_blit_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blit_slow.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.c"; sourceTree = ""; }; - CD795CE517F0850F006AEB47 /* SDL_blit_slow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blit_slow.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_blit_slow.h"; sourceTree = ""; }; - CD795CE617F0850F006AEB47 /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_bmp.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_bmp.c"; sourceTree = ""; }; - CD795CE717F0850F006AEB47 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_clipboard.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_clipboard.c"; sourceTree = ""; }; - CD795CE817F0850F006AEB47 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_fillrect.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_fillrect.c"; sourceTree = ""; }; - CD795CE917F0850F006AEB47 /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_pixels.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_pixels.c"; sourceTree = ""; }; - CD795CEA17F0850F006AEB47 /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_pixels_c.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_pixels_c.h"; sourceTree = ""; }; - CD795CEB17F0850F006AEB47 /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rect.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_rect.c"; sourceTree = ""; }; - CD795CEC17F0850F006AEB47 /* SDL_RLEaccel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_RLEaccel.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel.c"; sourceTree = ""; }; - CD795CED17F0850F006AEB47 /* SDL_RLEaccel_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_RLEaccel_c.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_RLEaccel_c.h"; sourceTree = ""; }; - CD795CEE17F0850F006AEB47 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_shape.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_shape.c"; sourceTree = ""; }; - CD795CEF17F0850F006AEB47 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape_internals.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_shape_internals.h"; sourceTree = ""; }; - CD795CF017F0850F006AEB47 /* SDL_stretch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_stretch.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_stretch.c"; sourceTree = ""; }; - CD795CF117F0850F006AEB47 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_surface.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_surface.c"; sourceTree = ""; }; - CD795CF217F0850F006AEB47 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysvideo.h; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_sysvideo.h"; sourceTree = ""; }; - CD795CF317F0850F006AEB47 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_video.c; path = "../../3rdparty/sdl2-2.0.4/src/video/SDL_video.c"; sourceTree = ""; }; - CD795D0E17F08522006AEB47 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = imKStoUCS.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.c"; sourceTree = ""; }; - CD795D0F17F08522006AEB47 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imKStoUCS.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/imKStoUCS.h"; sourceTree = ""; }; - CD795D1017F08522006AEB47 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11clipboard.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.c"; sourceTree = ""; }; - CD795D1117F08522006AEB47 /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11clipboard.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11clipboard.h"; sourceTree = ""; }; - CD795D1217F08522006AEB47 /* SDL_x11dyn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11dyn.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.c"; sourceTree = ""; }; - CD795D1317F08522006AEB47 /* SDL_x11dyn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11dyn.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11dyn.h"; sourceTree = ""; }; - CD795D1417F08522006AEB47 /* SDL_x11events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11events.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.c"; sourceTree = ""; }; - CD795D1517F08522006AEB47 /* SDL_x11events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11events.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11events.h"; sourceTree = ""; }; - CD795D1617F08522006AEB47 /* SDL_x11framebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11framebuffer.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.c"; sourceTree = ""; }; - CD795D1717F08522006AEB47 /* SDL_x11framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11framebuffer.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11framebuffer.h"; sourceTree = ""; }; - CD795D1817F08522006AEB47 /* SDL_x11keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11keyboard.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.c"; sourceTree = ""; }; - CD795D1917F08522006AEB47 /* SDL_x11keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11keyboard.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11keyboard.h"; sourceTree = ""; }; - CD795D1A17F08522006AEB47 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11messagebox.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11messagebox.c"; sourceTree = ""; }; - CD795D1B17F08522006AEB47 /* SDL_x11modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11modes.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.c"; sourceTree = ""; }; - CD795D1C17F08522006AEB47 /* SDL_x11modes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11modes.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11modes.h"; sourceTree = ""; }; - CD795D1D17F08522006AEB47 /* SDL_x11mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11mouse.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.c"; sourceTree = ""; }; - CD795D1E17F08522006AEB47 /* SDL_x11mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11mouse.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11mouse.h"; sourceTree = ""; }; - CD795D1F17F08522006AEB47 /* SDL_x11opengl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11opengl.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.c"; sourceTree = ""; }; - CD795D2017F08522006AEB47 /* SDL_x11opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11opengl.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengl.h"; sourceTree = ""; }; - CD795D2117F08522006AEB47 /* SDL_x11opengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11opengles.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.c"; sourceTree = ""; }; - CD795D2217F08522006AEB47 /* SDL_x11opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11opengles.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11opengles.h"; sourceTree = ""; }; - CD795D2317F08522006AEB47 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11shape.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.c"; sourceTree = ""; }; - CD795D2417F08522006AEB47 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11shape.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11shape.h"; sourceTree = ""; }; - CD795D2517F08522006AEB47 /* SDL_x11sym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11sym.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11sym.h"; sourceTree = ""; }; - CD795D2617F08522006AEB47 /* SDL_x11touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11touch.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.c"; sourceTree = ""; }; - CD795D2717F08522006AEB47 /* SDL_x11touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11touch.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11touch.h"; sourceTree = ""; }; - CD795D2817F08522006AEB47 /* SDL_x11video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11video.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.c"; sourceTree = ""; }; - CD795D2917F08522006AEB47 /* SDL_x11video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11video.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11video.h"; sourceTree = ""; }; - CD795D2A17F08522006AEB47 /* SDL_x11window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11window.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.c"; sourceTree = ""; }; - CD795D2B17F08522006AEB47 /* SDL_x11window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11window.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11window.h"; sourceTree = ""; }; - CD795D2C17F08522006AEB47 /* SDL_x11xinput2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_x11xinput2.c; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.c"; sourceTree = ""; }; - CD795D2D17F08522006AEB47 /* SDL_x11xinput2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_x11xinput2.h; path = "../../3rdparty/sdl2-2.0.4/src/video/x11/SDL_x11xinput2.h"; sourceTree = ""; }; - CD795D4E17F0852B006AEB47 /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullevents.c; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents.c"; sourceTree = ""; }; - CD795D4F17F0852B006AEB47 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullevents_c.h; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullevents_c.h"; sourceTree = ""; }; - CD795D5017F0852B006AEB47 /* SDL_nullframebuffer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullframebuffer_c.h; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer_c.h"; sourceTree = ""; }; - CD795D5117F0852B006AEB47 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullframebuffer.c; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullframebuffer.c"; sourceTree = ""; }; - CD795D5217F0852B006AEB47 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_nullvideo.c; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.c"; sourceTree = ""; }; - CD795D5317F0852B006AEB47 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_nullvideo.h; path = "../../3rdparty/sdl2-2.0.4/src/video/dummy/SDL_nullvideo.h"; sourceTree = ""; }; - CD795D5A17F08532006AEB47 /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaclipboard.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.h"; sourceTree = ""; }; - CD795D5B17F08532006AEB47 /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaclipboard.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.m"; sourceTree = ""; }; - CD795D5C17F08532006AEB47 /* SDL_cocoaevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaevents.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.h"; sourceTree = ""; }; - CD795D5D17F08532006AEB47 /* SDL_cocoaevents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaevents.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaevents.m"; sourceTree = ""; }; - CD795D5E17F08532006AEB47 /* SDL_cocoakeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoakeyboard.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.h"; sourceTree = ""; }; - CD795D5F17F08532006AEB47 /* SDL_cocoakeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoakeyboard.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.m"; sourceTree = ""; }; - CD795D6017F08532006AEB47 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamessagebox.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.h"; sourceTree = ""; }; - CD795D6117F08532006AEB47 /* SDL_cocoamessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamessagebox.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.m"; sourceTree = ""; }; - CD795D6217F08532006AEB47 /* SDL_cocoamodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamodes.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.h"; sourceTree = ""; }; - CD795D6317F08532006AEB47 /* SDL_cocoamodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamodes.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamodes.m"; sourceTree = ""; }; - CD795D6417F08532006AEB47 /* SDL_cocoamouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamouse.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.h"; sourceTree = ""; }; - CD795D6517F08532006AEB47 /* SDL_cocoamouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamouse.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamouse.m"; sourceTree = ""; }; - CD795D6617F08532006AEB47 /* SDL_cocoamousetap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoamousetap.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.h"; sourceTree = ""; }; - CD795D6717F08532006AEB47 /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoamousetap.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoamousetap.m"; sourceTree = ""; }; - CD795D6817F08532006AEB47 /* SDL_cocoaopengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoaopengl.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.h"; sourceTree = ""; }; - CD795D6917F08532006AEB47 /* SDL_cocoaopengl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoaopengl.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoaopengl.m"; sourceTree = ""; }; - CD795D6A17F08532006AEB47 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoashape.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.h"; sourceTree = ""; }; - CD795D6B17F08532006AEB47 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoashape.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoashape.m"; sourceTree = ""; }; - CD795D6C17F08532006AEB47 /* SDL_cocoavideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoavideo.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.h"; sourceTree = ""; }; - CD795D6D17F08532006AEB47 /* SDL_cocoavideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoavideo.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoavideo.m"; sourceTree = ""; }; - CD795D6E17F08532006AEB47 /* SDL_cocoawindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoawindow.h; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.h"; sourceTree = ""; }; - CD795D6F17F08532006AEB47 /* SDL_cocoawindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoawindow.m; path = "../../3rdparty/sdl2-2.0.4/src/video/cocoa/SDL_cocoawindow.m"; sourceTree = ""; }; - CD795D8717F08548006AEB47 /* SDL_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_timer.c; path = "../../3rdparty/sdl2-2.0.4/src/timer/SDL_timer.c"; sourceTree = ""; }; - CD795D8817F08548006AEB47 /* SDL_timer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_timer_c.h; path = "../../3rdparty/sdl2-2.0.4/src/timer/SDL_timer_c.h"; sourceTree = ""; }; - CD795D8B17F0854D006AEB47 /* SDL_systimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systimer.c; path = "../../3rdparty/sdl2-2.0.4/src/timer/unix/SDL_systimer.c"; sourceTree = ""; }; - CD795D8E17F08560006AEB47 /* SDL_systhread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_systhread.h; path = "../../3rdparty/sdl2-2.0.4/src/thread/SDL_systhread.h"; sourceTree = ""; }; - CD795D8F17F08560006AEB47 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/SDL_thread.c"; sourceTree = ""; }; - CD795D9017F08560006AEB47 /* SDL_thread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_thread_c.h; path = "../../3rdparty/sdl2-2.0.4/src/thread/SDL_thread_c.h"; sourceTree = ""; }; - CD795D9417F08569006AEB47 /* SDL_syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syscond.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syscond.c"; sourceTree = ""; }; - CD795D9517F08569006AEB47 /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysmutex.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex.c"; sourceTree = ""; }; - CD795D9617F08569006AEB47 /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysmutex_c.h; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_sysmutex_c.h"; sourceTree = ""; }; - CD795D9717F08569006AEB47 /* SDL_syssem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syssem.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_syssem.c"; sourceTree = ""; }; - CD795D9817F08569006AEB47 /* SDL_systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systhread.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread.c"; sourceTree = ""; }; - CD795D9917F08569006AEB47 /* SDL_systhread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_systhread_c.h; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systhread_c.h"; sourceTree = ""; }; - CD795D9A17F08569006AEB47 /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_systls.c; path = "../../3rdparty/sdl2-2.0.4/src/thread/pthread/SDL_systls.c"; sourceTree = ""; }; - CD795DA217F08574006AEB47 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_getenv.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_getenv.c"; sourceTree = ""; }; - CD795DA317F08574006AEB47 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_iconv.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_iconv.c"; sourceTree = ""; }; - CD795DA417F08574006AEB47 /* SDL_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_malloc.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_malloc.c"; sourceTree = ""; }; - CD795DA517F08574006AEB47 /* SDL_qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_qsort.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_qsort.c"; sourceTree = ""; }; - CD795DA617F08574006AEB47 /* SDL_stdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_stdlib.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_stdlib.c"; sourceTree = ""; }; - CD795DA717F08574006AEB47 /* SDL_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_string.c; path = "../../3rdparty/sdl2-2.0.4/src/stdlib/SDL_string.c"; sourceTree = ""; }; - CD795DB017F08591006AEB47 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mmx.h; path = "../../3rdparty/sdl2-2.0.4/src/render/mmx.h"; sourceTree = ""; }; - CD795DB117F08591006AEB47 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render.c; path = "../../3rdparty/sdl2-2.0.4/src/render/SDL_render.c"; sourceTree = ""; }; - CD795DB217F08591006AEB47 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysrender.h; path = "../../3rdparty/sdl2-2.0.4/src/render/SDL_sysrender.h"; sourceTree = ""; }; - CD795DB317F08591006AEB47 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_yuv_mmx.c; path = "../../3rdparty/sdl2-2.0.4/src/render/SDL_yuv_mmx.c"; sourceTree = ""; }; - CD795DB417F08591006AEB47 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_yuv_sw_c.h; path = "../../3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw_c.h"; sourceTree = ""; }; - CD795DB517F08591006AEB47 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_yuv_sw.c; path = "../../3rdparty/sdl2-2.0.4/src/render/SDL_yuv_sw.c"; sourceTree = ""; }; - CD795DBC17F0859D006AEB47 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendfillrect.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.c"; sourceTree = ""; }; - CD795DBD17F0859D006AEB47 /* SDL_blendfillrect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendfillrect.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendfillrect.h"; sourceTree = ""; }; - CD795DBE17F0859D006AEB47 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendline.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.c"; sourceTree = ""; }; - CD795DBF17F0859D006AEB47 /* SDL_blendline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendline.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendline.h"; sourceTree = ""; }; - CD795DC017F0859D006AEB47 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_blendpoint.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.c"; sourceTree = ""; }; - CD795DC117F0859D006AEB47 /* SDL_blendpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendpoint.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_blendpoint.h"; sourceTree = ""; }; - CD795DC217F0859D006AEB47 /* SDL_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_draw.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_draw.h"; sourceTree = ""; }; - CD795DC317F0859D006AEB47 /* SDL_drawline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_drawline.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.c"; sourceTree = ""; }; - CD795DC417F0859D006AEB47 /* SDL_drawline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_drawline.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_drawline.h"; sourceTree = ""; }; - CD795DC517F0859D006AEB47 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_drawpoint.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.c"; sourceTree = ""; }; - CD795DC617F0859D006AEB47 /* SDL_drawpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_drawpoint.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_drawpoint.h"; sourceTree = ""; }; - CD795DC717F0859D006AEB47 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render_sw.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw.c"; sourceTree = ""; }; - CD795DC817F0859D006AEB47 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_render_sw_c.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_render_sw_c.h"; sourceTree = ""; }; - CD795DC917F0859D006AEB47 /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rotate.c; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.c"; sourceTree = ""; }; - CD795DCA17F0859D006AEB47 /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rotate.h; path = "../../3rdparty/sdl2-2.0.4/src/render/software/SDL_rotate.h"; sourceTree = ""; }; - CD795DDA17F085A5006AEB47 /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_glfuncs.h; path = "../../3rdparty/sdl2-2.0.4/src/render/opengl/SDL_glfuncs.h"; sourceTree = ""; }; - CD795DDB17F085A5006AEB47 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_render_gl.c; path = "../../3rdparty/sdl2-2.0.4/src/render/opengl/SDL_render_gl.c"; sourceTree = ""; }; - CD795DDC17F085A5006AEB47 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_shaders_gl.c; path = "../../3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.c"; sourceTree = ""; }; - CD795DDD17F085A5006AEB47 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shaders_gl.h; path = "../../3rdparty/sdl2-2.0.4/src/render/opengl/SDL_shaders_gl.h"; sourceTree = ""; }; - CD795DE317F085BB006AEB47 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = "../../3rdparty/sdl2-2.0.4/src/power/SDL_power.c"; sourceTree = ""; }; - CD795DE517F085C1006AEB47 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syspower.c; path = "../../3rdparty/sdl2-2.0.4/src/power/macosx/SDL_syspower.c"; sourceTree = ""; }; - CD795DE817F085D2006AEB47 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysloadso.c; path = "../../3rdparty/sdl2-2.0.4/src/loadso/dlopen/SDL_sysloadso.c"; sourceTree = ""; }; - CD795DEB17F085E3006AEB47 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_joystick.c; path = "../../3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick.c"; sourceTree = ""; }; - CD795DEC17F085E3006AEB47 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_joystick_c.h; path = "../../3rdparty/sdl2-2.0.4/src/joystick/SDL_joystick_c.h"; sourceTree = ""; }; - CD795DED17F085E3006AEB47 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_gamecontroller.c; path = "../../3rdparty/sdl2-2.0.4/src/joystick/SDL_gamecontroller.c"; sourceTree = ""; }; - CD795DEE17F085E3006AEB47 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysjoystick.h; path = "../../3rdparty/sdl2-2.0.4/src/joystick/SDL_sysjoystick.h"; sourceTree = ""; }; - CD795DF317F085E9006AEB47 /* SDL_sysjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_sysjoystick.c; path = "../../3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick.c"; sourceTree = ""; }; - CD795DF417F085E9006AEB47 /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysjoystick_c.h; path = "../../3rdparty/sdl2-2.0.4/src/joystick/darwin/SDL_sysjoystick_c.h"; sourceTree = ""; }; - CD795DF817F085FD006AEB47 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_haptic.c; path = "../../3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic.c"; sourceTree = ""; }; - CD795DF917F085FD006AEB47 /* SDL_haptic_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic_c.h; path = "../../3rdparty/sdl2-2.0.4/src/haptic/SDL_haptic_c.h"; sourceTree = ""; }; - CD795DFA17F085FD006AEB47 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syshaptic.h; path = "../../3rdparty/sdl2-2.0.4/src/haptic/SDL_syshaptic.h"; sourceTree = ""; }; - CD795DFE17F08606006AEB47 /* SDL_syshaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_syshaptic.c; path = "../../3rdparty/sdl2-2.0.4/src/haptic/darwin/SDL_syshaptic.c"; sourceTree = ""; }; - CD795E0117F08627006AEB47 /* SDL_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_rwops.c; path = "../../3rdparty/sdl2-2.0.4/src/file/SDL_rwops.c"; sourceTree = ""; }; - CD795E0317F0862D006AEB47 /* SDL_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rwopsbundlesupport.h; path = "../../3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.h"; sourceTree = ""; }; - CD795E0417F0862D006AEB47 /* SDL_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_rwopsbundlesupport.m; path = "../../3rdparty/sdl2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.m"; sourceTree = ""; }; - CD795E0717F08638006AEB47 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blank_cursor.h; path = "../../3rdparty/sdl2-2.0.4/src/events/blank_cursor.h"; sourceTree = ""; }; - CD795E0817F08638006AEB47 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = default_cursor.h; path = "../../3rdparty/sdl2-2.0.4/src/events/default_cursor.h"; sourceTree = ""; }; - CD795E0917F08638006AEB47 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_darwin.h; path = "../../3rdparty/sdl2-2.0.4/src/events/scancodes_darwin.h"; sourceTree = ""; }; - CD795E0A17F08638006AEB47 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_linux.h; path = "../../3rdparty/sdl2-2.0.4/src/events/scancodes_linux.h"; sourceTree = ""; }; - CD795E0B17F08638006AEB47 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scancodes_xfree86.h; path = "../../3rdparty/sdl2-2.0.4/src/events/scancodes_xfree86.h"; sourceTree = ""; }; - CD795E0C17F08638006AEB47 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_clipboardevents.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents.c"; sourceTree = ""; }; - CD795E0D17F08638006AEB47 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboardevents_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_clipboardevents_c.h"; sourceTree = ""; }; - CD795E0E17F08638006AEB47 /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dropevents_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_dropevents_c.h"; sourceTree = ""; }; - CD795E0F17F08638006AEB47 /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dropevents.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_dropevents.c"; sourceTree = ""; }; - CD795E1017F08638006AEB47 /* SDL_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_events.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_events.c"; sourceTree = ""; }; - CD795E1117F08638006AEB47 /* SDL_events_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_events_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_events_c.h"; sourceTree = ""; }; - CD795E1217F08638006AEB47 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_gesture.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_gesture.c"; sourceTree = ""; }; - CD795E1317F08638006AEB47 /* SDL_gesture_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_gesture_c.h"; sourceTree = ""; }; - CD795E1417F08638006AEB47 /* SDL_keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_keyboard.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_keyboard.c"; sourceTree = ""; }; - CD795E1517F08638006AEB47 /* SDL_keyboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keyboard_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_keyboard_c.h"; sourceTree = ""; }; - CD795E1617F08638006AEB47 /* SDL_mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_mouse.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_mouse.c"; sourceTree = ""; }; - CD795E1717F08638006AEB47 /* SDL_mouse_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mouse_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_mouse_c.h"; sourceTree = ""; }; - CD795E1817F08638006AEB47 /* SDL_quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_quit.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_quit.c"; sourceTree = ""; }; - CD795E1917F08638006AEB47 /* SDL_sysevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysevents.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_sysevents.h"; sourceTree = ""; }; - CD795E1A17F08638006AEB47 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_touch.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_touch.c"; sourceTree = ""; }; - CD795E1B17F08638006AEB47 /* SDL_touch_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_touch_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_touch_c.h"; sourceTree = ""; }; - CD795E1C17F08638006AEB47 /* SDL_windowevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_windowevents.c; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_windowevents.c"; sourceTree = ""; }; - CD795E1D17F08638006AEB47 /* SDL_windowevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_windowevents_c.h; path = "../../3rdparty/sdl2-2.0.4/src/events/SDL_windowevents_c.h"; sourceTree = ""; }; - CD795E3517F0863E006AEB47 /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_cpuinfo.c; path = "../../3rdparty/sdl2-2.0.4/src/cpuinfo/SDL_cpuinfo.c"; sourceTree = ""; }; - CD795E3A17F08667006AEB47 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audio.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audio.c"; sourceTree = ""; }; - CD795E3B17F08667006AEB47 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audio_c.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audio_c.h"; sourceTree = ""; }; - CD795E3C17F08667006AEB47 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiocvt.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audiocvt.c"; sourceTree = ""; }; - CD795E3D17F08667006AEB47 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiodev.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev.c"; sourceTree = ""; }; - CD795E3E17F08667006AEB47 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audiodev_c.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audiodev_c.h"; sourceTree = ""; }; - CD795E3F17F08667006AEB47 /* SDL_audiomem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audiomem.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audiomem.h"; sourceTree = ""; }; - CD795E4017F08667006AEB47 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_audiotypecvt.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_audiotypecvt.c"; sourceTree = ""; }; - CD795E4117F08667006AEB47 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_mixer.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_mixer.c"; sourceTree = ""; }; - CD795E4217F08667006AEB47 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysaudio.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_sysaudio.h"; sourceTree = ""; }; - CD795E4317F08667006AEB47 /* SDL_wave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_wave.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_wave.c"; sourceTree = ""; }; - CD795E4417F08667006AEB47 /* SDL_wave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_wave.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/SDL_wave.h"; sourceTree = ""; }; - CD795E5017F0866D006AEB47 /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_coreaudio.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.c"; sourceTree = ""; }; - CD795E5117F0866D006AEB47 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_coreaudio.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/coreaudio/SDL_coreaudio.h"; sourceTree = ""; }; - CD795E5417F08675006AEB47 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dummyaudio.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.c"; sourceTree = ""; }; - CD795E5517F08675006AEB47 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dummyaudio.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/dummy/SDL_dummyaudio.h"; sourceTree = ""; }; - CD795E5817F0867B006AEB47 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_diskaudio.c; path = "../../3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.c"; sourceTree = ""; }; - CD795E5917F0867B006AEB47 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_diskaudio.h; path = "../../3rdparty/sdl2-2.0.4/src/audio/disk/SDL_diskaudio.h"; sourceTree = ""; }; - CD795E5C17F08689006AEB47 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_atomic.c; path = "../../3rdparty/sdl2-2.0.4/src/atomic/SDL_atomic.c"; sourceTree = ""; }; - CD795E5D17F08689006AEB47 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_spinlock.c; path = "../../3rdparty/sdl2-2.0.4/src/atomic/SDL_spinlock.c"; sourceTree = ""; }; CD795EFE17F0901A006AEB47 /* mongoose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mongoose.c; path = ../../3rdparty/mongoose/mongoose.c; sourceTree = ""; }; CD795EFF17F0901A006AEB47 /* mongoose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mongoose.h; path = ../../3rdparty/mongoose/mongoose.h; sourceTree = ""; }; CD807E981831C42100E658D9 /* libmoai-osx-zl-crypto.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libmoai-osx-zl-crypto.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -7538,93 +7681,6 @@ CDEFD563181ECB3E0058D772 /* MOAIVectorEllipse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOAIVectorEllipse.h; sourceTree = ""; }; CDEFD564181ECB3E0058D772 /* MOAIVectorRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MOAIVectorRect.cpp; sourceTree = ""; }; CDEFD565181ECB3E0058D772 /* MOAIVectorRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOAIVectorRect.h; sourceTree = ""; }; - CDF2372F1CAA70CD00A45E31 /* begin_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = begin_code.h; path = "../../3rdparty/sdl2-2.0.4/include/begin_code.h"; sourceTree = ""; }; - CDF237301CAA70CD00A45E31 /* close_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = close_code.h; path = "../../3rdparty/sdl2-2.0.4/include/close_code.h"; sourceTree = ""; }; - CDF237311CAA70CD00A45E31 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_assert.h"; sourceTree = ""; }; - CDF237321CAA70CD00A45E31 /* SDL_atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_atomic.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_atomic.h"; sourceTree = ""; }; - CDF237331CAA70CD00A45E31 /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_audio.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_audio.h"; sourceTree = ""; }; - CDF237341CAA70CD00A45E31 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_bits.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_bits.h"; sourceTree = ""; }; - CDF237351CAA70CD00A45E31 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_blendmode.h"; sourceTree = ""; }; - CDF237361CAA70CD00A45E31 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_clipboard.h"; sourceTree = ""; }; - CDF237371CAA70CD00A45E31 /* SDL_config_android.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_android.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_android.h"; sourceTree = ""; }; - CDF237381CAA70CD00A45E31 /* SDL_config_iphoneos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_iphoneos.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_iphoneos.h"; sourceTree = ""; }; - CDF237391CAA70CD00A45E31 /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_macosx.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_macosx.h"; sourceTree = ""; }; - CDF2373A1CAA70CD00A45E31 /* SDL_config_minimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_minimal.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_minimal.h"; sourceTree = ""; }; - CDF2373B1CAA70CD00A45E31 /* SDL_config_pandora.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_pandora.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_pandora.h"; sourceTree = ""; }; - CDF2373C1CAA70CD00A45E31 /* SDL_config_psp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_psp.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_psp.h"; sourceTree = ""; }; - CDF2373D1CAA70CD00A45E31 /* SDL_config_windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_windows.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_windows.h"; sourceTree = ""; }; - CDF2373E1CAA70CD00A45E31 /* SDL_config_winrt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_winrt.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_winrt.h"; sourceTree = ""; }; - CDF2373F1CAA70CD00A45E31 /* SDL_config_wiz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config_wiz.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config_wiz.h"; sourceTree = ""; }; - CDF237401CAA70CD00A45E31 /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_config.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config.h"; sourceTree = ""; }; - CDF237411CAA70CD00A45E31 /* SDL_config.h.cmake */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SDL_config.h.cmake; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config.h.cmake"; sourceTree = ""; }; - CDF237421CAA70CD00A45E31 /* SDL_config.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SDL_config.h.in; path = "../../3rdparty/sdl2-2.0.4/include/SDL_config.h.in"; sourceTree = ""; }; - CDF237431CAA70CD00A45E31 /* SDL_copying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_copying.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_copying.h"; sourceTree = ""; }; - CDF237441CAA70CD00A45E31 /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cpuinfo.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_cpuinfo.h"; sourceTree = ""; }; - CDF237451CAA70CD00A45E31 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_egl.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_egl.h"; sourceTree = ""; }; - CDF237461CAA70CD00A45E31 /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_endian.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_endian.h"; sourceTree = ""; }; - CDF237471CAA70CD00A45E31 /* SDL_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_error.h"; sourceTree = ""; }; - CDF237481CAA70CD00A45E31 /* SDL_events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_events.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_events.h"; sourceTree = ""; }; - CDF237491CAA70CD00A45E31 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_filesystem.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_filesystem.h"; sourceTree = ""; }; - CDF2374A1CAA70CD00A45E31 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gamecontroller.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_gamecontroller.h"; sourceTree = ""; }; - CDF2374B1CAA70CD00A45E31 /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_gesture.h"; sourceTree = ""; }; - CDF2374C1CAA70CD00A45E31 /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_haptic.h"; sourceTree = ""; }; - CDF2374D1CAA70CD00A45E31 /* SDL_hints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hints.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_hints.h"; sourceTree = ""; }; - CDF2374E1CAA70CD00A45E31 /* SDL_joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_joystick.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_joystick.h"; sourceTree = ""; }; - CDF2374F1CAA70CD00A45E31 /* SDL_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keyboard.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_keyboard.h"; sourceTree = ""; }; - CDF237501CAA70CD00A45E31 /* SDL_keycode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_keycode.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_keycode.h"; sourceTree = ""; }; - CDF237511CAA70CD00A45E31 /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_loadso.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_loadso.h"; sourceTree = ""; }; - CDF237521CAA70CD00A45E31 /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_log.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_log.h"; sourceTree = ""; }; - CDF237531CAA70CD00A45E31 /* SDL_main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_main.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_main.h"; sourceTree = ""; }; - CDF237541CAA70CD00A45E31 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_messagebox.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_messagebox.h"; sourceTree = ""; }; - CDF237551CAA70CD00A45E31 /* SDL_mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mouse.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_mouse.h"; sourceTree = ""; }; - CDF237561CAA70CD00A45E31 /* SDL_mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_mutex.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_mutex.h"; sourceTree = ""; }; - CDF237571CAA70CD00A45E31 /* SDL_name.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_name.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_name.h"; sourceTree = ""; }; - CDF237581CAA70CD00A45E31 /* SDL_opengl_glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengl_glext.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengl_glext.h"; sourceTree = ""; }; - CDF237591CAA70CD00A45E31 /* SDL_opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengl.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengl.h"; sourceTree = ""; }; - CDF2375A1CAA70CD00A45E31 /* SDL_opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles.h"; sourceTree = ""; }; - CDF2375B1CAA70CD00A45E31 /* SDL_opengles2_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2.h"; sourceTree = ""; }; - CDF2375C1CAA70CD00A45E31 /* SDL_opengles2_gl2ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2ext.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2ext.h"; sourceTree = ""; }; - CDF2375D1CAA70CD00A45E31 /* SDL_opengles2_gl2platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2platform.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles2_gl2platform.h"; sourceTree = ""; }; - CDF2375E1CAA70CD00A45E31 /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_khrplatform.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles2_khrplatform.h"; sourceTree = ""; }; - CDF2375F1CAA70CD00A45E31 /* SDL_opengles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_opengles2.h"; sourceTree = ""; }; - CDF237601CAA70CD00A45E31 /* SDL_pixels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_pixels.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_pixels.h"; sourceTree = ""; }; - CDF237611CAA70CD00A45E31 /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_platform.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_platform.h"; sourceTree = ""; }; - CDF237621CAA70CD00A45E31 /* SDL_power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_power.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_power.h"; sourceTree = ""; }; - CDF237631CAA70CD00A45E31 /* SDL_quit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_quit.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_quit.h"; sourceTree = ""; }; - CDF237641CAA70CD00A45E31 /* SDL_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rect.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_rect.h"; sourceTree = ""; }; - CDF237651CAA70CD00A45E31 /* SDL_render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_render.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_render.h"; sourceTree = ""; }; - CDF237661CAA70CD00A45E31 /* SDL_revision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_revision.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_revision.h"; sourceTree = ""; }; - CDF237671CAA70CD00A45E31 /* SDL_rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_rwops.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_rwops.h"; sourceTree = ""; }; - CDF237681CAA70CD00A45E31 /* SDL_scancode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_scancode.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_scancode.h"; sourceTree = ""; }; - CDF237691CAA70CD00A45E31 /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_shape.h"; sourceTree = ""; }; - CDF2376A1CAA70CD00A45E31 /* SDL_stdinc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_stdinc.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_stdinc.h"; sourceTree = ""; }; - CDF2376B1CAA70CD00A45E31 /* SDL_surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_surface.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_surface.h"; sourceTree = ""; }; - CDF2376C1CAA70CD00A45E31 /* SDL_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_system.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_system.h"; sourceTree = ""; }; - CDF2376D1CAA70CD00A45E31 /* SDL_syswm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syswm.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_syswm.h"; sourceTree = ""; }; - CDF2376E1CAA70CD00A45E31 /* SDL_test_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_assert.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_assert.h"; sourceTree = ""; }; - CDF2376F1CAA70CD00A45E31 /* SDL_test_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_common.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_common.h"; sourceTree = ""; }; - CDF237701CAA70CD00A45E31 /* SDL_test_compare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_compare.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_compare.h"; sourceTree = ""; }; - CDF237711CAA70CD00A45E31 /* SDL_test_crc32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_crc32.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_crc32.h"; sourceTree = ""; }; - CDF237721CAA70CD00A45E31 /* SDL_test_font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_font.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_font.h"; sourceTree = ""; }; - CDF237731CAA70CD00A45E31 /* SDL_test_fuzzer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_fuzzer.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_fuzzer.h"; sourceTree = ""; }; - CDF237741CAA70CD00A45E31 /* SDL_test_harness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_harness.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_harness.h"; sourceTree = ""; }; - CDF237751CAA70CD00A45E31 /* SDL_test_images.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_images.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_images.h"; sourceTree = ""; }; - CDF237761CAA70CD00A45E31 /* SDL_test_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_log.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_log.h"; sourceTree = ""; }; - CDF237771CAA70CD00A45E31 /* SDL_test_md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_md5.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_md5.h"; sourceTree = ""; }; - CDF237781CAA70CD00A45E31 /* SDL_test_random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test_random.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test_random.h"; sourceTree = ""; }; - CDF237791CAA70CD00A45E31 /* SDL_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_test.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_test.h"; sourceTree = ""; }; - CDF2377A1CAA70CD00A45E31 /* SDL_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_thread.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_thread.h"; sourceTree = ""; }; - CDF2377B1CAA70CD00A45E31 /* SDL_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_timer.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_timer.h"; sourceTree = ""; }; - CDF2377C1CAA70CD00A45E31 /* SDL_touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_touch.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_touch.h"; sourceTree = ""; }; - CDF2377D1CAA70CD00A45E31 /* SDL_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_types.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_types.h"; sourceTree = ""; }; - CDF2377E1CAA70CD00A45E31 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_version.h"; sourceTree = ""; }; - CDF2377F1CAA70CD00A45E31 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL_video.h"; sourceTree = ""; }; - CDF237801CAA70CD00A45E31 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = "../../3rdparty/sdl2-2.0.4/include/SDL.h"; sourceTree = ""; }; - CDF237D21CAA715000A45E31 /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = "../../3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_overrides.h"; sourceTree = ""; }; - CDF237D31CAA715000A45E31 /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = "../../3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi_procs.h"; sourceTree = ""; }; - CDF237D41CAA715000A45E31 /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = "../../3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.c"; sourceTree = ""; }; - CDF237D51CAA715000A45E31 /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = "../../3rdparty/sdl2-2.0.4/src/dynapi/SDL_dynapi.h"; sourceTree = ""; }; - CDF237DB1CAA71BC00A45E31 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = "../../3rdparty/sdl2-2.0.4/src/filesystem/cocoa/SDL_sysfilesystem.m"; sourceTree = ""; }; CDF288BC17ED41CF00FD4F59 /* libmoai-ios-zl-vfs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libmoai-ios-zl-vfs.a"; sourceTree = BUILT_PRODUCTS_DIR; }; CDF359261ADB93AB00C26CD5 /* MOAIMaterialBatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MOAIMaterialBatch.cpp; sourceTree = ""; }; CDF359271ADB93AB00C26CD5 /* MOAIMaterialBatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOAIMaterialBatch.h; sourceTree = ""; }; @@ -9558,6 +9614,92 @@ name = "moai-apple"; sourceTree = ""; }; + CD273AE321B11F82006C4D84 /* cocoa */ = { + isa = PBXGroup; + children = ( + CD273CDD21B1EC28006C4D84 /* SDL_sysfilesystem.m */, + ); + name = cocoa; + sourceTree = ""; + }; + CD273C4321B122A1006C4D84 /* hidapi */ = { + isa = PBXGroup; + children = ( + CD273C4521B12324006C4D84 /* mac */, + ); + name = hidapi; + sourceTree = ""; + }; + CD273C4421B122B5006C4D84 /* sensor */ = { + isa = PBXGroup; + children = ( + CD273C6321B1240D006C4D84 /* dummy */, + CD273D4B21B1ED2D006C4D84 /* SDL_sensor_c.h */, + CD273D4C21B1ED2D006C4D84 /* SDL_sensor.c */, + CD273D4D21B1ED2D006C4D84 /* SDL_syssensor.h */, + ); + name = sensor; + sourceTree = ""; + }; + CD273C4521B12324006C4D84 /* mac */ = { + isa = PBXGroup; + children = ( + CD273CE921B1EC58006C4D84 /* hid.c */, + ); + name = mac; + sourceTree = ""; + }; + CD273C4821B12348006C4D84 /* hidapi */ = { + isa = PBXGroup; + children = ( + CD273CF521B1EC78006C4D84 /* SDL_hidapi_ps4.c */, + CD273CF621B1EC78006C4D84 /* SDL_hidapi_switch.c */, + CD273CF721B1EC78006C4D84 /* SDL_hidapi_xbox360.c */, + CD273CF821B1EC78006C4D84 /* SDL_hidapi_xboxone.c */, + CD273CF921B1EC78006C4D84 /* SDL_hidapijoystick_c.h */, + CD273CFA21B1EC78006C4D84 /* SDL_hidapijoystick.c */, + ); + name = hidapi; + sourceTree = ""; + }; + CD273C5521B12381006C4D84 /* metal */ = { + isa = PBXGroup; + children = ( + CD273D0D21B1ECF1006C4D84 /* SDL_render_metal.m */, + CD273D0E21B1ECF1006C4D84 /* SDL_shaders_metal_osx.h */, + ); + name = metal; + sourceTree = ""; + }; + CD273C5621B123AC006C4D84 /* opengles2 */ = { + isa = PBXGroup; + children = ( + CD273D1921B1ED05006C4D84 /* SDL_gles2funcs.h */, + CD273D1A21B1ED05006C4D84 /* SDL_render_gles2.c */, + CD273D1B21B1ED05006C4D84 /* SDL_shaders_gles2.c */, + CD273D1C21B1ED05006C4D84 /* SDL_shaders_gles2.h */, + ); + name = opengles2; + sourceTree = ""; + }; + CD273C6321B1240D006C4D84 /* dummy */ = { + isa = PBXGroup; + children = ( + CD273D5121B1ED36006C4D84 /* SDL_dummysensor.c */, + CD273D5221B1ED36006C4D84 /* SDL_dummysensor.h */, + ); + name = dummy; + sourceTree = ""; + }; + CD273C6E21B1244B006C4D84 /* yuv2rgb */ = { + isa = PBXGroup; + children = ( + CD273E0B21B1EDB9006C4D84 /* yuv_rgb.c */, + CD273E0C21B1EDB9006C4D84 /* yuv_rgb.h */, + ); + name = yuv2rgb; + sourceTree = ""; + }; CD2B7C2E17FA564B00EBA2DB /* moai-ios */ = { isa = PBXGroup; children = ( @@ -10955,32 +11097,40 @@ CD795CD917F084FB006AEB47 /* cocoa */, CD795CD817F084F6006AEB47 /* dummy */, CD795CD717F084ED006AEB47 /* x11 */, - CD795CDA17F0850F006AEB47 /* SDL_blit.c */, - CD795CDB17F0850F006AEB47 /* SDL_blit.h */, - CD795CDC17F0850F006AEB47 /* SDL_blit_0.c */, - CD795CDD17F0850F006AEB47 /* SDL_blit_1.c */, - CD795CDE17F0850F006AEB47 /* SDL_blit_A.c */, - CD795CDF17F0850F006AEB47 /* SDL_blit_auto.c */, - CD795CE017F0850F006AEB47 /* SDL_blit_auto.h */, - CD795CE117F0850F006AEB47 /* SDL_blit_copy.c */, - CD795CE217F0850F006AEB47 /* SDL_blit_copy.h */, - CD795CE317F0850F006AEB47 /* SDL_blit_N.c */, - CD795CE417F0850F006AEB47 /* SDL_blit_slow.c */, - CD795CE517F0850F006AEB47 /* SDL_blit_slow.h */, - CD795CE617F0850F006AEB47 /* SDL_bmp.c */, - CD795CE717F0850F006AEB47 /* SDL_clipboard.c */, - CD795CE817F0850F006AEB47 /* SDL_fillrect.c */, - CD795CE917F0850F006AEB47 /* SDL_pixels.c */, - CD795CEA17F0850F006AEB47 /* SDL_pixels_c.h */, - CD795CEB17F0850F006AEB47 /* SDL_rect.c */, - CD795CEC17F0850F006AEB47 /* SDL_RLEaccel.c */, - CD795CED17F0850F006AEB47 /* SDL_RLEaccel_c.h */, - CD795CEE17F0850F006AEB47 /* SDL_shape.c */, - CD795CEF17F0850F006AEB47 /* SDL_shape_internals.h */, - CD795CF017F0850F006AEB47 /* SDL_stretch.c */, - CD795CF117F0850F006AEB47 /* SDL_surface.c */, - CD795CF217F0850F006AEB47 /* SDL_sysvideo.h */, - CD795CF317F0850F006AEB47 /* SDL_video.c */, + CD273C6E21B1244B006C4D84 /* yuv2rgb */, + CD273E1121B1EDD2006C4D84 /* SDL_blit_0.c */, + CD273E1221B1EDD2006C4D84 /* SDL_blit_1.c */, + CD273E1321B1EDD2006C4D84 /* SDL_blit_A.c */, + CD273E1421B1EDD2006C4D84 /* SDL_blit_auto.c */, + CD273E1521B1EDD2006C4D84 /* SDL_blit_auto.h */, + CD273E1621B1EDD2006C4D84 /* SDL_blit_copy.c */, + CD273E1721B1EDD2006C4D84 /* SDL_blit_copy.h */, + CD273E1821B1EDD2006C4D84 /* SDL_blit_N.c */, + CD273E1921B1EDD2006C4D84 /* SDL_blit_slow.c */, + CD273E1A21B1EDD2006C4D84 /* SDL_blit_slow.h */, + CD273E1B21B1EDD2006C4D84 /* SDL_blit.c */, + CD273E1C21B1EDD2006C4D84 /* SDL_blit.h */, + CD273E1D21B1EDD2006C4D84 /* SDL_bmp.c */, + CD273E1E21B1EDD2006C4D84 /* SDL_clipboard.c */, + CD273E1F21B1EDD2006C4D84 /* SDL_egl_c.h */, + CD273E2021B1EDD2006C4D84 /* SDL_egl.c */, + CD273E2121B1EDD2006C4D84 /* SDL_fillrect.c */, + CD273E2221B1EDD2006C4D84 /* SDL_pixels_c.h */, + CD273E2321B1EDD2006C4D84 /* SDL_pixels.c */, + CD273E2421B1EDD2006C4D84 /* SDL_rect_c.h */, + CD273E2521B1EDD2006C4D84 /* SDL_rect.c */, + CD273E2621B1EDD2006C4D84 /* SDL_RLEaccel_c.h */, + CD273E2721B1EDD2006C4D84 /* SDL_RLEaccel.c */, + CD273E2821B1EDD2006C4D84 /* SDL_shape_internals.h */, + CD273E2921B1EDD2006C4D84 /* SDL_shape.c */, + CD273E2A21B1EDD2006C4D84 /* SDL_stretch.c */, + CD273E2B21B1EDD2006C4D84 /* SDL_surface.c */, + CD273E2C21B1EDD2006C4D84 /* SDL_sysvideo.h */, + CD273E2D21B1EDD2006C4D84 /* SDL_video.c */, + CD273E2E21B1EDD2006C4D84 /* SDL_vulkan_internal.h */, + CD273E2F21B1EDD2006C4D84 /* SDL_vulkan_utils.c */, + CD273E3021B1EDD2006C4D84 /* SDL_yuv_c.h */, + CD273E3121B1EDD2006C4D84 /* SDL_yuv.c */, ); name = video; sourceTree = ""; @@ -10989,8 +11139,8 @@ isa = PBXGroup; children = ( CD795D8617F0853B006AEB47 /* unix */, - CD795D8717F08548006AEB47 /* SDL_timer.c */, - CD795D8817F08548006AEB47 /* SDL_timer_c.h */, + CD273D7521B1ED6B006C4D84 /* SDL_timer_c.h */, + CD273D7621B1ED6B006C4D84 /* SDL_timer.c */, ); name = timer; sourceTree = ""; @@ -10999,9 +11149,9 @@ isa = PBXGroup; children = ( CD795D8D17F08553006AEB47 /* pthread */, - CD795D8E17F08560006AEB47 /* SDL_systhread.h */, - CD795D8F17F08560006AEB47 /* SDL_thread.c */, - CD795D9017F08560006AEB47 /* SDL_thread_c.h */, + CD273D6121B1ED53006C4D84 /* SDL_systhread.h */, + CD273D6221B1ED53006C4D84 /* SDL_thread_c.h */, + CD273D6321B1ED53006C4D84 /* SDL_thread.c */, ); name = thread; sourceTree = ""; @@ -11009,12 +11159,12 @@ CD795CCC17F08480006AEB47 /* stdlib */ = { isa = PBXGroup; children = ( - CD795DA217F08574006AEB47 /* SDL_getenv.c */, - CD795DA317F08574006AEB47 /* SDL_iconv.c */, - CD795DA417F08574006AEB47 /* SDL_malloc.c */, - CD795DA517F08574006AEB47 /* SDL_qsort.c */, - CD795DA617F08574006AEB47 /* SDL_stdlib.c */, - CD795DA717F08574006AEB47 /* SDL_string.c */, + CD273D5521B1ED44006C4D84 /* SDL_getenv.c */, + CD273D5621B1ED44006C4D84 /* SDL_iconv.c */, + CD273D5721B1ED44006C4D84 /* SDL_malloc.c */, + CD273D5821B1ED44006C4D84 /* SDL_qsort.c */, + CD273D5921B1ED44006C4D84 /* SDL_stdlib.c */, + CD273D5A21B1ED44006C4D84 /* SDL_string.c */, ); name = stdlib; sourceTree = ""; @@ -11022,14 +11172,16 @@ CD795CCD17F08485006AEB47 /* render */ = { isa = PBXGroup; children = ( + CD273C5521B12381006C4D84 /* metal */, CD795DAF17F08584006AEB47 /* opengl */, + CD273C5621B123AC006C4D84 /* opengles2 */, CD795DAE17F0857F006AEB47 /* software */, - CD795DB017F08591006AEB47 /* mmx.h */, - CD795DB117F08591006AEB47 /* SDL_render.c */, - CD795DB217F08591006AEB47 /* SDL_sysrender.h */, - CD795DB317F08591006AEB47 /* SDL_yuv_mmx.c */, - CD795DB417F08591006AEB47 /* SDL_yuv_sw_c.h */, - CD795DB517F08591006AEB47 /* SDL_yuv_sw.c */, + CD273D3F21B1ED1B006C4D84 /* SDL_d3dmath.c */, + CD273D4021B1ED1B006C4D84 /* SDL_d3dmath.h */, + CD273D4121B1ED1B006C4D84 /* SDL_render.c */, + CD273D4221B1ED1B006C4D84 /* SDL_sysrender.h */, + CD273D4321B1ED1B006C4D84 /* SDL_yuv_sw_c.h */, + CD273D4421B1ED1B006C4D84 /* SDL_yuv_sw.c */, ); name = render; sourceTree = ""; @@ -11038,7 +11190,8 @@ isa = PBXGroup; children = ( CD795DE217F085AE006AEB47 /* macosx */, - CD795DE317F085BB006AEB47 /* SDL_power.c */, + CD273D0721B1ECCD006C4D84 /* SDL_power.c */, + CD273D0821B1ECCD006C4D84 /* SDL_syspower.h */, ); name = power; sourceTree = ""; @@ -11055,10 +11208,12 @@ isa = PBXGroup; children = ( CD795DEA17F085D8006AEB47 /* darwin */, - CD795DEB17F085E3006AEB47 /* SDL_joystick.c */, - CD795DEC17F085E3006AEB47 /* SDL_joystick_c.h */, - CD795DED17F085E3006AEB47 /* SDL_gamecontroller.c */, - CD795DEE17F085E3006AEB47 /* SDL_sysjoystick.h */, + CD273C4821B12348006C4D84 /* hidapi */, + CD273CEB21B1EC69006C4D84 /* SDL_gamecontroller.c */, + CD273CEC21B1EC69006C4D84 /* SDL_gamecontrollerdb.h */, + CD273CED21B1EC69006C4D84 /* SDL_joystick_c.h */, + CD273CEE21B1EC69006C4D84 /* SDL_joystick.c */, + CD273CEF21B1EC69006C4D84 /* SDL_sysjoystick.h */, ); name = joystick; sourceTree = ""; @@ -11067,9 +11222,9 @@ isa = PBXGroup; children = ( CD795DF717F085EF006AEB47 /* darwin */, - CD795DF817F085FD006AEB47 /* SDL_haptic.c */, - CD795DF917F085FD006AEB47 /* SDL_haptic_c.h */, - CD795DFA17F085FD006AEB47 /* SDL_syshaptic.h */, + CD273CDF21B1EC42006C4D84 /* SDL_haptic_c.h */, + CD273CE021B1EC42006C4D84 /* SDL_haptic.c */, + CD273CE121B1EC42006C4D84 /* SDL_syshaptic.h */, ); name = haptic; sourceTree = ""; @@ -11078,7 +11233,7 @@ isa = PBXGroup; children = ( CD795E0017F08610006AEB47 /* cocoa */, - CD795E0117F08627006AEB47 /* SDL_rwops.c */, + CD273CD721B1EC10006C4D84 /* SDL_rwops.c */, ); name = file; sourceTree = ""; @@ -11086,29 +11241,32 @@ CD795CD317F084B5006AEB47 /* events */ = { isa = PBXGroup; children = ( - CD795E0717F08638006AEB47 /* blank_cursor.h */, - CD795E0817F08638006AEB47 /* default_cursor.h */, - CD795E0917F08638006AEB47 /* scancodes_darwin.h */, - CD795E0A17F08638006AEB47 /* scancodes_linux.h */, - CD795E0B17F08638006AEB47 /* scancodes_xfree86.h */, - CD795E0C17F08638006AEB47 /* SDL_clipboardevents.c */, - CD795E0D17F08638006AEB47 /* SDL_clipboardevents_c.h */, - CD795E0E17F08638006AEB47 /* SDL_dropevents_c.h */, - CD795E0F17F08638006AEB47 /* SDL_dropevents.c */, - CD795E1017F08638006AEB47 /* SDL_events.c */, - CD795E1117F08638006AEB47 /* SDL_events_c.h */, - CD795E1217F08638006AEB47 /* SDL_gesture.c */, - CD795E1317F08638006AEB47 /* SDL_gesture_c.h */, - CD795E1417F08638006AEB47 /* SDL_keyboard.c */, - CD795E1517F08638006AEB47 /* SDL_keyboard_c.h */, - CD795E1617F08638006AEB47 /* SDL_mouse.c */, - CD795E1717F08638006AEB47 /* SDL_mouse_c.h */, - CD795E1817F08638006AEB47 /* SDL_quit.c */, - CD795E1917F08638006AEB47 /* SDL_sysevents.h */, - CD795E1A17F08638006AEB47 /* SDL_touch.c */, - CD795E1B17F08638006AEB47 /* SDL_touch_c.h */, - CD795E1C17F08638006AEB47 /* SDL_windowevents.c */, - CD795E1D17F08638006AEB47 /* SDL_windowevents_c.h */, + CD273CA321B1EBF5006C4D84 /* blank_cursor.h */, + CD273CA421B1EBF5006C4D84 /* default_cursor.h */, + CD273CA521B1EBF5006C4D84 /* scancodes_darwin.h */, + CD273CA621B1EBF5006C4D84 /* scancodes_linux.h */, + CD273CA721B1EBF5006C4D84 /* scancodes_windows.h */, + CD273CA821B1EBF5006C4D84 /* scancodes_xfree86.h */, + CD273CA921B1EBF5006C4D84 /* SDL_clipboardevents_c.h */, + CD273CAA21B1EBF5006C4D84 /* SDL_clipboardevents.c */, + CD273CAB21B1EBF5006C4D84 /* SDL_displayevents_c.h */, + CD273CAC21B1EBF5006C4D84 /* SDL_displayevents.c */, + CD273CAD21B1EBF5006C4D84 /* SDL_dropevents_c.h */, + CD273CAE21B1EBF5006C4D84 /* SDL_dropevents.c */, + CD273CAF21B1EBF5006C4D84 /* SDL_events_c.h */, + CD273CB021B1EBF5006C4D84 /* SDL_events.c */, + CD273CB121B1EBF5006C4D84 /* SDL_gesture_c.h */, + CD273CB221B1EBF5006C4D84 /* SDL_gesture.c */, + CD273CB321B1EBF5006C4D84 /* SDL_keyboard_c.h */, + CD273CB421B1EBF5006C4D84 /* SDL_keyboard.c */, + CD273CB521B1EBF5006C4D84 /* SDL_mouse_c.h */, + CD273CB621B1EBF5006C4D84 /* SDL_mouse.c */, + CD273CB721B1EBF5006C4D84 /* SDL_quit.c */, + CD273CB821B1EBF5006C4D84 /* SDL_sysevents.h */, + CD273CB921B1EBF5006C4D84 /* SDL_touch_c.h */, + CD273CBA21B1EBF5006C4D84 /* SDL_touch.c */, + CD273CBB21B1EBF5006C4D84 /* SDL_windowevents_c.h */, + CD273CBC21B1EBF5006C4D84 /* SDL_windowevents.c */, ); name = events; sourceTree = ""; @@ -11116,7 +11274,8 @@ CD795CD417F084BA006AEB47 /* cpuinfo */ = { isa = PBXGroup; children = ( - CD795E3517F0863E006AEB47 /* SDL_cpuinfo.c */, + CD273C9721B1EBDE006C4D84 /* SDL_cpuinfo.c */, + CD273C9821B1EBDE006C4D84 /* SDL_simd.h */, ); name = cpuinfo; sourceTree = ""; @@ -11127,17 +11286,16 @@ CD795E3717F08646006AEB47 /* disk */, CD795E3817F0864F006AEB47 /* dummy */, CD795E3917F08655006AEB47 /* coreaudio */, - CD795E3A17F08667006AEB47 /* SDL_audio.c */, - CD795E3B17F08667006AEB47 /* SDL_audio_c.h */, - CD795E3C17F08667006AEB47 /* SDL_audiocvt.c */, - CD795E3D17F08667006AEB47 /* SDL_audiodev.c */, - CD795E3E17F08667006AEB47 /* SDL_audiodev_c.h */, - CD795E3F17F08667006AEB47 /* SDL_audiomem.h */, - CD795E4017F08667006AEB47 /* SDL_audiotypecvt.c */, - CD795E4117F08667006AEB47 /* SDL_mixer.c */, - CD795E4217F08667006AEB47 /* SDL_sysaudio.h */, - CD795E4317F08667006AEB47 /* SDL_wave.c */, - CD795E4417F08667006AEB47 /* SDL_wave.h */, + CD273C7721B1EBAA006C4D84 /* SDL_audio_c.h */, + CD273C7821B1EBAA006C4D84 /* SDL_audio.c */, + CD273C7921B1EBAA006C4D84 /* SDL_audiocvt.c */, + CD273C7A21B1EBAA006C4D84 /* SDL_audiodev_c.h */, + CD273C7B21B1EBAA006C4D84 /* SDL_audiodev.c */, + CD273C7C21B1EBAA006C4D84 /* SDL_audiotypecvt.c */, + CD273C7D21B1EBAA006C4D84 /* SDL_mixer.c */, + CD273C7E21B1EBAA006C4D84 /* SDL_sysaudio.h */, + CD273C7F21B1EBAA006C4D84 /* SDL_wave.c */, + CD273C8021B1EBAA006C4D84 /* SDL_wave.h */, ); name = audio; sourceTree = ""; @@ -11145,8 +11303,8 @@ CD795CD617F084C9006AEB47 /* atomic */ = { isa = PBXGroup; children = ( - CD795E5C17F08689006AEB47 /* SDL_atomic.c */, - CD795E5D17F08689006AEB47 /* SDL_spinlock.c */, + CD273C7321B1EB96006C4D84 /* SDL_atomic.c */, + CD273C7421B1EB96006C4D84 /* SDL_spinlock.c */, ); name = atomic; sourceTree = ""; @@ -11154,38 +11312,43 @@ CD795CD717F084ED006AEB47 /* x11 */ = { isa = PBXGroup; children = ( - CD795D0E17F08522006AEB47 /* imKStoUCS.c */, - CD795D0F17F08522006AEB47 /* imKStoUCS.h */, - CD795D1017F08522006AEB47 /* SDL_x11clipboard.c */, - CD795D1117F08522006AEB47 /* SDL_x11clipboard.h */, - CD795D1217F08522006AEB47 /* SDL_x11dyn.c */, - CD795D1317F08522006AEB47 /* SDL_x11dyn.h */, - CD795D1417F08522006AEB47 /* SDL_x11events.c */, - CD795D1517F08522006AEB47 /* SDL_x11events.h */, - CD795D1617F08522006AEB47 /* SDL_x11framebuffer.c */, - CD795D1717F08522006AEB47 /* SDL_x11framebuffer.h */, - CD795D1817F08522006AEB47 /* SDL_x11keyboard.c */, - CD795D1917F08522006AEB47 /* SDL_x11keyboard.h */, - CD795D1A17F08522006AEB47 /* SDL_x11messagebox.c */, - CD795D1B17F08522006AEB47 /* SDL_x11modes.c */, - CD795D1C17F08522006AEB47 /* SDL_x11modes.h */, - CD795D1D17F08522006AEB47 /* SDL_x11mouse.c */, - CD795D1E17F08522006AEB47 /* SDL_x11mouse.h */, - CD795D1F17F08522006AEB47 /* SDL_x11opengl.c */, - CD795D2017F08522006AEB47 /* SDL_x11opengl.h */, - CD795D2117F08522006AEB47 /* SDL_x11opengles.c */, - CD795D2217F08522006AEB47 /* SDL_x11opengles.h */, - CD795D2317F08522006AEB47 /* SDL_x11shape.c */, - CD795D2417F08522006AEB47 /* SDL_x11shape.h */, - CD795D2517F08522006AEB47 /* SDL_x11sym.h */, - CD795D2617F08522006AEB47 /* SDL_x11touch.c */, - CD795D2717F08522006AEB47 /* SDL_x11touch.h */, - CD795D2817F08522006AEB47 /* SDL_x11video.c */, - CD795D2917F08522006AEB47 /* SDL_x11video.h */, - CD795D2A17F08522006AEB47 /* SDL_x11window.c */, - CD795D2B17F08522006AEB47 /* SDL_x11window.h */, - CD795D2C17F08522006AEB47 /* SDL_x11xinput2.c */, - CD795D2D17F08522006AEB47 /* SDL_x11xinput2.h */, + CD273DBF21B1EDA6006C4D84 /* edid-parse.c */, + CD273DC021B1EDA6006C4D84 /* edid.h */, + CD273DC121B1EDA6006C4D84 /* imKStoUCS.c */, + CD273DC221B1EDA6006C4D84 /* imKStoUCS.h */, + CD273DC321B1EDA6006C4D84 /* SDL_x11clipboard.c */, + CD273DC421B1EDA6006C4D84 /* SDL_x11clipboard.h */, + CD273DC521B1EDA6006C4D84 /* SDL_x11dyn.c */, + CD273DC621B1EDA6006C4D84 /* SDL_x11dyn.h */, + CD273DC721B1EDA6006C4D84 /* SDL_x11events.c */, + CD273DC821B1EDA6006C4D84 /* SDL_x11events.h */, + CD273DC921B1EDA6006C4D84 /* SDL_x11framebuffer.c */, + CD273DCA21B1EDA6006C4D84 /* SDL_x11framebuffer.h */, + CD273DCB21B1EDA6006C4D84 /* SDL_x11keyboard.c */, + CD273DCC21B1EDA6006C4D84 /* SDL_x11keyboard.h */, + CD273DCD21B1EDA6006C4D84 /* SDL_x11messagebox.c */, + CD273DCE21B1EDA6006C4D84 /* SDL_x11messagebox.h */, + CD273DCF21B1EDA6006C4D84 /* SDL_x11modes.c */, + CD273DD021B1EDA6006C4D84 /* SDL_x11modes.h */, + CD273DD121B1EDA6006C4D84 /* SDL_x11mouse.c */, + CD273DD221B1EDA6006C4D84 /* SDL_x11mouse.h */, + CD273DD321B1EDA6006C4D84 /* SDL_x11opengl.c */, + CD273DD421B1EDA6006C4D84 /* SDL_x11opengl.h */, + CD273DD521B1EDA6006C4D84 /* SDL_x11opengles.c */, + CD273DD621B1EDA6006C4D84 /* SDL_x11opengles.h */, + CD273DD721B1EDA6006C4D84 /* SDL_x11shape.c */, + CD273DD821B1EDA6006C4D84 /* SDL_x11shape.h */, + CD273DD921B1EDA6006C4D84 /* SDL_x11sym.h */, + CD273DDA21B1EDA6006C4D84 /* SDL_x11touch.c */, + CD273DDB21B1EDA6006C4D84 /* SDL_x11touch.h */, + CD273DDC21B1EDA6006C4D84 /* SDL_x11video.c */, + CD273DDD21B1EDA6006C4D84 /* SDL_x11video.h */, + CD273DDE21B1EDA6006C4D84 /* SDL_x11vulkan.c */, + CD273DDF21B1EDA6006C4D84 /* SDL_x11vulkan.h */, + CD273DE021B1EDA6006C4D84 /* SDL_x11window.c */, + CD273DE121B1EDA6006C4D84 /* SDL_x11window.h */, + CD273DE221B1EDA6006C4D84 /* SDL_x11xinput2.c */, + CD273DE321B1EDA6006C4D84 /* SDL_x11xinput2.h */, ); name = x11; sourceTree = ""; @@ -11193,12 +11356,12 @@ CD795CD817F084F6006AEB47 /* dummy */ = { isa = PBXGroup; children = ( - CD795D4E17F0852B006AEB47 /* SDL_nullevents.c */, - CD795D4F17F0852B006AEB47 /* SDL_nullevents_c.h */, - CD795D5017F0852B006AEB47 /* SDL_nullframebuffer_c.h */, - CD795D5117F0852B006AEB47 /* SDL_nullframebuffer.c */, - CD795D5217F0852B006AEB47 /* SDL_nullvideo.c */, - CD795D5317F0852B006AEB47 /* SDL_nullvideo.h */, + CD273DB321B1ED93006C4D84 /* SDL_nullevents_c.h */, + CD273DB421B1ED93006C4D84 /* SDL_nullevents.c */, + CD273DB521B1ED93006C4D84 /* SDL_nullframebuffer_c.h */, + CD273DB621B1ED93006C4D84 /* SDL_nullframebuffer.c */, + CD273DB721B1ED93006C4D84 /* SDL_nullvideo.c */, + CD273DB821B1ED93006C4D84 /* SDL_nullvideo.h */, ); name = dummy; sourceTree = ""; @@ -11206,28 +11369,34 @@ CD795CD917F084FB006AEB47 /* cocoa */ = { isa = PBXGroup; children = ( - CD795D5A17F08532006AEB47 /* SDL_cocoaclipboard.h */, - CD795D5B17F08532006AEB47 /* SDL_cocoaclipboard.m */, - CD795D5C17F08532006AEB47 /* SDL_cocoaevents.h */, - CD795D5D17F08532006AEB47 /* SDL_cocoaevents.m */, - CD795D5E17F08532006AEB47 /* SDL_cocoakeyboard.h */, - CD795D5F17F08532006AEB47 /* SDL_cocoakeyboard.m */, - CD795D6017F08532006AEB47 /* SDL_cocoamessagebox.h */, - CD795D6117F08532006AEB47 /* SDL_cocoamessagebox.m */, - CD795D6217F08532006AEB47 /* SDL_cocoamodes.h */, - CD795D6317F08532006AEB47 /* SDL_cocoamodes.m */, - CD795D6417F08532006AEB47 /* SDL_cocoamouse.h */, - CD795D6517F08532006AEB47 /* SDL_cocoamouse.m */, - CD795D6617F08532006AEB47 /* SDL_cocoamousetap.h */, - CD795D6717F08532006AEB47 /* SDL_cocoamousetap.m */, - CD795D6817F08532006AEB47 /* SDL_cocoaopengl.h */, - CD795D6917F08532006AEB47 /* SDL_cocoaopengl.m */, - CD795D6A17F08532006AEB47 /* SDL_cocoashape.h */, - CD795D6B17F08532006AEB47 /* SDL_cocoashape.m */, - CD795D6C17F08532006AEB47 /* SDL_cocoavideo.h */, - CD795D6D17F08532006AEB47 /* SDL_cocoavideo.m */, - CD795D6E17F08532006AEB47 /* SDL_cocoawindow.h */, - CD795D6F17F08532006AEB47 /* SDL_cocoawindow.m */, + CD273D7B21B1ED8A006C4D84 /* SDL_cocoaclipboard.h */, + CD273D7C21B1ED8A006C4D84 /* SDL_cocoaclipboard.m */, + CD273D7D21B1ED8A006C4D84 /* SDL_cocoaevents.h */, + CD273D7E21B1ED8A006C4D84 /* SDL_cocoaevents.m */, + CD273D7F21B1ED8A006C4D84 /* SDL_cocoakeyboard.h */, + CD273D8021B1ED8A006C4D84 /* SDL_cocoakeyboard.m */, + CD273D8121B1ED8A006C4D84 /* SDL_cocoamessagebox.h */, + CD273D8221B1ED8A006C4D84 /* SDL_cocoamessagebox.m */, + CD273D8321B1ED8A006C4D84 /* SDL_cocoametalview.h */, + CD273D8421B1ED8A006C4D84 /* SDL_cocoametalview.m */, + CD273D8521B1ED8A006C4D84 /* SDL_cocoamodes.h */, + CD273D8621B1ED8A006C4D84 /* SDL_cocoamodes.m */, + CD273D8721B1ED8A006C4D84 /* SDL_cocoamouse.h */, + CD273D8821B1ED8A006C4D84 /* SDL_cocoamouse.m */, + CD273D8921B1ED8A006C4D84 /* SDL_cocoamousetap.h */, + CD273D8A21B1ED8A006C4D84 /* SDL_cocoamousetap.m */, + CD273D8B21B1ED8A006C4D84 /* SDL_cocoaopengl.h */, + CD273D8C21B1ED8A006C4D84 /* SDL_cocoaopengl.m */, + CD273D8D21B1ED8A006C4D84 /* SDL_cocoaopengles.h */, + CD273D8E21B1ED8A006C4D84 /* SDL_cocoaopengles.m */, + CD273D8F21B1ED8A006C4D84 /* SDL_cocoashape.h */, + CD273D9021B1ED8A006C4D84 /* SDL_cocoashape.m */, + CD273D9121B1ED8A006C4D84 /* SDL_cocoavideo.h */, + CD273D9221B1ED8A006C4D84 /* SDL_cocoavideo.m */, + CD273D9321B1ED8A006C4D84 /* SDL_cocoavulkan.h */, + CD273D9421B1ED8A006C4D84 /* SDL_cocoavulkan.m */, + CD273D9521B1ED8A006C4D84 /* SDL_cocoawindow.h */, + CD273D9621B1ED8A006C4D84 /* SDL_cocoawindow.m */, ); name = cocoa; sourceTree = ""; @@ -11235,7 +11404,7 @@ CD795D8617F0853B006AEB47 /* unix */ = { isa = PBXGroup; children = ( - CD795D8B17F0854D006AEB47 /* SDL_systimer.c */, + CD273D7921B1ED74006C4D84 /* SDL_systimer.c */, ); name = unix; sourceTree = ""; @@ -11243,13 +11412,13 @@ CD795D8D17F08553006AEB47 /* pthread */ = { isa = PBXGroup; children = ( - CD795D9417F08569006AEB47 /* SDL_syscond.c */, - CD795D9517F08569006AEB47 /* SDL_sysmutex.c */, - CD795D9617F08569006AEB47 /* SDL_sysmutex_c.h */, - CD795D9717F08569006AEB47 /* SDL_syssem.c */, - CD795D9817F08569006AEB47 /* SDL_systhread.c */, - CD795D9917F08569006AEB47 /* SDL_systhread_c.h */, - CD795D9A17F08569006AEB47 /* SDL_systls.c */, + CD273D6721B1ED5C006C4D84 /* SDL_syscond.c */, + CD273D6821B1ED5C006C4D84 /* SDL_sysmutex_c.h */, + CD273D6921B1ED5C006C4D84 /* SDL_sysmutex.c */, + CD273D6A21B1ED5C006C4D84 /* SDL_syssem.c */, + CD273D6B21B1ED5C006C4D84 /* SDL_systhread_c.h */, + CD273D6C21B1ED5C006C4D84 /* SDL_systhread.c */, + CD273D6D21B1ED5C006C4D84 /* SDL_systls.c */, ); name = pthread; sourceTree = ""; @@ -11257,21 +11426,21 @@ CD795DAE17F0857F006AEB47 /* software */ = { isa = PBXGroup; children = ( - CD795DBC17F0859D006AEB47 /* SDL_blendfillrect.c */, - CD795DBD17F0859D006AEB47 /* SDL_blendfillrect.h */, - CD795DBE17F0859D006AEB47 /* SDL_blendline.c */, - CD795DBF17F0859D006AEB47 /* SDL_blendline.h */, - CD795DC017F0859D006AEB47 /* SDL_blendpoint.c */, - CD795DC117F0859D006AEB47 /* SDL_blendpoint.h */, - CD795DC217F0859D006AEB47 /* SDL_draw.h */, - CD795DC317F0859D006AEB47 /* SDL_drawline.c */, - CD795DC417F0859D006AEB47 /* SDL_drawline.h */, - CD795DC517F0859D006AEB47 /* SDL_drawpoint.c */, - CD795DC617F0859D006AEB47 /* SDL_drawpoint.h */, - CD795DC717F0859D006AEB47 /* SDL_render_sw.c */, - CD795DC817F0859D006AEB47 /* SDL_render_sw_c.h */, - CD795DC917F0859D006AEB47 /* SDL_rotate.c */, - CD795DCA17F0859D006AEB47 /* SDL_rotate.h */, + CD273D2121B1ED11006C4D84 /* SDL_blendfillrect.c */, + CD273D2221B1ED11006C4D84 /* SDL_blendfillrect.h */, + CD273D2321B1ED11006C4D84 /* SDL_blendline.c */, + CD273D2421B1ED11006C4D84 /* SDL_blendline.h */, + CD273D2521B1ED11006C4D84 /* SDL_blendpoint.c */, + CD273D2621B1ED11006C4D84 /* SDL_blendpoint.h */, + CD273D2721B1ED11006C4D84 /* SDL_draw.h */, + CD273D2821B1ED11006C4D84 /* SDL_drawline.c */, + CD273D2921B1ED11006C4D84 /* SDL_drawline.h */, + CD273D2A21B1ED11006C4D84 /* SDL_drawpoint.c */, + CD273D2B21B1ED11006C4D84 /* SDL_drawpoint.h */, + CD273D2C21B1ED11006C4D84 /* SDL_render_sw_c.h */, + CD273D2D21B1ED11006C4D84 /* SDL_render_sw.c */, + CD273D2E21B1ED11006C4D84 /* SDL_rotate.c */, + CD273D2F21B1ED11006C4D84 /* SDL_rotate.h */, ); name = software; sourceTree = ""; @@ -11279,10 +11448,10 @@ CD795DAF17F08584006AEB47 /* opengl */ = { isa = PBXGroup; children = ( - CD795DDA17F085A5006AEB47 /* SDL_glfuncs.h */, - CD795DDB17F085A5006AEB47 /* SDL_render_gl.c */, - CD795DDC17F085A5006AEB47 /* SDL_shaders_gl.c */, - CD795DDD17F085A5006AEB47 /* SDL_shaders_gl.h */, + CD273D1121B1ECFA006C4D84 /* SDL_glfuncs.h */, + CD273D1221B1ECFA006C4D84 /* SDL_render_gl.c */, + CD273D1321B1ECFA006C4D84 /* SDL_shaders_gl.c */, + CD273D1421B1ECFA006C4D84 /* SDL_shaders_gl.h */, ); name = opengl; sourceTree = ""; @@ -11290,7 +11459,7 @@ CD795DE217F085AE006AEB47 /* macosx */ = { isa = PBXGroup; children = ( - CD795DE517F085C1006AEB47 /* SDL_syspower.c */, + CD273D0B21B1ECD6006C4D84 /* SDL_syspower.c */, ); name = macosx; sourceTree = ""; @@ -11298,7 +11467,7 @@ CD795DE717F085C9006AEB47 /* dlopen */ = { isa = PBXGroup; children = ( - CD795DE817F085D2006AEB47 /* SDL_sysloadso.c */, + CD273D0521B1EC98006C4D84 /* SDL_sysloadso.c */, ); name = dlopen; sourceTree = ""; @@ -11306,8 +11475,8 @@ CD795DEA17F085D8006AEB47 /* darwin */ = { isa = PBXGroup; children = ( - CD795DF317F085E9006AEB47 /* SDL_sysjoystick.c */, - CD795DF417F085E9006AEB47 /* SDL_sysjoystick_c.h */, + CD273D0121B1EC84006C4D84 /* SDL_sysjoystick_c.h */, + CD273D0221B1EC84006C4D84 /* SDL_sysjoystick.c */, ); name = darwin; sourceTree = ""; @@ -11315,7 +11484,8 @@ CD795DF717F085EF006AEB47 /* darwin */ = { isa = PBXGroup; children = ( - CD795DFE17F08606006AEB47 /* SDL_syshaptic.c */, + CD273CE521B1EC4A006C4D84 /* SDL_syshaptic_c.h */, + CD273CE621B1EC4A006C4D84 /* SDL_syshaptic.c */, ); name = darwin; sourceTree = ""; @@ -11323,8 +11493,8 @@ CD795E0017F08610006AEB47 /* cocoa */ = { isa = PBXGroup; children = ( - CD795E0317F0862D006AEB47 /* SDL_rwopsbundlesupport.h */, - CD795E0417F0862D006AEB47 /* SDL_rwopsbundlesupport.m */, + CD273CD921B1EC19006C4D84 /* SDL_rwopsbundlesupport.h */, + CD273CDA21B1EC19006C4D84 /* SDL_rwopsbundlesupport.m */, ); name = cocoa; sourceTree = ""; @@ -11332,8 +11502,8 @@ CD795E3717F08646006AEB47 /* disk */ = { isa = PBXGroup; children = ( - CD795E5817F0867B006AEB47 /* SDL_diskaudio.c */, - CD795E5917F0867B006AEB47 /* SDL_diskaudio.h */, + CD273C8B21B1EBB2006C4D84 /* SDL_diskaudio.c */, + CD273C8C21B1EBB2006C4D84 /* SDL_diskaudio.h */, ); name = disk; sourceTree = ""; @@ -11341,8 +11511,8 @@ CD795E3817F0864F006AEB47 /* dummy */ = { isa = PBXGroup; children = ( - CD795E5417F08675006AEB47 /* SDL_dummyaudio.c */, - CD795E5517F08675006AEB47 /* SDL_dummyaudio.h */, + CD273C8F21B1EBB9006C4D84 /* SDL_dummyaudio.c */, + CD273C9021B1EBB9006C4D84 /* SDL_dummyaudio.h */, ); name = dummy; sourceTree = ""; @@ -11350,8 +11520,8 @@ CD795E3917F08655006AEB47 /* coreaudio */ = { isa = PBXGroup; children = ( - CD795E5017F0866D006AEB47 /* SDL_coreaudio.c */, - CD795E5117F0866D006AEB47 /* SDL_coreaudio.h */, + CD273C9321B1EBC4006C4D84 /* SDL_coreaudio.h */, + CD273C9421B1EBC4006C4D84 /* SDL_coreaudio.m */, ); name = coreaudio; sourceTree = ""; @@ -11367,21 +11537,26 @@ CD795CD217F084AF006AEB47 /* file */, CDF237DA1CAA719700A45E31 /* filesystem */, CD795CD117F084A8006AEB47 /* haptic */, + CD273C4321B122A1006C4D84 /* hidapi */, CD795CD017F084A0006AEB47 /* joystick */, CD795CCF17F08499006AEB47 /* loadso */, CD795CCE17F08493006AEB47 /* power */, CD795CCD17F08485006AEB47 /* render */, + CD273C4421B122B5006C4D84 /* sensor */, CD795CCC17F08480006AEB47 /* stdlib */, CD795CCB17F08479006AEB47 /* thread */, CD795CCA17F08467006AEB47 /* timer */, CD795CC917F0845D006AEB47 /* video */, - CD795CBB17F08459006AEB47 /* SDL_assert_c.h */, - CD795CBC17F08459006AEB47 /* SDL_assert.c */, - CD795CBD17F08459006AEB47 /* SDL_error_c.h */, - CD795CBE17F08459006AEB47 /* SDL_error.c */, - CD795CBF17F08459006AEB47 /* SDL_hints.c */, - CD795CC017F08459006AEB47 /* SDL_log.c */, - CD795CC117F08459006AEB47 /* SDL.c */, + CD273E5321B1EDE2006C4D84 /* SDL_assert_c.h */, + CD273E5421B1EDE2006C4D84 /* SDL_assert.c */, + CD273E5521B1EDE2006C4D84 /* SDL_dataqueue.c */, + CD273E5621B1EDE2006C4D84 /* SDL_dataqueue.h */, + CD273E5721B1EDE2006C4D84 /* SDL_error_c.h */, + CD273E5821B1EDE2006C4D84 /* SDL_error.c */, + CD273E5921B1EDE2006C4D84 /* SDL_hints.c */, + CD273E5A21B1EDE2006C4D84 /* SDL_internal.h */, + CD273E5B21B1EDE2006C4D84 /* SDL_log.c */, + CD273E5C21B1EDE2006C4D84 /* SDL.c */, ); name = "Library Source"; sourceTree = ""; @@ -11389,88 +11564,68 @@ CD795E6117F08B97006AEB47 /* Public Headers */ = { isa = PBXGroup; children = ( - CDF2372F1CAA70CD00A45E31 /* begin_code.h */, - CDF237301CAA70CD00A45E31 /* close_code.h */, - CDF237311CAA70CD00A45E31 /* SDL_assert.h */, - CDF237321CAA70CD00A45E31 /* SDL_atomic.h */, - CDF237331CAA70CD00A45E31 /* SDL_audio.h */, - CDF237341CAA70CD00A45E31 /* SDL_bits.h */, - CDF237351CAA70CD00A45E31 /* SDL_blendmode.h */, - CDF237361CAA70CD00A45E31 /* SDL_clipboard.h */, - CDF237371CAA70CD00A45E31 /* SDL_config_android.h */, - CDF237381CAA70CD00A45E31 /* SDL_config_iphoneos.h */, - CDF237391CAA70CD00A45E31 /* SDL_config_macosx.h */, - CDF2373A1CAA70CD00A45E31 /* SDL_config_minimal.h */, - CDF2373B1CAA70CD00A45E31 /* SDL_config_pandora.h */, - CDF2373C1CAA70CD00A45E31 /* SDL_config_psp.h */, - CDF2373D1CAA70CD00A45E31 /* SDL_config_windows.h */, - CDF2373E1CAA70CD00A45E31 /* SDL_config_winrt.h */, - CDF2373F1CAA70CD00A45E31 /* SDL_config_wiz.h */, - CDF237401CAA70CD00A45E31 /* SDL_config.h */, - CDF237411CAA70CD00A45E31 /* SDL_config.h.cmake */, - CDF237421CAA70CD00A45E31 /* SDL_config.h.in */, - CDF237431CAA70CD00A45E31 /* SDL_copying.h */, - CDF237441CAA70CD00A45E31 /* SDL_cpuinfo.h */, - CDF237451CAA70CD00A45E31 /* SDL_egl.h */, - CDF237461CAA70CD00A45E31 /* SDL_endian.h */, - CDF237471CAA70CD00A45E31 /* SDL_error.h */, - CDF237481CAA70CD00A45E31 /* SDL_events.h */, - CDF237491CAA70CD00A45E31 /* SDL_filesystem.h */, - CDF2374A1CAA70CD00A45E31 /* SDL_gamecontroller.h */, - CDF2374B1CAA70CD00A45E31 /* SDL_gesture.h */, - CDF2374C1CAA70CD00A45E31 /* SDL_haptic.h */, - CDF2374D1CAA70CD00A45E31 /* SDL_hints.h */, - CDF2374E1CAA70CD00A45E31 /* SDL_joystick.h */, - CDF2374F1CAA70CD00A45E31 /* SDL_keyboard.h */, - CDF237501CAA70CD00A45E31 /* SDL_keycode.h */, - CDF237511CAA70CD00A45E31 /* SDL_loadso.h */, - CDF237521CAA70CD00A45E31 /* SDL_log.h */, - CDF237531CAA70CD00A45E31 /* SDL_main.h */, - CDF237541CAA70CD00A45E31 /* SDL_messagebox.h */, - CDF237551CAA70CD00A45E31 /* SDL_mouse.h */, - CDF237561CAA70CD00A45E31 /* SDL_mutex.h */, - CDF237571CAA70CD00A45E31 /* SDL_name.h */, - CDF237581CAA70CD00A45E31 /* SDL_opengl_glext.h */, - CDF237591CAA70CD00A45E31 /* SDL_opengl.h */, - CDF2375A1CAA70CD00A45E31 /* SDL_opengles.h */, - CDF2375B1CAA70CD00A45E31 /* SDL_opengles2_gl2.h */, - CDF2375C1CAA70CD00A45E31 /* SDL_opengles2_gl2ext.h */, - CDF2375D1CAA70CD00A45E31 /* SDL_opengles2_gl2platform.h */, - CDF2375E1CAA70CD00A45E31 /* SDL_opengles2_khrplatform.h */, - CDF2375F1CAA70CD00A45E31 /* SDL_opengles2.h */, - CDF237601CAA70CD00A45E31 /* SDL_pixels.h */, - CDF237611CAA70CD00A45E31 /* SDL_platform.h */, - CDF237621CAA70CD00A45E31 /* SDL_power.h */, - CDF237631CAA70CD00A45E31 /* SDL_quit.h */, - CDF237641CAA70CD00A45E31 /* SDL_rect.h */, - CDF237651CAA70CD00A45E31 /* SDL_render.h */, - CDF237661CAA70CD00A45E31 /* SDL_revision.h */, - CDF237671CAA70CD00A45E31 /* SDL_rwops.h */, - CDF237681CAA70CD00A45E31 /* SDL_scancode.h */, - CDF237691CAA70CD00A45E31 /* SDL_shape.h */, - CDF2376A1CAA70CD00A45E31 /* SDL_stdinc.h */, - CDF2376B1CAA70CD00A45E31 /* SDL_surface.h */, - CDF2376C1CAA70CD00A45E31 /* SDL_system.h */, - CDF2376D1CAA70CD00A45E31 /* SDL_syswm.h */, - CDF2376E1CAA70CD00A45E31 /* SDL_test_assert.h */, - CDF2376F1CAA70CD00A45E31 /* SDL_test_common.h */, - CDF237701CAA70CD00A45E31 /* SDL_test_compare.h */, - CDF237711CAA70CD00A45E31 /* SDL_test_crc32.h */, - CDF237721CAA70CD00A45E31 /* SDL_test_font.h */, - CDF237731CAA70CD00A45E31 /* SDL_test_fuzzer.h */, - CDF237741CAA70CD00A45E31 /* SDL_test_harness.h */, - CDF237751CAA70CD00A45E31 /* SDL_test_images.h */, - CDF237761CAA70CD00A45E31 /* SDL_test_log.h */, - CDF237771CAA70CD00A45E31 /* SDL_test_md5.h */, - CDF237781CAA70CD00A45E31 /* SDL_test_random.h */, - CDF237791CAA70CD00A45E31 /* SDL_test.h */, - CDF2377A1CAA70CD00A45E31 /* SDL_thread.h */, - CDF2377B1CAA70CD00A45E31 /* SDL_timer.h */, - CDF2377C1CAA70CD00A45E31 /* SDL_touch.h */, - CDF2377D1CAA70CD00A45E31 /* SDL_types.h */, - CDF2377E1CAA70CD00A45E31 /* SDL_version.h */, - CDF2377F1CAA70CD00A45E31 /* SDL_video.h */, - CDF237801CAA70CD00A45E31 /* SDL.h */, + CD273E6721B1EE03006C4D84 /* begin_code.h */, + CD273E6821B1EE03006C4D84 /* close_code.h */, + CD273E6921B1EE03006C4D84 /* SDL_assert.h */, + CD273E6A21B1EE03006C4D84 /* SDL_atomic.h */, + CD273E6B21B1EE03006C4D84 /* SDL_audio.h */, + CD273E6C21B1EE03006C4D84 /* SDL_bits.h */, + CD273E6D21B1EE03006C4D84 /* SDL_blendmode.h */, + CD273E6E21B1EE03006C4D84 /* SDL_clipboard.h */, + CD273E7121B1EE03006C4D84 /* SDL_config_macosx.h */, + CD273E7921B1EE03006C4D84 /* SDL_config.h */, + CD273E7C21B1EE03006C4D84 /* SDL_copying.h */, + CD273E7D21B1EE03006C4D84 /* SDL_cpuinfo.h */, + CD273E7E21B1EE03006C4D84 /* SDL_egl.h */, + CD273E7F21B1EE03006C4D84 /* SDL_endian.h */, + CD273E8021B1EE03006C4D84 /* SDL_error.h */, + CD273E8121B1EE03006C4D84 /* SDL_events.h */, + CD273E8221B1EE03006C4D84 /* SDL_filesystem.h */, + CD273E8321B1EE03006C4D84 /* SDL_gamecontroller.h */, + CD273E8421B1EE03006C4D84 /* SDL_gesture.h */, + CD273E8521B1EE03006C4D84 /* SDL_haptic.h */, + CD273E8621B1EE03006C4D84 /* SDL_hints.h */, + CD273E8721B1EE03006C4D84 /* SDL_joystick.h */, + CD273E8821B1EE03006C4D84 /* SDL_keyboard.h */, + CD273E8921B1EE03006C4D84 /* SDL_keycode.h */, + CD273E8A21B1EE03006C4D84 /* SDL_loadso.h */, + CD273E8B21B1EE03006C4D84 /* SDL_log.h */, + CD273E8C21B1EE03006C4D84 /* SDL_main.h */, + CD273E8D21B1EE03006C4D84 /* SDL_messagebox.h */, + CD273E8E21B1EE03006C4D84 /* SDL_mouse.h */, + CD273E8F21B1EE03006C4D84 /* SDL_mutex.h */, + CD273E9021B1EE03006C4D84 /* SDL_name.h */, + CD273E9121B1EE03006C4D84 /* SDL_opengl_glext.h */, + CD273E9221B1EE03006C4D84 /* SDL_opengl.h */, + CD273E9321B1EE03006C4D84 /* SDL_opengles.h */, + CD273E9421B1EE03006C4D84 /* SDL_opengles2_gl2.h */, + CD273E9521B1EE03006C4D84 /* SDL_opengles2_gl2ext.h */, + CD273E9621B1EE03006C4D84 /* SDL_opengles2_gl2platform.h */, + CD273E9721B1EE03006C4D84 /* SDL_opengles2_khrplatform.h */, + CD273E9821B1EE03006C4D84 /* SDL_opengles2.h */, + CD273E9921B1EE03006C4D84 /* SDL_pixels.h */, + CD273E9A21B1EE03006C4D84 /* SDL_platform.h */, + CD273E9B21B1EE03006C4D84 /* SDL_power.h */, + CD273E9C21B1EE03006C4D84 /* SDL_quit.h */, + CD273E9D21B1EE03006C4D84 /* SDL_rect.h */, + CD273E9E21B1EE03006C4D84 /* SDL_render.h */, + CD273E9F21B1EE03006C4D84 /* SDL_revision.h */, + CD273EA021B1EE03006C4D84 /* SDL_rwops.h */, + CD273EA121B1EE03006C4D84 /* SDL_scancode.h */, + CD273EA221B1EE03006C4D84 /* SDL_sensor.h */, + CD273EA321B1EE03006C4D84 /* SDL_shape.h */, + CD273EA421B1EE03006C4D84 /* SDL_stdinc.h */, + CD273EA521B1EE03006C4D84 /* SDL_surface.h */, + CD273EA621B1EE03006C4D84 /* SDL_system.h */, + CD273EA721B1EE03006C4D84 /* SDL_syswm.h */, + CD273EA821B1EE03006C4D84 /* SDL_thread.h */, + CD273EA921B1EE03006C4D84 /* SDL_timer.h */, + CD273EAA21B1EE03006C4D84 /* SDL_touch.h */, + CD273EAB21B1EE03006C4D84 /* SDL_types.h */, + CD273EAC21B1EE03006C4D84 /* SDL_version.h */, + CD273EAD21B1EE03006C4D84 /* SDL_video.h */, + CD273EAE21B1EE03006C4D84 /* SDL_vulkan.h */, + CD273EAF21B1EE03006C4D84 /* SDL.h */, ); name = "Public Headers"; sourceTree = ""; @@ -12590,10 +12745,10 @@ CDF237D11CAA710C00A45E31 /* dynapi */ = { isa = PBXGroup; children = ( - CDF237D21CAA715000A45E31 /* SDL_dynapi_overrides.h */, - CDF237D31CAA715000A45E31 /* SDL_dynapi_procs.h */, - CDF237D41CAA715000A45E31 /* SDL_dynapi.c */, - CDF237D51CAA715000A45E31 /* SDL_dynapi.h */, + CD273C9B21B1EBE8006C4D84 /* SDL_dynapi_overrides.h */, + CD273C9C21B1EBE8006C4D84 /* SDL_dynapi_procs.h */, + CD273C9D21B1EBE8006C4D84 /* SDL_dynapi.c */, + CD273C9E21B1EBE8006C4D84 /* SDL_dynapi.h */, ); name = dynapi; sourceTree = ""; @@ -12601,7 +12756,7 @@ CDF237DA1CAA719700A45E31 /* filesystem */ = { isa = PBXGroup; children = ( - CDF237DB1CAA71BC00A45E31 /* SDL_sysfilesystem.m */, + CD273AE321B11F82006C4D84 /* cocoa */, ); name = filesystem; sourceTree = ""; @@ -14076,219 +14231,226 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CDF2378C1CAA70CD00A45E31 /* SDL_config_minimal.h in Headers */, - CD32B54119F9EE610059D019 /* SDL_sysjoystick_c.h in Headers */, - CDF237881CAA70CD00A45E31 /* SDL_clipboard.h in Headers */, + CD273ED521B1EE03006C4D84 /* SDL_mouse.h in Headers */, + CD273CA021B1EBE8006C4D84 /* SDL_dynapi_procs.h in Headers */, + CD273CC721B1EBF5006C4D84 /* SDL_dropevents_c.h in Headers */, CD32B3C319F9EDD10059D019 /* SFMT-params11213.h in Headers */, + CD273CD321B1EBF5006C4D84 /* SDL_touch_c.h in Headers */, + CD273E5D21B1EDE2006C4D84 /* SDL_assert_c.h in Headers */, + CD273C9221B1EBB9006C4D84 /* SDL_dummyaudio.h in Headers */, + CD273ED021B1EE03006C4D84 /* SDL_keycode.h in Headers */, + CD273C9A21B1EBDE006C4D84 /* SDL_simd.h in Headers */, CD32B3C419F9EDD10059D019 /* SFMT-params44497.h in Headers */, - CD32B53819F9EE3F0059D019 /* SDL_windowevents_c.h in Headers */, - CD32B55219F9EEDC0059D019 /* SDL_blendpoint.h in Headers */, - CD32B52819F9EE3F0059D019 /* SDL_clipboardevents_c.h in Headers */, - CDF237A41CAA70CD00A45E31 /* SDL_messagebox.h in Headers */, - CDF237BC1CAA70CD00A45E31 /* SDL_system.h in Headers */, CD32B3C619F9EDD10059D019 /* SFMT-params1279.h in Headers */, - CD32B59719F9EF200059D019 /* imKStoUCS.h in Headers */, + CD273DB121B1ED8A006C4D84 /* SDL_cocoawindow.h in Headers */, + CD273E4021B1EDD2006C4D84 /* SDL_egl_c.h in Headers */, + CD273EF421B1EE03006C4D84 /* SDL_video.h in Headers */, + CD273D1521B1ECFA006C4D84 /* SDL_glfuncs.h in Headers */, CD32B3C719F9EDD10059D019 /* SFMT-params607.h in Headers */, - CDF237B81CAA70CD00A45E31 /* SDL_scancode.h in Headers */, - CD32B51E19F9EE340059D019 /* SDL_sysaudio.h in Headers */, - CDF237C61CAA70CD00A45E31 /* SDL_test_log.h in Headers */, - CD32B54919F9EED00059D019 /* SDL_glfuncs.h in Headers */, - CDF237C01CAA70CD00A45E31 /* SDL_test_compare.h in Headers */, - CDF237811CAA70CD00A45E31 /* begin_code.h in Headers */, - CD32B58A19F9EF140059D019 /* SDL_cocoashape.h in Headers */, - CD32B57419F9EF000059D019 /* SDL_systhread.h in Headers */, - CD32B52219F9EE3F0059D019 /* blank_cursor.h in Headers */, + CD273EF021B1EE03006C4D84 /* SDL_timer.h in Headers */, + CD273CC921B1EBF5006C4D84 /* SDL_events_c.h in Headers */, + CD273EC721B1EE03006C4D84 /* SDL_error.h in Headers */, + CD273EDC21B1EE03006C4D84 /* SDL_opengles2_gl2ext.h in Headers */, + CD273DED21B1EDA6006C4D84 /* SDL_x11events.h in Headers */, + CD273EEB21B1EE03006C4D84 /* SDL_stdinc.h in Headers */, + CD273D4921B1ED1B006C4D84 /* SDL_yuv_sw_c.h in Headers */, + CD273CC021B1EBF5006C4D84 /* scancodes_linux.h in Headers */, + CD273E0621B1EDA6006C4D84 /* SDL_x11window.h in Headers */, + CD273D0321B1EC84006C4D84 /* SDL_sysjoystick_c.h in Headers */, CD32B3C819F9EDD10059D019 /* SFMT-sse2.h in Headers */, - CD32B58619F9EF140059D019 /* SDL_cocoamousetap.h in Headers */, - CD32B5AD19F9EF200059D019 /* SDL_x11sym.h in Headers */, - CD32B53219F9EE3F0059D019 /* SDL_mouse_c.h in Headers */, - CDF237B41CAA70CD00A45E31 /* SDL_rect.h in Headers */, + CD273ED821B1EE03006C4D84 /* SDL_opengl_glext.h in Headers */, CD32B3C919F9EDD10059D019 /* SFMT-params132049.h in Headers */, - CDF237CC1CAA70CD00A45E31 /* SDL_touch.h in Headers */, CD32B3CA19F9EDD10059D019 /* SFMT-params4253.h in Headers */, - CDF237AD1CAA70CD00A45E31 /* SDL_opengles2_gl2platform.h in Headers */, - CD32B58819F9EF140059D019 /* SDL_cocoaopengl.h in Headers */, - CD32B57E19F9EF140059D019 /* SDL_cocoakeyboard.h in Headers */, - CDF237C51CAA70CD00A45E31 /* SDL_test_images.h in Headers */, - CD32B51B19F9EE340059D019 /* SDL_audiomem.h in Headers */, - CD32B52619F9EE3F0059D019 /* scancodes_xfree86.h in Headers */, - CD32B5B119F9EF200059D019 /* SDL_x11video.h in Headers */, - CDF2378F1CAA70CD00A45E31 /* SDL_config_windows.h in Headers */, - CD32B51719F9EE340059D019 /* SDL_audio_c.h in Headers */, - CD32B58419F9EF140059D019 /* SDL_cocoamouse.h in Headers */, - CDF237A21CAA70CD00A45E31 /* SDL_log.h in Headers */, + CD273D3E21B1ED11006C4D84 /* SDL_rotate.h in Headers */, + CD273CF421B1EC69006C4D84 /* SDL_sysjoystick.h in Headers */, + CD273E4521B1EDD2006C4D84 /* SDL_rect_c.h in Headers */, + CD273CE221B1EC42006C4D84 /* SDL_haptic_c.h in Headers */, + CD273EF521B1EE03006C4D84 /* SDL_vulkan.h in Headers */, + CD273D4621B1ED1B006C4D84 /* SDL_d3dmath.h in Headers */, + CD273DAF21B1ED8A006C4D84 /* SDL_cocoavulkan.h in Headers */, + CD273EE421B1EE03006C4D84 /* SDL_rect.h in Headers */, CD32B3D919F9EDD10059D019 /* ft2build.h in Headers */, - CDF237C91CAA70CD00A45E31 /* SDL_test.h in Headers */, - CD32B5C619F9EF260059D019 /* SDL_pixels_c.h in Headers */, - CD32B59F19F9EF200059D019 /* SDL_x11framebuffer.h in Headers */, + CD273DF721B1EDA6006C4D84 /* SDL_x11mouse.h in Headers */, CD32B3DA19F9EDD10059D019 /* ftconfig.h in Headers */, - CD32B55B19F9EEDC0059D019 /* SDL_rotate.h in Headers */, - CDF237871CAA70CD00A45E31 /* SDL_blendmode.h in Headers */, CD32B3DB19F9EDD10059D019 /* ftheader.h in Headers */, - CDF237AF1CAA70CD00A45E31 /* SDL_opengles2.h in Headers */, - CD32B57219F9EF000059D019 /* SDL_systhread_c.h in Headers */, - CDF237CB1CAA70CD00A45E31 /* SDL_timer.h in Headers */, + CD273CC121B1EBF5006C4D84 /* scancodes_windows.h in Headers */, + CD273CA221B1EBE8006C4D84 /* SDL_dynapi.h in Headers */, + CD273ED721B1EE03006C4D84 /* SDL_name.h in Headers */, + CD273CDB21B1EC19006C4D84 /* SDL_rwopsbundlesupport.h in Headers */, CD32B3DC19F9EDD10059D019 /* ftmodule.h in Headers */, - CDF237B61CAA70CD00A45E31 /* SDL_revision.h in Headers */, - CDF237AE1CAA70CD00A45E31 /* SDL_opengles2_khrplatform.h in Headers */, - CDF237CF1CAA70CD00A45E31 /* SDL_video.h in Headers */, - CD32B53919F9EE4A0059D019 /* SDL_rwopsbundlesupport.h in Headers */, + CD273ECF21B1EE03006C4D84 /* SDL_keyboard.h in Headers */, + CD273EE921B1EE03006C4D84 /* SDL_sensor.h in Headers */, + CD273DA521B1ED8A006C4D84 /* SDL_cocoamousetap.h in Headers */, + CD273E4D21B1EDD2006C4D84 /* SDL_sysvideo.h in Headers */, + CD273EC621B1EE03006C4D84 /* SDL_endian.h in Headers */, CD32B3DD19F9EDD10059D019 /* ftoption.h in Headers */, - CDF237BB1CAA70CD00A45E31 /* SDL_surface.h in Headers */, CD32B3DE19F9EDD10059D019 /* ftstdlib.h in Headers */, - CDF2378D1CAA70CD00A45E31 /* SDL_config_pandora.h in Headers */, - CDF237D71CAA715000A45E31 /* SDL_dynapi_procs.h in Headers */, - CD32B5BC19F9EF260059D019 /* SDL_blit_auto.h in Headers */, - CD32B5D219F9EF2E0059D019 /* SDL_error_c.h in Headers */, - CDF237891CAA70CD00A45E31 /* SDL_config_android.h in Headers */, - CD32B5B319F9EF200059D019 /* SDL_x11window.h in Headers */, - CD32B56119F9EEE50059D019 /* mmx.h in Headers */, - CDF237D61CAA715000A45E31 /* SDL_dynapi_overrides.h in Headers */, - CD32B52C19F9EE3F0059D019 /* SDL_events_c.h in Headers */, - CD32B56319F9EEE50059D019 /* SDL_sysrender.h in Headers */, - CD32B55319F9EEDC0059D019 /* SDL_draw.h in Headers */, - CD32B53E19F9EE550059D019 /* SDL_haptic_c.h in Headers */, + CD273E0821B1EDA6006C4D84 /* SDL_x11xinput2.h in Headers */, + CD273D7221B1ED5C006C4D84 /* SDL_systhread_c.h in Headers */, + CD273EE321B1EE03006C4D84 /* SDL_quit.h in Headers */, + CD273D3121B1ED11006C4D84 /* SDL_blendfillrect.h in Headers */, + CD273D4821B1ED1B006C4D84 /* SDL_sysrender.h in Headers */, + CD273EC321B1EE03006C4D84 /* SDL_copying.h in Headers */, + CD273EB121B1EE03006C4D84 /* close_code.h in Headers */, + CD273ECD21B1EE03006C4D84 /* SDL_hints.h in Headers */, + CD273E3B21B1EDD2006C4D84 /* SDL_blit_slow.h in Headers */, CD32B3E619F9EDD10059D019 /* SFMT-params216091.h in Headers */, - CD32B5B719F9EF260059D019 /* SDL_blit.h in Headers */, - CDF2379D1CAA70CD00A45E31 /* SDL_hints.h in Headers */, + CD273DA321B1ED8A006C4D84 /* SDL_cocoamouse.h in Headers */, CD32B3EC19F9EDD10059D019 /* lapi.h in Headers */, + CD273DAD21B1ED8A006C4D84 /* SDL_cocoavideo.h in Headers */, + CD273E3821B1EDD2006C4D84 /* SDL_blit_copy.h in Headers */, + CD273D6F21B1ED5C006C4D84 /* SDL_sysmutex_c.h in Headers */, + CD273DEB21B1EDA6006C4D84 /* SDL_x11dyn.h in Headers */, CD32B3EE19F9EDD10059D019 /* lauxlib.h in Headers */, - CDF237BF1CAA70CD00A45E31 /* SDL_test_common.h in Headers */, + CD273D2021B1ED05006C4D84 /* SDL_shaders_gles2.h in Headers */, + CD273EBA21B1EE03006C4D84 /* SDL_config_macosx.h in Headers */, + CD273D6421B1ED53006C4D84 /* SDL_systhread.h in Headers */, CD32B3EF19F9EDD10059D019 /* lcode.h in Headers */, + CD273E0021B1EDA6006C4D84 /* SDL_x11touch.h in Headers */, + CD273E4721B1EDD2006C4D84 /* SDL_RLEaccel_c.h in Headers */, + CD273CBD21B1EBF5006C4D84 /* blank_cursor.h in Headers */, + CD273EF221B1EE03006C4D84 /* SDL_types.h in Headers */, + CD273DE521B1EDA6006C4D84 /* edid.h in Headers */, + CD273DA121B1ED8A006C4D84 /* SDL_cocoamodes.h in Headers */, + CD273D3821B1ED11006C4D84 /* SDL_drawline.h in Headers */, + CD273CD521B1EBF5006C4D84 /* SDL_windowevents_c.h in Headers */, + CD273E6421B1EDE2006C4D84 /* SDL_internal.h in Headers */, CD32B3F019F9EDD10059D019 /* ldebug.h in Headers */, + CD273ECB21B1EE03006C4D84 /* SDL_gesture.h in Headers */, CD32B3F119F9EDD10059D019 /* ldo.h in Headers */, - CD32B54319F9EE610059D019 /* SDL_joystick_c.h in Headers */, - CDF237C71CAA70CD00A45E31 /* SDL_test_md5.h in Headers */, CD32B3F219F9EDD10059D019 /* lfunc.h in Headers */, - CD32B53019F9EE3F0059D019 /* SDL_keyboard_c.h in Headers */, - CD32B57C19F9EF140059D019 /* SDL_cocoaevents.h in Headers */, - CDF237991CAA70CD00A45E31 /* SDL_filesystem.h in Headers */, - CD32B51519F9EE2E0059D019 /* SDL_coreaudio.h in Headers */, - CD32B58019F9EF140059D019 /* SDL_cocoamessagebox.h in Headers */, - CDF237B01CAA70CD00A45E31 /* SDL_pixels.h in Headers */, - CDF237A61CAA70CD00A45E31 /* SDL_mutex.h in Headers */, - CD32B52E19F9EE3F0059D019 /* SDL_gesture_c.h in Headers */, - CD32B5CE19F9EF260059D019 /* SDL_sysvideo.h in Headers */, - CD32B58C19F9EF140059D019 /* SDL_cocoavideo.h in Headers */, - CDF237C21CAA70CD00A45E31 /* SDL_test_font.h in Headers */, - CDF237B91CAA70CD00A45E31 /* SDL_shape.h in Headers */, + CD273DF121B1EDA6006C4D84 /* SDL_x11keyboard.h in Headers */, + CD273D3621B1ED11006C4D84 /* SDL_draw.h in Headers */, + CD273E6121B1EDE2006C4D84 /* SDL_error_c.h in Headers */, + CD273DA721B1ED8A006C4D84 /* SDL_cocoaopengl.h in Headers */, + CD273D6521B1ED53006C4D84 /* SDL_thread_c.h in Headers */, + CD273E0421B1EDA6006C4D84 /* SDL_x11vulkan.h in Headers */, + CD273DE721B1EDA6006C4D84 /* imKStoUCS.h in Headers */, + CD273EC421B1EE03006C4D84 /* SDL_cpuinfo.h in Headers */, + CD273D1821B1ECFA006C4D84 /* SDL_shaders_gl.h in Headers */, + CD273EEC21B1EE03006C4D84 /* SDL_surface.h in Headers */, + CD273EF321B1EE03006C4D84 /* SDL_version.h in Headers */, + CD273EE721B1EE03006C4D84 /* SDL_rwops.h in Headers */, + CD273D9721B1ED8A006C4D84 /* SDL_cocoaclipboard.h in Headers */, + CD273D3521B1ED11006C4D84 /* SDL_blendpoint.h in Headers */, + CD273EB621B1EE03006C4D84 /* SDL_blendmode.h in Headers */, + CD273EEA21B1EE03006C4D84 /* SDL_shape.h in Headers */, CD32B3F319F9EDD10059D019 /* lgc.h in Headers */, - CDF2379F1CAA70CD00A45E31 /* SDL_keyboard.h in Headers */, + CD273CCD21B1EBF5006C4D84 /* SDL_keyboard_c.h in Headers */, + CD273ED421B1EE03006C4D84 /* SDL_messagebox.h in Headers */, CD32B3F419F9EDD10059D019 /* llex.h in Headers */, - CDF237841CAA70CD00A45E31 /* SDL_atomic.h in Headers */, + CD273ED921B1EE03006C4D84 /* SDL_opengl.h in Headers */, + CD273CBE21B1EBF5006C4D84 /* default_cursor.h in Headers */, + CD273EC821B1EE03006C4D84 /* SDL_events.h in Headers */, + CD273D3A21B1ED11006C4D84 /* SDL_drawpoint.h in Headers */, + CD273C8421B1EBAA006C4D84 /* SDL_audiodev_c.h in Headers */, + CD273EC921B1EE03006C4D84 /* SDL_filesystem.h in Headers */, + CD273D0A21B1ECCD006C4D84 /* SDL_syspower.h in Headers */, + CD273C8A21B1EBAA006C4D84 /* SDL_wave.h in Headers */, CD32B3F519F9EDD10059D019 /* llimits.h in Headers */, - CDF237CA1CAA70CD00A45E31 /* SDL_thread.h in Headers */, - CDF237CD1CAA70CD00A45E31 /* SDL_types.h in Headers */, + CD273EF121B1EE03006C4D84 /* SDL_touch.h in Headers */, + CD273CCF21B1EBF5006C4D84 /* SDL_mouse_c.h in Headers */, + CD273ED121B1EE03006C4D84 /* SDL_loadso.h in Headers */, + CD273DF921B1EDA6006C4D84 /* SDL_x11opengl.h in Headers */, + CD273EDD21B1EE03006C4D84 /* SDL_opengles2_gl2platform.h in Headers */, + CD273D5421B1ED36006C4D84 /* SDL_dummysensor.h in Headers */, + CD273CBF21B1EBF5006C4D84 /* scancodes_darwin.h in Headers */, + CD273D3321B1ED11006C4D84 /* SDL_blendline.h in Headers */, + CD273E4F21B1EDD2006C4D84 /* SDL_vulkan_internal.h in Headers */, + CD273ED321B1EE03006C4D84 /* SDL_main.h in Headers */, + CD273D7721B1ED6B006C4D84 /* SDL_timer_c.h in Headers */, + CD273DBB21B1ED93006C4D84 /* SDL_nullframebuffer_c.h in Headers */, CD32B3F619F9EDD10059D019 /* lmem.h in Headers */, - CDF237D91CAA715000A45E31 /* SDL_dynapi.h in Headers */, + CD273CE721B1EC4A006C4D84 /* SDL_syshaptic_c.h in Headers */, CD32B3F719F9EDD10059D019 /* lobject.h in Headers */, CD32B3F819F9EDD10059D019 /* lopcodes.h in Headers */, CD32B3F919F9EDD10059D019 /* lparser.h in Headers */, CD32B3FA19F9EDD10059D019 /* SFMT-params19937.h in Headers */, + CD273E0221B1EDA6006C4D84 /* SDL_x11video.h in Headers */, CD32B3FB19F9EDD10059D019 /* lstate.h in Headers */, - CD32B54E19F9EEDC0059D019 /* SDL_blendfillrect.h in Headers */, - CDF237A31CAA70CD00A45E31 /* SDL_main.h in Headers */, CD32B3FC19F9EDD10059D019 /* lstring.h in Headers */, + CD273D5021B1ED2D006C4D84 /* SDL_syssensor.h in Headers */, + CD273CF121B1EC69006C4D84 /* SDL_gamecontrollerdb.h in Headers */, + CD273EEE21B1EE03006C4D84 /* SDL_syswm.h in Headers */, CD32B3FD19F9EDD10059D019 /* ltable.h in Headers */, - CDF237921CAA70CD00A45E31 /* SDL_config.h in Headers */, + CD273EC521B1EE03006C4D84 /* SDL_egl.h in Headers */, + CD273CFF21B1EC78006C4D84 /* SDL_hidapijoystick_c.h in Headers */, + CD273EE621B1EE03006C4D84 /* SDL_revision.h in Headers */, + CD273E3D21B1EDD2006C4D84 /* SDL_blit.h in Headers */, + CD273EC221B1EE03006C4D84 /* SDL_config.h in Headers */, CD32B3FE19F9EDD10059D019 /* ltm.h in Headers */, - CDF237A01CAA70CD00A45E31 /* SDL_keycode.h in Headers */, + CD273DB921B1ED93006C4D84 /* SDL_nullevents_c.h in Headers */, + CD273ECE21B1EE03006C4D84 /* SDL_joystick.h in Headers */, CD32B3FF19F9EDD10059D019 /* lua.h in Headers */, + CD273D4E21B1ED2D006C4D84 /* SDL_sensor_c.h in Headers */, + CD273CE421B1EC42006C4D84 /* SDL_syshaptic.h in Headers */, + CD273C8821B1EBAA006C4D84 /* SDL_sysaudio.h in Headers */, + CD273C9F21B1EBE8006C4D84 /* SDL_dynapi_overrides.h in Headers */, + CD273EE021B1EE03006C4D84 /* SDL_pixels.h in Headers */, CD32B40019F9EDD10059D019 /* luaconf.h in Headers */, - CDF237AC1CAA70CD00A45E31 /* SDL_opengles2_gl2ext.h in Headers */, + CD273DFE21B1EDA6006C4D84 /* SDL_x11sym.h in Headers */, CD32B40119F9EDD10059D019 /* lualib.h in Headers */, - CDF237A71CAA70CD00A45E31 /* SDL_name.h in Headers */, - CDF237C31CAA70CD00A45E31 /* SDL_test_fuzzer.h in Headers */, - CDF237941CAA70CD00A45E31 /* SDL_cpuinfo.h in Headers */, + CD273EB221B1EE03006C4D84 /* SDL_assert.h in Headers */, CD32B40219F9EDD10059D019 /* lundump.h in Headers */, - CDF237981CAA70CD00A45E31 /* SDL_events.h in Headers */, - CDF237A51CAA70CD00A45E31 /* SDL_mouse.h in Headers */, - CDF237CE1CAA70CD00A45E31 /* SDL_version.h in Headers */, - CDF237AB1CAA70CD00A45E31 /* SDL_opengles2_gl2.h in Headers */, - CDF237D01CAA70CD00A45E31 /* SDL.h in Headers */, - CD32B55519F9EEDC0059D019 /* SDL_drawline.h in Headers */, + CD273EE521B1EE03006C4D84 /* SDL_render.h in Headers */, + CD273D9D21B1ED8A006C4D84 /* SDL_cocoamessagebox.h in Headers */, + CD273DBE21B1ED93006C4D84 /* SDL_nullvideo.h in Headers */, CD32B40319F9EDD10059D019 /* lvm.h in Headers */, + CD273EE221B1EE03006C4D84 /* SDL_power.h in Headers */, + CD273EDA21B1EE03006C4D84 /* SDL_opengles.h in Headers */, CD32B40419F9EDD10059D019 /* lzio.h in Headers */, - CD32B57619F9EF000059D019 /* SDL_thread_c.h in Headers */, - CD32B5AC19F9EF200059D019 /* SDL_x11shape.h in Headers */, - CD32B5A619F9EF200059D019 /* SDL_x11mouse.h in Headers */, - CD32B59519F9EF1A0059D019 /* SDL_nullvideo.h in Headers */, - CDF2379B1CAA70CD00A45E31 /* SDL_gesture.h in Headers */, - CDF237831CAA70CD00A45E31 /* SDL_assert.h in Headers */, - CD32B5A819F9EF200059D019 /* SDL_x11opengl.h in Headers */, - CD32B53619F9EE3F0059D019 /* SDL_touch_c.h in Headers */, - CD32B5AA19F9EF200059D019 /* SDL_x11opengles.h in Headers */, - CDF237861CAA70CD00A45E31 /* SDL_bits.h in Headers */, - CD32B59B19F9EF200059D019 /* SDL_x11dyn.h in Headers */, + CD273E6021B1EDE2006C4D84 /* SDL_dataqueue.h in Headers */, + CD273EDE21B1EE03006C4D84 /* SDL_opengles2_khrplatform.h in Headers */, + CD273CC321B1EBF5006C4D84 /* SDL_clipboardevents_c.h in Headers */, + CD273DE921B1EDA6006C4D84 /* SDL_x11clipboard.h in Headers */, CD32B40C19F9EDD10059D019 /* SFMT.h in Headers */, - CDF237A11CAA70CD00A45E31 /* SDL_loadso.h in Headers */, - CDF237A81CAA70CD00A45E31 /* SDL_opengl_glext.h in Headers */, - CD32B5B519F9EF200059D019 /* SDL_x11xinput2.h in Headers */, - CD32B51A19F9EE340059D019 /* SDL_audiodev_c.h in Headers */, - CDF237AA1CAA70CD00A45E31 /* SDL_opengles.h in Headers */, - CD32B52319F9EE3F0059D019 /* default_cursor.h in Headers */, - CD32B54C19F9EED00059D019 /* SDL_shaders_gl.h in Headers */, - CD32B59D19F9EF200059D019 /* SDL_x11events.h in Headers */, - CDF237B71CAA70CD00A45E31 /* SDL_rwops.h in Headers */, - CD32B55919F9EEDC0059D019 /* SDL_render_sw_c.h in Headers */, + CD273E5121B1EDD2006C4D84 /* SDL_yuv_c.h in Headers */, + CD273EB021B1EE03006C4D84 /* begin_code.h in Headers */, + CD273EED21B1EE03006C4D84 /* SDL_system.h in Headers */, + CD273E3621B1EDD2006C4D84 /* SDL_blit_auto.h in Headers */, CD32B41219F9EDD10059D019 /* SFMT-params2281.h in Headers */, - CD32B51119F9EE210059D019 /* SDL_diskaudio.h in Headers */, - CD32B59919F9EF200059D019 /* SDL_x11clipboard.h in Headers */, - CD32B55019F9EEDC0059D019 /* SDL_blendline.h in Headers */, - CDF237901CAA70CD00A45E31 /* SDL_config_winrt.h in Headers */, - CD32B5BE19F9EF260059D019 /* SDL_blit_copy.h in Headers */, + CD273DA921B1ED8A006C4D84 /* SDL_cocoaopengles.h in Headers */, + CD273D3B21B1ED11006C4D84 /* SDL_render_sw_c.h in Headers */, + CD273ECA21B1EE03006C4D84 /* SDL_gamecontroller.h in Headers */, + CD273ED621B1EE03006C4D84 /* SDL_mutex.h in Headers */, + CD273CC221B1EBF5006C4D84 /* scancodes_xfree86.h in Headers */, + CD273EB421B1EE03006C4D84 /* SDL_audio.h in Headers */, CD32B41519F9EDD10059D019 /* SFMT-common.h in Headers */, - CDF237B31CAA70CD00A45E31 /* SDL_quit.h in Headers */, - CD32B52919F9EE3F0059D019 /* SDL_dropevents_c.h in Headers */, - CD32B56519F9EEE50059D019 /* SDL_yuv_sw_c.h in Headers */, - CD32B54519F9EE610059D019 /* SDL_sysjoystick.h in Headers */, - CDF237C11CAA70CD00A45E31 /* SDL_test_crc32.h in Headers */, - CD32B52519F9EE3F0059D019 /* scancodes_linux.h in Headers */, - CDF2379A1CAA70CD00A45E31 /* SDL_gamecontroller.h in Headers */, - CD32B5D019F9EF2E0059D019 /* SDL_assert_c.h in Headers */, - CD32B58219F9EF140059D019 /* SDL_cocoamodes.h in Headers */, - CDF237B21CAA70CD00A45E31 /* SDL_power.h in Headers */, - CDF237851CAA70CD00A45E31 /* SDL_audio.h in Headers */, - CDF237BE1CAA70CD00A45E31 /* SDL_test_assert.h in Headers */, - CD32B55719F9EEDC0059D019 /* SDL_drawpoint.h in Headers */, - CD32B57919F9EF090059D019 /* SDL_timer_c.h in Headers */, - CDF237BD1CAA70CD00A45E31 /* SDL_syswm.h in Headers */, - CDF237A91CAA70CD00A45E31 /* SDL_opengl.h in Headers */, - CDF2378A1CAA70CD00A45E31 /* SDL_config_iphoneos.h in Headers */, - CD32B51319F9EE260059D019 /* SDL_dummyaudio.h in Headers */, - CD32B56F19F9EF000059D019 /* SDL_sysmutex_c.h in Headers */, - CDF237911CAA70CD00A45E31 /* SDL_config_wiz.h in Headers */, - CD32B5C119F9EF260059D019 /* SDL_blit_slow.h in Headers */, - CD32B5A419F9EF200059D019 /* SDL_x11modes.h in Headers */, - CDF237961CAA70CD00A45E31 /* SDL_endian.h in Headers */, - CD32B5AF19F9EF200059D019 /* SDL_x11touch.h in Headers */, - CD32B5CB19F9EF260059D019 /* SDL_shape_internals.h in Headers */, - CDF237931CAA70CD00A45E31 /* SDL_copying.h in Headers */, - CDF2378E1CAA70CD00A45E31 /* SDL_config_psp.h in Headers */, - CD32B52019F9EE340059D019 /* SDL_wave.h in Headers */, - CD32B5A119F9EF200059D019 /* SDL_x11keyboard.h in Headers */, - CDF237B51CAA70CD00A45E31 /* SDL_render.h in Headers */, - CD32B53F19F9EE550059D019 /* SDL_syshaptic.h in Headers */, - CDF237971CAA70CD00A45E31 /* SDL_error.h in Headers */, - CDF2378B1CAA70CD00A45E31 /* SDL_config_macosx.h in Headers */, - CDF2379C1CAA70CD00A45E31 /* SDL_haptic.h in Headers */, - CD32B59219F9EF1A0059D019 /* SDL_nullframebuffer_c.h in Headers */, - CDF237C41CAA70CD00A45E31 /* SDL_test_harness.h in Headers */, - CD32B59119F9EF1A0059D019 /* SDL_nullevents_c.h in Headers */, + CD273C8E21B1EBB2006C4D84 /* SDL_diskaudio.h in Headers */, + CD273EB321B1EE03006C4D84 /* SDL_atomic.h in Headers */, + CD273ECC21B1EE03006C4D84 /* SDL_haptic.h in Headers */, + CD273EF621B1EE03006C4D84 /* SDL.h in Headers */, + CD273D9B21B1ED8A006C4D84 /* SDL_cocoakeyboard.h in Headers */, + CD273EEF21B1EE03006C4D84 /* SDL_thread.h in Headers */, + CD273E1021B1EDB9006C4D84 /* yuv_rgb.h in Headers */, + CD273CF221B1EC69006C4D84 /* SDL_joystick_c.h in Headers */, + CD273EB521B1EE03006C4D84 /* SDL_bits.h in Headers */, + CD273EB721B1EE03006C4D84 /* SDL_clipboard.h in Headers */, + CD273DF521B1EDA6006C4D84 /* SDL_x11modes.h in Headers */, + CD273DFB21B1EDA6006C4D84 /* SDL_x11opengles.h in Headers */, + CD273D1D21B1ED05006C4D84 /* SDL_gles2funcs.h in Headers */, + CD273E4321B1EDD2006C4D84 /* SDL_pixels_c.h in Headers */, + CD273D1021B1ECF1006C4D84 /* SDL_shaders_metal_osx.h in Headers */, + CD273CCB21B1EBF5006C4D84 /* SDL_gesture_c.h in Headers */, + CD273ED221B1EE03006C4D84 /* SDL_log.h in Headers */, + CD273D9921B1ED8A006C4D84 /* SDL_cocoaevents.h in Headers */, + CD273CD221B1EBF5006C4D84 /* SDL_sysevents.h in Headers */, + CD273EDF21B1EE03006C4D84 /* SDL_opengles2.h in Headers */, CD32B42219F9EDD10059D019 /* SFMT-params.h in Headers */, - CDF2379E1CAA70CD00A45E31 /* SDL_joystick.h in Headers */, + CD273D9F21B1ED8A006C4D84 /* SDL_cocoametalview.h in Headers */, + CD273CC521B1EBF5006C4D84 /* SDL_displayevents_c.h in Headers */, + CD273DEF21B1EDA6006C4D84 /* SDL_x11framebuffer.h in Headers */, + CD273EDB21B1EE03006C4D84 /* SDL_opengles2_gl2.h in Headers */, + CD273C9521B1EBC4006C4D84 /* SDL_coreaudio.h in Headers */, CD32B42319F9EDD10059D019 /* SFMT-alti.h in Headers */, - CD32B57A19F9EF140059D019 /* SDL_cocoaclipboard.h in Headers */, - CDF237821CAA70CD00A45E31 /* close_code.h in Headers */, - CDF237B11CAA70CD00A45E31 /* SDL_platform.h in Headers */, - CDF237BA1CAA70CD00A45E31 /* SDL_stdinc.h in Headers */, - CD32B53419F9EE3F0059D019 /* SDL_sysevents.h in Headers */, + CD273EE121B1EE03006C4D84 /* SDL_platform.h in Headers */, + CD273DF321B1EDA6006C4D84 /* SDL_x11messagebox.h in Headers */, CD32B42419F9EDD10059D019 /* SFMT-params86243.h in Headers */, - CDF237C81CAA70CD00A45E31 /* SDL_test_random.h in Headers */, - CD32B52419F9EE3F0059D019 /* scancodes_darwin.h in Headers */, - CD32B58E19F9EF140059D019 /* SDL_cocoawindow.h in Headers */, - CD32B5C919F9EF260059D019 /* SDL_RLEaccel_c.h in Headers */, - CDF237951CAA70CD00A45E31 /* SDL_egl.h in Headers */, + CD273E4921B1EDD2006C4D84 /* SDL_shape_internals.h in Headers */, + CD273EE821B1EE03006C4D84 /* SDL_scancode.h in Headers */, + CD273DAB21B1ED8A006C4D84 /* SDL_cocoashape.h in Headers */, + CD273DFD21B1EDA6006C4D84 /* SDL_x11shape.h in Headers */, + CD273C8121B1EBAA006C4D84 /* SDL_audio_c.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -17346,187 +17508,209 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - CD32B57319F9EF000059D019 /* SDL_systls.c in Sources */, - CD32B51619F9EE340059D019 /* SDL_audio.c in Sources */, CD32B42D19F9EDD10059D019 /* ftbbox.c in Sources */, CD32B42E19F9EDD10059D019 /* ftgxval.c in Sources */, CD32B42F19F9EDD10059D019 /* ftlcdfil.c in Sources */, + CD273D7321B1ED5C006C4D84 /* SDL_systhread.c in Sources */, + CD273C8221B1EBAA006C4D84 /* SDL_audio.c in Sources */, + CD273DF821B1EDA6006C4D84 /* SDL_x11opengl.c in Sources */, CD32B43019F9EDD10059D019 /* ftmm.c in Sources */, + CD273E0521B1EDA6006C4D84 /* SDL_x11window.c in Sources */, CD32B43119F9EDD10059D019 /* ftotval.c in Sources */, - CD32B5D119F9EF2E0059D019 /* SDL_assert.c in Sources */, CD32B43219F9EDD10059D019 /* ftpatent.c in Sources */, + CD273E3921B1EDD2006C4D84 /* SDL_blit_N.c in Sources */, CD32B43319F9EDD10059D019 /* ftpfr.c in Sources */, - CD32B58319F9EF140059D019 /* SDL_cocoamodes.m in Sources */, + CD273CD621B1EBF5006C4D84 /* SDL_windowevents.c in Sources */, + CD273C7521B1EB96006C4D84 /* SDL_atomic.c in Sources */, + CD273DF021B1EDA6006C4D84 /* SDL_x11keyboard.c in Sources */, + CD273C9621B1EBC4006C4D84 /* SDL_coreaudio.m in Sources */, + CD273D9821B1ED8A006C4D84 /* SDL_cocoaclipboard.m in Sources */, CD32B43419F9EDD10059D019 /* ftsynth.c in Sources */, - CD32B5B219F9EF200059D019 /* SDL_x11window.c in Sources */, + CD273DFC21B1EDA6006C4D84 /* SDL_x11shape.c in Sources */, CD32B43519F9EDD10059D019 /* fttype1.c in Sources */, - CD32B55A19F9EEDC0059D019 /* SDL_rotate.c in Sources */, + CD273E3E21B1EDD2006C4D84 /* SDL_bmp.c in Sources */, + CD273D3921B1ED11006C4D84 /* SDL_drawpoint.c in Sources */, CD32B43619F9EDD10059D019 /* ftwinfnt.c in Sources */, - CD32B53719F9EE3F0059D019 /* SDL_windowevents.c in Sources */, - CD32B56D19F9EF000059D019 /* SDL_syscond.c in Sources */, + CD273DF621B1EDA6006C4D84 /* SDL_x11mouse.c in Sources */, CD32B43819F9EDD10059D019 /* pcf.c in Sources */, - CD32B5B819F9EF260059D019 /* SDL_blit_0.c in Sources */, + CD273E0121B1EDA6006C4D84 /* SDL_x11video.c in Sources */, CD32B43919F9EDD10059D019 /* pfr.c in Sources */, + CD273E6621B1EDE2006C4D84 /* SDL.c in Sources */, CD32B43A19F9EDD10059D019 /* psaux.c in Sources */, CD32B43B19F9EDD10059D019 /* pshinter.c in Sources */, - CD32B57119F9EF000059D019 /* SDL_systhread.c in Sources */, - CD32B5B419F9EF200059D019 /* SDL_x11xinput2.c in Sources */, + CD273DA621B1ED8A006C4D84 /* SDL_cocoamousetap.m in Sources */, + CD273D1E21B1ED05006C4D84 /* SDL_render_gles2.c in Sources */, + CD273E4E21B1EDD2006C4D84 /* SDL_video.c in Sources */, + CD273D3221B1ED11006C4D84 /* SDL_blendline.c in Sources */, + CD273E0321B1EDA6006C4D84 /* SDL_x11vulkan.c in Sources */, + CD273D6621B1ED53006C4D84 /* SDL_thread.c in Sources */, CD32B43C19F9EDD10059D019 /* psmodule.c in Sources */, + CD273D0021B1EC78006C4D84 /* SDL_hidapijoystick.c in Sources */, CD32B43D19F9EDD10059D019 /* raster.c in Sources */, - CD32B5C019F9EF260059D019 /* SDL_blit_slow.c in Sources */, + CD273D0C21B1ECD6006C4D84 /* SDL_syspower.c in Sources */, + CD273DAE21B1ED8A006C4D84 /* SDL_cocoavideo.m in Sources */, CD32B43E19F9EDD10059D019 /* sfnt.c in Sources */, + CD273DAC21B1ED8A006C4D84 /* SDL_cocoashape.m in Sources */, CD32B43F19F9EDD10059D019 /* truetype.c in Sources */, + CD273D7021B1ED5C006C4D84 /* SDL_sysmutex.c in Sources */, + CD273DE821B1EDA6006C4D84 /* SDL_x11clipboard.c in Sources */, + CD273D1F21B1ED05006C4D84 /* SDL_shaders_gles2.c in Sources */, + CD273E4C21B1EDD2006C4D84 /* SDL_surface.c in Sources */, CD32B44019F9EDD10059D019 /* type1.c in Sources */, + CD273CD421B1EBF5006C4D84 /* SDL_touch.c in Sources */, CD32B44119F9EDD10059D019 /* type1cid.c in Sources */, - CD32B5C319F9EF260059D019 /* SDL_clipboard.c in Sources */, + CD273C9921B1EBDE006C4D84 /* SDL_cpuinfo.c in Sources */, + CD273E4421B1EDD2006C4D84 /* SDL_pixels.c in Sources */, + CD273D5D21B1ED44006C4D84 /* SDL_malloc.c in Sources */, CD32B44319F9EDD10059D019 /* type42.c in Sources */, - CD32B58B19F9EF140059D019 /* SDL_cocoashape.m in Sources */, - CDF237D81CAA715000A45E31 /* SDL_dynapi.c in Sources */, - CD32B56919F9EEF60059D019 /* SDL_malloc.c in Sources */, - CD32B58519F9EF140059D019 /* SDL_cocoamouse.m in Sources */, - CD32B57D19F9EF140059D019 /* SDL_cocoaevents.m in Sources */, + CD273CFB21B1EC78006C4D84 /* SDL_hidapi_ps4.c in Sources */, + CD273D1721B1ECFA006C4D84 /* SDL_shaders_gl.c in Sources */, CD32B44419F9EDD10059D019 /* winfnt.c in Sources */, + CD273CF021B1EC69006C4D84 /* SDL_gamecontroller.c in Sources */, + CD273CFE21B1EC78006C4D84 /* SDL_hidapi_xboxone.c in Sources */, CD32B44519F9EDD10059D019 /* autofit.c in Sources */, - CD32B5A219F9EF200059D019 /* SDL_x11messagebox.c in Sources */, + CD273E0F21B1EDB9006C4D84 /* yuv_rgb.c in Sources */, + CD273CFD21B1EC78006C4D84 /* SDL_hidapi_xbox360.c in Sources */, CD32B44619F9EDD10059D019 /* bdf.c in Sources */, + CD273D7821B1ED6B006C4D84 /* SDL_timer.c in Sources */, CD32B44719F9EDD10059D019 /* cff.c in Sources */, CD32B44819F9EDD10059D019 /* ftbase.c in Sources */, CD32B44919F9EDD10059D019 /* ftbitmap.c in Sources */, - CD32B59619F9EF200059D019 /* imKStoUCS.c in Sources */, - CD32B5A019F9EF200059D019 /* SDL_x11keyboard.c in Sources */, + CD273DAA21B1ED8A006C4D84 /* SDL_cocoaopengles.m in Sources */, CD32B44A19F9EDD10059D019 /* ftcache.c in Sources */, + CD273DB021B1ED8A006C4D84 /* SDL_cocoavulkan.m in Sources */, + CD273CE321B1EC42006C4D84 /* SDL_haptic.c in Sources */, CD32B44B19F9EDD10059D019 /* ftdebug.c in Sources */, CD32B44C19F9EDD10059D019 /* ftfstype.c in Sources */, + CD273DEC21B1EDA6006C4D84 /* SDL_x11events.c in Sources */, CD32B44D19F9EDD10059D019 /* ftgasp.c in Sources */, - CD32B56619F9EEE50059D019 /* SDL_yuv_sw.c in Sources */, + CD273D4A21B1ED1B006C4D84 /* SDL_yuv_sw.c in Sources */, + CD273E3421B1EDD2006C4D84 /* SDL_blit_A.c in Sources */, + CD273D0421B1EC84006C4D84 /* SDL_sysjoystick.c in Sources */, + CD273D7421B1ED5C006C4D84 /* SDL_systls.c in Sources */, + CD273DE421B1EDA6006C4D84 /* edid-parse.c in Sources */, + CD273DBA21B1ED93006C4D84 /* SDL_nullevents.c in Sources */, CD32B44E19F9EDD10059D019 /* ftglyph.c in Sources */, CD32B44F19F9EDD10059D019 /* ftgzip.c in Sources */, CD32B45019F9EDD10059D019 /* ftinit.c in Sources */, + CD273D1621B1ECFA006C4D84 /* SDL_render_gl.c in Sources */, + CD273E3F21B1EDD2006C4D84 /* SDL_clipboard.c in Sources */, CD32B45119F9EDD10059D019 /* ftlzw.c in Sources */, - CD32B5AE19F9EF200059D019 /* SDL_x11touch.c in Sources */, CD32B45219F9EDD10059D019 /* ftstroke.c in Sources */, - CD32B51219F9EE260059D019 /* SDL_dummyaudio.c in Sources */, + CD273E5021B1EDD2006C4D84 /* SDL_vulkan_utils.c in Sources */, + CD273D9A21B1ED8A006C4D84 /* SDL_cocoaevents.m in Sources */, CD32B45319F9EDD10059D019 /* ftsystem.c in Sources */, CD32B45419F9EDD10059D019 /* smooth.c in Sources */, - CD32B5B919F9EF260059D019 /* SDL_blit_1.c in Sources */, - CD32B58D19F9EF140059D019 /* SDL_cocoavideo.m in Sources */, - CD32B50E19F9EE1C0059D019 /* SDL_atomic.c in Sources */, - CD32B5D619F9EF2E0059D019 /* SDL.c in Sources */, - CD32B54019F9EE610059D019 /* SDL_sysjoystick.c in Sources */, - CD32B51C19F9EE340059D019 /* SDL_audiotypecvt.c in Sources */, - CD32B52119F9EE390059D019 /* SDL_cpuinfo.c in Sources */, - CD32B56E19F9EF000059D019 /* SDL_sysmutex.c in Sources */, - CD32B51F19F9EE340059D019 /* SDL_wave.c in Sources */, - CD32B52D19F9EE3F0059D019 /* SDL_gesture.c in Sources */, - CD32B53C19F9EE550059D019 /* SDL_syshaptic.c in Sources */, - CD32B5CA19F9EF260059D019 /* SDL_shape.c in Sources */, - CD32B54619F9EEBA0059D019 /* SDL_sysloadso.c in Sources */, - CD32B5CC19F9EF260059D019 /* SDL_stretch.c in Sources */, - CD32B5A919F9EF200059D019 /* SDL_x11opengles.c in Sources */, - CD32B54219F9EE610059D019 /* SDL_joystick.c in Sources */, + CD273CE821B1EC4A006C4D84 /* SDL_syshaptic.c in Sources */, + CD273C8321B1EBAA006C4D84 /* SDL_audiocvt.c in Sources */, CD32B47119F9EDD10059D019 /* lapi.c in Sources */, - CD32B5C519F9EF260059D019 /* SDL_pixels.c in Sources */, - CD32B53119F9EE3F0059D019 /* SDL_mouse.c in Sources */, + CD273DA821B1ED8A006C4D84 /* SDL_cocoaopengl.m in Sources */, + CD273D4521B1ED1B006C4D84 /* SDL_d3dmath.c in Sources */, + CD273E4121B1EDD2006C4D84 /* SDL_egl.c in Sources */, + CD273CC821B1EBF5006C4D84 /* SDL_dropevents.c in Sources */, + CD273DA421B1ED8A006C4D84 /* SDL_cocoamouse.m in Sources */, + CD273CCC21B1EBF5006C4D84 /* SDL_gesture.c in Sources */, + CD273E4B21B1EDD2006C4D84 /* SDL_stretch.c in Sources */, CD32B47219F9EDD10059D019 /* lauxlib.c in Sources */, CD32B47319F9EDD10059D019 /* lbaselib.c in Sources */, CD32B47419F9EDD10059D019 /* lcode.c in Sources */, - CD32B53A19F9EE4A0059D019 /* SDL_rwopsbundlesupport.m in Sources */, + CD273E3221B1EDD2006C4D84 /* SDL_blit_0.c in Sources */, + CD273E3721B1EDD2006C4D84 /* SDL_blit_copy.c in Sources */, CD32B47519F9EDD10059D019 /* ldblib.c in Sources */, + CD273D0621B1EC98006C4D84 /* SDL_sysloadso.c in Sources */, + CD273DA221B1ED8A006C4D84 /* SDL_cocoamodes.m in Sources */, CD32B47619F9EDD10059D019 /* ldebug.c in Sources */, CD32B47719F9EDD10059D019 /* ldo.c in Sources */, + CD273CC421B1EBF5006C4D84 /* SDL_clipboardevents.c in Sources */, CD32B47819F9EDD10059D019 /* ldump.c in Sources */, - CD32B52A19F9EE3F0059D019 /* SDL_dropevents.c in Sources */, - CD32B5D319F9EF2E0059D019 /* SDL_error.c in Sources */, CD32B47919F9EDD10059D019 /* lfunc.c in Sources */, + CD273DB221B1ED8A006C4D84 /* SDL_cocoawindow.m in Sources */, + CD273C8521B1EBAA006C4D84 /* SDL_audiodev.c in Sources */, + CD273D7121B1ED5C006C4D84 /* SDL_syssem.c in Sources */, CD32B47A19F9EDD10059D019 /* lgc.c in Sources */, - CD32B5BF19F9EF260059D019 /* SDL_blit_N.c in Sources */, - CD32B54819F9EEC10059D019 /* SDL_power.c in Sources */, - CD32B57519F9EF000059D019 /* SDL_thread.c in Sources */, - CD32B59319F9EF1A0059D019 /* SDL_nullframebuffer.c in Sources */, + CD273D6E21B1ED5C006C4D84 /* SDL_syscond.c in Sources */, + CD273DF421B1EDA6006C4D84 /* SDL_x11modes.c in Sources */, + CD273DEE21B1EDA6006C4D84 /* SDL_x11framebuffer.c in Sources */, + CD273D9E21B1ED8A006C4D84 /* SDL_cocoamessagebox.m in Sources */, CD32B47B19F9EDD10059D019 /* linit.c in Sources */, - CD32B59A19F9EF200059D019 /* SDL_x11dyn.c in Sources */, + CD273E6321B1EDE2006C4D84 /* SDL_hints.c in Sources */, + CD273D3421B1ED11006C4D84 /* SDL_blendpoint.c in Sources */, + CD273E3C21B1EDD2006C4D84 /* SDL_blit.c in Sources */, CD32B47C19F9EDD10059D019 /* liolib.c in Sources */, + CD273DBD21B1ED93006C4D84 /* SDL_nullvideo.c in Sources */, CD32B47D19F9EDD10059D019 /* llex.c in Sources */, + CD273CDE21B1EC28006C4D84 /* SDL_sysfilesystem.m in Sources */, + CD273D3721B1ED11006C4D84 /* SDL_drawline.c in Sources */, CD32B47E19F9EDD10059D019 /* lmathlib.c in Sources */, + CD273E0721B1EDA6006C4D84 /* SDL_x11xinput2.c in Sources */, + CD273C8621B1EBAA006C4D84 /* SDL_audiotypecvt.c in Sources */, + CD273E5F21B1EDE2006C4D84 /* SDL_dataqueue.c in Sources */, CD32B47F19F9EDD10059D019 /* lmem.c in Sources */, + CD273D5F21B1ED44006C4D84 /* SDL_stdlib.c in Sources */, CD32B48019F9EDD10059D019 /* loadlib.c in Sources */, CD32B48119F9EDD10059D019 /* lobject.c in Sources */, - CD32B56819F9EEF60059D019 /* SDL_iconv.c in Sources */, - CD32B54419F9EE610059D019 /* SDL_gamecontroller.c in Sources */, CD32B48219F9EDD10059D019 /* lopcodes.c in Sources */, + CD273E3A21B1EDD2006C4D84 /* SDL_blit_slow.c in Sources */, + CD273D0921B1ECCD006C4D84 /* SDL_power.c in Sources */, CD32B48319F9EDD10059D019 /* loslib.c in Sources */, + CD273D5E21B1ED44006C4D84 /* SDL_qsort.c in Sources */, + CD273CFC21B1EC78006C4D84 /* SDL_hidapi_switch.c in Sources */, + CD273C7621B1EB96006C4D84 /* SDL_spinlock.c in Sources */, + CD273CD121B1EBF5006C4D84 /* SDL_quit.c in Sources */, + CD273E6221B1EDE2006C4D84 /* SDL_error.c in Sources */, + CD273CD021B1EBF5006C4D84 /* SDL_mouse.c in Sources */, + CD273DF221B1EDA6006C4D84 /* SDL_x11messagebox.c in Sources */, CD32B48419F9EDD10059D019 /* lparser.c in Sources */, CD32B48519F9EDD10059D019 /* lstate.c in Sources */, - CD32B5A519F9EF200059D019 /* SDL_x11mouse.c in Sources */, + CD273C8721B1EBAA006C4D84 /* SDL_mixer.c in Sources */, CD32B48619F9EDD10059D019 /* lstring.c in Sources */, + CD273D5C21B1ED44006C4D84 /* SDL_iconv.c in Sources */, CD32B48719F9EDD10059D019 /* lstrlib.c in Sources */, - CD32B5CD19F9EF260059D019 /* SDL_surface.c in Sources */, + CD273D5B21B1ED44006C4D84 /* SDL_getenv.c in Sources */, CD32B48819F9EDD10059D019 /* ltable.c in Sources */, - CD32B52F19F9EE3F0059D019 /* SDL_keyboard.c in Sources */, - CD32B5C219F9EF260059D019 /* SDL_bmp.c in Sources */, - CD32B59E19F9EF200059D019 /* SDL_x11framebuffer.c in Sources */, - CD32B5BD19F9EF260059D019 /* SDL_blit_copy.c in Sources */, + CD273CA121B1EBE8006C4D84 /* SDL_dynapi.c in Sources */, CD32B48919F9EDD10059D019 /* SFMT.c in Sources */, - CD32B5C719F9EF260059D019 /* SDL_rect.c in Sources */, CD32B48A19F9EDD10059D019 /* ltablib.c in Sources */, CD32B48B19F9EDD10059D019 /* ltm.c in Sources */, - CD32B54A19F9EED00059D019 /* SDL_render_gl.c in Sources */, - CD32B58919F9EF140059D019 /* SDL_cocoaopengl.m in Sources */, + CD273CCE21B1EBF5006C4D84 /* SDL_keyboard.c in Sources */, + CD273C9121B1EBB9006C4D84 /* SDL_dummyaudio.c in Sources */, + CD273D6021B1ED44006C4D84 /* SDL_string.c in Sources */, + CD273E4221B1EDD2006C4D84 /* SDL_fillrect.c in Sources */, + CD273CD821B1EC10006C4D84 /* SDL_rwops.c in Sources */, + CD273D3D21B1ED11006C4D84 /* SDL_rotate.c in Sources */, CD32B48C19F9EDD10059D019 /* lundump.c in Sources */, - CD32B5C819F9EF260059D019 /* SDL_RLEaccel.c in Sources */, - CD32B58F19F9EF140059D019 /* SDL_cocoawindow.m in Sources */, CD32B48D19F9EDD10059D019 /* lvm.c in Sources */, CD32B48E19F9EDD10059D019 /* lzio.c in Sources */, - CD32B58719F9EF140059D019 /* SDL_cocoamousetap.m in Sources */, - CD32B57019F9EF000059D019 /* SDL_syssem.c in Sources */, CD32B48F19F9EDD10059D019 /* print.c in Sources */, - CD32B59019F9EF1A0059D019 /* SDL_nullevents.c in Sources */, - CD32B57719F9EF090059D019 /* SDL_systimer.c in Sources */, - CD32B54B19F9EED00059D019 /* SDL_shaders_gl.c in Sources */, - CD32B55619F9EEDC0059D019 /* SDL_drawpoint.c in Sources */, - CD32B59419F9EF1A0059D019 /* SDL_nullvideo.c in Sources */, - CD32B5A719F9EF200059D019 /* SDL_x11opengl.c in Sources */, - CD32B5C419F9EF260059D019 /* SDL_fillrect.c in Sources */, - CD32B5B619F9EF260059D019 /* SDL_blit.c in Sources */, - CD32B51819F9EE340059D019 /* SDL_audiocvt.c in Sources */, - CD32B59C19F9EF200059D019 /* SDL_x11events.c in Sources */, - CD32B51419F9EE2E0059D019 /* SDL_coreaudio.c in Sources */, - CD32B56719F9EEF60059D019 /* SDL_getenv.c in Sources */, - CD32B5BA19F9EF260059D019 /* SDL_blit_A.c in Sources */, - CD32B59819F9EF200059D019 /* SDL_x11clipboard.c in Sources */, - CD32B57F19F9EF140059D019 /* SDL_cocoakeyboard.m in Sources */, - CD32B51D19F9EE340059D019 /* SDL_mixer.c in Sources */, - CD32B51019F9EE210059D019 /* SDL_diskaudio.c in Sources */, - CD32B50F19F9EE1C0059D019 /* SDL_spinlock.c in Sources */, - CD32B53D19F9EE550059D019 /* SDL_haptic.c in Sources */, - CDF237DC1CAA71BC00A45E31 /* SDL_sysfilesystem.m in Sources */, - CD32B53B19F9EE4A0059D019 /* SDL_rwops.c in Sources */, - CD32B5B019F9EF200059D019 /* SDL_x11video.c in Sources */, - CD32B53319F9EE3F0059D019 /* SDL_quit.c in Sources */, - CD32B56A19F9EEF60059D019 /* SDL_qsort.c in Sources */, - CD32B57819F9EF090059D019 /* SDL_timer.c in Sources */, - CD32B52719F9EE3F0059D019 /* SDL_clipboardevents.c in Sources */, - CD32B55419F9EEDC0059D019 /* SDL_drawline.c in Sources */, - CD32B54F19F9EEDC0059D019 /* SDL_blendline.c in Sources */, - CD32B5BB19F9EF260059D019 /* SDL_blit_auto.c in Sources */, - CD32B57B19F9EF140059D019 /* SDL_cocoaclipboard.m in Sources */, - CD32B56219F9EEE50059D019 /* SDL_render.c in Sources */, - CD32B5CF19F9EF260059D019 /* SDL_video.c in Sources */, - CD32B54719F9EEC10059D019 /* SDL_syspower.c in Sources */, - CD32B53519F9EE3F0059D019 /* SDL_touch.c in Sources */, - CD32B58119F9EF140059D019 /* SDL_cocoamessagebox.m in Sources */, - CD32B56419F9EEE50059D019 /* SDL_yuv_mmx.c in Sources */, - CD32B5A319F9EF200059D019 /* SDL_x11modes.c in Sources */, - CD32B5D519F9EF2E0059D019 /* SDL_log.c in Sources */, - CD32B55819F9EEDC0059D019 /* SDL_render_sw.c in Sources */, - CD32B56B19F9EEF60059D019 /* SDL_stdlib.c in Sources */, - CD32B54D19F9EEDC0059D019 /* SDL_blendfillrect.c in Sources */, - CD32B56C19F9EEF60059D019 /* SDL_string.c in Sources */, - CD32B5D419F9EF2E0059D019 /* SDL_hints.c in Sources */, - CD32B51919F9EE340059D019 /* SDL_audiodev.c in Sources */, - CD32B5AB19F9EF200059D019 /* SDL_x11shape.c in Sources */, - CD32B55119F9EEDC0059D019 /* SDL_blendpoint.c in Sources */, - CD32B52B19F9EE3F0059D019 /* SDL_events.c in Sources */, + CD273C8921B1EBAA006C4D84 /* SDL_wave.c in Sources */, + CD273D3021B1ED11006C4D84 /* SDL_blendfillrect.c in Sources */, + CD273CCA21B1EBF5006C4D84 /* SDL_events.c in Sources */, + CD273DA021B1ED8A006C4D84 /* SDL_cocoametalview.m in Sources */, + CD273CF321B1EC69006C4D84 /* SDL_joystick.c in Sources */, + CD273DEA21B1EDA6006C4D84 /* SDL_x11dyn.c in Sources */, + CD273D9C21B1ED8A006C4D84 /* SDL_cocoakeyboard.m in Sources */, + CD273DBC21B1ED93006C4D84 /* SDL_nullframebuffer.c in Sources */, + CD273D4721B1ED1B006C4D84 /* SDL_render.c in Sources */, + CD273D0F21B1ECF1006C4D84 /* SDL_render_metal.m in Sources */, + CD273CDC21B1EC19006C4D84 /* SDL_rwopsbundlesupport.m in Sources */, + CD273D4F21B1ED2D006C4D84 /* SDL_sensor.c in Sources */, + CD273CEA21B1EC58006C4D84 /* hid.c in Sources */, + CD273E4A21B1EDD2006C4D84 /* SDL_shape.c in Sources */, + CD273D5321B1ED36006C4D84 /* SDL_dummysensor.c in Sources */, + CD273E3321B1EDD2006C4D84 /* SDL_blit_1.c in Sources */, + CD273E4621B1EDD2006C4D84 /* SDL_rect.c in Sources */, + CD273E4821B1EDD2006C4D84 /* SDL_RLEaccel.c in Sources */, + CD273C8D21B1EBB2006C4D84 /* SDL_diskaudio.c in Sources */, + CD273E6521B1EDE2006C4D84 /* SDL_log.c in Sources */, + CD273E5221B1EDD2006C4D84 /* SDL_yuv.c in Sources */, + CD273E3521B1EDD2006C4D84 /* SDL_blit_auto.c in Sources */, + CD273DFF21B1EDA6006C4D84 /* SDL_x11touch.c in Sources */, + CD273E5E21B1EDE2006C4D84 /* SDL_assert.c in Sources */, + CD273D3C21B1ED11006C4D84 /* SDL_render_sw.c in Sources */, + CD273CC621B1EBF5006C4D84 /* SDL_displayevents.c in Sources */, + CD273D7A21B1ED74006C4D84 /* SDL_systimer.c in Sources */, + CD273DE621B1EDA6006C4D84 /* imKStoUCS.c in Sources */, + CD273DFA21B1EDA6006C4D84 /* SDL_x11opengles.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -19379,7 +19563,7 @@ "\"../../3rdparty/zlib-1.2.8\"", "\"../../3rdparty/ooid-0.99\"", "\"../../3rdparty/mongoose\"", - "\"../../3rdparty/sdl2-2.0.4/include\"", + "\"../../3rdparty/sdl2-2.0.9/include\"", "\"../../3rdparty/sfmt-1.4\"", "\"../../3rdparty/libtess2/include\"", "\"../../3rdparty/google-test/googletest/include\"", @@ -20602,7 +20786,7 @@ "\"../../3rdparty/zlib-1.2.8\"", "\"../../3rdparty/ooid-0.99\"", "\"../../3rdparty/mongoose\"", - "\"../../3rdparty/sdl2-2.0.4/include\"", + "\"../../3rdparty/sdl2-2.0.9/include\"", "\"../../3rdparty/sfmt-1.4\"", "\"../../3rdparty/libtess2/include\"", "\"../../3rdparty/google-test/googletest/include\"", @@ -21271,8 +21455,11 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; HEADER_SEARCH_PATHS = ( - "\"/usr/X11R6/include\"", "$(inherited)", + /usr/X11R6/include, + "$(VULKAN_SDK)/include", + "\"../../3rdparty/sdl2-2.0.9/src/video/khronos\"", + "\"../../3rdparty/sdl2-2.0.9/src/hidapi/hidapi\"", ); PRODUCT_NAME = "moai-osx-3rdparty-sdl"; SDKROOT = macosx; @@ -21317,8 +21504,11 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; HEADER_SEARCH_PATHS = ( - "\"/usr/X11R6/include\"", "$(inherited)", + /usr/X11R6/include, + "$(VULKAN_SDK)/include", + "\"../../3rdparty/sdl2-2.0.9/src/video/khronos\"", + "\"../../3rdparty/sdl2-2.0.9/src/hidapi/hidapi\"", ); PRODUCT_NAME = "moai-osx-3rdparty-sdl"; SDKROOT = macosx; @@ -21363,8 +21553,11 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; HEADER_SEARCH_PATHS = ( - "\"/usr/X11R6/include\"", "$(inherited)", + /usr/X11R6/include, + "$(VULKAN_SDK)/include", + "\"../../3rdparty/sdl2-2.0.9/src/video/khronos\"", + "\"../../3rdparty/sdl2-2.0.9/src/hidapi/hidapi\"", ); PRODUCT_NAME = "moai-osx-3rdparty-sdl"; SDKROOT = macosx; @@ -25608,7 +25801,7 @@ "\"../../3rdparty/zlib-1.2.8\"", "\"../../3rdparty/ooid-0.99\"", "\"../../3rdparty/mongoose\"", - "\"../../3rdparty/sdl2-2.0.4/include\"", + "\"../../3rdparty/sdl2-2.0.9/include\"", "\"../../3rdparty/sfmt-1.4\"", "\"../../3rdparty/libtess2/include\"", "\"../../3rdparty/google-test/googletest/include\"", diff --git a/xcode/osx/moai-osx.xcodeproj/project.pbxproj b/xcode/osx/moai-osx.xcodeproj/project.pbxproj index 9a1b4f851b..9a7ab78b17 100644 --- a/xcode/osx/moai-osx.xcodeproj/project.pbxproj +++ b/xcode/osx/moai-osx.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ B319C9911DBFF96600A6C621 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B319C9901DBFF96600A6C621 /* JavaScriptCore.framework */; }; CD096FD218E0FFE300A36EDD /* libstdc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CD096FD118E0FFE300A36EDD /* libstdc++.dylib */; }; CD1845BD1A626F0300FCCCE0 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD1845BC1A626F0300FCCCE0 /* SystemConfiguration.framework */; }; + CD273EF821B1F209006C4D84 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD273EF721B1F209006C4D84 /* Metal.framework */; }; CD2E46C51C5181A3008E22A1 /* libmoai-osx-harfbuzz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CD1F44E81BDEBB7800F5CF59 /* libmoai-osx-harfbuzz.a */; }; CD323B071A8040CB00E2FEBB /* SDLJoystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD323B031A8040CB00E2FEBB /* SDLJoystick.cpp */; }; CD323B081A8040CB00E2FEBB /* SDLKeyCodeMapping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD323B051A8040CB00E2FEBB /* SDLKeyCodeMapping.cpp */; }; @@ -876,6 +877,7 @@ B319C9901DBFF96600A6C621 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; CD096FD118E0FFE300A36EDD /* libstdc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.dylib"; path = "usr/lib/libstdc++.dylib"; sourceTree = SDKROOT; }; CD1845BC1A626F0300FCCCE0 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + CD273EF721B1F209006C4D84 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; CD323B031A8040CB00E2FEBB /* SDLJoystick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDLJoystick.cpp; path = "../../src/host-sdl/SDLJoystick.cpp"; sourceTree = ""; }; CD323B041A8040CB00E2FEBB /* SDLJoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLJoystick.h; path = "../../src/host-sdl/SDLJoystick.h"; sourceTree = ""; }; CD323B051A8040CB00E2FEBB /* SDLKeyCodeMapping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDLKeyCodeMapping.cpp; path = "../../src/host-sdl/SDLKeyCodeMapping.cpp"; sourceTree = ""; }; @@ -924,7 +926,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 095A1748218DE7BC003543B8 /* libmoai-osx-expat.a in Frameworks */, CDFD8FC01AD8653C0003F415 /* libmoai-osx.a in Frameworks */, CD6E274D1D19157000792933 /* libmoai-osx-3rdparty-assimp.a in Frameworks */, CDFD8FB11AD8653C0003F415 /* libmoai-osx-3rdparty-core.a in Frameworks */, @@ -934,6 +935,7 @@ CDFF5ADE1C29232600969B44 /* libmoai-osx-audio-sampler.a in Frameworks */, CDFD8FB51AD8653C0003F415 /* libmoai-osx-box2d.a in Frameworks */, CDFD8FB61AD8653C0003F415 /* libmoai-osx-crypto.a in Frameworks */, + 095A1748218DE7BC003543B8 /* libmoai-osx-expat.a in Frameworks */, CD2E46C51C5181A3008E22A1 /* libmoai-osx-harfbuzz.a in Frameworks */, CDFD8FB71AD8653C0003F415 /* libmoai-osx-http-client.a in Frameworks */, CDFD8FB81AD8653C0003F415 /* libmoai-osx-http-server.a in Frameworks */, @@ -963,6 +965,7 @@ 4C623B6415246B10008E4436 /* Foundation.framework in Frameworks */, 0300CF68140DC53C00ABCC5B /* IOKit.framework in Frameworks */, B319C9911DBFF96600A6C621 /* JavaScriptCore.framework in Frameworks */, + CD273EF821B1F209006C4D84 /* Metal.framework in Frameworks */, CD6600661831CB5400D9862B /* OpenGL.framework in Frameworks */, CD1845BD1A626F0300FCCCE0 /* SystemConfiguration.framework in Frameworks */, ); @@ -1044,9 +1047,9 @@ CD2FDE8613542E9F00B814DF /* Frameworks */ = { isa = PBXGroup; children = ( - B319C9901DBFF96600A6C621 /* JavaScriptCore.framework */, B319C95D1DBFF95800A6C621 /* libcommonCrypto.tbd */, - CDF2380E1CAA731C00A45E31 /* CoreVideo.framework */, + CD74EA2B137807E40093EE68 /* libcrypto.dylib */, + CDFD8FB01AD8653C0003F415 /* libmoai-osx.a */, CDFD8FA11AD8653C0003F415 /* libmoai-osx-3rdparty-core.a */, CDFD8FA21AD8653C0003F415 /* libmoai-osx-3rdparty-crypto.a */, CDFD8FA31AD8653C0003F415 /* libmoai-osx-3rdparty-sdl.a */, @@ -1062,23 +1065,24 @@ CDFD8FAD1AD8653C0003F415 /* libmoai-osx-zl-core.a */, CDFD8FAE1AD8653C0003F415 /* libmoai-osx-zl-crypto.a */, CDFD8FAF1AD8653C0003F415 /* libmoai-osx-zl-vfs.a */, - CDFD8FB01AD8653C0003F415 /* libmoai-osx.a */, CD096FD118E0FFE300A36EDD /* libstdc++.dylib */, - CD74EA2B137807E40093EE68 /* libcrypto.dylib */, CD74EA311378080E0093EE68 /* libssl.dylib */, 0324CC63135643FD000ADC60 /* libSystem.dylib */, 66D9680B14047B7100017919 /* libz.dylib */, CD795EF117F08E4B006AEB47 /* Cocoa.framework */, CD795EF317F08F4E006AEB47 /* CoreAudio.framework */, 4C623B6515246B25008E4436 /* CoreServices.framework */, + CDF2380E1CAA731C00A45E31 /* CoreVideo.framework */, CD795EF517F08F86006AEB47 /* ForceFeedback.framework */, 4C623B6315246B10008E4436 /* Foundation.framework */, 07CC7AF913DF7E9B00F2DEDE /* CoreFoundation.framework */, 07CC7AFF13DF7EF200F2DEDE /* Carbon.framework */, 07CC7B0613DF7F0F00F2DEDE /* IOKit.framework */, + B319C9901DBFF96600A6C621 /* JavaScriptCore.framework */, 0300CF7A140DC61000ABCC5B /* AudioToolbox.framework */, 0300CF93140DC65100ABCC5B /* AudioUnit.framework */, CD6600651831CB5400D9862B /* OpenGL.framework */, + CD273EF721B1F209006C4D84 /* Metal.framework */, CD1845BC1A626F0300FCCCE0 /* SystemConfiguration.framework */, ); name = Frameworks; @@ -2124,7 +2128,7 @@ "\"../../src\"", "\"../../src/config\"", "\"../../src/config-default\"", - "\"../../3rdparty/sdl2-2.0.4/include\"", + "\"../../3rdparty/sdl2-2.0.9/include\"", "\"../../3rdparty/google-test/googletest/include\"", ); MACOSX_DEPLOYMENT_TARGET = 10.9; @@ -2209,7 +2213,7 @@ "\"../../src\"", "\"../../src/config\"", "\"../../src/config-default\"", - "\"../../3rdparty/sdl2-2.0.4/include\"", + "\"../../3rdparty/sdl2-2.0.9/include\"", "\"../../3rdparty/google-test/googletest/include\"", ); MACOSX_DEPLOYMENT_TARGET = 10.9;